Index: sm/branches/trunk-jpl-damage/COPYING
===================================================================
--- /issm/branches/trunk-jpl-damage/COPYING	(revision 12003)
+++ 	(revision )
@@ -1,28 +1,0 @@
-Copyright (c) 2002-2011, California Institute of Technology.
-All rights reserved.  Based on Government Sponsored Research under contracts
-NAS7-1407 and/or NAS7-03001.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    1. Redistributions of source code must retain the above copyright notice,
-       this list of conditions and the following disclaimer.
-    2. Redistributions in binary form must reproduce the above copyright
-       notice, this list of conditions and the following disclaimer in the
-       documentation and/or other materials provided with the distribution.
-    3. Neither the name of the California Institute of Technology (Caltech),
-       its operating division the Jet Propulsion Laboratory (JPL), the National
-       Aeronautics and Space Administration (NASA), nor the names of its
-       contributors may be used to endorse or promote products derived from
-       this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index: sm/branches/trunk-jpl-damage/ChangeLog
===================================================================
--- /issm/branches/trunk-jpl-damage/ChangeLog	(revision 12003)
+++ 	(revision )
@@ -1,3 +1,0 @@
-Go to
-
-https://issm.ess.uci.edu:80/trac/issm/timeline
Index: sm/branches/trunk-jpl-damage/INSTALL
===================================================================
--- /issm/branches/trunk-jpl-damage/INSTALL	(revision 12003)
+++ 	(revision )
@@ -1,3 +1,0 @@
-For the installation process please go to the ISSM website:
-
-http://issm.jpl.nasa.gov/
Index: sm/branches/trunk-jpl-damage/LICENSE
===================================================================
--- /issm/branches/trunk-jpl-damage/LICENSE	(revision 12003)
+++ 	(revision )
@@ -1,28 +1,0 @@
-Copyright (c) 2002-2011, California Institute of Technology.
-All rights reserved.  Based on Government Sponsored Research under contracts
-NAS7-1407 and/or NAS7-03001.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    1. Redistributions of source code must retain the above copyright notice,
-       this list of conditions and the following disclaimer.
-    2. Redistributions in binary form must reproduce the above copyright
-       notice, this list of conditions and the following disclaimer in the
-       documentation and/or other materials provided with the distribution.
-    3. Neither the name of the California Institute of Technology (Caltech),
-       its operating division the Jet Propulsion Laboratory (JPL), the National
-       Aeronautics and Space Administration (NASA), nor the names of its
-       contributors may be used to endorse or promote products derived from
-       this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index: /issm/branches/trunk-jpl-damage/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/Makefile.am	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/Makefile.am	(revision 12004)
@@ -1,3 +1,3 @@
-EXTRA_DIST = reconf  scripts test INSTALLICE LICENSE m4 examples cron etc doc packages ChangeLogCielo ChangeLogIce contributors.txt run READMEICE startup.m startup.m startup.m startup.m  todo MakefileIce
+EXTRA_DIST = reconf  scripts test m4 examples cron etc doc packages contributors.txt 
 SUBDIRS = src bin
 bin_SCRIPTS=config.h startup.m README.rtf
Index: sm/branches/trunk-jpl-damage/NEWS
===================================================================
--- /issm/branches/trunk-jpl-damage/NEWS	(revision 12003)
+++ 	(revision )
@@ -1,3 +1,0 @@
-please go to the ISSM website for the latest news:
-
-http://issm.jpl.nasa.gov/
Index: sm/branches/trunk-jpl-damage/ar-lib
===================================================================
--- /issm/branches/trunk-jpl-damage/ar-lib	(revision 12003)
+++ 	(revision )
@@ -1,265 +1,0 @@
-#! /bin/sh
-# Wrapper for Microsoft lib.exe
-
-me=ar-lib
-scriptversion=2012-01-30.22; # UTC
-
-# Copyright (C) 2010, 2012 Free Software Foundation, Inc.
-# Written by Peter Rosin <peda@lysator.liu.se>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-
-# func_error message
-func_error ()
-{
-  echo "$me: $1" 1>&2
-  exit 1
-}
-
-file_conv=
-
-# func_file_conv build_file
-# Convert a $build file to $host form and store it in $file
-# Currently only supports Windows hosts.
-func_file_conv ()
-{
-  file=$1
-  case $file in
-    / | /[!/]*) # absolute file, and not a UNC file
-      if test -z "$file_conv"; then
-	# lazily determine how to convert abs files
-	case `uname -s` in
-	  MINGW*)
-	    file_conv=mingw
-	    ;;
-	  CYGWIN*)
-	    file_conv=cygwin
-	    ;;
-	  *)
-	    file_conv=wine
-	    ;;
-	esac
-      fi
-      case $file_conv in
-	mingw)
-	  file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
-	  ;;
-	cygwin)
-	  file=`cygpath -m "$file" || echo "$file"`
-	  ;;
-	wine)
-	  file=`winepath -w "$file" || echo "$file"`
-	  ;;
-      esac
-      ;;
-  esac
-}
-
-# func_at_file at_file operation archive
-# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
-# for each of them.
-# When interpreting the content of the @FILE, do NOT use func_file_conv,
-# since the user would need to supply preconverted file names to
-# binutils ar, at least for MinGW.
-func_at_file ()
-{
-  operation=$2
-  archive=$3
-  at_file_contents=`cat "$1"`
-  eval set x "$at_file_contents"
-  shift
-
-  for member
-  do
-    $AR -NOLOGO $operation:"$member" "$archive" || exit $?
-  done
-}
-
-case $1 in
-  '')
-     func_error "no command.  Try '$0 --help' for more information."
-     ;;
-  -h | --h*)
-    cat <<EOF
-Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
-
-Members may be specified in a file named with @FILE.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "$me, version $scriptversion"
-    exit $?
-    ;;
-esac
-
-if test $# -lt 3; then
-  func_error "you must specify a program, an action and an archive"
-fi
-
-AR=$1
-shift
-while :
-do
-  if test $# -lt 2; then
-    func_error "you must specify a program, an action and an archive"
-  fi
-  case $1 in
-    -lib | -LIB \
-    | -ltcg | -LTCG \
-    | -machine* | -MACHINE* \
-    | -subsystem* | -SUBSYSTEM* \
-    | -verbose | -VERBOSE \
-    | -wx* | -WX* )
-      AR="$AR $1"
-      shift
-      ;;
-    *)
-      action=$1
-      shift
-      break
-      ;;
-  esac
-done
-orig_archive=$1
-shift
-func_file_conv "$orig_archive"
-archive=$file
-
-# strip leading dash in $action
-action=${action#-}
-
-delete=
-extract=
-list=
-replace=
-create=
-
-while test -n "$action"
-do
-  case $action in
-    d*) delete=yes  ;;
-    x*) extract=yes ;;
-    t*) list=yes    ;;
-    r*) replace=yes ;;
-    c*) create=yes  ;;
-    u*)             ;; # TODO: don't ignore the update modifier
-    v*)             ;; # TODO: don't ignore the verbose modifier
-    *)
-      func_error "unknown action specified"
-      ;;
-  esac
-  action=${action#?}
-done
-
-case $delete$extract$list$replace in
-  yes)
-    ;;
-  yesyes*)
-    func_error "more than one action specified"
-    ;;
-  *)
-    func_error "no action specified"
-    ;;
-esac
-
-if test -n "$delete"; then
-  if test ! -f "$orig_archive"; then
-    func_error "archive not found"
-  fi
-  for member
-  do
-    case $1 in
-      @*)
-        func_at_file "${1#@}" -REMOVE "$archive"
-        ;;
-      *)
-        func_file_conv "$1"
-        $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
-        ;;
-    esac
-  done
-
-elif test -n "$extract"; then
-  if test ! -f "$orig_archive"; then
-    func_error "archive not found"
-  fi
-  if test $# -gt 0; then
-    for member
-    do
-      case $1 in
-        @*)
-          func_at_file "${1#@}" -EXTRACT "$archive"
-          ;;
-        *)
-          func_file_conv "$1"
-          $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
-          ;;
-      esac
-    done
-  else
-    $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
-    do
-      $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
-    done
-  fi
-
-elif test -n "$replace"; then
-  if test ! -f "$orig_archive"; then
-    if test -z "$create"; then
-      echo "$me: creating $orig_archive"
-    fi
-    orig_archive=
-  else
-    orig_archive=$archive
-  fi
-
-  for member
-  do
-    case $1 in
-    @*)
-      func_file_conv "${1#@}"
-      set x "$@" "@$file"
-      ;;
-    *)
-      func_file_conv "$1"
-      set x "$@" "$file"
-      ;;
-    esac
-    shift
-    shift
-  done
-
-  if test -n "$orig_archive"; then
-    $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
-  else
-    $AR -NOLOGO -OUT:"$archive" "$@" || exit $?
-  fi
-
-elif test -n "$list"; then
-  if test ! -f "$orig_archive"; then
-    func_error "archive not found"
-  fi
-  $AR -NOLOGO -LIST "$archive" || exit $?
-fi
Index: sm/branches/trunk-jpl-damage/compile
===================================================================
--- /issm/branches/trunk-jpl-damage/compile	(revision 12003)
+++ 	(revision )
@@ -1,142 +1,0 @@
-#! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
-
-scriptversion=2005-05-14.22
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-# Written by Tom Tromey <tromey@cygnus.com>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-case $1 in
-  '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
-  -h | --h*)
-    cat <<\EOF
-Usage: compile [--help] [--version] PROGRAM [ARGS]
-
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
-arguments, and rename the output as expected.
-
-If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "compile $scriptversion"
-    exit $?
-    ;;
-esac
-
-ofile=
-cfile=
-eat=
-
-for arg
-do
-  if test -n "$eat"; then
-    eat=
-  else
-    case $1 in
-      -o)
-	# configure might choose to run compile as `compile cc -o foo foo.c'.
-	# So we strip `-o arg' only if arg is an object.
-	eat=1
-	case $2 in
-	  *.o | *.obj)
-	    ofile=$2
-	    ;;
-	  *)
-	    set x "$@" -o "$2"
-	    shift
-	    ;;
-	esac
-	;;
-      *.c)
-	cfile=$1
-	set x "$@" "$1"
-	shift
-	;;
-      *)
-	set x "$@" "$1"
-	shift
-	;;
-    esac
-  fi
-  shift
-done
-
-if test -z "$ofile" || test -z "$cfile"; then
-  # If no `-o' option was seen then we might have been invoked from a
-  # pattern rule where we don't need one.  That is ok -- this is a
-  # normal compilation that the losing compiler can handle.  If no
-  # `.c' file was seen then we are probably linking.  That is also
-  # ok.
-  exec "$@"
-fi
-
-# Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
-
-# Create the lock directory.
-# Note: use `[/.-]' here to ensure that we don't use the same name
-# that we are using for the .o file.  Also, base the name on the expected
-# object file name, since that is what matters with a parallel build.
-lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
-while true; do
-  if mkdir "$lockdir" >/dev/null 2>&1; then
-    break
-  fi
-  sleep 1
-done
-# FIXME: race condition here if user kills between mkdir and trap.
-trap "rmdir '$lockdir'; exit 1" 1 2 15
-
-# Run the compile.
-"$@"
-ret=$?
-
-if test -f "$cofile"; then
-  mv "$cofile" "$ofile"
-elif test -f "${cofile}bj"; then
-  mv "${cofile}bj" "$ofile"
-fi
-
-rmdir "$lockdir"
-exit $ret
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
Index: /issm/branches/trunk-jpl-damage/configs/config-linux64-murdo-nopetsc.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/configs/config-linux64-murdo-nopetsc.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/configs/config-linux64-murdo-nopetsc.sh	(revision 12004)
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+./configure \
+ --prefix=$ISSM_TIER \
+ --with-mpi-include=$ISSM_TIER/externalpackages/mpich2/install/include  \
+ --with-mpi-lib="-L$ISSM_TIER/externalpackages/mpich2/install/lib/ -lmpich" \
+ --with-matlab-dir=$MATLAB_DIR \
+ --with-triangle-dir=$ISSM_TIER/externalpackages/triangle/install \
+ --with-metis-dir=$ISSM_TIER/externalpackages/metis/install \
+ --with-blas-lapack-dir=$ISSM_TIER/externalpackages/petsc/install/lib \
+ --with-graphics-lib=/usr/lib64/libX11.so \
+ --with-scotch-dir="$ISSM_TIER/externalpackages/scotch/install" \
+ --with-chaco-dir="$ISSM_TIER/externalpackages/chaco/install" \
+ --with-cxxoptflags="-mtune=barcelona -ffast-math -O3 -msse4.2 -Wno-write-strings "\
+ --with-numthreads=18 \
+ --enable-debugging \
+ --with-gsl-dir=$ISSM_TIER/externalpackages/gsl/install
+ 
+ 
+# --with-petsc-dir=$ISSM_TIER/externalpackages/petsc/install \
+# --with-petsc-arch=$ISSM_ARCH \
+# --with-plapack-lib="-L$ISSM_TIER/externalpackages/petsc/install/ -lPLAPACK" \
+# --with-plapack-include="-I$ISSM_TIER/externalpackages/petsc/install/externalpackages/PLAPACKR32-hg/INCLUDE" \
+# --with-blacs-dir=$ISSM_TIER/externalpackages/petsc/install/ \
+# --with-scalapack-dir=$ISSM_TIER/externalpackages/petsc/install/ \
+# --with-mumps-dir=$ISSM_TIER/externalpackages/petsc/install/ \
+# --with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install \
Index: /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-ad.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-ad.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-ad.sh	(revision 12004)
@@ -12,5 +12,5 @@
 	--without-blas-lapack-dir \
 	--with-chaco-dir=$ISSM_TIER/externalpackages/chaco/install \
-	--with-fortran-lib="/usr/local/lib/libgfortran.a" \
+	--with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
 	--with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install \
 	--with-math-lib="/usr/lib/libm.dylib" \
Index: /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-nopetsc.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-nopetsc.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-nopetsc.sh	(revision 12004)
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#petsc 3.2
+#mpich 1.4
+
+./configure \
+	--prefix=$ISSM_TIER \
+	--with-mpi-include=$ISSM_TIER/externalpackages/mpich2/install/include  \
+	--with-mpi-lib=" $ISSM_TIER/externalpackages/mpich2/install/lib/libpmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpl.a " \
+	--with-matlab-dir=$MATLAB_DIR \
+	--with-triangle-dir=$ISSM_TIER/externalpackages/triangle/install \
+	--with-metis-dir=$ISSM_TIER/externalpackages/metis/install \
+	--with-chaco-dir=$ISSM_TIER/externalpackages/chaco/install \
+	--with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
+	--with-math-lib="/usr/lib/libm.dylib" \
+	--with-blas-lapack-dir=$ISSM_TIER/externalpackages/petsc/install/lib \
+	--with-graphics-lib="/usr/X11/lib/libX11.dylib" \
+	--with-cxxoptflags=" -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -mmacosx-version-min=10.5  -O3 -DNDEBUG -w "\
+	--with-numthreads=8 \
+	--with-gsl-dir=$ISSM_TIER/externalpackages/gsl/install
+#	--with-petsc-dir=$ISSM_TIER/externalpackages/petsc/install  \
+#	--with-petsc-arch=$ISSM_ARCH \
+#	--with-plapack-lib="-L$ISSM_TIER/externalpackages/petsc/install/ -lPLAPACK" \
+#	--with-plapack-include="-I$ISSM_TIER/externalpackages/petsc/install/include/ " \
+#	--with-blacs-dir=$ISSM_TIER/externalpackages/petsc/install/ \
+#	--with-scalapack-dir=$ISSM_TIER/externalpackages/petsc/install/ \
+#	--with-mumps-dir=$ISSM_TIER/externalpackages/petsc/install/ 
+#   --with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install \
Index: /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-python.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-python.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour-python.sh	(revision 12004)
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+#petsc 3.2
+#mpich 1.4
+
+./configure \
+	--prefix=$ISSM_TIER \
+	--with-triangle-dir=$ISSM_TIER/externalpackages/triangle/install \
+	--with-python-dir=$ISSM_TIER/externalpackages/python/install\
+	--with-python-numpy-dir=$ISSM_TIER/externalpackages/python/install/Python.framework/Versions/3.2/lib/python3.2/site-packages/numpy/core/include/numpy\
+	--with-metis-dir=$ISSM_TIER/externalpackages/metis/install \
+	--with-mpi-include=$ISSM_TIER/externalpackages/mpich2/install/include  \
+	--with-mpi-lib=" $ISSM_TIER/externalpackages/mpich2/install/lib/libpmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpl.a " \
+	--with-chaco-dir=$ISSM_TIER/externalpackages/chaco/install \
+	--with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
+	--with-math-lib="/usr/lib/libm.dylib" \
+	--with-graphics-lib="/usr/X11/lib/libX11.dylib" \
+	--with-cxxoptflags=" -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -mmacosx-version-min=10.5  -O3 -DNDEBUG -w "\
+	--with-numthreads=8 \
+	--with-petsc-dir=$ISSM_TIER/externalpackages/petsc/install  \
+	--with-petsc-arch=$ISSM_ARCH \
+	--with-blas-lapack-dir=$ISSM_TIER/externalpackages/petsc/install \
+	--with-plapack-lib="-L$ISSM_TIER/externalpackages/petsc/install/ -lPLAPACK" \
+	--with-plapack-include="-I$ISSM_TIER/externalpackages/petsc/install/include/ " \
+	--with-blacs-dir=$ISSM_TIER/externalpackages/petsc/install/ \
+	--with-scalapack-dir=$ISSM_TIER/externalpackages/petsc/install/ \
+	--with-mumps-dir=$ISSM_TIER/externalpackages/petsc/install/ 
+	#--with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install \
+	#--with-boost-dir=$ISSM_TIER/externalpackages/boost/install/ \
Index: /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/configs/config-macosx64-larour.sh	(revision 12004)
@@ -12,6 +12,5 @@
 	--with-mpi-lib=" $ISSM_TIER/externalpackages/mpich2/install/lib/libpmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpich.a $ISSM_TIER/externalpackages/mpich2/install/lib/libmpl.a " \
 	--with-chaco-dir=$ISSM_TIER/externalpackages/chaco/install \
-	--with-fortran-lib="/usr/local/lib/libgfortran.a" \
-	--with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install \
+	--with-fortran-lib="/usr/local/gfortran/lib/libgfortran.a" \
 	--with-math-lib="/usr/lib/libm.dylib" \
 	--with-graphics-lib="/usr/X11/lib/libX11.dylib" \
@@ -26,2 +25,3 @@
 	--with-scalapack-dir=$ISSM_TIER/externalpackages/petsc/install/ \
 	--with-mumps-dir=$ISSM_TIER/externalpackages/petsc/install/ 
+	#--with-dakota-dir=$ISSM_TIER/externalpackages/dakota/install \
Index: /issm/branches/trunk-jpl-damage/configure.ac
===================================================================
--- /issm/branches/trunk-jpl-damage/configure.ac	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/configure.ac	(revision 12004)
@@ -1,19 +1,37 @@
-AC_INIT(ISSM,4.0,issm@jpl.nasa.gov)
-AM_CONFIG_HEADER(config.h)
+# Process this file with autoconf to produce a configure script.
+
+#AUTOCONF
+AC_INIT([ISSM],[4.0],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
+AC_CONFIG_AUX_DIR([./aux-config])         #Put config files in aux-config
+AC_CONFIG_MACRO_DIR([m4])                 #m4 macros are located in m4
+AC_CANONICAL_TARGET                       #Determine the system type
+#Compilers
+AC_PROG_CC([cccl cl icl gcc])
+AC_PROG_CPP
+AC_PROG_CXX([cccl cl icl g++])
+AC_PROG_F77([ifort g77 gfortran])
+#Libraries and linking
+AC_PROG_RANLIB
+AC_F77_LIBRARY_LDFLAGS
+AC_PATH_XTRA      #figure out X library and include paths
+
+#AUTOMAKE
+#Initialize automake and declare foreign so that we don't need a ChangeLog, INSTALL, etc
+AM_INIT_AUTOMAKE([foreign])
+AM_CONFIG_HEADER([./config.h])   #Config file must be config.h
+AM_SILENT_RULES([yes])           #Do not show compilation command by default
+AM_PROG_CC_C_O
+
+##LIBTOOL?
 #AC_PROG_LIBTOOL
 #LT_INIT
-AC_CANONICAL_TARGET
-AM_INIT_AUTOMAKE
-AM_SILENT_RULES([yes])
-AC_PROG_RANLIB
-AC_PROG_CC([gcc icl cccl cl])
-AC_PROG_CPP
-AC_PROG_CXX([g++ icl cccl cl])
-AC_PROG_F77([ifort g77 gfortran])
-AC_F77_LIBRARY_LDFLAGS
-AM_PROG_CC_C_O
-AC_PATH_XTRA
+
+#Run issm_options.m4
 ISSM_OPTIONS
+
+#AM_PROG_AR must be placed after ISSM_OPTIONS
 AM_PROG_AR
+
+#List all Makefiles
 AC_CONFIG_FILES([Makefile
 			src/Makefile
@@ -21,53 +39,6 @@
 			src/mex/Makefile
 			src/m/Makefile
-			src/m/classes/Makefile
-			src/m/classes/@modellist/Makefile
-			src/m/classes/@pairoptions/Makefile
-			src/m/classes/model/Makefile
-			src/m/classes/clusters/Makefile
-			src/m/enum/Makefile
-			src/m/kml/Makefile
-			src/m/model/Makefile
-			src/m/model/plot/Makefile
-			src/m/model/mesh/Makefile
-			src/m/model/display/Makefile
-			src/m/model/parameterization/Makefile
-			src/m/model/partition/Makefile
-			src/m/model/solvers/Makefile
-			src/m/planet/Makefile
-			src/m/qmu/Makefile
-			src/m/shared/Makefile
-			src/m/solutions/Makefile
-			src/m/solvers/Makefile
-			src/m/utils/Makefile
-			src/m/utils/Analysis/Makefile
-			src/m/utils/Array/Makefile
-			src/m/utils/BC/Makefile
-			src/m/utils/Basins/Makefile
-			src/m/utils/Cluster/Makefile
-			src/m/utils/DataProcessing/Makefile
-			src/m/utils/Ecco3/Makefile
-			src/m/utils/Exp/Makefile
-			src/m/utils/Exp/manipulation/Makefile
-			src/m/utils/Exp/readwrite/Makefile
-			src/m/utils/Geometry/Makefile
-			src/m/utils/ImageProcessing/Makefile
-			src/m/utils/Interp/Makefile
-			src/m/utils/Kml/Makefile
-			src/m/utils/LatLong/Makefile
-			src/m/utils/Math/Makefile
-			src/m/utils/Meca/Makefile
-			src/m/utils/Mesh/Makefile
-			src/m/utils/Miscellaneous/Makefile
-			src/m/utils/Model/Makefile
-			src/m/utils/Numerics/Makefile
-			src/m/utils/OS/Makefile
-			src/m/utils/Plot/Makefile
-			src/m/utils/Shell/Makefile
-			src/m/utils/String/Makefile
-			src/m/utils/consistency/Makefile
-			src/m/utils/qmu/Makefile
 			bin/Makefile])
+
+#End of configure.ac
 AC_OUTPUT
-
-
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_daily	(revision 12003)
+++ 	(revision )
@@ -1,100 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full paths)
-ISSM_DIR="/u/astrid-r1b/cborstad/issmuci"
-ISSM_TIER="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/cborstad/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="cborstad@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
-
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_nightly
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_nightly	(revision 12003)
+++ 	(revision )
@@ -1,100 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/cborstad/issmuci"
-ISSM_TIER="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/cborstad/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="cborstad@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
-
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_ucitrunk
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_ucitrunk	(revision 12003)
+++ 	(revision )
@@ -1,99 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/cborstad/issmuci"
-ISSM_TIER="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/cron/trunk"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/cborstad/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="cborstad@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_validation
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_borstad_validation	(revision 12003)
+++ 	(revision )
@@ -1,99 +1,0 @@
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/cborstad/issmuci"
-ISSM_TIER="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/cborstad/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/cborstad/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco yams"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="cborstad@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'benchmark','all'"
-
Index: /issm/branches/trunk-jpl-damage/cron/configs/linux64_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_daily	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/cron/configs/linux64_daily	(revision 12004)
@@ -0,0 +1,97 @@
+########### Configuration file for nightly run on Linux ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full paths)
+ISSM_DIR="/path/to/issm"
+ISSM_TIER="/path/to/issm/cron/trunk-jpl"
+
+#ISSM Architecture
+ISSM_ARCH="linux-gnu-amd64"
+
+#Machine configuration
+MACHINE="astrid"
+
+#COMPILATION CONFIGURATION FILE
+COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
+
+#MATLAB path
+MATLAB_PATH="/path/to/matlab-7.6/"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="update"
+
+#SVN repository
+REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/path/to/ExecutionNightlyRun"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="none"
+EXTERNALPACKAGESDIR="/path/to/trunk-jpl/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
+
+#Corresponding list of installation files to use
+EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="yes"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="example@example.edu"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=8
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=7
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS=""
+
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_larour
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_larour	(revision 12003)
+++ 	(revision )
@@ -1,93 +1,0 @@
-#
-########### Configuration file for Eric Larour's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full paths)
-ISSM_DIR="/u/astrid-r1b/larour/issm/"
-ISSM_TIER="/u/astrid-r1b/larour/issm/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/wilkes-r1b/morlighe/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/larour/issm/execution"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/larour/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="no"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=8
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_morlighem_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_morlighem_daily	(revision 12003)
+++ 	(revision )
@@ -1,93 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full paths)
-ISSM_DIR="/u/astrid-r1b/morlighe/svn/issm"
-ISSM_TIER="/u/astrid-r1b/morlighe/svn/issm/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/morlighe/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/morlighe/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/morlighe/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="automake autoconf matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="mathieu.morlighem@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_morlighem_nightly
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_morlighem_nightly	(revision 12003)
+++ 	(revision )
@@ -1,93 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/morlighe/issm"
-ISSM_TIER="/u/astrid-r1b/morlighe/issm/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/morlighe/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/morlighe/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/morlighe/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="mathieu.morlighem@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_morlighem_validation
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_morlighem_validation	(revision 12003)
+++ 	(revision )
@@ -1,92 +1,0 @@
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/morlighe/issm"
-ISSM_TIER="/u/astrid-r1b/morlighe/issm/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/morlighe/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/morlighe/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/morlighe/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco yams"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="mathieu.morlighem@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'benchmark','all'"
Index: /issm/branches/trunk-jpl-damage/cron/configs/linux64_nightly
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_nightly	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/cron/configs/linux64_nightly	(revision 12004)
@@ -0,0 +1,97 @@
+########### Configuration file for nightly run on Linux ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full paths)
+ISSM_DIR="/path/to/issm"
+ISSM_TIER="/path/to/issm/cron/trunk-jpl"
+
+#ISSM Architecture
+ISSM_ARCH="linux-gnu-amd64"
+
+#Machine configuration
+MACHINE="astrid"
+
+#COMPILATION CONFIGURATION FILE
+COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
+
+#MATLAB path
+MATLAB_PATH="/path/to/matlab-7.6/"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="checkout"
+
+#SVN repository
+REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/path/to/ExecutionNightlyRun"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="install"
+EXTERNALPACKAGESDIR="/path/to/trunk-jpl/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
+
+#Corresponding list of installation files to use
+EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="yes"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="example@example.edu"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=8
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=7
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS=""
+
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_daily	(revision 12003)
+++ 	(revision )
@@ -1,100 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full paths)
-ISSM_DIR="/u/astrid-r1b/schlegel/issmuci"
-ISSM_TIER="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/schlegel/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="schlegel@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
-
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_nightly
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_nightly	(revision 12003)
+++ 	(revision )
@@ -1,100 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/schlegel/issmuci"
-ISSM_TIER="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/schlegel/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="schlegel@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
-
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_ucitrunk
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_ucitrunk	(revision 12003)
+++ 	(revision )
@@ -1,99 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/schlegel/issmuci"
-ISSM_TIER="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/cron/trunk"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/schlegel/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="schlegel@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_validation
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_schlegel_validation	(revision 12003)
+++ 	(revision )
@@ -1,99 +1,0 @@
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/schlegel/issmuci"
-ISSM_TIER="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-linux64-astrid.sh"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/schlegel/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/schlegel/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco yams"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="schlegel@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'benchmark','all'"
-
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi	(revision 12003)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#
-########### Configuration file for Helene Seroussi's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/wilkes-r1b/seroussi/issm"
-ISSM_TIER="/u/wilkes-r1b/seroussi/issm/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/wilkes-r1b/seroussi/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/u/wilkes-r1b/seroussi/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="helene.seroussi@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_daily	(revision 12003)
+++ 	(revision )
@@ -1,93 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full paths)
-ISSM_DIR="/u/astrid-r1b/seroussi/issm"
-ISSM_TIER="/u/astrid-r1b/seroussi/issm/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/seroussi/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/seroussi/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="helene.seroussi@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_nightly
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_nightly	(revision 12003)
+++ 	(revision )
@@ -1,93 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/seroussi/issm"
-ISSM_TIER="/u/astrid-r1b/seroussi/issm/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/seroussi/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/seroussi/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="helene.seroussi@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_ucitrunk
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_ucitrunk	(revision 12003)
+++ 	(revision )
@@ -1,93 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/seroussi/issm"
-ISSM_TIER="/u/astrid-r1b/seroussi/issm/trunk-jpl/cron/trunk"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/seroussi/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/seroussi/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="helene.seroussi@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_validation
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/linux64_seroussi_validation	(revision 12003)
+++ 	(revision )
@@ -1,92 +1,0 @@
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/u/astrid-r1b/seroussi/issm"
-ISSM_TIER="/u/astrid-r1b/seroussi/issm/trunk-jpl/cron/trunk-jpl"
-#ISSM_TIER="/u/astrid-r1b/seroussi/svn/issm/trunk/cron/issm2.2"
-
-#ISSM Architecture
-ISSM_ARCH="linux-gnu-amd64"
-
-#Machine configuration
-MACHINE="astrid"
-
-#MATLAB path
-MATLAB_PATH="/usr/local/pkgs/matlab-7.6/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/seroussi/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/u/astrid-r1b/seroussi/issm/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco yams"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="helene.seroussi@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=7
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'benchmark','all'"
Index: sm/branches/trunk-jpl-damage/cron/configs/macosx32_seroussi
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx32_seroussi	(revision 12003)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#
-########### Configuration file for Helene Seroussi's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/Users/seroussi/Desktop/issmuci"
-ISSM_TIER="/Users/seroussi/Desktop/issmuci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="macosx-gnu"
-
-#Machine configuration
-MACHINE="macmathieu"
-
-#MATLAB path
-MATLAB_PATH="/Applications/MATLAB_R2009a.app/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH=""
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR=""
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="helene.seroussi@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=1
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/macosx64_borstad
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_borstad	(revision 12003)
+++ 	(revision )
@@ -1,98 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/Users/cborstad/issmuci"
-ISSM_TIER="/Users/cborstad/issmuci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="macosx-gnu"
-
-#Machine configuration
-MACHINE="macosx-gil"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-macosx64-chris.sh"
-
-#MATLAB path
-MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/Users/cborstad/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/Users/cborstad/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.4-macosx64.sh install-3.2-macosx64.sh install-4.0-macosx64.sh install-macosx64.sh install-macosx64.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="cborstad@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=4
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'exclude',[137 425:434 527]"
-
Index: sm/branches/trunk-jpl-damage/cron/configs/macosx64_borstad_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_borstad_daily	(revision 12003)
+++ 	(revision )
@@ -1,98 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/Users/cborstad/issmuci"
-ISSM_TIER="/Users/cborstad/issmuci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="macosx-gnu"
-
-#Machine configuration
-MACHINE="macosx-gil"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-macosx64-nicole.sh"
-
-#MATLAB path
-MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/Users/cborstad/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/Users/cborstad/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.4-macosx64.sh install-3.2-macosx64.sh install-4.0-macosx64.sh install-macosx64.sh install-macosx64.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="cborstad@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=4
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=4
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'exclude',[137 425:434 527]"
-
Index: /issm/branches/trunk-jpl-damage/cron/configs/macosx64_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_daily	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/cron/configs/macosx64_daily	(revision 12004)
@@ -0,0 +1,97 @@
+########### Configuration file for nightly run on MAC OSX 64 bit ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full path)
+ISSM_DIR="/path/to/issm/"
+ISSM_TIER="/path/to/issm/trunk-jpl/cron/trunk-jpl"
+
+#ISSM Architecture
+ISSM_ARCH="macosx-gnu"
+
+#Machine configuration
+MACHINE="macosx-gil"
+
+#COMPILATION CONFIGURATION FILE
+COMPILE_CONFIG_FILE="config-macosx64-nicole.sh"
+
+#MATLAB path
+MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="update"
+
+#SVN repository
+REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/path/to/ExecutionNightlyRun"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="none"
+EXTERNALPACKAGESDIR="/path/to/issm/trunk-jpl/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
+
+#Corresponding list of installation files to use
+EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.4-macosx64.sh install-3.2-macosx64.sh install-4.0-macosx64.sh install-macosx64.sh install-macosx64.sh install.sh"
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="yes"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="example@example.edu"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=1
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=4
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS="'exclude',[137 425:434 527]"
+
Index: sm/branches/trunk-jpl-damage/cron/configs/macosx64_larour
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_larour	(revision 12003)
+++ 	(revision )
@@ -1,106 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/Users/larour/issm-uci"
-ISSM_TIER="/Users/larour/issm-uci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="macosx-gnu"
-
-#Machine configuration
-MACHINE="macosx-gil"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-macosx64-mathieu.sh"
-
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/Users/larour/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="copy"
-EXTERNALPACKAGESDIR="/Users/larour/issm-uci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-EXTERNALPACKAGES_NUMCPUS=" 1 1 1 1 1 1"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="yes"
-
-#Sender email address
-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=4
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=1
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
-
-
-#------------------------#
-# 7: Matlab#
-#------------------------#
-
-#MATLAB path
-MATLAB_PATH="/Applications/MATLAB_R2010a.app/"
-
-MATLABBIN="/Applications/MATLAB_R2010a.app/bin/matlab"
Index: sm/branches/trunk-jpl-damage/cron/configs/macosx64_larour_validation
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_larour_validation	(revision 12003)
+++ 	(revision )
@@ -1,108 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/Users/larour/issm-uci"
-ISSM_TIER="/Users/larour/issm-uci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="macosx-gnu"
-
-#Machine configuration
-MACHINE="macosx-gil"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-macosx64-larour.sh"
-
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/Users/larour/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="link"
-EXTERNALPACKAGESDIR="/Users/larour/issm-uci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.0.2-linux64.sh install-3.2-linux64.sh install-4.0-linux64.sh install-linux64.sh install-linux64-astrid.sh install.sh"
-EXTERNALPACKAGES_NUMCPUS=" 1 1 1 1 1 1"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="yes"
-
-#Sender email address
-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=1
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'id',[101:136 138:151]"
-
-#------------------------#
-# 7: Matlab#
-#------------------------#
-
-#MATLAB path
-MATLAB_PATH="/Applications/MATLAB_R2010a.app/"
-
-MATLABBIN="/Applications/MATLAB_R2010a.app/bin/matlab"
-
-#Specialty one: 
-export  FC=gfortran
Index: /issm/branches/trunk-jpl-damage/cron/configs/macosx64_nightly
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_nightly	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/cron/configs/macosx64_nightly	(revision 12004)
@@ -0,0 +1,97 @@
+########### Configuration file for nightly run on MAC OSX 64 bit ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full path)
+ISSM_DIR="/path/to/issm/"
+ISSM_TIER="/path/to/issm/trunk-jpl/cron/trunk-jpl"
+
+#ISSM Architecture
+ISSM_ARCH="macosx-gnu"
+
+#Machine configuration
+MACHINE="macosx-gil"
+
+#COMPILATION CONFIGURATION FILE
+COMPILE_CONFIG_FILE="config-macosx64-nicole.sh"
+
+#MATLAB path
+MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="checkout"
+
+#SVN repository
+REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/path/to/ExecutionNightlyRun"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="install"
+EXTERNALPACKAGESDIR="/path/to/issm/trunk-jpl/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
+
+#Corresponding list of installation files to use
+EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.4-macosx64.sh install-3.2-macosx64.sh install-4.0-macosx64.sh install-macosx64.sh install-macosx64.sh install.sh"
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="yes"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="example@example.edu"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=1
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=4
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS="'exclude',[137 425:434 527]"
+
Index: sm/branches/trunk-jpl-damage/cron/configs/macosx64_schlegel
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_schlegel	(revision 12003)
+++ 	(revision )
@@ -1,98 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/Users/schlegel/issmuci"
-ISSM_TIER="/Users/schlegel/issmuci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="macosx-gnu"
-
-#Machine configuration
-MACHINE="macosx-gil"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-macosx64-nicole.sh"
-
-#MATLAB path
-MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="checkout"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/Users/schlegel/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="install"
-EXTERNALPACKAGESDIR="/Users/schlegel/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.4-macosx64.sh install-3.2-macosx64.sh install-4.0-macosx64.sh install-macosx64.sh install-macosx64.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="schlegel@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=4
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'exclude',[137 425:434 527]"
-
Index: sm/branches/trunk-jpl-damage/cron/configs/macosx64_schlegel_daily
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/macosx64_schlegel_daily	(revision 12003)
+++ 	(revision )
@@ -1,98 +1,0 @@
-#
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/Users/schlegel/issmuci"
-ISSM_TIER="/Users/schlegel/issmuci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="macosx-gnu"
-
-#Machine configuration
-MACHINE="macosx-gil"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-macosx64-nicole.sh"
-
-#MATLAB path
-MATLAB_PATH="/Applications/MATLAB_R2011b.app/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/Users/schlegel/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/Users/schlegel/issmuci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install.sh install-1.4-macosx64.sh install-3.2-macosx64.sh install-4.0-macosx64.sh install-macosx64.sh install-macosx64.sh install.sh"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="yes"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="schlegel@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=4
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=4
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'exclude',[137 425:434 527]"
-
Index: /issm/branches/trunk-jpl-damage/cron/configs/win732
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/win732	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/cron/configs/win732	(revision 12004)
@@ -0,0 +1,102 @@
+########### Configuration file for nightly run on Windows 7, 32 bit ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full path)
+ISSM_DIR="/cygdrive/c/issm"
+ISSM_TIER="/cygdrive/c/issm/trunk-jpl/cron/trunk-jpl"
+
+#ISSM Architecture
+ISSM_ARCH="cygwin-intel"
+
+#Machine configuration
+MACHINE="win7"
+
+#MATLAB path
+MATLAB_PATH="C:/MATLAB/R2011b32/"
+
+#COMPILATION CONFIGURATION FILE
+COMPILE_CONFIG_FILE="config-win7-32.sh"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="none"
+
+#SVN repository
+REPOSITORY="http://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/cygdrive/c/issm/ExecutionNightlyRun"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="none"
+EXTERNALPACKAGESDIR="/cygdrive/c/issm/trunk-jpl/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES=" autoconf automake petsc metis triangle cccl"
+
+#Corresponding list of installation files to use
+EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install-3.1-win7.sh install-4.0-win7.sh install-win7.sh install-win7.sh"
+EXTERNALPACKAGES_NUMCPUS=" 1 1 1 1 1 1" 
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="no"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=8
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=1
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS="'benchmark','all'"
+
+#------------------------#
+# 7: Matlab#
+#------------------------#
+MATLABBIN=/cygdrive/c/MATLAB/R2011b32/bin/matlab
Index: sm/branches/trunk-jpl-damage/cron/configs/win732_larour
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/win732_larour	(revision 12003)
+++ 	(revision )
@@ -1,102 +1,0 @@
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/cygdrive/c/issm-uci"
-ISSM_TIER="/cygdrive/c/issm-uci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="cygwin-intel"
-
-#Machine configuration
-MACHINE="win7"
-
-#MATLAB path
-MATLAB_PATH="C:/MATLAB/R2011b32/"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-win7-32.sh"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="none"
-
-#SVN repository
-REPOSITORY="http://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/cygdrive/c/issm-uci/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/cygdrive/c/issm-uci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES=" autoconf automake petsc metis triangle cccl"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install-3.1-win7.sh install-4.0-win7.sh install-win7.sh install-win7.sh"
-EXTERNALPACKAGES_NUMCPUS=" 1 1 1 1 1 1" 
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="no"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=1
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS="'benchmark','all'"
-
-#------------------------#
-# 7: Matlab#
-#------------------------#
-MATLABBIN=/cygdrive/c/MATLAB/R2011b32/bin/matlab
Index: /issm/branches/trunk-jpl-damage/cron/configs/win764
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/win764	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/cron/configs/win764	(revision 12004)
@@ -0,0 +1,102 @@
+########### Configuration file for nightly run on Windows 7, 64 bit ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full path)
+ISSM_DIR="/cygdrive/c/issm"
+ISSM_TIER="/cygdrive/c/issm/trunk-jpl/cron/trunk-jpl"
+
+#ISSM Architecture
+ISSM_ARCH="cygwin-intel"
+
+#Machine configuration
+MACHINE="win7"
+
+#MATLAB path
+MATLAB_PATH="C:/MATLAB/R2011b/"
+
+#COMPILATION CONFIGURATION FILE
+COMPILE_CONFIG_FILE="config-win7-64.sh"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="none"
+
+#SVN repository
+REPOSITORY="http://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/cygdrive/c/issm/ExecutionNightlyRun"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="none"
+EXTERNALPACKAGESDIR="/cygdrive/c/issm/trunk-jpl/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES=" autoconf automake petsc metis triangle cccl"
+
+#Corresponding list of installation files to use
+EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install-3.1-win7.sh install-4.0-win7.sh install-win7.sh install-win7.sh"
+EXTERNALPACKAGES_NUMCPUS=" 1 1 1 1 1 1" 
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="no"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=8
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=1
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS=""
+
+#------------------------#
+# 7: Matlab#
+#------------------------#
+MATLABBIN=/cygdrive/c/MATLAB/R2011b32/bin/matlab
Index: sm/branches/trunk-jpl-damage/cron/configs/win764_larour
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/win764_larour	(revision 12003)
+++ 	(revision )
@@ -1,102 +1,0 @@
-########### Configuration file for Mathieu Morlighem's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="/cygdrive/c/issm-uci"
-ISSM_TIER="/cygdrive/c/issm-uci/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="cygwin-intel"
-
-#Machine configuration
-MACHINE="win7"
-
-#MATLAB path
-MATLAB_PATH="C:/MATLAB/R2011b/"
-
-#COMPILATION CONFIGURATION FILE
-COMPILE_CONFIG_FILE="config-win7-64.sh"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="none"
-
-#SVN repository
-REPOSITORY="http://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/cygdrive/c/issm-uci/ExecutionNightlyRun"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/cygdrive/c/issm-uci/trunk-jpl/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES=" autoconf automake petsc metis triangle cccl"
-
-#Corresponding list of installation files to use
-EXTERNALPACKAGES_CONFIGS=" install.sh install.sh install-3.1-win7.sh install-4.0-win7.sh install-win7.sh install-win7.sh"
-EXTERNALPACKAGES_NUMCPUS=" 1 1 1 1 1 1" 
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="no"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=8
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=1
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
-
-#------------------------#
-# 7: Matlab#
-#------------------------#
-MATLABBIN=/cygdrive/c/MATLAB/R2011b32/bin/matlab
Index: /issm/branches/trunk-jpl-damage/cron/configs/winxp32
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/winxp32	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/cron/configs/winxp32	(revision 12004)
@@ -0,0 +1,90 @@
+########### Configuration file for nightly run on Windows XP, 32 bit ############
+
+#-------------------------------#
+# 1: ISSM general configuration #
+#-------------------------------#
+
+#ISSM main directory (full path)
+ISSM_DIR="C:/home/issm/trunk-jpl"
+ISSM_TIER="C:/home/issm/trunk-jpl/cron/trunk-jpl"
+
+#ISSM Architecture
+ISSM_ARCH="cygwin-intel"
+
+#Machine configuration
+MACHINE="wineric"
+
+#MATLAB path
+MATLAB_PATH="C:/MATLAB/R2009a/"
+
+#----------------------#
+# 2: ISSM Installation #
+#----------------------#
+
+#ISSM_INSTALLATION can have 3 values:
+# - "checkout" the existing version of the code will be erased and
+#              the latest version will be checked out
+# - "update"   the directory won't be erased but ISSM will be updated
+#              ->skip to section 3
+# - "none"     leave ISSM as is in its directory
+#              ->skip to section 3
+ISSM_INSTALLATION="update"
+
+#SVN repository
+REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
+
+#execution path used for parallel runs
+EXECUTION_PATH="/path/to/issm/execution"
+
+#-----------------------------------#
+# 3: External packages installation #
+#-----------------------------------#
+
+#ISSM_EXTERNALPACKAGES can have 3 values:
+# - "install" install all external packages listed below
+# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
+# - "none"    leave external packages as is
+#             ->skip to section 4
+ISSM_EXTERNALPACKAGES="none"
+EXTERNALPACKAGESDIR="/cygdrive/c/home/externalpackages"
+
+#List of external pakages to be installed
+EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
+
+#---------------------#
+# 4: ISSM Compilation #
+#---------------------#
+
+#ISSM_COMPILATION can have 2 values:
+# - "yes" compile ISSM
+# - "no"  do not compile ISSM
+ISSM_COMPILATION="no"
+
+#----------------------#
+# 5: Mail notification #
+#----------------------#
+
+#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
+#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
+SKIPMAIL="no"
+
+#Sender email address
+EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
+
+#------------------------#
+# 6: Nightly run options #
+#------------------------#
+
+#number of cpus used in ISSM installation and compilation (one is usually
+#safer as some packages are very sensitive to parallel compilation)
+NUMCPUS_INSTALL=1
+
+#number of cpus used in the nightly runs.
+NUMCPUS_RUN=1
+
+#Nightly run options. The matlab routine nightlyrun.m will be called
+#as follows: nightlyrun($NROPTIONS). The options must be understandable
+#by Matlab and nightlyrun.m
+#ex: "'id',[101 102 103]"
+
+NROPTIONS=""
Index: sm/branches/trunk-jpl-damage/cron/configs/winxp32_larour
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/configs/winxp32_larour	(revision 12003)
+++ 	(revision )
@@ -1,92 +1,0 @@
-#
-########### Configuration file for Eric Larour's nightly run on Linux ############
-
-#-------------------------------#
-# 1: ISSM general configuration #
-#-------------------------------#
-
-#ISSM main directory (full path)
-ISSM_DIR="C:/home/issm/trunk-jpl"
-ISSM_TIER="C:/home/issm/trunk-jpl/cron/trunk-jpl"
-
-#ISSM Architecture
-ISSM_ARCH="cygwin-intel"
-
-#Machine configuration
-MACHINE="wineric"
-
-#MATLAB path
-MATLAB_PATH="C:/MATLAB/R2009a/"
-
-#----------------------#
-# 2: ISSM Installation #
-#----------------------#
-
-#ISSM_INSTALLATION can have 3 values:
-# - "checkout" the existing version of the code will be erased and
-#              the latest version will be checked out
-# - "update"   the directory won't be erased but ISSM will be updated
-#              ->skip to section 3
-# - "none"     leave ISSM as is in its directory
-#              ->skip to section 3
-ISSM_INSTALLATION="update"
-
-#SVN repository
-REPOSITORY="https://issm.ess.uci.edu/svn/issm/issm/trunk-jpl"
-#REPOSITORY="http://s383-rhat/issm/svn/issm/branches/issm2.2"
-
-#execution path used for parallel runs
-EXECUTION_PATH="/u/astrid-r1b/larour/issm/execution"
-
-#-----------------------------------#
-# 3: External packages installation #
-#-----------------------------------#
-
-#ISSM_EXTERNALPACKAGES can have 3 values:
-# - "install" install all external packages listed below
-# - "copy"    copy existing directories (EXTERNALPACKAGESDIR)
-# - "none"    leave external packages as is
-#             ->skip to section 4
-ISSM_EXTERNALPACKAGES="none"
-EXTERNALPACKAGESDIR="/cygdrive/c/home/externalpackages"
-
-#List of external pakages to be installed
-EXTERNALPACKAGES="autoconf automake matlab mpich2 petsc metis triangle dakota chaco"
-
-#---------------------#
-# 4: ISSM Compilation #
-#---------------------#
-
-#ISSM_COMPILATION can have 2 values:
-# - "yes" compile ISSM
-# - "no"  do not compile ISSM
-ISSM_COMPILATION="no"
-
-#----------------------#
-# 5: Mail notification #
-#----------------------#
-
-#Mail delivery. If SKIPMAIL="no", the html nightly run report will be
-#sent to the adresses present in $ISSM_TIER/cron/mailinglist.
-SKIPMAIL="no"
-
-#Sender email address
-EMAIL_ADRESS="eric.larour@jpl.nasa.gov"
-
-#------------------------#
-# 6: Nightly run options #
-#------------------------#
-
-#number of cpus used in ISSM installation and compilation (one is usually
-#safer as some packages are very sensitive to parallel compilation)
-NUMCPUS_INSTALL=1
-
-#number of cpus used in the nightly runs.
-NUMCPUS_RUN=1
-
-#Nightly run options. The matlab routine nightlyrun.m will be called
-#as follows: nightlyrun($NROPTIONS). The options must be understandable
-#by Matlab and nightlyrun.m
-#ex: "'id',[101 102 103]"
-
-NROPTIONS=""
Index: /issm/branches/trunk-jpl-damage/cron/nightlyrun.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/cron/nightlyrun.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/cron/nightlyrun.sh	(revision 12004)
@@ -337,5 +337,5 @@
 		if [ "$MACHINE" = "win7" ]
 		then
-			email -html -s "Nightly runs on $HOST_NAME (version: $ISSM_RELEASE)" $i < $ISSM_TIER/nightlylog/report.html
+			email -html -s "Nightly runs on $HOST_NAME (version: $ISSM_RELEASE)" -n "ISSM Nightly run" -f echo $EMAIL_ADRESS $i < $ISSM_TIER/nightlylog/report.html
 		else 
 			if [ "$MACHINE" = "astrid" ]
Index: sm/branches/trunk-jpl-damage/depcomp
===================================================================
--- /issm/branches/trunk-jpl-damage/depcomp	(revision 12003)
+++ 	(revision )
@@ -1,589 +1,0 @@
-#! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2007-03-29.01
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
-
-case $1 in
-  '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
-  -h | --h*)
-    cat <<\EOF
-Usage: depcomp [--help] [--version] PROGRAM [ARGS]
-
-Run PROGRAMS ARGS to compile a file, generating dependencies
-as side-effects.
-
-Environment variables:
-  depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
-  DEPDIR      directory where to store dependencies.
-  depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
-  libtool     Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "depcomp $scriptversion"
-    exit $?
-    ;;
-esac
-
-if test -z "$depmode" || test -z "$source" || test -z "$object"; then
-  echo "depcomp: Variables source, object and depmode must be set" 1>&2
-  exit 1
-fi
-
-# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
-depfile=${depfile-`echo "$object" |
-  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
-tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
-
-rm -f "$tmpdepfile"
-
-# Some modes work just like other modes, but use different flags.  We
-# parameterize here, but still list the modes in the big case below,
-# to make depend.m4 easier to write.  Note that we *cannot* use a case
-# here, because this file can only contain one case statement.
-if test "$depmode" = hp; then
-  # HP compiler uses -M and no extra arg.
-  gccflag=-M
-  depmode=gcc
-fi
-
-if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
-fi
-
-case "$depmode" in
-gcc3)
-## gcc 3 implements dependency tracking that does exactly what
-## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
-## it if -MD -MP comes after the -MF stuff.  Hmm.
-## Unfortunately, FreeBSD c89 acceptance of flags depends upon
-## the command line argument order; so add the flags where they
-## appear in depend2.am.  Note that the slowdown incurred here
-## affects only configure: in makefiles, %FASTDEP% shortcuts this.
-  for arg
-  do
-    case $arg in
-    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
-    *)  set fnord "$@" "$arg" ;;
-    esac
-    shift # fnord
-    shift # $arg
-  done
-  "$@"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  mv "$tmpdepfile" "$depfile"
-  ;;
-
-gcc)
-## There are various ways to get dependency output from gcc.  Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-##   up in a subdir.  Having to rename by hand is ugly.
-##   (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-##   than renaming).
-  if test -z "$gccflag"; then
-    gccflag=-MD,
-  fi
-  "$@" -Wp,"$gccflag$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
-  sed -e 's/^[^:]*: / /' \
-      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header).  We avoid this by adding
-## dummy dependencies for each header file.  Too bad gcc doesn't do
-## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
-## that the space means something, we add a space to the output as
-## well.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
-sgi)
-  if test "$libtool" = yes; then
-    "$@" "-Wp,-MDupdate,$tmpdepfile"
-  else
-    "$@" -MDupdate "$tmpdepfile"
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-
-  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
-    echo "$object : \\" > "$depfile"
-
-    # Clip off the initial element (the dependent).  Don't try to be
-    # clever and replace this with sed code, as IRIX sed won't handle
-    # lines with more than a fixed number of characters (4096 in
-    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
-    # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> $depfile
-    echo >> $depfile
-
-    # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> $depfile
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-aix)
-  # The C for AIX Compiler uses -M and outputs the dependencies
-  # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
-  # start of each line; $object doesn't have directory information.
-  # Version 6 uses the directory in both cases.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-  if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$base.u
-    tmpdepfile3=$dir.libs/$base.u
-    "$@" -Wc,-M
-  else
-    tmpdepfile1=$dir$base.u
-    tmpdepfile2=$dir$base.u
-    tmpdepfile3=$dir$base.u
-    "$@" -M
-  fi
-  stat=$?
-
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-    exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
-  # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp2)
-  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
-  # compilers, which have integrated preprocessors.  The correct option
-  # to use with these is +Maked; it writes dependencies to a file named
-  # 'foo.d', which lands next to the object file, wherever that
-  # happens to be.
-  # Much of this is similar to the tru64 case; see comments there.
-  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-  test "x$dir" = "x$object" && dir=
-  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-  if test "$libtool" = yes; then
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir.libs/$base.d
-    "$@" -Wc,+Maked
-  else
-    tmpdepfile1=$dir$base.d
-    tmpdepfile2=$dir$base.d
-    "$@" +Maked
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-     rm -f "$tmpdepfile1" "$tmpdepfile2"
-     exit $stat
-  fi
-
-  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
-  do
-    test -f "$tmpdepfile" && break
-  done
-  if test -f "$tmpdepfile"; then
-    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
-    sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
-  else
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile" "$tmpdepfile2"
-  ;;
-
-tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mechanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
-
-#nosideeffect)
-  # This comment above is used by automake to tell side-effect
-  # dependency tracking mechanisms from slower ones.
-
-dashmstdout)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
-  # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
-  "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-dashXmstdout)
-  # This case only exists to satisfy depend.m4.  It is never actually
-  # run, as this mode is specially recognized in the preamble.
-  exit 1
-  ;;
-
-makedepend)
-  "$@" || exit $?
-  # Remove any Libtool call
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-  # X makedepend
-  shift
-  cleared=no
-  for arg in "$@"; do
-    case $cleared in
-    no)
-      set ""; shift
-      cleared=yes ;;
-    esac
-    case "$arg" in
-    -D*|-I*)
-      set fnord "$@" "$arg"; shift ;;
-    # Strip any option that makedepend may not understand.  Remove
-    # the object too, otherwise makedepend will parse it as a source file.
-    -*|$object)
-      ;;
-    *)
-      set fnord "$@" "$arg"; shift ;;
-    esac
-  done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
-  touch "$tmpdepfile"
-  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile" "$tmpdepfile".bak
-  ;;
-
-cpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  cat < "$tmpdepfile" >> "$depfile"
-  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvisualcpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
-  "$@" || exit $?
-  IFS=" "
-  for arg
-  do
-    case "$arg" in
-    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-	set fnord "$@"
-	shift
-	shift
-	;;
-    *)
-	set fnord "$@" "$arg"
-	shift
-	shift
-	;;
-    esac
-  done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
-  echo "	" >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-none)
-  exec "$@"
-  ;;
-
-*)
-  echo "Unknown depmode $depmode" 1>&2
-  exit 1
-  ;;
-esac
-
-exit 0
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
Index: /issm/branches/trunk-jpl-damage/etc/environment.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/etc/environment.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/etc/environment.sh	(revision 12004)
@@ -1,6 +1,12 @@
 #ISSM_TIER and ISSM_ARCH should have been defined already in your shell settings file (.bashrc, .cshrc, etc ...)
+
+#Windows compilers: 
+if [[ "$ISSM_ARCH" == "cygwin-intel" ]]; then
+	source $ISSM_TIER/externalpackages/windows/windows_environment.sh
+fi
+
 source $ISSM_TIER/etc/environment_variables.sh
 
-#Do we have any command line arguments? (such as MATLAB_DIR=otherdirthandefault), source them before exporting the variables 
+#Do we have any command line arguments? (such as MATLAB_DIR=otherdirthandefault), source them after exporting the variables
 #to environment.
 for i in $@
@@ -8,10 +14,4 @@
 	eval $i
 done
-
-#Windows compilers: 
-if [[ "$ISSM_ARCH" == "cygwin-intel" ]]; then
-	source $ISSM_TIER/externalpackages/windows/windows_environment.sh
-fi
-
 
 #CRON utilities
@@ -173,4 +173,5 @@
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BOOST_DIR/lib"
 export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$BOOST_DIR/lib"
+export PATH="$PATH:$BOOST_DIR/bin"
 
 #XERCES
@@ -238,5 +239,9 @@
 
 #ANDROID_NDK:
+export ANDROID_NDK_DIR
 export PATH="$PATH:$ANDROID_NDK_DIR/"
+
+#ANDROID_DEV_DIR
+export ANDROID_DEV_DIR
 
 #ANDROID_SDK
@@ -245,2 +250,16 @@
 #ANDROID_ANT
 export PATH="$PATH:$ANDROID_ANT_DIR/"
+
+#GSL
+export PATH="$PATH:$GSL_DIR/bin"
+
+#GMAKE
+export PATH="$GMAKE_DIR/bin:$PATH"
+
+#PYTHON
+export PATH="$PYTHON_DIR/bin:$PATH"
+export PYTHONPATH="$PYTHONPATH:$ISSM_TIER/src/mex"
+export LD_LIBRARY_PATH=$ISSM_TIER/src/mex:$LD_LIBRARY_PATH
+
+#MODELE
+export PATH="$MODELE_DIR/src/exec:$PATH"
Index: /issm/branches/trunk-jpl-damage/etc/environment_variables.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/etc/environment_variables.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/etc/environment_variables.sh	(revision 12004)
@@ -176,4 +176,7 @@
 ANDROID_NDK_DIR="$ISSM_TIER/externalpackages/android-ndk/install"
 
+#android-dev-dir
+ANDROID_DEV_DIR="$ISSM_TIER/externalpackages/android-dev-dir"
+
 #android-sdk
 ANDROID_SDK_DIR="$ISSM_TIER/externalpackages/android-sdk/install-sdk"
@@ -181,2 +184,14 @@
 #android-ant
 ANDROID_ANT_DIR="$ISSM_TIER/externalpackages/android-sdk/install-ant"
+
+#gsl
+GSL_DIR="$ISSM_TIER/externalpackages/gsl/install"
+
+#gnu make
+GMAKE_DIR="$ISSM_TIER/externalpackages/gmake/install"
+
+#PYTHON
+PYTHON_DIR="$ISSM_TIER/externalpackages/python/install"
+
+#MODELE
+MODELE_DIR="$ISSM_TIER/externalpackages/modelE"
Index: /issm/branches/trunk-jpl-damage/externalpackages/adolc/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/adolc/install.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/adolc/install.sh	(revision 12004)
@@ -1,3 +1,5 @@
 #!/bin/bash
+
+#some issues on macosx64 with ISSM's autoconf. you might want to run native to mac on this.
 
 #Some cleanup
@@ -16,9 +18,12 @@
 #Compile ADOL-C
 cd src 
+
 ./configure \
 	--prefix=$ISSM_TIER/externalpackages/adolc/install \
 	--enable-sparse \
 	--enable-docexa \
-	--enable-addexa          
+	--enable-addexa \
+	--disable-shave
+
 if [ -z $1 ]; then
 	make
Index: /issm/branches/trunk-jpl-damage/externalpackages/android-ndk/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/android-ndk/install.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/android-ndk/install.sh	(revision 12004)
@@ -8,4 +8,5 @@
 #Cleanup the install
 rm -rf install
+rm -rf $ANROID_DEV_DIR/tmp
 
 # Install Android SDK and NDK.
@@ -17,2 +18,5 @@
 #Move to install
 mv android-ndk-r7b install
+
+#Create Standalone Development Directory
+$ANDROID_NDK_DIR/build/tools/make-standalone-toolchain.sh --platform=android-5 --install-dir=$ANDROID_DEV_DIR/tmp/android-linux-4.0
Index: /issm/branches/trunk-jpl-damage/externalpackages/android-sdk/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/android-sdk/install.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/android-sdk/install.sh	(revision 12004)
@@ -2,5 +2,5 @@
 #which is needed for the compilation of the Java project. 
 
-step=1;
+step=3;
 
 #Different steps here. 
@@ -11,4 +11,5 @@
 
 present_dir=`pwd`;
+default_droid="Android-4.0"
 
 if [[ $step == "1" ]]; then
@@ -31,7 +32,9 @@
 	#For now, we need to install:  
 	#android sdk platform tools  
-	#a specific android api: API 15
+	#and a specific android api: API 15
+	#Note: API 15 corresponds to Android 4.0.3
 
-	cd install-sdk/tools/ && source ./android
+	cd install-sdk/tools/ && source ./android update sdk -t platform-tools,android-15,android-14,system-image --no-ui
+
 fi
 
@@ -42,15 +45,30 @@
 	#For now, it's called: Android-4.0.3
 
+
+	#Here we delete the Android-4.0.3 device if it already exists.
 	cd $present_dir/install-sdk/tools
-	./android avd
-	mv ~/.android/avd/Android-4.0.3.*  $ISSM_TIER/externalpackages/android-emulators
 
+    if [ -e $ANDROID_DEV_DIR/android-emulators/$default_droid ] 
+    then
+        echo "Deleting previously created device: $default_droid"
+	    ./android delete avd -n $default_droid
+    fi
+
+	#Android will prompt the user to specify hardware emulation options. For now, default
+	#default settings will suffice. Press 'enter' to take default settings or enter 'no'.
+
+	./android create avd -f -n $default_droid -t 2 -p $ANDROID_DEV_DIR/android-emulators/$default_droid --abi armeabi-v7a
 fi
 
+if [[ $step == "3" ]]; then
+    #Here we will start up our default emulator to test that it is working properly.
+    #Once the device has booted we will use the Android Debug Bridge tool to gain
+    #a terminal in our device.
 
-if [[ $step == "3" ]]; then
-	
-	cd $present_dir/install-sdk/platform-tools
-	./adb -p "$ISSM_TIER/externalpackages/android-emulators" devices
+	cd $present_dir/install-sdk/tools
+	./emulator -avd $default_droid -sdcard $ANDROID_DEV_DIR/android-emulators/test &
+
+    cd ../platform-tools
+    ./adb wait-for-device shell
 
 fi
Index: /issm/branches/trunk-jpl-damage/externalpackages/boost/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/boost/install.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/boost/install.sh	(revision 12004)
@@ -1,24 +1,33 @@
 #!/bin/bash
 
+#Note of caution:  stop after boostrap phase, and run 
+#bjam --debug-configuration, to figure out which paths boost is using to include 
+#python. make sure everyone of these paths is covered by python. If not, just make 
+#symlinks in externalpackages/python to what boost is expecting. Ther is NO WAY 
+#to get the boost library to include python support without doing that. 
+
+
+
 #Some cleanup
-rm -rf install boost_1_45_0 src
+rm -rf install boost_1_49_0 src
 mkdir install src
 
 #Untar 
-tar -zxvf  boost_1_45_0.tar.gz
+tar -zxvf  boost_1_49_0.tar.gz
 
 #Move boost into install directory
-mv boost_1_45_0/* src
-rm -rf boost_1_45_0
-
+mv boost_1_49_0/* src
+rm -rf boost_1_49_0
 #Configure and compile
 cd src 
-./bootstrap.sh --prefix=$ISSM_TIER/externalpackages/boost/install
+./bootstrap.sh \
+	--prefix="$ISSM_TIER/externalpackages/boost/install" \
+	--with-python=python3.2 \
+	--with-python-root="$ISSM_TIER/externalpackages/python/install" 
 
 #Compile boost
-if [ -z $1 ];
-then
-	./bjam install
-else
-	./bjam -j $1 install
-fi
+./bjam install
+
+#put bjam into install also: 
+mkdir ../install/bin
+cp bjam ../install/bin
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/Contents.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/Contents.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/Contents.m	(revision 12004)
@@ -0,0 +1,16 @@
+% Utilities for coloring with MATLAB by Carlos Vargas.
+%
+% COLORMAP utilites:
+%   cmapping - Colormap linear mapping/interpolation.                        v1.1    (Sep 02, 2009)
+%   cmfit    - Sets the COLORMAP and CAXIS to specific color bands.          v1.0    (Jun 08, 2009)
+%   cmjoin   - Joins colormaps at certain levels.                            v2.0    (Jun 08, 2009)
+%   cmlines  - Change the color of plotted lines using the colormap.         v1.0    (Jun 08, 2009)
+%
+% COLORBAR utilities:
+%   cbfit    - Draws a colorbar with specific color bands between its ticks. v2.1    (Sep 30, 2009)
+%   cbfreeze - Freezes the colormap of a colorbar.                           v1.1    (Sep 02, 2009)
+%   cbhandle - Handle of current colorbar axes.                              v1.1    (Aug 20, 2009)
+%   cblabel  - Adds a label to the colorbar.                                 v2.0    (Jun 08, 2009)
+%   cbunits  - Adds units to the colorbar ticklabels.                        v3.0    (Sep 30, 2009)
+%
+% Sep 30, 2009
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbfit.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbfit.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbfit.m	(revision 12004)
@@ -0,0 +1,252 @@
+function CBH = cbfit(varargin)
+%CBFIT   Draws a colorbar with specific color bands between its ticks.
+% 
+%   SYNTAX:
+%           cbfit
+%           cbfit(NBANDS)               % May be LBANDS instead of NBANDS
+%           cbfit(NBANDS,CENTER)
+%           cbfit(...,MODE)
+%           cbfit(...,OPT)
+%           cbfit(CBH,...)
+%     CBH = cbfit(...);
+%
+%   INPUT:
+%     NBANDS - Draws a colorbar with NBANDS bands colors between each tick
+%      or      mark or a colorband between the specifies level bands
+%     LBANDS   (LBANDS=NBANDS).
+%              DEFAULT: 5     
+%     CENTER - Center the colormap to this CENTER reference.
+%              DEFAULT: [] (do not centers)
+%     MODE   - Specifies the ticks mode (should be before AP,AV). One of:
+%                'manual' - Forces color ticks on the new bands. 
+%                'auto'   - Do not forces
+%              DEFAULT: 'auto'
+%     OPT    - Normal optional arguments of the COLORBAR function (should
+%              be the last arguments).
+%              DEFAULT: none.
+%     CBH    - Uses this colorbar handle instead of current one.
+%
+%   OUTPUT (all optional):
+%     CBH  - Returns the colorbar axes handle.
+%
+%   DESCRIPTION:
+%     Draws a colorbar with specified number of color bands between its
+%     ticks by modifying the current colormap and caxis.
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%     * Sets the color limits, CAXIS, and color map, COLORMAP, before using
+%       this function. Use them after this function to get the
+%       modifications.
+%
+%   EXAMPLE:
+%     figure, surf(peaks+2), colormap(jet(14)), colorbar
+%      title('Normal colorbar.m')
+%     figure, surf(peaks+2),                    cbfit(2,0)
+%      title('Fitted 2 color bands and centered on zero')
+%     figure, surf(peaks+2), caxis([0 10]),     cbfit(4,8)
+%      title('Fitted 4 color bands and centered at 8')
+%
+%   SEE ALSO:
+%     COLORBAR
+%     and
+%     CBFREEZE, CMFIT by Carlos Vargas
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cbfit.m
+%   VERSION: 2.1 (Sep 30, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released as COLORBARFIT.M. (Mar 11, 2008)
+%   1.1      Fixed bug when CAXIS is used before this function. (Jul 01,
+%            2008)
+%   1.2      Works properly when CAXIS is used before this function. Bug
+%            fixed on subfunction and rewritten code. (Aug 21, 2008)
+%   2.0      Rewritten code. Instead of the COLORBAND subfunction, now uses
+%            the CMFIT function. Changed its name from COLORBARFIT to
+%            CBFIT. (Jun 08, 2008)
+%   2.1      Fixed bug and help with CBH input. (Sep 30, 2009)
+
+%   DISCLAIMER:
+%   cbfit.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2008,2009 Carlos Adrian Vargas Aguilera
+
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Sets defaults:
+NBANDS = 5;
+CENTER = [];
+MODE   = 'auto';            
+CBH    = [];
+pax    = [];        % Peer axes
+
+% Checks if first argument is a handle: Fixed bug Sep 2009
+if (~isempty(varargin) && (length(varargin{1})==1) && ...
+  ishandle(varargin{1})) && strcmp(get(varargin{1},'Type'),'axes')
+ if strcmp(get(varargin{1},'Tag'),'Colorbar')
+  CBH = varargin{1};
+ else
+  warning('CVARGAS:cbfit:incorrectHInput',...
+   'Unrecognized first input handle.')
+ end
+ varargin(1) = [];
+end
+ 
+% Reads NBANDS and CENTER:
+if ~isempty(varargin) && isnumeric(varargin{1})
+ if ~isempty(varargin{1})
+  NBANDS = varargin{1};
+ end
+ if (length(varargin)>1) && isnumeric(varargin{2})
+  CENTER = varargin{2};
+  varargin(2) = [];
+ end
+ varargin(1) = [];
+end
+
+% Reads MODE:
+if (~isempty(varargin) && (rem(length(varargin),2)==1))
+ if (~isempty(varargin{1}) && ischar(varargin{1}))
+  switch lower(varargin{1})
+   case 'auto'  , MODE = 'auto';
+   case 'manual', MODE = 'manual';
+   otherwise % 'off', 'hide' and 'delete'
+    warning('CVARGAS:cbfit:incorrectStringInput',...
+     'No pair string input must be one of ''auto'' or ''manual''.')
+  end
+ end
+ varargin(1) = [];
+end
+
+% Reads peer axes:
+for k = 1:2:length(varargin)
+ if ~isempty(varargin{k})
+  switch lower(varargin{k})
+   case 'peer', pax = varargin{k+1}; break
+  end
+ end
+end
+if isempty(pax)
+ pax = gca;
+end
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+
+% Generates a preliminary colorbar:
+if isempty(CBH)
+ CBH = colorbar(varargin{:});
+end
+
+% Gets limits and orientation:
+s     = 'Y';
+ticks = get(CBH,[s 'Tick']);
+if isempty(ticks)             
+ s     = 'X';
+ ticks = get(CBH,[s 'Tick']);
+end
+zlim = get(CBH,[s 'Lim']);
+
+% Gets width and ref:
+if ~isempty(NBANDS)
+
+ NL = length(NBANDS);
+ 
+ if (NL==1)
+  
+  % Force positive integers:
+  NBANDS = round(abs(NBANDS));
+ 
+  % Ignores ticks outside the limits:
+  if zlim(1)>ticks(1)
+   ticks(1) = [];
+  end
+  if zlim(2)<ticks(end)
+   ticks(end) = [];
+  end
+
+  % Get the ticks step and colorband:
+  tstep = ticks(2)-ticks(1);
+  WIDTH = tstep/NBANDS;
+  
+  % Sets color limits
+  if strcmp(get(pax,'CLimMode'),'auto')
+   caxis(zlim);
+  end
+  
+  % Forces old colorbar ticks: 
+  set(CBH,[s 'Lim'],zlim,[s 'Tick'],ticks)
+  
+  % Levels:
+  if strcmp(MODE,'manual')
+   LBANDS = [fliplr(ticks(1)-WIDTH:-WIDTH:zlim(1)) ticks(1):WIDTH:zlim(2)];
+  end
+  
+ else
+  
+  % Nonlinear colorbar:
+  ticks = NBANDS;
+  WIDTH = ticks;
+  
+  % Scales to CLIM:
+  if strcmp(get(pax,'CLimMode'),'manual')
+   ticks = ticks-ticks(1);
+   ticks = ticks/ticks(end);
+   ticks = ticks*diff(zlim) + zlim(1);
+  end
+  zlim = [ticks(1) ticks(end)];
+  caxis(pax,zlim)
+  CBIH = get(CBH,'Children');
+  
+  % Change ticks:
+  set(CBIH,[s 'Data'],ticks)
+  
+  % Sets limits:
+  set(CBH,[s 'Lim'],zlim)
+  
+  % Levels:
+  if strcmp(MODE,'manual')
+   LBANDS = NBANDS;
+  end
+  
+ end
+ 
+ % Get reference mark
+ if ~isempty(CENTER)
+  REF    = CENTER;
+  CENTER = true;
+ else
+  REF    = ticks(1);
+  CENTER = false;
+ end
+  
+end
+
+% Fits the colormap and limits:
+cmfit(get(get(pax,'Parent'),'Colormap'),zlim,WIDTH,REF,CENTER)
+
+% Sets ticks:
+if strcmp(MODE,'manual')
+ set(CBH,[s 'Tick'],LBANDS)
+end
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+
+if ~nargout
+ clear CBH
+end
+
+
+% [EOF]   cbfit.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbfreeze.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbfreeze.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbfreeze.m	(revision 12004)
@@ -0,0 +1,382 @@
+function CBH = cbfreeze(varargin)
+%CBFREEZE   Freezes the colormap of a colorbar.
+%
+%   SYNTAX:
+%           cbfreeze
+%           cbfreeze('off')
+%           cbfreeze(H,...)
+%     CBH = cbfreeze(...);
+%
+%   INPUT:
+%     H     - Handles of colorbars to be freezed, or from figures to search
+%             for them or from peer axes (see COLORBAR).
+%             DEFAULT: gcf (freezes all colorbars from the current figure)
+%     'off' - Unfreezes the colorbars, other options are:
+%               'on'    Freezes
+%               'un'    same as 'off'
+%               'del'   Deletes the colormap(s).
+%             DEFAULT: 'on' (of course)
+%
+%   OUTPUT (all optional):
+%     CBH - Color bar handle(s).
+%
+%   DESCRIPTION:
+%     MATLAB works with a unique COLORMAP by figure which is a big
+%     limitation. Function FREEZECOLORS by John Iversen allows to use
+%     different COLORMAPs in a single figure, but it fails freezing the
+%     COLORBAR. This program handles this problem.
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%     * If no colorbar is found, one is created.
+%     * The new frozen colorbar is an axes object and does not behaves
+%       as normally colorbars when resizing the peer axes. Although, some
+%       time the normal behavior is not that good.
+%     * Besides, it does not have the 'Location' property anymore.
+%     * But, it does acts normally: no ZOOM, no PAN, no ROTATE3D and no
+%       mouse selectable.
+%     * No need to say that CAXIS and COLORMAP must be defined before using
+%       this function. Besides, the colorbar location. Anyway, 'off' or
+%       'del' may help.
+%     * The 'del' functionality may be used whether or not the colorbar(s)
+%       is(are) froozen. The peer axes are resized back. Try: 
+%        >> colorbar, cbfreeze del
+%
+%   EXAMPLE:
+%     surf(peaks(30))
+%     colormap jet
+%     cbfreeze
+%     colormap gray
+%     title('What...?')
+%
+%   SEE ALSO:
+%     COLORMAP, COLORBAR, CAXIS
+%     and
+%     FREEZECOLORS by John Iversen
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cbfreeze.m
+%   VERSION: 1.1 (Sep 02, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released. (Jun 08, 2009)
+%   1.1      Fixed BUG with image handle on MATLAB R2009a. Thanks to Sergio
+%            Muniz. (Sep 02, 2009)
+
+%   DISCLAIMER:
+%   cbfreeze.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2009 Carlos Adrian Vargas Aguilera
+
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Parameters:
+cbappname = 'Frozen';         % Colorbar application data with fields:
+                              % 'Location' from colorbar
+                              % 'Position' from peer axes befor colorbar
+                              % 'pax'      handle from peer axes.
+axappname = 'FrozenColorbar'; % Peer axes application data with frozen
+                              % colorbar handle.
+ 
+% Set defaults:
+S = 'on';                   Sopt = {'on','un','off','del'};
+H = get(0,'CurrentFig');
+
+% Check inputs:
+if nargin==2 && (~isempty(varargin{1}) && all(ishandle(varargin{1})) && ...
+  isempty(varargin{2}))
+ 
+ % Check for CallBacks functionalities:
+ % ------------------------------------
+ 
+ varargin{1} = double(varargin{1});
+ 
+ if strcmp(get(varargin{1},'BeingDelete'),'on') 
+  % Working as DeletFcn:
+
+  if (ishandle(get(varargin{1},'Parent')) && ...
+      ~strcmpi(get(get(varargin{1},'Parent'),'BeingDeleted'),'on'))
+    % The handle input is being deleted so do the colorbar:
+    S = 'del'; 
+    
+   if ~isempty(getappdata(varargin{1},cbappname))
+    % The frozen colorbar is being deleted:
+    H = varargin{1};
+   else
+    % The peer axes is being deleted:
+    H = ancestor(varargin{1},{'figure','uipanel'}); 
+   end
+   
+  else
+   % The figure is getting close:
+   return
+  end
+  
+ elseif (gca==varargin{1} && ...
+                     gcf==ancestor(varargin{1},{'figure','uipanel'}))
+  % Working as ButtonDownFcn:
+  
+  cbfreezedata = getappdata(varargin{1},cbappname);
+  if ~isempty(cbfreezedata) 
+   if ishandle(cbfreezedata.ax)
+    % Turns the peer axes as current (ignores mouse click-over):
+    set(gcf,'CurrentAxes',cbfreezedata.ax);
+    return
+   end
+  else
+   % Clears application data:
+   rmappdata(varargin{1},cbappname) 
+  end
+  H = varargin{1};
+ end
+ 
+else
+ 
+ % Checks for normal calling:
+ % --------------------------
+ 
+ % Looks for H:
+ if nargin && ~isempty(varargin{1}) && all(ishandle(varargin{1}))
+  H = varargin{1};
+  varargin(1) = [];
+ end
+
+ % Looks for S:
+ if ~isempty(varargin) && (isempty(varargin{1}) || ischar(varargin{1}))
+  S = varargin{1};
+ end
+end
+
+% Checks S:
+if isempty(S)
+ S = 'on';
+end
+S = lower(S);
+iS = strmatch(S,Sopt);
+if isempty(iS)
+ error('CVARGAS:cbfreeze:IncorrectStringOption',...
+  ['Unrecognized ''' S ''' argument.' ])
+else
+ S = Sopt{iS};
+end
+
+% Looks for CBH:
+CBH = cbhandle(H);
+
+if ~strcmp(S,'del') && isempty(CBH)
+ % Creates a colorbar and peer axes:
+ pax = gca;
+ CBH = colorbar('peer',pax);
+else
+ pax = [];
+end
+
+
+% -------------------------------------------------------------------------
+% MAIN 
+% -------------------------------------------------------------------------
+% Note: only CBH and S are necesary, but I use pax to avoid the use of the
+%       "hidden" 'Axes' COLORBAR's property. Why... ¿?
+
+% Saves current position:
+fig = get(  0,'CurrentFigure');
+cax = get(fig,'CurrentAxes');
+
+% Works on every colorbar:
+for icb = 1:length(CBH)
+ 
+ % Colorbar axes handle:
+ h  = double(CBH(icb));
+ 
+ % This application data:
+ cbfreezedata = getappdata(h,cbappname);
+ 
+ % Gets peer axes:
+ if ~isempty(cbfreezedata)
+  pax = cbfreezedata.pax;
+  if ~ishandle(pax) % just in case
+   rmappdata(h,cbappname)
+   continue
+  end
+ elseif isempty(pax) % not generated
+  try
+   pax = double(get(h,'Axes'));  % NEW feature in COLORBARs
+  catch
+   continue
+  end
+ end
+ 
+ % Choose functionality:
+ switch S
+  
+  case 'del'
+   % Deletes:
+   if ~isempty(cbfreezedata)
+    % Returns axes to previous size:
+    oldunits = get(pax,'Units');
+    set(pax,'Units','Normalized');
+    set(pax,'Position',cbfreezedata.Position)
+    set(pax,'Units',oldunits)
+    set(pax,'DeleteFcn','')
+    if isappdata(pax,axappname)
+     rmappdata(pax,axappname)
+    end
+   end
+   if strcmp(get(h,'BeingDelete'),'off') 
+    delete(h)
+   end
+   
+  case {'un','off'}
+   % Unfrozes:
+   if ~isempty(cbfreezedata)
+    delete(h);
+    set(pax,'DeleteFcn','')
+    if isappdata(pax,axappname)
+     rmappdata(pax,axappname)
+    end
+    oldunits = get(pax,'Units');
+    set(pax,'Units','Normalized')
+    set(pax,'Position',cbfreezedata.Position)
+    set(pax,'Units',oldunits)
+    CBH(icb) = colorbar(...
+     'peer'    ,pax,...
+     'Location',cbfreezedata.Location);
+   end
+ 
+  otherwise % 'on'
+   % Freezes:
+ 
+   % Gets colorbar axes properties:
+   cb_prop  = get(h);
+   
+   % Gets colorbar image handle. Fixed BUG, Sep 2009
+   hi = findobj(h,'Type','image');
+    
+   % Gets image data and transform it in a RGB:
+   CData = get(hi,'CData'); 
+   if size(CData,3)~=1
+    % It's already frozen:
+    continue
+   end
+  
+   % Gets image tag:
+   Tag = get(hi,'Tag');
+  
+   % Deletes previous colorbar preserving peer axes position:
+   oldunits = get(pax,'Units');
+              set(pax,'Units','Normalized')
+   Position = get(pax,'Position');
+   delete(h)
+   cbfreezedata.Position = get(pax,'Position');
+              set(pax,'Position',Position)
+              set(pax,'Units',oldunits)
+  
+   % Generates new colorbar axes:
+   % NOTE: this is needed because each time COLORMAP or CAXIS is used,
+   %       MATLAB generates a new COLORBAR! This eliminates that behaviour
+   %       and is the central point on this function.
+   h = axes(...
+    'Parent'  ,cb_prop.Parent,...
+    'Units'   ,'Normalized',...
+    'Position',cb_prop.Position...
+   );
+  
+   % Save location for future call:
+   cbfreezedata.Location = cb_prop.Location;
+  
+   % Move ticks because IMAGE draws centered pixels:
+   XLim = cb_prop.XLim;
+   YLim = cb_prop.YLim;
+   if     isempty(cb_prop.XTick)
+    % Vertical:
+    X = XLim(1) + diff(XLim)/2;
+    Y = YLim    + diff(YLim)/(2*length(CData))*[+1 -1];
+   else % isempty(YTick)
+    % Horizontal:
+    Y = YLim(1) + diff(YLim)/2;
+    X = XLim    + diff(XLim)/(2*length(CData))*[+1 -1];
+   end
+  
+   % Draws a new RGB image:
+   image(X,Y,ind2rgb(CData,colormap),...
+    'Parent'            ,h,...
+    'HitTest'           ,'off',...
+    'Interruptible'     ,'off',...
+    'SelectionHighlight','off',...
+    'Tag'               ,Tag...
+   )  
+
+   % Removes all   '...Mode'   properties:
+   cb_fields = fieldnames(cb_prop);
+   indmode   = strfind(cb_fields,'Mode');
+   for k=1:length(indmode)
+    if ~isempty(indmode{k})
+     cb_prop = rmfield(cb_prop,cb_fields{k});
+    end
+   end
+   
+   % Removes special COLORBARs properties:
+   cb_prop = rmfield(cb_prop,{...
+    'CurrentPoint','TightInset','BeingDeleted','Type',...       % read-only
+    'Title','XLabel','YLabel','ZLabel','Parent','Children',...  % handles
+    'UIContextMenu','Location',...                              % colorbars
+    'ButtonDownFcn','DeleteFcn',...                             % callbacks
+    'CameraPosition','CameraTarget','CameraUpVector','CameraViewAngle',...
+    'PlotBoxAspectRatio','DataAspectRatio','Position',... 
+    'XLim','YLim','ZLim'});
+   
+   % And now, set new axes properties almost equal to the unfrozen
+   % colorbar:
+   set(h,cb_prop)
+
+   % CallBack features:
+   set(h,...
+    'ActivePositionProperty','position',...
+    'ButtonDownFcn'         ,@cbfreeze,...  % mhh...
+    'DeleteFcn'             ,@cbfreeze)     % again
+   set(pax,'DeleteFcn'      ,@cbfreeze)     % and again!  
+  
+   % Do not zoom or pan or rotate:
+   setAllowAxesZoom  (zoom    ,h,false)
+   setAllowAxesPan   (pan     ,h,false)
+   setAllowAxesRotate(rotate3d,h,false)
+   
+   % Updates data:
+   CBH(icb) = h;   
+
+   % Saves data for future undo:
+   cbfreezedata.pax       = pax;
+   setappdata(  h,cbappname,cbfreezedata);
+   setappdata(pax,axappname,h);
+   
+ end % switch functionality   
+
+end  % MAIN loop
+
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+
+% Output?:
+if ~nargout
+ clear CBH
+else
+ CBH(~ishandle(CBH)) = [];
+end
+
+% Returns current axes:
+if ishandle(cax) 
+ set(fig,'CurrentAxes',cax)
+end
+
+
+% [EOF]   cbfreeze.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbhandle.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbhandle.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbhandle.m	(revision 12004)
@@ -0,0 +1,93 @@
+function CBH = cbhandle(varargin)
+%CBHANDLE   Handle of current colorbar axes.
+%
+%   SYNTAX:
+%     CBH = cbhandle;
+%     CBH = cbhandle(H);
+%
+%   INPUT:
+%     H - Handles axes, figures or uipanels to look for colorbars.
+%         DEFAULT: gca (current axes)
+%
+%   OUTPUT:
+%     CBH - Color bar handle(s).
+%
+%   DESCRIPTION:
+%     By default, color bars are hidden objects. This function searches for
+%     them by its 'axes' type and 'Colorbar' tag.
+%    
+%   SEE ALSO:
+%     COLORBAR
+%     and
+%     CBUNITS, CBLABEL, CBFREEZE by Carlos Vargas
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cbhandle.m
+%   VERSION: 1.1 (Aug 20, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released. (Jun 08, 2009)
+%   1.1      Fixed bug with colorbar handle input. (Aug 20, 2009)
+
+%   DISCLAIMER:
+%   cbhandle.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2009 Carlos Adrian Vargas Aguilera
+
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Parameters:
+axappname = 'FrozenColorbar'; % Peer axes application data with frozen
+                              % colorbar handle.
+
+% Sets default:
+H = get(get(0,'CurrentFigure'),'CurrentAxes');
+
+if nargin && ~isempty(varargin{1}) && all(ishandle(varargin{1}))
+ H = varargin{1};
+end
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+
+% Looks for CBH:
+CBH = [];
+% set(0,'ShowHiddenHandles','on')
+for k = 1:length(H)
+ switch get(H(k),'type')
+  case {'figure','uipanel'}
+   % Parents axes?:
+   CBH = [CBH; ...
+    findobj(H(k),'-depth',1,'Tag','Colorbar','-and','Type','axes')];
+  case 'axes'
+   % Peer axes?:
+   hin  = double(getappdata(H(k),'LegendColorbarInnerList'));
+   hout = double(getappdata(H(k),'LegendColorbarOuterList'));
+   if     (~isempty(hin)  && ishandle(hin))
+    CBH = [CBH; hin];
+   elseif (~isempty(hout) && ishandle(hout))
+    CBH = [CBH; hout];
+   elseif isappdata(H(k),axappname)
+    % Peer from frozen axes?:
+    CBH = [CBH; double(getappdata(H(k),axappname))];
+   elseif strcmp(get(H(k),'Tag'),'Colorbar') % Fixed BUG Aug 2009
+    % Colorbar axes?
+    CBH = [CBH; H(k)];
+   end
+  otherwise
+   % continue
+ end
+end
+% set(0,'ShowHiddenHandles','off')
+
+
+% [EOF]   cbhandle.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cblabel.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cblabel.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cblabel.m	(revision 12004)
@@ -0,0 +1,160 @@
+function CBLH = cblabel(varargin)
+%CBLABEL   Adds a label to the colorbar.
+%
+%   SYNTAX:
+%            cblabel(LABEL)
+%            cblabel(LABEL,..,TP,TV);
+%            cblabel(H,...)
+%     CBLH = cblabel(...);
+%
+%   INPUT:
+%     LABEL - String (or cell of strings) specifying the colorbar label.
+%     TP,TV - Optional text property/property value arguments (in pairs).
+%             DEFAULT:  (none)
+%     H     - Color bar or peer axes (see COLORBAR) or figure handle(s) to
+%             search for a single color bar handle.
+%             DEFAULT: gca (current axes color bar)
+%
+%   OUTPUT (all optional):
+%     CBLH  - Returns the colorbar label handle(s).
+%           - Labels modified on the colorbar of the current figure or
+%             the one(s) specified by CBH.
+%
+%   DESCRIPTION:
+%     This function sets the label of the colorbar(s) in the current
+%     figure.
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%
+%   EXAMPLE:
+%     figure, colorbar, cblabel(['           T, °C'],'Rotation',0)
+%     figure
+%      subplot(211), h1 = colorbar;
+%      subplot(212), h2 = colorbar('Location','south');
+%      cblabel([h1 h2],{'$1-\alpha$','$\beta^3$'},'Interpreter','latex')   
+%
+%   SEE ALSO: 
+%     COLORBAR
+%     and 
+%     CBUNITS, CBHANDLE, CBFREEZE by Carlos Vargas
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cblabel.m
+%   VERSION: 2.0 (Jun 08, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released. (Aug 21, 2008)
+%   2.0      Minor changes. Added CBHANDLE dependency. (Jun 08, 2009)
+
+%   DISCLAIMER:
+%   cblabel.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2008,2009 Carlos Adrian Vargas Aguilera
+
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Parameters:
+cbappname = 'Frozen';         % Colorbar application data with fields:
+                              % 'Location' from colorbar
+                              % 'Position' from peer axes befor colorbar
+                              % 'pax'      handle from peer axes.
+
+% Sets defaults:
+H     = get(get(0,'CurrentFigure'),'CurrentAxes');
+LABEL = '';
+TOPT  = {};
+CBLH  = [];
+
+% Number of inputs:
+if nargin<1
+ error('CVARGAS:cblabel:incorrectNumberOfInputs',...
+        'At least one input is required.')
+end
+
+% Looks for H:
+if nargin && ~isempty(varargin{1}) && all(ishandle(varargin{1}))
+ H = varargin{1};
+ varargin(1) = [];
+end
+
+% Looks for CBH:
+CBH = cbhandle(H);
+if isempty(CBH), if ~nargout, clear CBLH, end, return, end
+
+% Looks for LABEL:
+if ~isempty(varargin) && (ischar(varargin{1}) || iscellstr(varargin{1}))  
+ LABEL = varargin{1};
+ varargin(1) = [];
+end
+
+% Forces cell of strings:
+if ischar(LABEL)
+ % Same label to all the color bars:
+ LABEL = repmat({LABEL},length(CBH),1);
+elseif iscellstr(LABEL) && (length(LABEL)==length(CBH))
+  % Continue...
+else
+ error('CVARGAS:cblabel:incorrectInputLabel',...
+        ['LABEL must be a string or cell of strings of equal size as ' ...
+         'the color bar handles: ' int2str(length(CBH)) '.'])
+end
+
+% OPTIONAL arguments:
+if ~isempty(varargin)
+ TOPT = varargin;
+end
+if length(TOPT)==1
+ TOPT = repmat({TOPT},size(CBH));
+end
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+% NOTE: Only CBH, LABEL and TOPT are needed.
+
+% Applies to each colorbar:
+CBLH = repmat(NaN,size(CBH));
+for icb = 1:length(CBH)
+ 
+ % Searches for label location:
+ try 
+  % Normal colorbar:
+  location = get(CBH(icb),'Location');
+ catch
+  % Frozen colorbar:
+  location = getappdata(CBH(icb),cbappname);
+  location = location.Location;
+ end
+ switch location(1)
+  case 'E', as  = 'Y';
+  case 'W', as  = 'Y';
+  case 'N', as  = 'X';
+  case 'S', as  = 'X';
+ end
+ % Gets label handle:
+ CBLH(icb) = get(CBH(icb),[as 'Label']);
+ % Updates label:
+ set(CBLH(icb),'String',LABEL{icb},TOPT{:});
+ 
+end
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+
+% Sets output:
+if ~nargout
+ clear CBLH
+end
+
+
+% [EOF]   cblabel.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbunits.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbunits.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cbunits.m	(revision 12004)
@@ -0,0 +1,235 @@
+function CBH = cbunits(varargin)
+%CBUNITS   Adds units to the colorbar ticklabels.
+%
+%   SYNTAX:
+%           cbunits(UNITS)
+%           cbunits(UNITS,SPACE)
+%           cbunits -clear
+%           cbunits(H,...)
+%     CBH = cbunits(...);
+%
+%   INPUT:
+%     UNITS - String (or cell of strings) with the colorbar(s) units or
+%             '-clear' to eliminate any unit. 
+%     SPACE - Logical indicating whether an space should be put between
+%             quantity and units. Useful when using '3°C', for example.
+%             DEFAULT: true (use an space)
+%     H     - Colorbar, or peer axes (see COLORBAR) or figure handle(s) to
+%             search for color bars. 
+%             DEFAULT: gca (current axes color bar)
+%
+%   OUTPUT (all optional):
+%     CBH   - Returns the colorbar handle(s).
+%             DEFAULT: Not returned if not required.
+%           - Ticklabels modified on the colorbar of the current axes or
+%             the one(s) specified by CBH.
+%
+%   DESCRIPTION:
+%     This function adds units to the current colorbar, by writting them
+%     after the biggest ticklabel.
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%     * Scientific notation is included in the units (if any).
+%     * When more than one colorbar handle is given or founded and a single
+%       UNITS string is given, it is applied to all of them.
+%     * Use a cell of strings for UNITS when more than one colorbar handles
+%       are given in order to give to each one their proper units. This
+%       also works when the handlesare founded but the units order is
+%       confusing and not recommended.
+%     * Once applied, CAXIS shouldn't be used.
+%     * To undo sets the ticklabelmode to 'auto'.
+%
+%   EXAMPLE:
+%     % Easy to use:
+%       figure, caxis([1e2 1e8]), colorbar, cbunits('°F',false)
+%     % Vectorized:
+%       figure
+%       subplot(211), h1 = colorbar;
+%       subplot(212), h2 = colorbar;
+%       cbunits([h1;h2],{'°C','dollars'},[false true])
+%     % Handle input:
+%       figure
+%       subplot(211), colorbar;
+%       subplot(212), colorbar('Location','North');
+%       caxis([1e2 1e8])
+%       cbunits(gcf,'m/s')
+%
+%   SEE ALSO: 
+%     COLORBAR
+%     and
+%     CBLABEL, CBHANDLE, CBFREEZE by Carlos Vargas
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cbunits.m
+%   VERSION: 3.0 (Sep 30, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released. (Aug 21, 2008)
+%   2.0      Minor changes. Added 'clear' option and CBHANDLE dependency.
+%            (Jun 08, 2009)
+%   3.0      Fixed bug when inserting units on lower tick and ticklabel
+%            justification. Added SPACE option. (Sep 30, 2009)
+
+%   DISCLAIMER:
+%   cbunits.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2008,2009 Carlos Adrian Vargas Aguilera
+
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Sets defaults:
+H     = get(get(0,'CurrentFigure'),'CurrentAxes');
+UNITS = '';
+SPACE = true;
+
+% Checks inputs/outputs number:
+if     nargin<1
+ error('CVARGAS:cbunits:notEnoughInputs',...
+  'At least 1 input is required.')
+elseif nargin>3
+ error('CVARGAS:cbunits:tooManyInputs',...
+  'At most 3 inputs are allowed.')
+elseif nargout>1
+ error('CVARGAS:cbunits:tooManyOutputs',...
+  'At most 1 output is allowed.')
+end
+
+% Looks for H:
+if nargin && ~isempty(varargin{1}) && all(ishandle(varargin{1}))
+ H = varargin{1};
+ varargin(1) = [];
+end
+
+% Looks for CBH:
+CBH = cbhandle(H);
+if isempty(CBH), if ~nargout, clear CBH, end, return, end
+
+% Looks for UNITS:
+if ~isempty(varargin) && ~isempty(varargin{1}) && ...
+  (ischar(varargin{1}) || iscellstr(varargin{1}))  
+ UNITS = varargin{1};
+ varargin(1) = [];
+end
+if isempty(UNITS), if ~nargout, clear CBH, end, return, end
+
+% Forces cell of strings:
+if ischar(UNITS)
+ if numel(UNITS)~=size(UNITS,2)
+  error('CVARGAS:cbunits:IncorrectUnitsString',...
+        'UNITS string must be a row vector.')
+ end
+ % Same units to all the color bars:
+ UNITS = repmat({UNITS},length(CBH),1);
+elseif iscellstr(UNITS) && (length(UNITS)==length(CBH))
+  % Continue...
+else
+ error('CVARGAS:cbunits:IncorrectInputUnits',...
+        ['UNITS must be a string or cell of strings of equal size as ' ...
+         'the color bar handles: ' int2str(length(CBH)) '.'])
+end
+
+% Looks for SPACE:
+Nunits = length(UNITS);
+if ~isempty(varargin) && ~isempty(varargin{1}) && ...
+  ((length(varargin{1})==1) || (length(varargin{1})==Nunits))  
+ SPACE = varargin{1};
+end
+SPACE = logical(SPACE);
+
+% Forces equal size of SPACE and UNITS.
+if (length(SPACE)==1) && (Nunits~=1)
+ SPACE = repmat(SPACE,Nunits,1);
+end
+
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+% Note: Only CBH and UNITS are required.
+
+% Applies to each colorbar:
+for icb = 1:length(CBH)
+ 
+ units  = UNITS{icb};
+ space  = SPACE(icb);
+ cbh    = CBH(icb);
+ append = [];
+ 
+ % Gets tick labels:
+ as  = 'Y';
+ at  = get(cbh,[as 'Tick']);
+ if isempty(at)
+  as = 'X';
+  at = get(cbh,[as 'Tick']);
+ end
+ 
+ % Checks for elimitation:
+ if strcmpi(units,'-clear')
+  set(cbh,[as 'TickLabelMode'],'auto')
+  continue
+ end
+
+             set(cbh,[as 'TickLabelMode'],'manual');
+ old_ticks = get(cbh,[as 'TickLabel']);
+
+ % Adds scientific notation:
+ if strcmp(get(cbh,[as 'Scale']),'linear')
+  ind = 1;
+  if at(ind)==0
+   ind = 2;
+  end
+  o  = log10(abs(at(ind)/str2double(old_ticks(ind,:))));
+  sg = '';
+  if at(ind)<0, sg = '-'; end
+  if o>0
+   append = [' e' sg int2str(o) ''];
+  end
+ end
+ 
+ % Updates ticklabels:
+ Nu = length(units);
+ Na = length(append);
+ Nt = size(old_ticks,1);
+ loc = Nt; % Fixed bug, Sep 2009
+ if (strcmp(as,'Y') && ((abs(at(1))>abs(at(Nt))) && ...
+    (length(fliplr(deblank(fliplr(old_ticks( 1,:))))) > ...
+     length(fliplr(deblank(fliplr(old_ticks(Nt,:)))))))) || ...
+     (strcmp(as,'X') && strcmp(get(cbh,[as 'Dir']),'reverse'))
+  loc = 1; 
+ end
+ new_ticks  = [old_ticks repmat(' ',Nt,Nu+(Na-(Na>0))+space)];
+ new_ticks(loc,end-Nu-Na-space+1:end) = [append repmat(' ',1,space) units];
+ if strcmp(as,'Y') % Fixed bug, Sep 2009
+  if strcmp(get(cbh,[as 'AxisLocation']),'right')
+   new_ticks = strjust(new_ticks,'left');
+  else
+   new_ticks = strjust(new_ticks,'right');
+  end
+ else
+  new_ticks = strjust(new_ticks,'center');
+ end
+ set(cbh,[as 'TickLabel'],new_ticks)
+ 
+end % MAIN LOOP
+
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+
+% Sets output:
+if ~nargout
+ clear CBH
+end
+
+
+% [EOF]   cbunits.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmapping.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmapping.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmapping.m	(revision 12004)
@@ -0,0 +1,515 @@
+function RGB = cmapping(varargin)
+%CMAPPING   Colormap linear mapping/interpolation.
+%
+%   SYNTAX:
+%           cmapping
+%           cmapping(U)
+%           cmapping(U,CMAP)
+%           cmapping(U,CMAP,...,CNAN)
+%           cmapping(U,CMAP,...,TYPE)
+%           cmapping(U,CMAP,...,MODE)
+%           cmapping(U,CMAP,...,MAPS)
+%           cmapping(U,CMAP,...,CLIM)
+%           cmapping(AX,...)
+%     RGB = cmapping(...);
+%
+%   INPUT:
+%     U     - May be one of the following options:
+%              a) An scalar specifying the output M number of colors.
+%              b) A vector of length M specifying the values at which
+%                 the function CMAP(IMAP) will be mapped.
+%              c) A matrix of size M-by-N specifying intensities to be
+%                 mapped to an RGB (3-dim) image. May have NaNs elements. 
+%             DEFAULT: Current colormap length.
+%     CMAP  - A COLORMAP defined by its name or handle-function or RGB
+%             matrix (with 3 columns) or by a combination of colors chars
+%             specifiers ('kbcw', for example) to be mapped. See NOTE below
+%             for more options.
+%             DEFAULT: Current colormap
+%     CNAN  - Color for NaNs values on U, specified by a 1-by-3 RGB color
+%             or a char specifier.
+%             DEFAULT: Current axes background (white color: [1 1 1])
+%     TYPE  - String specifying the result type. One of:
+%               'colormap'  Forces a RGB colormap matrix result (3 columns)
+%               'image'     Forces a RGB image result (3 dimensions)
+%             DEFAULT: 'image' if U is a matrix, otherwise is 'colormap'
+%     MODE  - Defines the mapping way. One of:
+%               'discrete'     For discrete colors
+%               'continuous'   For continuous color (interpolates)
+%             DEFAULT: 'continuous' (interpolates between colors)
+%     MAPS  - Specifies the mapping type. One of (see NOTES below):
+%               'scaled'   Scales mapping, also by using CLIM (as IMAGESC).
+%               'direct'   Do not scales the mapping (as IMAGE).
+%             DEFAULT: 'scaled' (uses CLIM)
+%     CLIM  - Two element vector that, if given, scales the mapping within
+%             this color limits. Ignored if 'direct' is specified.
+%             DEFAULT: [0 size(CMAP,1)] or [0 1].
+%     AX    - Uses specified axes or figure handle to set/get the colormap.
+%             If used, must be the first input.
+%             DEFAULT: gca
+%
+%   OUTPUT (all optional):
+%     RGB - If U is not a matrix, this is an M-by-3 colormap matrix with
+%           RGB colors in its rows, otherwise is an RGB image: M-by-N-by-3,
+%           with the color red intensities defined by RGB(:,:,1), the green
+%           ones by RGB(:,:,2) and the blue ones by RGB(:,:,3).
+%
+%   DESCRIPTION:
+%     This functions has various functionalities like: colormap generator,
+%     colormap expansion/contraction, color mapping/interpolation, matrix
+%     intensities convertion to RGB image, etc.
+%
+%     The basic idea is a linear mapping between the CMAP columns
+%     [red green blue] and the U data, ignoring its NaNs.
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%     * If a single value of U is required for interpolation, use [U U].
+%     * If the char '-' is used before the CMAP name, the colors will be
+%       flipped. The same occurs if U is a negative integer.
+%
+%   EXAMPLE:
+%     % Colormaps:
+%       figure, cmapping( 256,'krgby')            , colorbar
+%       figure, cmapping(-256,'krgby' ,'discrete'), colorbar
+%       figure, cmapping(log(1:100),[],'discrete'), colorbar
+%     % Images:
+%       u = random('chi2',2,20,30); u(15:16,7:9) = NaN;
+%       u = peaks(30);  u(15:16,7:9) = NaN;
+%       v = cmapping(u,jet(64),'discrete','k');
+%       w = cmapping(u,cmapping(log(0:63),'jet','discrete'),'discrete');
+%       figure, imagesc(u), cmapping(64,'jet'), colorbar
+%        title('u')
+%       figure, imagesc(v), cmapping(64,'jet'), colorbar
+%        title('u transformed to RGB (look the colored NaNs)')
+%       figure, imagesc(w) ,cmapping(64,'jet'), colorbar
+%        title('u mapped with log(colormap)')
+%       figure, imagesc(u), cmapping(log(0:63),'jet','discrete'), colorbar
+%        title('u with log(colormap)')
+%    
+%   SEE ALSO:
+%     COLORMAP, IND2RGB
+%     and
+%     CMJOIN by Carlos Vargas
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cmapping.m
+%   VERSION: 1.1 (Sep 02, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released. (Jun 08, 2009)
+%   1.0.1    Fixed little bug with 'm' magenta color. (Jun 30, 2009)
+%   1.1      Fixed BUG with empty CMAP, thanks to Andrea Rumazza. (Sep 02,
+%            2009) 
+
+%   DISCLAIMER:
+%   cmapping.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2009 Carlos Adrian Vargas Aguilera
+
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Sets defaults:
+AX     = {};                     % Calculated inside.
+U      = [];                     % Calculated inside.
+CMAP   = [];                     % Calculated inside.
+TYPE   = 'colormap';             % Changes to 'image' if U is a matrix.
+CLIM   = [];                     % To use in scaling
+CNAN   = [1 1 1];                % White 'w'
+MODE   = 'continuous';           % Scaling to CLIM
+MAPS   = 'scaled';               % Scaled mapping
+method = 'linear';               % Interpolation method
+mflip  = false;                  % Flip the colormap
+
+% Gets figure handle and axes handle (just in case the default colormap or
+% background color axes will be used.
+HF     = get(0,'CurrentFigure');
+HA     = [];
+if ~isempty(HF)
+ HA    = get(HF,'CurrentAxes');
+ if ~isempty(HA)
+  CNAN = get(HA,'Color');        % NaNs colors
+ end
+end
+
+% Checks inputs:
+if nargin>8
+ error('CVARGAS:cmapping:tooManyInputs', ...
+  'At most 8 inputs are allowed.')
+elseif nargout>1
+ error('CVARGAS:cmapping:tooManyOutputs', ...
+  'At most 1 output is allowed.')
+end
+
+% Checks AX:
+if (~isempty(varargin)) && ~isempty(varargin{1}) && ...
+  (numel(varargin{1})==1) && ishandle(varargin{1}) && ...
+  strcmp(get(varargin{1},'Type'),'axes')
+ % Gets AX and moves all other inputs to the left:
+ AX          = varargin(1);
+ HA          = AX{1};
+ CNAN        = get(HA,'Color');
+ varargin(1) = [];
+end
+
+% Checks U:
+Nargin = length(varargin);
+if ~isempty(varargin)
+ U           = varargin{1};
+ varargin(1) = [];
+end
+
+% Checks CMAP:
+if ~isempty(varargin)
+ CMAP        = varargin{1};
+ varargin(1) = []; 
+end
+
+% Checks input U, if not given uses as default colormap length:
+% Note: it is not converted to a vector in case CMAP is a function and IMAP
+%       was not given.
+if isempty(U)
+ % Gets default COLORMAP length:
+ if ~isempty(HA)
+  U = size(colormap(HA),1);
+ else
+  U = size(get(0,'DefaultFigureColormap'),1);
+ end
+elseif ndims(U)>2
+ error('CVARGAS:cmapping:incorrectXInput', ...
+  'U must be an scalar, a vector or a 2-dimensional matrix.')
+end
+
+% Checks input CMAP:
+if isempty(CMAP)
+ % CMAP empty, then uses default:
+ if ~isempty(HA)
+  CMAP = colormap(HA);
+  if isempty(CMAP) % Fixed BUG, Sep 2009.
+   CMAP = get(0,'DefaultFigureColormap');
+   if isempty(CMAP)
+    CMAP = jet(64);
+   end
+  end
+ else
+  CMAP = get(0,'DefaultFigureColormap');
+  if isempty(CMAP)
+   CMAP = jet(64);
+  end
+ end
+ Ncmap = size(CMAP,1);
+elseif isnumeric(CMAP)
+ % CMAP as an [R G B] colormap:
+ Ncmap = size(CMAP,1);
+ if (size(CMAP,2)~=3) || ...
+  ((min(CMAP(:))<0) || (max(CMAP(:))>1)) || any(~isfinite(CMAP(:)))
+  error('CVARGAS:cmapping:incorrectCmapInput', ...
+        'CMAP is an incorrect 3 columns RGB colors.')
+ end
+elseif ischar(CMAP)
+ % String CMAP
+ % Checks first character:
+ switch CMAP(1)
+  case '-'
+   mflip = ~mflip;
+   CMAP(1) = [];
+   if isempty(CMAP)
+    error('CVARGAS:cmapping:emptyCmapInput',...
+     'CMAP function is empty.')
+   end
+ end
+ if ~((exist(CMAP,'file')==2) || (exist(CMAP,'builtin')==5))
+  % CMAP as a combination of color char specifiers:
+  CMAP  = lower(CMAP);
+  iy    = (CMAP=='y');
+  im    = (CMAP=='m');
+  ic    = (CMAP=='c');
+  ir    = (CMAP=='r');
+  ig    = (CMAP=='g');
+  ib    = (CMAP=='b');
+  iw    = (CMAP=='w');
+  ik    = (CMAP=='k');
+  Ncmap = length(CMAP);
+  if (sum([iy im ic ir ig ib iw ik])~=Ncmap)
+   error('CVARGAS:cmapping:incorrectCmapStringInput', ...
+   ['String CMAP must be a valid colormap name or a combination of '...
+    '''ymcrgbwk''.'])
+  end
+  % Convertion to [R G B]:
+  CMAP       = zeros(Ncmap,3);
+  CMAP(iy,:) = repmat([1 1 0],sum(iy),1);
+  CMAP(im,:) = repmat([1 0 1],sum(im),1); % BUG fixed Jun 2009
+  CMAP(ic,:) = repmat([0 1 1],sum(ic),1);
+  CMAP(ir,:) = repmat([1 0 0],sum(ir),1);
+  CMAP(ig,:) = repmat([0 1 0],sum(ig),1);
+  CMAP(ib,:) = repmat([0 0 1],sum(ib),1);
+  CMAP(iw,:) = repmat([1 1 1],sum(iw),1);
+  CMAP(ik,:) = repmat([0 0 0],sum(ik),1);
+ else
+  % CMAP as a function name
+  % Changes function name to handle:
+  CMAP = str2func(CMAP);
+  Ncmap = []; % This indicates a CMAP function input
+ end
+elseif isa(CMAP,'function_handle')
+ Ncmap = []; % This indicates a CMAP function input
+else
+ % CMAP input unrecognized:
+ error('CVARGAS:cmapping:incorrectCmapInput', ...
+  'Not recognized CMAP input.') 
+end
+
+% Checks CMAP function handle:
+if isempty(Ncmap)
+ % Generates the COLORMAP from function:
+ try
+  temp = CMAP(2);
+  if ~all(size(temp)==[2 3]) || any(~isfinite(temp(:))), error(''), end
+  clear temp
+ catch
+  error('CVARGAS:cmapping:incorrectCmapFunction', ...
+   ['CMAP function ''' func2str(CMAP) ''' must result in RGB colors.'])
+ end
+end
+
+% Checks varargin:
+while ~isempty(varargin)
+ if     isempty(varargin{1})
+  % continue
+ elseif ischar(varargin{1})
+  % string input
+  switch lower(varargin{1})
+   % CNAN:
+   case 'y'         , CNAN = [1 1 0];
+   case 'm'         , CNAN = [1 0 0];
+   case 'c'         , CNAN = [0 1 1];
+   case 'r'         , CNAN = [1 0 0];
+   case 'g'         , CNAN = [0 1 0];
+   case 'b'         , CNAN = [0 0 1];
+   case 'w'         , CNAN = [1 1 1];
+   case 'k'         , CNAN = [0 0 0];
+   % MODE:
+   case 'discrete'  , MODE = 'discrete';
+   case 'continuous', MODE = 'continuous';
+   % TYPE:
+   case 'colormap'  , TYPE = 'colormap';
+   case 'image'     , TYPE = 'image';
+   % MAPS:
+   case 'direct'    , MAPS = 'direct';
+   case 'scaled'    , MAPS = 'scaled';
+   % Incorrect input:
+   otherwise
+    error('CVARGAS:cmapping:incorrectStringInput',...
+     ['Not recognized optional string input: ''' varargin{1} '''.'])
+  end
+ elseif isnumeric(varargin{1}) && all(isfinite(varargin{1}(:)))
+  % numeric input
+  nv = numel(varargin{1});
+  if (nv==3) && (size(varargin{1},1)==1)
+   % CNAN:
+   CNAN = varargin{1}(:)';
+   if (max(CNAN)>1) || (min(CNAN)<0)
+    error('CVARGAS:cmapping:incorrectCnanInput',...
+     'CNAN elements must be between 0 and 1.')
+   end
+  elseif (nv==2) && (size(varargin{1},1)==1)
+   % CLIM:
+   CLIM = sort(varargin{1},'ascend');
+   if (diff(CLIM)==0)
+    error('CVARGAS:cmapping:incorrectClimValues',...
+     'CLIM must have 2 distint elements.')
+   end
+  else
+   error('CVARGAS:cmapping:incorrectNumericInput',...
+   'Not recognized numeric input.')
+  end
+ else
+  error('CVARGAS:cmapping:incorrectInput',...
+   'Not recognized input.')
+ end
+ % Clears current optional input:
+ varargin(1) = [];
+end % while
+
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+
+% U size:
+[m,n] = size(U);
+mn    = m*n;
+
+% Checks TYPE:
+if ~any([m n]==1)
+ % Forces image TYPE if U is a matrix:
+ TYPE = 'image';
+elseif strcmp(TYPE,'colormap') && ~nargout && isempty(AX)
+ % Changes the colormap on the specified or current axes if no output
+ % argument:
+ AX = {gca};
+end
+
+% Forces positive integer if U is an scalar, and flips CMAP if is negative:
+if (mn==1)
+ U = round(U);
+ if (U==0)
+  if ~nargout && strcmp(TYPE,'colormap')
+   warning('CVARGAS:cmapping:incorrectUInput',...
+    'U was zero and produces no colormap')
+  else
+   RGB = [];
+  end
+  return
+ elseif (U<0)
+  mflip = ~mflip;
+  U     = abs(U);
+ end
+end
+
+% Gets CMAP from function handle:
+if isempty(Ncmap)
+ if (mn==1)
+  % From U:
+  Ncmap = U(1);
+ else
+  % From default colormap:
+  if ~isempty(HA)
+   Ncmap = size(colormap(HA),1);
+  else
+   Ncmap = size(get(0,'DefaultFigureColormap'),1);
+  end
+ end
+ CMAP = CMAP(Ncmap);
+end
+
+% Flips the colormap
+if mflip
+ CMAP = flipud(CMAP);
+end
+
+% Check CMAP when U is an scalar::
+if (mn==1) && (U==Ncmap)
+ % Finishes:
+ if ~nargout && strcmp(TYPE,'colormap')
+  if Nargin==0
+   RGB = colormap(AX{:},CMAP);
+  else
+   colormap(AX{:},CMAP)
+  end
+ else
+  RGB = CMAP;
+  if strcmp(TYPE,'image')
+   RGB = reshape(RGB,Ncmap,1,3);
+  end
+ end
+ return
+end
+
+% Sets scales:
+if strcmp(MAPS,'scaled')
+ % Scaled mapping:
+ if ~isempty(CLIM)
+  if (mn==1)
+   mn = U;
+   U = linspace(CLIM(1),CLIM(2),mn)';
+  else
+   % Continue  
+  end
+ else
+  CLIM = [0 1];
+  if (mn==1)
+   mn = U;
+   U = linspace(CLIM(1),CLIM(2),mn)';
+  else
+   % Scales U to [0 1]:
+   U = U-min(U(isfinite(U(:))));
+   U = U/max(U(isfinite(U(:))));
+   % Scales U to CLIM:
+   U = U*diff(CLIM)+CLIM(1);
+  end
+ end
+else
+ % Direct mapping:
+ CLIM = [1 Ncmap];
+end
+
+% Do not extrapolates:
+U(U<CLIM(1)) = CLIM(1);
+U(U>CLIM(2)) = CLIM(2);
+
+% Sets CMAP argument:
+umap = linspace(CLIM(1),CLIM(2),Ncmap)';
+
+% Sets U:
+if (mn==2) && (U(1)==U(2))
+ % U = [Uo Uo] implicates U = Uo:
+ U(2) = [];
+ mn   = 1;
+ m    = 1;
+ n    = 1;
+end
+
+% Sets discretization:
+if strcmp(MODE,'discrete')
+ umap2 = linspace(umap(1),umap(end),Ncmap+1)';
+ for k = 1:Ncmap
+  U((U>umap2(k)) & (U<=umap2(k+1))) = umap(k);
+ end
+ clear umap2
+end
+
+% Forces column vector:
+U = U(:);
+
+% Gets finite data:
+inan = ~isfinite(U);
+
+% Initializes:
+RGB  = repmat(reshape(CNAN,[1 1 3]),[mn 1 1]);
+
+% Interpolates:
+if (Ncmap>1) && (sum(~inan)>1)
+ [Utemp,a,b]    = unique(U(~inan));
+ RGBtemp = [...
+  interp1(umap,CMAP(:,1),Utemp,method) ...
+  interp1(umap,CMAP(:,2),Utemp,method) ...
+  interp1(umap,CMAP(:,3),Utemp,method) ...
+  ];
+ RGB(~inan,:) = RGBtemp(b,:);
+else
+ % single color:
+ RGB(~inan,1,:) = repmat(reshape(CMAP,[1 1 3]),[sum(~inan) 1 1]);
+end
+
+% Just in case
+RGB(RGB>1) = 1; 
+RGB(RGB<0) = 0;
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+
+% Output type:
+if strcmp(TYPE,'colormap')
+ RGB = reshape(RGB,mn,3);
+ if ~isempty(AX)
+  colormap(AX{:},RGB)
+  if ~nargout 
+   clear RGB
+  end
+ end
+else
+ RGB = reshape(RGB,[m n 3]);
+end
+
+
+% [EOF]   cmapping.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmfit.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmfit.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmfit.m	(revision 12004)
@@ -0,0 +1,360 @@
+function [CMAP,CLIM,WIDTH,REF,LEVELS] = ...
+                                 cmfit(CMAP,CLIM,WIDTH,REF,CENTER,varargin) 
+%CMFIT   Sets the COLORMAP and CAXIS to specific color bands. 
+%
+%   SYNTAX:
+%                                      cmfit
+%                                      cmfit(CMAP)
+%                                      cmfit(CMAP,CLIM)
+%                                      cmfit(CMAP,CLIM,WIDTH or LEVELS)
+%                                      cmfit(CMAP,CLIM,WIDTH,REF)
+%                                      cmfit(CMAP,CLIM,WIDTH,REF,CENTER)
+%                                      cmfit(AX,...)
+%     [CMAPF,CLIMF,WIDTHF,REFF,LEVF] = cmfit(...);
+%
+%   INPUT:
+%     CMAP   - Fits the specified colormap function or RGB colors. 
+%              DEFAULT: (current figure colormap)
+%     CLIM   - 2 element vector spacifying the limits of CMAP. 
+%              DEFAULT: (limits of a COLORBAR)
+%     WIDTH  - Color band width (limits are computed with CAXIS) for each
+%     or       band or a row vector specifying the LEVELS on each band (see
+%     LEVELS   NOTE below).
+%              DEFAULT: (fills the ticks of a COLORBAR)
+%     REF    - Reference level to start any of the color bands.
+%              DEFAULT: (generally the middle of CLIM)
+%     CENTER - Logical specifying weather the colormap should be center in
+%              the REF value or not.
+%              DEFAULT: false (do not centers)
+%     AX     - Uses the specified figure or axes handle.
+%
+%   OUTPUT (all optional):
+%     CMAPF  - RGB fitted color map (with 3 columns).
+%     CLIMF  - Limits of CMAPF.
+%     WIDTHF - Width of fitted colorbands.
+%     REFF   - Reference of fitted colorbands.
+%     LEVF   - Levels for the color bands.
+%
+%   DESCRIPTION:
+%     This program sets the current figure colormap with specified
+%     band-widths of colors taking the CAXIS limits as reference. When the 
+%     optional input argument CENTER is true, the colormap is moved and
+%     expanded so its middle color will be right at REF. This will help for
+%     distinguish between positive and negative values (REF=0).
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%     * When one of the first two inputs is missing, they are automatically
+%       calculated by using a COLORBAR (created temporarly if necesary). In
+%       this case CBHANDLE is necesary.
+%     * When CMAP is used as output, the current figure colormap won't be
+%       modificated. Use 
+%         >> colormap(CMAP)
+%       after this function, if necesary.
+%     * When LEVELS are used instead of band WINDTH, it shoud be
+%       monotonically increasing free of NaNs and of length equal to the
+%       number of colors minus one, on the output colormap.
+% 
+%   SEE ALSO:
+%     COLORMAP
+%     and 
+%     CMAPPING, CBFIT by Caros Vargas
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cmfit.m
+%   VERSION: 1.0 (Jun 08, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released. (Jun 08, 2009)
+
+%   DISCLAIMER:
+%   cmfit.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2008,2009 Carlos Adrian Vargas Aguilera
+
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Sets defaults: 
+AX  = {};    % Axes input
+tol = 1;     % Adds this tolerance to the decimal precision
+hfig = {get(0,'CurrentFigure')};
+if ~isempty(hfig)
+ hax = {get(hfig{1},'CurrentAxes')};
+ if isempty(hax{1}), hax = {}; end
+else
+ hfig = {};
+ hax  = {};
+end
+
+% Checks inputs:
+if nargin>6
+ error('CVARGAS:cmfit:tooManyInputs', ...
+  'At most 6 inputs are allowed.')
+end
+if nargin>5
+ error('CVARGAS:cmfit:tooManyOutputs', ...
+  'At most 5 outputs are allowed.')
+end
+
+% Saves number of arguments:
+Nargin = nargin;
+
+% Checks AX input:
+if (Nargin>0) && ~isempty(CMAP) && (numel(CMAP)==1) && ...
+  ishandle(CMAP)
+ % Gets AX and moves all other inputs to the left:
+ AX = {CMAP};
+ switch get(AX{1},'Type')
+  case 'axes'
+   hax  = AX;
+   hfig = {get(hax{1},'Parent')};
+  case {'figure','uipanel'}
+   hfig = {AX{1}};
+   hax  = {get(hfig{1},'CurrentAxes')};
+   if isempty(hax{1}), hax = {}; end
+  otherwise
+   error('CVARGAS:cmfit:incorrectAxHandle',...
+    'AX must be a valid axes or figure handle.')
+ end
+ if (Nargin>1)
+  CMAP = CLIM;
+  if (Nargin>2)
+   CLIM = WIDTH;
+   if (Nargin>3)
+    WIDTH = REF;
+    if (Nargin>4)
+     REF = CENTER;
+     if (Nargin>5)
+      CENTER = varargin{1};
+     end
+    end
+   end
+  end
+ end
+ Nargin = Nargin-1;
+end
+
+% Checks CMAP input:
+if Nargin<1 || isempty(CMAP)
+ if ~isempty(hax)
+  CMAP = colormap(hax{1});
+ else
+  CMAP = get(0,'DefaultFigureColormap');
+ end
+end
+
+% Checks CLIM input:
+if Nargin<2
+ CLIM = [];
+end
+
+% Checks WIDTH input:
+if Nargin<3
+ WIDTH = [];
+end
+
+% Checks REf input:
+if Nargin<4
+ REF = [];
+end
+
+% Checks CENTER input:
+if Nargin<5 || isempty(CENTER)
+ CENTER = false;
+end
+
+% Look for WIDTH and REF from a (temporarly) colorbar:
+if isempty(WIDTH) || (length(WIDTH)==1 && (isempty(REF) || ...
+  (isempty(CLIM) && (isempty(hax) || ...
+  ~strcmp(get(hax{1},'CLimMode'),'manual')))))
+ if ~isempty(CLIM)
+  caxis(hax{:},CLIM)
+ end
+ if ~isempty(AX) && ~isempty(cbhandle(AX{1}))
+  h = cbhandle(AX{1}); doclear = false; h = h(1);
+ elseif ~isempty(hax) && ~isempty(cbhandle(hax{1}))
+  h = cbhandle(hax{1}); doclear = false; h = h(1);
+ elseif ~isempty(hfig) && ~isempty(cbhandle(hfig{1}))
+  h = cbhandle(hfig{1}); doclear = false; h = h(1);
+ else
+  h = colorbar; doclear = true;
+ end
+ ticks = get(h,'XTick');
+ lim   = get(h,'XLim');
+ if isempty(ticks)
+  ticks = get(h,'YTick');
+  lim   = get(h,'YLim');
+ end
+ if isempty(WIDTH)
+  WIDTH = diff(ticks(1:2));
+ end
+ if isempty(CLIM)
+  CLIM = lim;
+ end
+ if isempty(REF) && ~CENTER
+  REF = ticks(1);
+ end
+ if doclear
+  delete(h)
+ end
+end
+
+% Centers at the middle:
+if CENTER && isempty(REF)
+ REF = 0;
+end 
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+
+
+% Gets minimum width from specified levels:
+NL = length(WIDTH); 
+if (NL>1)
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % NONLINEAR CASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ 
+ LEVELS = sort(WIDTH);
+ 
+ % Gets LEVELS width:
+ wLEVELS = diff(LEVELS);
+ 
+ % Scales to CLIM:
+ if ~isempty(CLIM)
+  % Scales to [0 1]
+  LEVELS = LEVELS-LEVELS(1);
+  LEVELS = LEVELS/LEVELS(end);
+  % Scales to CLIM:
+  LEVELS = LEVELS*diff(CLIM)+CLIM(1);
+ else
+  CLIM  = [LEVELS(1) LEVELS(end)]; 
+ end
+ 
+ % Gets precision:
+ if isinteger(wLEVELS) % Allows integer input: uint8, etc. 
+  wLEVELS = double(wLEVELS);
+ end
+ temp = warning('off','MATLAB:log:logOfZero');
+ precision = floor(log10(abs(wLEVELS))); % wLEVELS = Str.XXX x 10^precision.
+ precision(wLEVELS==0) = 0; % M=0 if x=0.
+ warning(temp.state,'MATLAB:log:logOfZero')
+ precision = min(precision)-tol;
+ 
+ % Sets levels up to precision:
+ wLEVELS = round(wLEVELS*10^(-precision));
+ 
+ % Gets COLORMAP for each LEVEL:
+ if CENTER
+  % Centers the colormap:
+  ind = (REF==LEVELS);
+  if ~any(ind)
+   error('CVARGAS:cmfit:uncorrectRefLevel',...
+    'When CENTER, REF level must be on of the specifyied LEVELS.')
+  end
+  Nl     = sum(~ind(1:find(ind)));
+  [Nl,l] = max([Nl (NL-1-Nl)]);
+  wCMAP  = cmapping(2*Nl,CMAP);
+  if l==1
+   wCMAP = wCMAP(1:NL-1,:);
+  else
+   wCMAP = wCMAP(end-NL+2:end,:);
+  end
+ else
+  wCMAP  = cmapping(NL-1,CMAP);
+ end
+ 
+ % Gets minimum band width:
+ WIDTH = wLEVELS(1);
+ for k = 1:NL-1
+  wlev    = wLEVELS;
+  wlev(k) = [];
+  WIDTH   = min(min(gcd(wLEVELS(k),wlev)),WIDTH);
+ end
+ 
+ % Gets number of bands:
+ wLEVELS = wLEVELS/WIDTH;
+ 
+ % Gets new CMAP:
+ N = sum(wLEVELS);
+ try
+  CMAP = repmat(wCMAP(1,:),N,1);
+ catch
+  error('CVARGAS:cmfit:memoryError',...
+   ['The number of colors (N=' int2str(N) ') for the new colormap ' ...
+    'is extremely large. Try other LEVELS.'])
+ end
+ ko = wLEVELS(1);
+ for k = 2:NL-1;
+  CMAP(ko+(1:wLEVELS(k)),:) = repmat(wCMAP(k,:),wLEVELS(k),1);
+  ko = ko+wLEVELS(k);
+ end
+ 
+else
+ 
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ % LINEAR CASE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ 
+ % Gets CLIM:
+ if isempty(CLIM)
+  CLIM = caxis(hax{:});
+ end
+
+ % Sets color limits to be a multipler of WIDTH passing through REF:
+ N1   = ceil((+REF-CLIM(1))/WIDTH);
+ N2   = ceil((-REF+CLIM(2))/WIDTH);
+ CLIM = REF + [-N1 N2]*WIDTH;
+
+ % Sets colormap with NC bands:
+ Nc = round(diff(CLIM)/WIDTH);
+ if CENTER
+  % Necesary colorbands number to be centered:
+  Nmin        = [N1 N2];
+  [Nmax,imax] = max(Nmin);
+  Nmin(imax)  = [];
+  Nc2         = Nc + Nmax - Nmin;
+  % Generate a colormap with this size:
+  CMAP = cmapping(Nc2,CMAP);
+  if imax==1
+   CMAP = CMAP(1:Nc,:);
+  else
+   CMAP = flipud(CMAP);
+   CMAP = CMAP(1:Nc,:);
+   CMAP = flipud(CMAP);
+  end
+ else
+  CMAP = cmapping(Nc,CMAP);
+ end
+ 
+ % Sets levels:
+ LEVELS = linspace(CLIM(1),CLIM(2),size(CMAP,1))';
+end
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+if ~isempty(AX)
+ colormap(AX{:},CMAP)
+ caxis(AX{:},CLIM)
+end
+if ~nargout
+ if isempty(AX)
+  colormap(CMAP)
+  caxis(CLIM)
+ end
+ clear CMAP
+end
+
+
+% [EOF]   cmfit.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmjoin.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmjoin.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmjoin.m	(revision 12004)
@@ -0,0 +1,462 @@
+function [CMAP,LEV,WID,CLIM] = cmjoin(varargin)
+%CMJOIN   Joins colormaps at certain levels.
+%
+%   SYNTAX:
+%                           cmjoin(CMAPS)
+%                           cmjoin(CMAPS,LEV)
+%                           cmjoin(CMAPS,LEV,WID)
+%                           cmjoin(CMAPS,LEV,WID,CLIM)
+%                           cmjoin(AX,...)
+%     [CMAP,LEV,WID,CLIM] = cmjoin(...);
+%
+%   INPUT:
+%     CMAPS - Cell with the N colormaps handles, names or RGB colors to be
+%             joined. See NOTE below.
+%     LEV   - One of:
+%               a) N-1 scalars specifying the color levels where the
+%                  colormaps will be joined (uses CAXIS). See NOTE below.
+%               b) N integers specifying the number of colors for each
+%                  colormap.
+%               c) N+1 scalars specifying the color limits for each
+%                  colormap (sets CAXIS). See NOTE below.
+%             DEFAULT: Tries to generate a CMAP with default length.
+%     WID   - May be one (or N) positive scalar specifying the width for
+%             every (or each) color band. See NOTE below.
+%             DEFAULT: uses CAXIS and LEV to estimate it.  
+%     CLIM  - 2 elements row vector specifying the color limits values. May
+%             be changed at the end, because of the discretization of the
+%             colormaps.
+%             DEFAULT: uses CAXIS or [0 1] if there are no axes.
+%     AX    - Uses the specified axes handle to get/set the CMAPS. If used,
+%             must be the first input.
+%             DEFAULT: gca
+%
+%   OUTPUT (all optional):
+%     CMAP - RGB colormap output matrix, M-by-3.
+%     LEV  - Final levels used.
+%     WID  - Final widths used.
+%     CLIM - Final color limits used.
+%
+%   DESCRIPTION:
+%     This function join two colormaps at specific level. Useful for
+%     joining colormaps at zero (for example) and distinguish from positive
+%     and negative values.
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%     * If no output is required or an axes handle were given, the current
+%       COLORMAP and CAXIS are changed.
+%     * If any of the inputs on CMAPS is a function name, 'jet', for
+%       example, it can be used backwards (because CMAPPING is used) if
+%       added a '-' at the beggining of its name: '-jet'.
+%     * When LEV is type b) and WID is specifyed, the latter is taken as
+%       relative colorbans widths between colormaps.
+%
+%   EXAMPLE:
+%     figure(1), clf, surf(peaks)
+%     cmjoin({'copper','-summer'},2.5)
+%      shading interp, colorbar, axis tight, zlabel('Meters')
+%      title('Union at 2.5 m')
+%     %
+%     figure(2), clf, surf(peaks) 
+%     cmjoin({'copper','-summer'},2.5,0.5)
+%      shading interp, colorbar, axis tight, zlabel('Meters')
+%      title('Union at 2.5 m and different color for each 0.5 m band')
+%     %
+%     figure(3), clf, surf(peaks)
+%     cmjoin({'copper','summer'},2.5,[2 0.5])
+%      shading interp, colorbar, axis tight, zlabel('Metros')
+%      title('Union at 2.5 m with lengths 2 and 0.5')
+%     %
+%     figure(4), clf, surf(peaks)
+%     cmjoin({'copper','summer'},[-10 2.5 10],[2 0.5])
+%      shading interp, colorbar, axis tight, zlabel('Metros')
+%      title('Union at 2.5 m with lengths 2 and 0.5 and specified levels')
+%     %
+%     figure(5), clf, surf(peaks)
+%     cmjoin({'copper','summer'},[10 8],[4 1])
+%      shading interp, colorbar, axis tight, zlabel('Metros')
+%      title('Union at 2.5 m with specified levels number of colors and widths 4:1')
+%    
+%   SEE ALSO:
+%     COLORMAP, COLORMAPEDITOR
+%     and
+%     CMAPPING by Carlos Vargas
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cmjoin.m
+%   VERSION: 2.0 (Jun 08, 2009) (<a href="matlab:web('http://www.mathworks.com/matlabcentral/fileexchange/authors/11258')">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0       Released as SETCOLORMAP. (Nov 07, 2006)
+%   1.1       English translation. (Nov 11, 2006)
+%   2.0       Rewritten and renamed code (from SETCOLORMAPS to CMJOIN. Now
+%             joins multiple colormaps. Inputs changed. (Jun 08, 2009)
+
+%   DISCLAIMER:
+%   cmjoin.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2006,2009 Carlos Adrian Vargas Aguilera
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Parameters:
+tol  = 1;            % When rounding the levels.
+
+% Checks inputs and outputs number:
+if nargin<1
+ error('CVARGAS:cmjoin:notEnoughInputs',...
+  'At least 1 input is required.')
+end
+if nargin>5
+ error('CVARGAS:cmjoin:tooManyInputs',...
+  'At most 5 inputs are allowed.')
+end
+if nargout>4
+ error('CVARGAS:cmjoin:tooManyOutputs',...
+  'At most 4 outputs are allowed.')
+end
+
+% Checks AX:
+AX = {get(get(0,'CurrentFigure'),'CurrentAxes')};
+if isempty(AX{1})
+ AX = {};
+end
+if (length(varargin{1})==1) && ishandle(varargin{1}) && ...
+  strcmp(get(varargin{1},'Type'),'axes')
+ AX = varargin(1);
+ varargin(1) = [];
+ if isempty(varargin)
+  error('CVARGAS:cmjoin:notEnoughInputs',...
+   'CMAPS input must be given.')
+ end
+end
+
+% Checks CMAPS:
+CMAPS  = varargin{1};
+Ncmaps = length(CMAPS);
+if ~iscell(CMAPS) || (Ncmaps<2)
+ error('CVARGAS:cmjoin:incorrectCmapsType',...
+  'CMAPS must be a cell input with at least 2 colormaps.')
+end
+varargin(1) = [];
+Nopt        = length(varargin);
+
+% Checks LEV and sets Ncol and Jlev:
+Ncol = []; % Number of colors for each colormap.
+Jlev = []; % Join levels.
+LEV  = []; % Levels at which each CMAPS begins and ends.
+if (Nopt<1) || isempty(varargin{1})
+ % continue as empty
+elseif ~all(isfinite(varargin{1}(:)))
+ error('CVARGAS:cmjoin:incorrectLevValue',...
+  'LEV must be integers or scalars.')
+else
+ Nopt1 = length(varargin{1}(:));
+ if (Nopt1==Ncmaps)
+  % Specifies number of colors:
+  Ncol = varargin{1}(:);
+  if ~all(Ncol==round(Ncol))
+   error('CVARGAS:cmjoin:incorrectLevInput',...
+    'LEV must be integers when defines number of colors.')
+  end
+ elseif ~all(sort(varargin{1})==varargin{1})
+  error('CVARGAS:cmjoin:incorrectLevInput',...
+   'LEV must be monotonically increasing.')
+ elseif Nopt1==(Ncmaps-1) 
+  Jlev = varargin{1}(:);
+ elseif Nopt1==(Ncmaps+1)
+  LEV = varargin{1}(:);
+ else
+  error('CVARGAS:cmjoin:incorrectLevLength',...
+   'LEV must have any of length(CMAPS)+[-1 0 1] elements.')
+ end
+end
+
+% Checks WID:
+Tcol = []; % Total number of colors for output colormap.
+if (Nopt<2) || isempty(varargin{2})
+ % Tries to generate a colormap with default length with every colorband
+ % of the same width:
+ WID = [];
+ if ~isempty(AX)
+  Tcol = size(colormap(AX{:}),1);
+ else
+  Tcol = size(get(0,'DefaultFigureColormap'),1);
+ end
+else
+ WID = varargin{2}(:);
+ WID(~isfinite(WID) | (WID<0)) = 0;
+ if ~any(WID>0)
+  error('CVARGAS:cmjoin:incorrectWidInput',...
+   'At least one WID must be positive.')
+ end
+ if length(WID)==1
+  WID = repmat(abs(varargin{2}),Ncmaps,1);
+ elseif length(WID)~=Ncmaps
+  error('CVARGAS:cmjoin:incorrectWidLength',...
+   'WID must have length 1 or same as CMAPS.')
+ end
+end
+
+% Checks CLIM:
+if (Nopt<3) || isempty(varargin{3})
+ % Sets default CLIM:
+ if ~isempty(LEV)
+  CLIM = [LEV(1) LEV(end)];
+ elseif ~isempty(AX)
+  CLIM = caxis(AX{:});
+ else
+  CLIM = [0 1];
+ end
+else
+ CLIM = varargin{3}(:).';
+ if (length(CLIM)==2) && (diff(CLIM)>0) && isfinite(diff(CLIM))
+  % continue
+ else
+  error('CVARGAS:cmjoin:incorrectClimInput',...
+   'CLIM must be a valid color limits. See CAXIS for details.')
+ end
+end
+
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+
+% Gets rounding precision:
+temp = warning('off','MATLAB:log:logOfZero');
+if ~isempty(WID)
+ tempp               = WID;
+ precision           = floor(log10(abs(tempp)));
+ precision(tempp==0) = 0;
+ precision           = min(precision)-tol;
+ % Rounds:
+ WID   = round(WID*10^(-precision))*10^precision;
+ if ~isempty(LEV)
+  LEV(1)        = floor(LEV(1)       *10^(-precision))*10^precision;
+  LEV(2:end-1)  = round(LEV(2:end-1) *10^(-precision))*10^precision;
+  LEV(end)      = ceil(LEV(end)      *10^(-precision))*10^precision;
+ elseif ~isempty(Jlev)
+  Jlev(1)       = floor(Jlev(1)      *10^(-precision))*10^precision;
+  Jlev(2:end-1) = round(Jlev(2:end-1)*10^(-precision))*10^precision;
+  Jlev(end)     = ceil(Jlev(end)     *10^(-precision))*10^precision;
+ end
+elseif ~isempty(LEV)
+ tempp               = diff(LEV);
+ precision           = floor(log10(abs(tempp)));
+ precision(tempp==0) = 0;
+ precision           = min(precision)-tol;
+ % Rounds:
+ LEV(1)       = floor(LEV(1)      *10^(-precision))*10^precision;
+ LEV(2:end-1) = round(LEV(2:end-1)*10^(-precision))*10^precision;
+ LEV(end)     = ceil(LEV(end)     *10^(-precision))*10^precision;
+elseif ~isempty(Jlev)
+ tempp               = diff(Jlev);
+ if isempty(tempp)
+  tempp              = Jlev;
+ end
+ precision           = floor(log10(abs(tempp)));
+ precision(tempp==0) = 0;
+ precision           = min(precision)-tol;
+ % Rounds:
+ if length(Jlev)==1
+  Jlev          = round(Jlev*10^(-precision))*10^precision;
+ else
+  Jlev(1)       = floor(Jlev(1)      *10^(-precision))*10^precision;
+  Jlev(2:end-1) = round(Jlev(2:end-1)*10^(-precision))*10^precision;
+  Jlev(end)     = ceil(Jlev(end)     *10^(-precision))*10^precision;
+ end
+else
+ tempp               = CLIM;
+ precision           = floor(log10(abs(tempp)));
+ precision(tempp==0) = 0;
+ precision           = min(precision)-tol;
+end
+% Rounds:
+CLIM(1) = floor(CLIM(1)*10^(-precision))*10^precision;
+CLIM(2) =  ceil(CLIM(2)*10^(-precision))*10^precision;
+warning(temp.state,'MATLAB:log:logOfZero')
+
+% Completes levels when only join levels are specified:
+if ~isempty(Jlev)
+ cedge = CLIM;
+ % First limit:
+ if cedge(1)<=Jlev(1)
+  if ~isempty(WID)
+   cedge(1) = Jlev(1);
+   if WID(1)~=0
+    cedge(1) = cedge(1) - WID(1)*ceil((Jlev(1)-CLIM(1))/WID(1));
+   end
+  else
+   % continue
+  end
+ else
+  if (Ncmaps==2)
+   cedge(1) = Jlev(1);
+  else
+   for k = 2:length(Jlev)
+    if cedge(1)<=Jlev(k)
+     cedge(1) = Jlev(k-1);
+     break
+    else
+     Jlev(k-1) = Jlev(k);
+    end
+   end
+  end
+ end
+ % Last limit:
+ if cedge(2)>=Jlev(end)
+  if ~isempty(WID)
+   cedge(2) = Jlev(end);
+   if WID(end)~=0
+    cedge(2) = cedge(2) + WID(end)*ceil((CLIM(2)-Jlev(end))/WID(end));
+   end
+  else
+   % continue
+  end
+ else
+  if (Ncmaps==2)
+   cedge(2) = Jlev(end);
+  else
+   for k = length(Jlev)-1:-1:1
+    if cedge(2)>=Jlev(k)
+     cedge(2) = Jlev(k+1);
+     break
+    else
+     Jlev(k+1) = Jlev(k);
+    end
+   end
+  end
+ end
+ % New Levels:
+ LEV = [cedge(1); Jlev; cedge(2)];
+ 
+end
+
+% Gets colorband width and sets WID:
+if ~isempty(Ncol)
+ if isempty(WID)
+  % Treats all colorbands with equal widths:
+  Cwid = diff(CLIM)/sum(abs(Ncol));
+  Cwid = round(Cwid*10^(-(precision-1)))*10^(precision-1);
+  WID  = repmat(Cwid,Ncmaps,1);
+  LEV  = [CLIM(1); CLIM(1)+cumsum(abs(Ncol))*Cwid];
+ else
+  % Treats WID as colorbands withs relations:
+  WID   = WID/min(WID(WID~=0));
+  Ncol2 = WID.*Ncol;
+  Cwid  = diff(CLIM)/sum(abs(Ncol2));
+  Cwid  = round(Cwid*10^(-(precision-1)))*10^(precision-1);
+  WID   = WID*Cwid;
+  LEV   = [CLIM(1); CLIM(1)+cumsum(abs(Ncol2))*Cwid];
+ end
+elseif ~isempty(WID)
+ % Gets colorband width:
+ Cwid  = WID(1)*10^(-precision);
+ for k = 2:Ncmaps
+  Cwid = gcd(Cwid,WID(k)*10^(-precision));
+ end
+ Cwid  = Cwid*10^precision;
+else
+ % Gets relation between colomaps width:
+ if isempty(LEV)
+  r    = ones(Ncmaps,1);
+  d    = diff(CLIM);
+ else
+  r         = diff(LEV);
+  temp      = warning('off','MATLAB:log:logOfZero');
+  precision = floor(log10(abs(r))); % r = Str.XXX x 10^precision.
+  precision(r==0) = 0; % precision=0 if Ncol=0.
+  warning(temp.state,'MATLAB:log:logOfZero')
+  precision = min(precision)-tol;
+  r  = round(r*10^(-precision));
+  rgcd  = r(1);
+  for k = 2:Ncmaps
+   rgcd = gcd(rgcd,r(k));
+  end
+  r = r/rgcd;
+  d = (LEV(end)-LEV(1));
+ end
+ % Gets colorband width:
+ r    = r*ceil(Tcol/sum(r));
+ Cwid = d/sum(r);
+ WID  = repmat(Cwid,Ncmaps,1);
+end
+
+% Sets LEV when empty:
+if isempty(LEV)
+ LEV = linspace(CLIM(1),CLIM(2),Ncmaps+1)';
+end
+
+% Gets number of colors for each colormap:
+Ncol2 = round(diff(LEV)/Cwid);
+if ~isempty(Ncol)
+ % continue
+else
+ Ncol = round(diff(LEV)./WID);
+ Ncol(~isfinite(Ncol)) = 0;
+ if ~all(Ncol==round(Ncol))
+  error('CVARGAS:cmjoin:incorrectWidColor',...
+   'Colorband do not match each colormap width. Modify LEV or WID.')
+ end
+end
+
+% Generates the colormaps:
+CMAP  = zeros(sum(abs(Ncol2)),3);
+xband = zeros(sum(abs(Ncol2))+1,1);
+tempr = [];
+for k = 1:Ncmaps
+ if Ncol(k)
+  r          = sum(abs(Ncol2(1:k-1)))+(1:abs(Ncol2(k)));
+  if Ncol(k)~=Ncol2(k)
+   CMAP(r,:) = cmapping(Ncol2(k),cmapping(Ncol(k),CMAPS{k}),'discrete');
+  else
+   CMAP(r,:) = cmapping(Ncol(k),CMAPS{k});
+  end
+  tempr      = linspace(LEV(k),LEV(k+1),abs(Ncol2(k))+1)';
+  xband(r)   = tempr(1:end-1); 
+ end
+end
+if ~isempty(tempr)
+ xband(end) = tempr(end);
+end
+
+% Cuts edges:
+ind = find((xband>=CLIM(1)) & (xband<=CLIM(2)));
+if (ind(1)~=1) && ~(any(xband==CLIM(1)))
+ ind = [ind(1)-1; ind];
+end
+if (ind(end)~=length(ind)) && ~(any(xband==CLIM(2)))
+ ind = [ind; ind(end)+1];
+end
+CMAP  = CMAP(ind(1:end-1),:);
+clim2 = xband(ind([1 end]));
+
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+
+if ~nargout
+ colormap(AX{:},CMAP)
+ caxis(AX{:},clim2(:)');
+ clear CMAP
+else
+ if ~isempty(AX)
+  colormap(AX{:},CMAP)
+  caxis(AX{:},clim2(:)');
+ end
+ CLIM = clim2;
+ WID  = diff(LEV)./max([Ncol ones(Ncmaps,1)],[],2);
+end
+
+
+% [EOF]   cmjoin.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmlines.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmlines.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/cm_and_cb_utilities/cmlines.m	(revision 12004)
@@ -0,0 +1,152 @@
+function [HL,CLIN] = cmlines(varargin)
+% CMLINES   Change the color of plotted lines using the colormap.
+%
+%   SYNTAX:
+%                 cmlines
+%                 cmlines(CMAP)
+%                 cmlines(H,...)
+%     [HL,CLIN] = cmlines(...);
+%   
+%   INPUT:
+%     CMAP - Color map name or handle to be used, or a Nx3 matrix of colors
+%            to be used for each of the N lines or color char specifiers.
+%            DEFAULT: jet.
+%     H    - Handles of lines or from a axes to search for lines or from
+%            figures to search for exes. If used, must be the first input.
+%            DEFAULT: gca (sets colors for lines in current axes)
+%
+%   OUTPUT (all optional):
+%     HL   - Returns the handles of lines. Is a cell array if several axes
+%            handle were used as input.
+%     CLIN - Returns the RGB colors of the lines. Is a cell array if
+%            several axes handle were used as input.
+%
+%   DESCRIPTION:
+%     Ths function colored the specified lines with the spectrum of the
+%     given colormap. Ideal for lines on the same axes which means increase
+%     (or decrease) monotonically.
+%
+%   EXAMPLE:
+%     plot(reshape((1:10).^2,2,5))
+%     cmlines
+%
+%   NOTE:
+%     * Optional inputs use its DEFAULT value when not given or [].
+%     * Optional outputs may or not be called.
+%    
+%   SEE ALSO:
+%     PLOT and COLORMAP.
+%     and
+%     CMAPPING
+%     at http://www.mathworks.com/matlabcentral/fileexchange
+%
+%
+%   ---
+%   MFILE:   cmlines.m
+%   VERSION: 1.0 (Jun 08, 2009) (<a href="matlab:web(['www.mathworks.com/matlabcentral/fileexchange/loadAuthor.do',char(63),'objectType',char(61),'author',char(38),'objectId=1093874'])">download</a>) 
+%   MATLAB:  7.7.0.471 (R2008b)
+%   AUTHOR:  Carlos Adrian Vargas Aguilera (MEXICO)
+%   CONTACT: nubeobscura@hotmail.com
+
+%   REVISIONS:
+%   1.0      Released. (Jun 08, 2009)
+
+%   DISCLAIMER:
+%   cmlines.m is provided "as is" without warranty of any kind, under the
+%   revised BSD license.
+
+%   Copyright (c) 2009 Carlos Adrian Vargas Aguilera
+
+% INPUTS CHECK-IN
+% -------------------------------------------------------------------------
+
+% Set defaults:
+HL   = {};
+Ha   = gca;
+CMAP = colormap;
+
+% Checks number of inputs:
+if nargin>2
+ error('CVARGAS:cmlines:tooManyInputs', ...
+  'At most 2 inputs are allowed.')
+end
+if nargout>2
+ error('CVARGAS:cmlines:tooManyOutputs', ...
+  'At most 2 outputs are allowed.')
+end
+
+% Checks handles of lines, axes or figure inputs:
+Hl = [];
+if (nargin~=0) && ~isempty(varargin{1}) && all(ishandle(varargin{1}(:))) ...
+ && ((length(varargin{1})>1) || ~isa(varargin{1},'function_handle'))
+ Ha = [];
+ for k = 1:length(varargin{1})
+  switch get(varargin{1}(k),'Type')
+   case 'line'
+    Hl = [Hl varargin{1}(k)];
+   case 'axes'
+    Ha = [Ha varargin{1}(k)];
+   case {'figure','uipanel'}
+    Ha = [Ha findobj(varargin{1}(k),'-depth',1,'Type','axes',...
+                      '-not',{'Tag','Colorbar','-or','Tag','legend'})];
+   otherwise
+     warning('CVARGAS:cmlines:unrecognizedHandleInput',...
+      'Ignored handle input.')
+  end
+ end
+ varargin(1) = [];
+end
+
+% Looks for CMAP input:
+if nargin && ~isempty(varargin) && ~isempty(varargin{1})
+ CMAP = varargin{1};
+end
+
+% Gets line handles:
+if ~isempty(Hl)
+ HL{1} = Hl;
+end
+if ~isempty(Ha)
+ for k = 1:length(Ha)
+  Hl = findobj(Ha(k),'Type','line');
+  if ~isempty(Hl)
+   HL{end+1} = Hl;
+  end
+ end
+end
+if isempty(HL)
+ if ~nargout
+  clear HL
+ end
+ return
+end
+
+% -------------------------------------------------------------------------
+% MAIN
+% -------------------------------------------------------------------------
+
+% Sets color lines for each set of lines:
+Nlines = length(HL);
+CLIN   = cell(1,Nlines);
+for k  = 1:length(HL)
+ 
+ % Interpolates the color map:
+ CLIN{k} = cmapping(length(HL{k}),CMAP);
+
+ % Changes lines colors:
+ set(HL{k},{'Color'},mat2cell(CLIN{k},ones(1,size(CLIN{k},1)),3))
+ 
+end
+
+% OUTPUTS CHECK-OUT
+% -------------------------------------------------------------------------
+
+if ~nargout
+ clear HL
+elseif Nlines==1
+ HL   = HL{1};
+ CLIN = CLIN{1};
+end
+
+
+% [EOF]   cmlines.m
Index: /issm/branches/trunk-jpl-damage/externalpackages/export_fig/copyfig.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/export_fig/copyfig.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/export_fig/copyfig.m	(revision 12004)
@@ -0,0 +1,33 @@
+%COPYFIG Create a copy of a figure, without changing the figure
+%
+% Examples:
+%   fh_new = copyfig(fh_old)
+%
+% This function will create a copy of a figure, but not change the figure,
+% as copyobj sometimes does, e.g. by changing legends.
+%
+% IN:
+%    fh_old - The handle of the figure to be copied. Default: gcf.
+%
+% OUT:
+%    fh_new - The handle of the created figure.
+
+% Copyright (C) Oliver Woodford 2012
+
+function fh = copyfig(fh)
+% Set the default
+if nargin == 0
+    fh = gcf;
+end
+% Is there a legend?
+if isempty(findobj(fh, 'Type', 'axes', 'Tag', 'legend'))
+    % Safe to copy using copyobj
+    fh = copyobj(fh, 0);
+else
+    % copyobj will change the figure, so save and then load it instead
+    tmp_nam = [tempname '.fig'];
+    hgsave(fh, tmp_nam);
+    fh = hgload(tmp_nam);
+    delete(tmp_nam);
+end
+return
Index: /issm/branches/trunk-jpl-damage/externalpackages/export_fig/eps2pdf.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/export_fig/eps2pdf.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/export_fig/eps2pdf.m	(revision 12004)
@@ -33,5 +33,5 @@
 %             gives lossless output. Default: ghostscript prepress default.
 
-% Copyright (C) Oliver Woodford 2009-2010
+% Copyright (C) Oliver Woodford 2009-2011
 
 % Suggestion of appending pdf files provided by Matt C at:
@@ -43,4 +43,6 @@
 % which was fixed for lossless compression settings.
 
+% 9/12/2011 Pass font path to ghostscript.
+
 function eps2pdf(source, dest, crop, append, gray, quality)
 % Intialise the options string for ghostscript
@@ -49,4 +51,9 @@
 if nargin < 3 || crop
     options = [options ' -dEPSCrop'];
+end
+% Set the font path
+fp = font_path();
+if ~isempty(fp)
+    options = [options ' -sFONTPATH="' fp '"'];
 end
 % Set the grayscale option
@@ -103,2 +110,25 @@
 return
 
+% Function to return (and create, where necessary) the font path
+function fp = font_path()
+fp = user_string('gs_font_path');
+if ~isempty(fp)
+    return
+end
+% Create the path
+% Start with the default path
+fp = getenv('GS_FONTPATH');
+% Add on the typical directories for a given OS
+if ispc
+    if ~isempty(fp)
+        fp = [fp ';'];
+    end
+    fp = [fp getenv('WINDIR') filesep 'Fonts'];
+else
+    if ~isempty(fp)
+        fp = [fp ':'];
+    end
+    fp = [fp '/usr/share/fonts:/usr/local/share/fonts:/usr/share/fonts/X11:/usr/local/share/fonts/X11:/usr/share/fonts/truetype:/usr/local/share/fonts/truetype'];
+end
+user_string('gs_font_path', fp);
+return
Index: /issm/branches/trunk-jpl-damage/externalpackages/export_fig/export_fig.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/export_fig/export_fig.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/export_fig/export_fig.m	(revision 12004)
@@ -134,5 +134,5 @@
 %   See also PRINT, SAVEAS.
 
-% Copyright (C) Oliver Woodford 2008-2011
+% Copyright (C) Oliver Woodford 2008-2012
 
 % The idea of using ghostscript is inspired by Peder Axensten's SAVEFIG
@@ -156,5 +156,12 @@
 % isolated from gui objects.
 
+% 23/02/12: Ensure that axes limits don't change during printing
+% 14/03/12: Fix bug in fixing the axes limits (thanks to Tobias Lamour for
+%           reporting it).
+
 function [im alpha] = export_fig(varargin)
+% Make sure the figure is rendered correctly _now_ so that properties like
+% axes limits are up-to-date.
+drawnow;
 % Parse the input arguments
 [fig options] = parse_args(nargout, varargin{:});
@@ -184,4 +191,14 @@
     end
 end
+% MATLAB "feature": axes limits can change when printing
+Hlims = findall(fig, 'Type', 'axes');
+if ~cls
+    % Record the old axes limit modes
+    Xlims = make_cell(get(Hlims, 'XLimMode'));
+    Ylims = make_cell(get(Hlims, 'YLimMode'));
+    Zlims = make_cell(get(Hlims, 'ZLimMode'));
+end
+% Set all axes limit modes to manual, so the limits can't change
+set(Hlims, 'XLimMode', 'manual', 'YLimMode', 'manual', 'ZLimMode', 'manual');
 % Set to print exactly what is there
 set(fig, 'InvertHardcopy', 'off');
@@ -418,4 +435,8 @@
     % Reset the hardcopy mode
     set(fig, 'InvertHardcopy', old_mode);
+    % Reset the axes limit modes
+    for a = 1:numel(Hlims)
+        set(Hlims(a), 'XLimMode', Xlims{a}, 'YLimMode', Ylims{a}, 'ZLimMode', Zlims{a});
+    end
 end
 return
@@ -719,2 +740,9 @@
 b = options.png || options.tif || options.jpg || options.bmp || options.im || options.alpha;
 return
+
+% Helper function
+function A = make_cell(A)
+ if ~iscell(A)
+     A = {A};
+ end
+ 
Index: /issm/branches/trunk-jpl-damage/externalpackages/export_fig/isolate_axes.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/export_fig/isolate_axes.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/export_fig/isolate_axes.m	(revision 12004)
@@ -18,7 +18,9 @@
 %    fh - The handle of the created figure.
 
-% Copyright (C) Oliver Woodford 2011
+% Copyright (C) Oliver Woodford 2011-2012
 
 % Thank you to Rosella Blatt for reporting a bug to do with axes in GUIs
+% 16/3/2012 Moved copyfig to its own function. Thanks to Bob Fratantonio
+% for pointing out that the function is also used in export_fig.m.
 
 function fh = isolate_axes(ah, vis)
@@ -107,16 +109,2 @@
 end
 return
-
-function fh = copyfig(fh)
-% Is there a legend?
-if isempty(findobj(fh, 'Type', 'axes', 'Tag', 'legend'))
-    % Safe to copy using copyobj
-    fh = copyobj(fh, 0);
-else
-    % copyobj will change the figure, so save and then load it instead
-    tmp_nam = [tempname '.fig'];
-    hgsave(fh, tmp_nam);
-    fh = hgload(tmp_nam);
-    delete(tmp_nam);
-end
-return
Index: /issm/branches/trunk-jpl-damage/externalpackages/export_fig/license.txt
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/export_fig/license.txt	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/export_fig/license.txt	(revision 12004)
@@ -1,3 +1,3 @@
-Copyright (c) 2011, Oliver Woodford
+Copyright (c) 2012, Oliver Woodford
 All rights reserved.
 
Index: /issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2array.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2array.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2array.m	(revision 12004)
@@ -37,4 +37,9 @@
 % Thanks to Phil Trinh and Meelis Lootus for reporting the issues.
 
+% 9/12/2011 Pass font path to ghostscript.
+
+% 27/1/2012 Bug fix affecting painters rendering tall figures. Thanks to
+% Ken Campbell for reporting it.
+
 function [A bcol] = print2array(fig, res, renderer)
 % Generate default input arguments, if needed
@@ -66,6 +71,15 @@
     print2eps(tmp_eps, fig, renderer, '-loose');
     try
-        % Export to tiff using ghostscript
-        ghostscript(['-dEPSCrop -q -dNOPAUSE -dBATCH ' res_str ' -sDEVICE=tiff24nc -sOutputFile="' tmp_nam '" "' tmp_eps '"']);
+        % Initialize the command to export to tiff using ghostscript
+        cmd_str = ['-dEPSCrop -q -dNOPAUSE -dBATCH ' res_str ' -sDEVICE=tiff24nc'];
+        % Set the font path
+        fp = font_path();
+        if ~isempty(fp)
+            cmd_str = [cmd_str ' -sFONTPATH="' fp '"'];
+        end
+        % Add the filenames
+        cmd_str = [cmd_str ' -sOutputFile="' tmp_nam '" "' tmp_eps '"'];
+        % Execute the ghostscript command
+        ghostscript(cmd_str);
     catch
         % Delete the intermediate file
@@ -105,5 +119,5 @@
             end
         end
-        bcol = median([reshape(A(:,[l r],:), [], size(A, 3)); reshape(A(:,[t b],:), [], size(A, 3))], 1);
+        bcol = median([reshape(A(:,[l r],:), [], size(A, 3)); reshape(A([t b],:,:), [], size(A, 3))], 1);
         for c = 1:size(A, 3)
             A(:,[1:l-1, r+1:end],c) = bcol(c);
@@ -156,2 +170,26 @@
 end
 return
+
+% Function to return (and create, where necessary) the font path
+function fp = font_path()
+fp = user_string('gs_font_path');
+if ~isempty(fp)
+    return
+end
+% Create the path
+% Start with the default path
+fp = getenv('GS_FONTPATH');
+% Add on the typical directories for a given OS
+if ispc
+    if ~isempty(fp)
+        fp = [fp ';'];
+    end
+    fp = [fp getenv('WINDIR') filesep 'Fonts'];
+else
+    if ~isempty(fp)
+        fp = [fp ':'];
+    end
+    fp = [fp '/usr/share/fonts:/usr/local/share/fonts:/usr/share/fonts/X11:/usr/local/share/fonts/X11:/usr/share/fonts/truetype:/usr/local/share/fonts/truetype'];
+end
+user_string('gs_font_path', fp);
+return
Index: /issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2eps.m
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2eps.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/export_fig/print2eps.m	(revision 12004)
@@ -6,7 +6,10 @@
 %   print2eps(filename, fig_handle, options)
 %
-% This function saves a figure as an eps file, and improves the line style,
-% making dashed lines more like those on screen and giving grid lines their
-% own dotted style.
+% This function saves a figure as an eps file, with two improvements over
+% MATLAB's print command. First, it improves the line style, making dashed
+% lines more like those on screen and giving grid lines their own dotted
+% style. Secondly, it substitutes original font names back into the eps
+% file, where these have been changed by MATLAB, for up to 11 different
+% fonts.
 %
 %IN:
@@ -18,5 +21,5 @@
 %   options - Additional parameter strings to be passed to print.
 
-% Copyright (C) Oliver Woodford 2008-2011
+% Copyright (C) Oliver Woodford 2008-2012
 
 % The idea of editing the EPS file to change line styles comes from Jiro
@@ -28,4 +31,17 @@
 % Thanks to Mathieu Morlighem for reporting the issue and obtaining a fix
 % from TMW.
+
+% 8/12/2011 Added ability to correct fonts. Several people have requested
+% this at one time or another, and also pointed me to printeps (fex id:
+% 7501), so thank you to them. My implementation (which was not inspired by
+% printeps - I'd already had the idea for my approach) goes
+% slightly further in that it allows multiple fonts to be swapped.
+
+% 14/12/2011 Fix bug affecting font names containing spaces. Many thanks to
+% David Szwer for reporting the issue.
+
+% 25/1/2012 Add a font not to be swapped. Thanks to Anna Rafferty and Adam
+% Jackson for reporting the issue. Also fix a bug whereby using a font
+% alias can lead to another font being swapped in.
 
 function print2eps(name, fig, varargin)
@@ -39,4 +55,35 @@
 if numel(name) < 5 || ~strcmpi(name(end-3:end), '.eps')
     name = [name '.eps']; % Add the missing extension
+end
+% Find all the used fonts in the figure
+fonts = get(findall(fig, '-property', 'FontName'), 'FontName');
+if ~iscell(fonts)
+    fonts = {fonts};
+end
+fonts = unique(fonts);
+% Map supported font aliases onto the correct name
+for a = 1:numel(fonts)
+    f = lower(fonts{a});
+    f(f==' ') = [];
+    switch f
+        case {'times', 'timesnewroman', 'times-roman'}
+            fonts{a} = 'Times-Roman';
+        case {'arial', 'helvetica'}
+            fonts{a} = 'Helvetica';
+        case {'newcenturyschoolbook', 'newcenturyschlbk'}
+            fonts{a} = 'NewCenturySchlbk';
+        otherwise
+    end
+end
+% Determine the font swap table
+matlab_fonts = {'Helvetica', 'Times-Roman', 'Palatino', 'Bookman', 'Helvetica-Narrow', 'Symbol', ...
+                'AvantGarde', 'NewCenturySchlbk', 'Courier', 'ZapfChancery', 'ZapfDingbats'};
+require_swap = find(~ismember(fonts, matlab_fonts));
+unused_fonts = find(~ismember(matlab_fonts, fonts));
+font_swap = min(numel(require_swap), numel(unused_fonts));
+font_swap = [reshape(matlab_fonts(unused_fonts(1:font_swap)), 1, font_swap); reshape(fonts(require_swap(1:font_swap)), 1, font_swap)];
+% Swap the fonts
+for a = 1:size(font_swap, 2)
+    set(findall(fig, 'FontName', font_swap{2,a}), 'FontName', font_swap{1,a});
 end
 % Set paper size
@@ -63,4 +110,18 @@
 % Reset paper size
 set(fig, 'PaperPositionMode', old_mode);
+% Correct the fonts
+if ~isempty(font_swap)
+    % Reset the font names in the figure
+    for a = 1:size(font_swap, 2)
+        set(findall(fig, 'FontName', font_swap{1,a}), 'FontName', font_swap{2,a});
+    end
+    % Replace the font names in the eps file
+    try
+        swap_fonts(name, font_swap{:});
+    catch
+        warning('swap_fonts() failed. This is usually because the figure contains a large number of patch objects. Consider exporting to a bitmap format in this case.');
+        return
+    end
+end
 % Fix the line styles
 try
@@ -70,2 +131,35 @@
 end
 return
+
+function swap_fonts(fname, varargin)
+% Read in the file
+fh = fopen(fname, 'r');
+if fh == -1
+    error('File %s not found.', fname);
+end
+try
+    fstrm = fread(fh, '*char')';
+catch ex
+    fclose(fh);
+    rethrow(ex);
+end
+fclose(fh);
+
+% Replace the font names
+for a = 1:2:numel(varargin)
+    fstrm = regexprep(fstrm, [varargin{a} '-?[a-zA-Z]*\>'], varargin{a+1}(~isspace(varargin{a+1})));
+end
+
+% Write out the updated file
+fh = fopen(fname, 'w');
+if fh == -1
+    error('Unable to open %s for writing.', fname2);
+end
+try
+    fwrite(fh, fstrm, 'char*1');
+catch ex
+    fclose(fh);
+    rethrow(ex);
+end
+fclose(fh);
+return
Index: /issm/branches/trunk-jpl-damage/externalpackages/geos5/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/geos5/install.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/geos5/install.sh	(revision 12004)
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+#Some cleanup
+rm -rf  GEOSagcm
+#svn download
+svn --username eric.larour@jpl.nasa.gov checkout http://geos5.org/svn/branches/Fortuna-2_5_p1 GEOSagcm
Index: /issm/branches/trunk-jpl-damage/externalpackages/gmake/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/gmake/install.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/gmake/install.sh	(revision 12004)
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#Some cleanup
+rm -rf install src make-3.82
+mkdir install src
+
+#Untar 
+tar -zxvf  make-3.82.tar.gz
+
+#Move make into install directory
+mv make-3.82/* src
+rm -rf make-3.82
+
+#Apply patches
+cd src 
+
+#Configure and compile: 
+./configure --prefix=$ISSM_TIER/externalpackages/gmake/install
+
+if [ -z $1 ]; then
+	make
+	make install
+else 
+	make -j $1; 
+	make -j $1 install;
+fi
Index: /issm/branches/trunk-jpl-damage/externalpackages/gsl/README
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/gsl/README	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/gsl/README	(revision 12004)
@@ -0,0 +1,1 @@
+GNU Scientfic Library, obtained from: http://www.gnu.org/software/gsl/
Index: /issm/branches/trunk-jpl-damage/externalpackages/gsl/install-linux64-murdo.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/gsl/install-linux64-murdo.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/gsl/install-linux64-murdo.sh	(revision 12004)
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+#Some cleanup
+rm -rf src install gsl-1.15
+mkdir src install
+
+#Untar 
+tar -zxvf  gsl-1.15.tar.gz
+
+#Move gsl into src directory
+mv gsl-1.15/* src
+rm -rf gsl-1.15
+
+#Configure gsl
+cd src
+
+./configure \
+	--prefix="$ISSM_TIER/externalpackages/gsl/install" 
+
+#Compile gsl
+if [ -z $1 ]; then
+	make
+else
+	make -j $1
+fi
+make install 
Index: /issm/branches/trunk-jpl-damage/externalpackages/gsl/install-macosx64.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/gsl/install-macosx64.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/gsl/install-macosx64.sh	(revision 12004)
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+#Some cleanup
+rm -rf src install gsl-1.15
+mkdir src install
+
+#Untar 
+tar -zxvf  gsl-1.15.tar.gz
+
+#Move gsl into src directory
+mv gsl-1.15/* src
+rm -rf gsl-1.15
+
+#Configure gsl
+cd src
+
+export CFLAGS=" -arch x86_64"
+
+./configure \
+	--prefix="$ISSM_TIER/externalpackages/gsl/install" 
+
+#Compile gsl
+if [ -z $1 ]; then
+	make
+else
+	make -j $1
+fi
+make install 
Index: sm/branches/trunk-jpl-damage/externalpackages/matlab/install-macosx-feras.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/matlab/install-macosx-feras.sh	(revision 12003)
+++ 	(revision )
@@ -1,13 +1,0 @@
-#!/bin/bash
-
-#Erase symlink
-rm -rf install
-
-#Generic Matlab softlink for Macintosh (OSX) directory structure
-
-#ln -s /Applications/MATLAB_R2008a/ install
-#ln -s /Applications/MATLAB_R2009a.app/ install
-#ln -s /Applications/MATLAB_R2010a.app/ install
-#ln -s /Applications/MATLAB_R2011b.app/ install
-
-ln -s /Applications/MATLAB*.app/ install
Index: /issm/branches/trunk-jpl-damage/externalpackages/matlab/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/matlab/install.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/matlab/install.sh	(revision 12004)
@@ -15,4 +15,4 @@
 #ln -s /Applications/MATLAB_R2009a.app/ install
 #ln -s /Applications/MATLAB_R2010a.app/ install
-#ln -s /Applications/MATLAB_R2011b.app/ install
-#ln -s /Applications/MATLAB*.app/ install
+#ln -s /Applications/MATLAB_R2012a.app/ install
+ln -s /Applications/MATLAB*.app/ install
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/altix64/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/altix64/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/altix64/Makefile.in.patch	(revision 12004)
@@ -1,10 +1,10 @@
-3,5c3
-< CC = gcc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
-> CC = cc
-8c6
-< OPTFLAGS = -DLINUX -fPIC
+> CC = gcc
+> OBJ_EXT=o
+> LIB_EXT=a
+6c8
+< OPTFLAGS = -O2 
 ---
-> OPTFLAGS = -O2 
+> OPTFLAGS = -DLINUX -fPIC
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/cosmos/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/cosmos/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/cosmos/Makefile.in.patch	(revision 12004)
@@ -1,10 +1,10 @@
-3,5c3
-< CC = icc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
-> CC = cc
-8c6
-< OPTFLAGS = -DLINUX -fPIC
+> CC = icc
+> OBJ_EXT=o
+> LIB_EXT=a
+6c8
+< OPTFLAGS = -O2 
 ---
-> OPTFLAGS = -O2 
+> OPTFLAGS = -DLINUX -fPIC
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/greenplanet/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/greenplanet/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/greenplanet/Makefile.in.patch	(revision 12004)
@@ -1,10 +1,10 @@
-3,5c3
-< CC = gcc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
 > CC = icc
-8c6
-< OPTFLAGS = -DLINUX -fPIC
+> OBJ_EXT=o
+> LIB_EXT=a
+6c8
+< OPTFLAGS = -O2 
 ---
-> OPTFLAGS = -O3
+> OPTFLAGS = -DLINUX -fPIC
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/linux64/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/linux64/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/linux64/Makefile.in.patch	(revision 12004)
@@ -1,10 +1,10 @@
-3,5c3
-< CC = gcc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
-> CC = cc
-8c6
-< OPTFLAGS = -DLINUX -fPIC
+> CC = gcc
+> OBJ_EXT=o
+> LIB_EXT=a
+6c8
+< OPTFLAGS = -O2 
 ---
-> OPTFLAGS = -O2 
+> OPTFLAGS = -DLINUX -fPIC
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/macosx32/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/macosx32/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/macosx32/Makefile.in.patch	(revision 12004)
@@ -1,10 +1,10 @@
-3,5c3
-< CC = gcc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
-> CC = cc
-8c6
-< OPTFLAGS = -DLINUX -fPIC
+> CC = gcc
+> OBJ_EXT=o
+> LIB_EXT=a
+6c8
+< OPTFLAGS = -O2 
 ---
 > OPTFLAGS = -O2  -m32
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/macosx64/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/macosx64/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/macosx64/Makefile.in.patch	(revision 12004)
@@ -1,10 +1,10 @@
-3,5c3
-< CC = gcc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
-> CC = cc
-8c6
-< OPTFLAGS = -DLINUX -fPIC
+> CC = gcc
+> OBJ_EXT=o
+> LIB_EXT=a
+6c8
+< OPTFLAGS = -O2 
 ---
 > OPTFLAGS = -O2  -m64
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/pleiades/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/pleiades/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/pleiades/Makefile.in.patch	(revision 12004)
@@ -1,10 +1,10 @@
-3,5c3
-< CC = gcc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
 > CC = icc
-8c6
-< OPTFLAGS = -DLINUX -fPIC
+> OBJ_EXT=o
+> LIB_EXT=a
+6c8
+< OPTFLAGS = -O2 
 ---
-> OPTFLAGS = -O2 
+> OPTFLAGS = -DLINUX -fPIC
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/win32/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/win32/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/win32/Makefile.in.patch	(revision 12004)
@@ -1,14 +1,10 @@
-3,5c3,5
-< CC = gcc
-< OBJ_EXT=o
-< LIB_EXT=a
+3c3,5
+< CC = cc
 ---
 > CC = icl
 > OBJ_EXT=obj
 > LIB_EXT=lib
-8c8
-< OPTFLAGS = -DLINUX -fPIC
+6c8
+< OPTFLAGS = -O2 
 ---
 > OPTFLAGS = -DWIN32 -D__VC__
-22d21
-< #RANLIB = 
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/win7/Makefile.in.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/win7/Makefile.in.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/configs/4.0/win7/Makefile.in.patch	(revision 12004)
@@ -1,25 +1,21 @@
-3,5c3,5
-< CC = cl
-< OBJ_EXT=obj
-< LIB_EXT=lib
+3c3,5
+< CC = cc
 ---
-> CC = gcc
-> OBJ_EXT=o
-> LIB_EXT=a
-8c8
-< OPTFLAGS = -DWIN32 -D__VC__
+> CC = cl
+> OBJ_EXT=obj
+> LIB_EXT=lib
+6c8
+< OPTFLAGS = -O2 
 ---
-> OPTFLAGS = -DLINUX -fPIC
-16,17c16,24
-< # What tool to use to create library
-< LIB=lib.exe
+> OPTFLAGS = -DWIN32 -D__VC__
+14,20c16,17
+< # What archiving to use
+< AR = ar rv
+< 
+< # What to use for indexing the archive
+< RANLIB = ranlib
+< #RANLIB = ar -ts
+< #RANLIB = 
 ---
-> # What archiving to use
-> AR = ar rv
-> 
-> # What to use for indexing the archive
-> RANLIB = ranlib
-> #RANLIB = ar -ts
-> #RANLIB = 
-> 
-> 
+> # What tool to use to create library
+> LIB=lib.exe
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/install-4.0-win7.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/install-4.0-win7.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/install-4.0-win7.sh	(revision 12004)
@@ -16,5 +16,5 @@
 patch -p1 < ../metis-4.0.patch
 patch -R Lib/Makefile ../configs/4.0/win7/Makefile.patch
-patch -R Makefile.in ../configs/4.0/win7/Makefile.in.patch
+patch Makefile.in ../configs/4.0/win7/Makefile.in.patch
 
 #Compile
Index: /issm/branches/trunk-jpl-damage/externalpackages/metis/metis-4.0.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/metis/metis-4.0.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/metis/metis-4.0.patch	(revision 12004)
@@ -236,28 +236,2 @@
   clean:
   	(cd Lib ; make clean )
-diff -crB install/Makefile.in install2/Makefile.in
-*** install/Makefile.in	1998-10-02 14:28:35.000000000 -0700
---- install2/Makefile.in	2011-06-08 15:19:00.536540378 -0700
-***************
-*** 1,9 ****
-  
-  # Which compiler to use
-! CC = cc
-  
-  # What optimization level to use
-! OPTFLAGS = -O2 
-  
-  # What options to be used by the compiler
-  COPTIONS = 
---- 1,11 ----
-  
-  # Which compiler to use
-! CC = gcc
-! OBJ_EXT=o
-! LIB_EXT=a
-  
-  # What optimization level to use
-! OPTFLAGS = -DLINUX -fPIC
-  
-  # What options to be used by the compiler
-  COPTIONS = 
Index: /issm/branches/trunk-jpl-damage/externalpackages/mitgcm/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/mitgcm/install.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/mitgcm/install.sh	(revision 12004)
@@ -6,14 +6,19 @@
 
 #Some cleanup
-rm -rf install  
+rm -rf install   bin exe
 
 #add cvs repository
 export CVSROOT=':pserver:cvsanon@mitgcm.org:/u/gcmpack'
 
+echo loging into MITgcm cvs: provide password, which is cvsanon
+cvs login
+
 #Download code from server
-cvs co -P MITgcm_code
+cvs login
+cvs co -P MITgcm
 
 #move
 mv MITgcm install
+
 
 #compile code
@@ -24,2 +29,5 @@
 make depend
 make -j 8
+
+
+
Index: /issm/branches/trunk-jpl-damage/externalpackages/mitgcm/notes
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/mitgcm/notes	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/mitgcm/notes	(revision 12004)
@@ -0,0 +1,112 @@
+Explanations of the code:  {{{1
+doc:  call Dimitris.
+
+Main code of MITgcm in 3 dir: 
+
+eesupp:  running the code on parallel  clusters. infrastructure for running MPI, shared memory, non-physics part of the code.
+	src: main.F: eeboo  (wrapper initialization)
+			     check_threads
+			     the_model_main
+			     eedie (wrapper termination)
+	inc
+
+
+model:  here is the model main.
+	src: the_model_main.F includes the base MITgcm code.
+	inc:
+
+pkg: do various physics. packages will not be compiled.
+   kpp: vertical mixing  parametization
+   gmred: isopicnel mixing parameterization. 
+  
+   thice: 
+   seaice: sea ice models
+   
+   shelfice: interacting with ice sheets
+   icefront 
+
+   cal: calendar correspondance between model time step and calendar time.
+
+   diagnostics: any physical variable that you want to look at. get output variables into output of the model.
+
+   debug: other kind of diagnostics, various levels of debug.
+
+   frazil: frazil ice.
+
+   atmospherics packages: fizhi, cheapaml
+
+   exch2: fancier way of exchanging data and tiling.
+
+
+jobs: forget about it.
+
+
+lsopt: forget it.
+
+optim: forget it.
+
+
+utils: 
+   matlab: bunch of matlab scripts.
+
+tools: build_options: platform dependent run files to be run with gene_make to generate the correct Makefile. 
+}}}
+How to run : {{{1
+All the verification tests are downloaded if you checkout the MITgcm repository instead of the 
+MITgcm_code: 
+cvs co -P MITgcm
+
+The verification tests are downloaded in MITgcm/verification. They can be run using 
+the testreport utility. Only a subset of the tests can be run if needed, by supplying 
+an option flag to tesstreport. 
+
+
+For our work, the relevant tests are: 
+labsea: sea ice
+ismip: shelf ice
+
+If you run a test like lab_sea: 
+
+./code/packages.conf: list of packages that we want to compile for this specific run.
+For each package, you at least need to modify code/size.h
+
+You can find the runtime parameters in: 
+input/data: runtime parameters  for model source
+input/eedata:runtime parameters  for eesupp source
+input/data.: runtime parameters for all packages
+intput/data.pkg: runtime parameters for packages that need to be run. subset of packages.conf
+
+The build directory holds the source and objects for the current test, with symlinks 
+
+If errors appear during the run, go into: 
+./run and find the STDERR file.
+
+To supply different Makefile templates for testreport:
+testreport -ef -opt Makefile_amd64_gfortran
+
+You can use matlab to plot the results: 
+use readbin from the labsea experiment or MITgcm/tools/matlab/rdmds
+
+There is an MITgcm_contrib repository for code that is not in the main trunk yet: 
+MITgcm_contrib/MPMice/beaufort presents a scenario for a quick coupler.
+
+}}}
+Extra nodes{{{
+cd install/verification/ 
+./testreport -of ../tools/build_options/linux_amd64_gfortran
+
+( results for baseline lab_sea verification
+  experiment are in verification/lab_sea/run )
+
+cd lab_sea/run
+there is routines in lab_sea/matlab
+
+ma
+addpath('../matlab')
+eta=readbin('Eta.0000000001.data',[20 16],1);
+pcolor(eta')
+colorbar
+
+addpath('../../../utils/matlab')
+eta=rdmds('Eta.0000000001');
+}}}
Index: /issm/branches/trunk-jpl-damage/externalpackages/modelE/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/modelE/install.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/modelE/install.sh	(revision 12004)
@@ -0,0 +1,17 @@
+#!/bin/bash
+#modelE  downloaded from the gis repository of the GISS (Goddard Institute for Space Studies)
+#at  http://www.giss.nasa.gov/tools/modelE/
+
+#Some cleanup
+rm -rf src install  modelE_AR5_branch
+mkdir src
+
+#Untar 
+tar -zxvf  modelE_AR5_branch.2012.03.13_10.12.21.tgz
+
+#Move modelE into install directory
+mv modelE_AR5_branch/* src
+rm -rf modelE_AR5_branch
+
+#Apply patches
+cd src 
Index: /issm/branches/trunk-jpl-damage/externalpackages/nose/install-macosx64sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/nose/install-macosx64sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/nose/install-macosx64sh	(revision 12004)
@@ -0,0 +1,10 @@
+#/bin/bash
+#Install Python3 nose module
+
+rm -rf py3k
+
+svn checkout http://python-nose.googlecode.com/svn/branches/py3k
+cd py3k
+
+python3.2 ./setup.py build
+python3.2 ./setup.py install
Index: /issm/branches/trunk-jpl-damage/externalpackages/packagemaker/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/packagemaker/install.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/packagemaker/install.sh	(revision 12004)
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+#Erase symlink
+rm -rf install
+
+#Select or create a new simlink
+ln -s /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/ install
Index: /issm/branches/trunk-jpl-damage/externalpackages/petsc/configs/3.1/win7/petscfix.h.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/petsc/configs/3.1/win7/petscfix.h.patch	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/petsc/configs/3.1/win7/petscfix.h.patch	(revision 12004)
@@ -0,0 +1,8 @@
+10c10
+< extern "C" {
+---
+> //extern "C" {
+14c14
+< }
+---
+> //}
Index: /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-2.3.2-macosx64.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-2.3.2-macosx64.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-2.3.2-macosx64.sh	(revision 12004)
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#Some cleanup
+rm -rf install petsc-2.3.2-p3 src
+mkdir install src
+
+#Untar and move petsc to install directory
+tar -zxvf  petsc-2.3.2-p3.tar.gz
+mv petsc-2.3.2-p3/* src/
+rm -rf petsc-2.3.2-p3
+
+#configure
+cd src
+./config/configure.py \
+  --prefix="$ISSM_TIER/externalpackages/petsc/install" \
+  --PETSC_DIR="$ISSM_TIER/externalpackages/petsc/src" \
+  --PETSC_ARCH=macosx-gnu \
+  --with-mpi-dir="$ISSM_TIER/externalpackages/mpich2/install" \
+  --with-debugging=0 \
+  --with-shared-libraries=0 \
+  --download-mumps=yes \
+  --download-scalapack=yes \
+  --download-blacs=yes \
+  --download-blas=yes \
+  --download-plapack=yes  \
+  --download-parmetis=yes \
+  --download-f-blas-lapack=yes 
+
+#Compile petsc and install it
+make
+make install
Index: /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-3.1-win7.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-3.1-win7.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-3.1-win7.sh	(revision 12004)
@@ -19,5 +19,9 @@
 	--with-debugging=0 \
 	--with-mpi=0 \
-	--download-c-blas-lapack=1
+	--download-c-blas-lapack=yes \
+	--with-cc='win32fe cl' \
+	--with-fc=0 \
+	--with-cxx='win32fe cl' \
+	--with-clanguage=cxx 
 
 #./config/configure.py  \
@@ -43,2 +47,4 @@
 make
 make install
+
+patch ../install/include/petscfix.h ../configs/3.1/win7/petscfix.h.patch
Index: /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-dev-linux64.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-dev-linux64.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/petsc/install-dev-linux64.sh	(revision 12004)
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+STEP=2
+
+if [ $STEP -eq 1 ]; then
+	# Adapted from petsc 3.2. 
+	# Used Mercurial to get code
+	hg clone http://petsc.cs.iit.edu/petsc/petsc-dev src
+	cd src
+	hg clone http://petsc.cs.iit.edu/petsc/BuildSystem config/BuildSystem
+fi
+
+# To update (via Mercurial):
+#      cd petsc-dev
+#      hg pull -u
+#      cd config/BuildSystem
+#      hg pull -u
+
+
+# configure script
+# Note: using metis from externalpackages did not work...
+# for now downloading new metis
+#   -then rename metis in externalpackages to metis2
+
+
+if [ $STEP -eq 2 ]; then
+	cd src
+	./config/configure.py \
+	--prefix="$ISSM_TIER/externalpackages/petsc/install" \
+	--with-mpi-dir="$ISSM_TIER/externalpackages/mpich2/install" \
+	--with-clanguage=C++ \
+	--PETSC_ARCH=linux-gnu-amd64 \
+	--PETSC_DIR="$ISSM_TIER/externalpackages/petsc/src" \
+	--with-debugging=0 \
+	--with-shared-libraries=0 \
+	--download-metis=yes \
+	--download-mumps=yes \
+	--download-scalapack=yes \
+	--download-blacs=yes \
+	--download-blas=yes \
+	--download-f-blas-lapack=yes \
+	--download-plapack=yes \
+	--download-parmetis=yes \
+	--with-pic=1
+
+	#Compile petsc and install it
+	make
+	make install
+fi
Index: /issm/branches/trunk-jpl-damage/externalpackages/python/install.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/python/install.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/python/install.sh	(revision 12004)
@@ -1,18 +1,24 @@
 #!/bin/bash
-#wget http://python.org/ftp/python/3.2.2/Python-3.2.2.tgz
+#wget http://python.org/ftp/python/version/Python-version.tgz
+
+version=3.2.2
+#version=2.7.2
 
 #Some cleanup
-rm -rf install
-rm -rf Python-3.2.2
-mkdir install
+rm -rf install src
+rm -rf Python-$version
+mkdir install src
+
+#exports
+export CC
 
 #Untar and move python into install directory
-tar -zxvf  Python-3.2.2.tgz
-mv Python-3.2.2/* install
-rm -rf Python-3.2.2
+tar -zxvf  Python-$version.tgz
+mv Python-$version/* src
+rm -rf Python-$version
 
 #Configure doxygen
-cd install 
-./configure --prefix "$ISSM_TIER/externalpackages/python/install"
+cd src 
+./configure --prefix="$ISSM_TIER/externalpackages/python/install" --enable-framework="$ISSM_TIER/externalpackages/python/install"
 if [ -z $1 ]; then
 	make
@@ -21,2 +27,13 @@
 fi
 make install
+
+#Some modifications to be done in case version is 3.2: 
+if [[ $version == "3.2.2" ]]; then 
+	cd install/bin
+	ln -s python3.2 python 
+	cd ../
+	ln -s Python.framework/Versions/3.2/include/python3.2m include
+	ln -s Python.framework/Versions/3.2/lib/ lib
+
+
+fi
Index: /issm/branches/trunk-jpl-damage/externalpackages/python/patch/pyport.h.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/python/patch/pyport.h.patch	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/python/patch/pyport.h.patch	(revision 12004)
@@ -0,0 +1,42 @@
+Index: Include/pyport.h
+===================================================================
+--- Include/pyport.h (revision 933)
++++ Include/pyport.h (working copy)
+@@ -514,22 +514,40 @@
+#if __FreeBSD_version > 500039
+#include <ctype.h>
+#include <wctype.h>
++/* If the source file #includes <cctype> before "Python.h" then
++ * these macros will not be defined at this point and we
++ * should not define them either.
++ */
++#ifdef isalnum
+#undef isalnum
+#define isalnum(c) iswalnum(btowc(c))
++#endif
++#ifdef isalpha
+#undef isalpha
+#define isalpha(c) iswalpha(btowc(c))
++#endif
++#ifdef islower
+#undef islower
+#define islower(c) iswlower(btowc(c))
++#endif
++#ifdef isspace
+#undef isspace
+#define isspace(c) iswspace(btowc(c))
++#endif
++#ifdef isupper
+#undef isupper
+#define isupper(c) iswupper(btowc(c))
++#endif
++#ifdef tolower
+#undef tolower
+#define tolower(c) towlower(btowc(c))
++#endif
++#ifdef toupper
+#undef toupper
+#define toupper(c) towupper(btowc(c))
+#endif
+#endif
++#endif
Index: /issm/branches/trunk-jpl-damage/externalpackages/python/patch/pyport.h.patch.bugreport
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/python/patch/pyport.h.patch.bugreport	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/python/patch/pyport.h.patch.bugreport	(revision 12004)
@@ -0,0 +1,1 @@
+http://bugs.python.org/issue10910
Index: /issm/branches/trunk-jpl-damage/externalpackages/scipy/README
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/scipy/README	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/scipy/README	(revision 12004)
@@ -0,0 +1,2 @@
+You will find instructions on scipy at: 
+http://www.scipy.org/Installing_SciPy/Mac_OS_X#head-ba1926aec910a9a1deaf9eff99e38ee23103a3b3
Index: /issm/branches/trunk-jpl-damage/externalpackages/scipy/install-macosx64.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/scipy/install-macosx64.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/scipy/install-macosx64.sh	(revision 12004)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+#1: install numpy
+#2 install scipy
+#3 erase
+install=2
+
+
+export CC=gcc
+export CXX=g++
+export FFLAGS=-ff2c
+
+
+if [[ $install == "1" ]];then 
+
+	#download numpy first
+	git clone https://github.com/numpy/numpy.git
+
+	#install numpy
+	cd numpy
+	python3.2 setup.py build
+	python3.2 setup.py install
+
+	
+elif [[ $install == "2" ]];then 
+	
+	#download scipy
+	git clone https://github.com/scipy/scipy.git
+
+	#install scipy
+	cd scipy
+	python3.2 setup.py build
+	python3.2 setup.py install
+
+elif [[ $install == "3" ]];then 
+	rm -rf numpy scipy
+else 
+	echo "Choice not covered"
+fi
Index: /issm/branches/trunk-jpl-damage/externalpackages/triangle/configs/android/android-4.0/configure.make
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/triangle/configs/android/android-4.0/configure.make	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/triangle/configs/android/android-4.0/configure.make	(revision 12004)
@@ -0,0 +1,19 @@
+# This makefile configures build process to cross-compile to the android platform.
+# The binary tools referenced below are specifically configuered to target armeabi-v7a.
+# Furthermore, the compilers (which are simply wrappers around GNU GCC) are set to
+# produce binaries that are EABI complient.
+#
+# Note that the AAPCS standard defines 'EABI' as a moniker used to specify
+# a _family_ of similar but distinct ABIs. Android follows the little-endian
+# ARM GNU/Linux ABI as documented in the following document:
+#
+# http://www.codesourcery.com/gnu_toolchains/arm/arm_gnu_linux_abi.pdf
+
+ANDROID_BIN=$(ISSM_TIER)/src/android/tmp/android-14-toolchain/bin
+CC=$(ANDROID_DEV_DIR)/tmp/android-linux-4.0/bin/arm-linux-androideabi-gcc
+AR=$(ANDROID_DEV_DIR)/tmp/android-linux-4.0/bin/arm-linux-androideabi-ar
+RANLIB=$(ANDROID_DEV_DIR)/tmp/android-linux-4.0/bin/arm-linux-androideabi-ranlib
+CSWITCHES = $(CFLAGS)  -I/usr/X11R6/include -L/usr/X11R6/lib -I$(MATLAB_DIR)/extern/include -fPIC -I$(MATLAB_DIR)/include
+TRILIBDEFS = -DTRILIBRARY
+OBJ_EXT=o
+LIB_EXT=a
Index: /issm/branches/trunk-jpl-damage/externalpackages/triangle/install-android-4.0.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/triangle/install-android-4.0.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/triangle/install-android-4.0.sh	(revision 12004)
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#use matlab? 
+matlab=0
+
+
+#Some cleanup 
+rm -rf install triangle
+mkdir install
+
+#Untar 
+cd install
+cp ../triangle.zip ./
+unzip triangle.zip
+
+#copy new makefile
+cp ../configs/android/android-4.0/configure.make ./
+cp ../makefile ./
+
+#Patch triangle.c 
+if [[ $matlab == "1" ]];then
+	patch triangle.c ../triangle.c.patch.matlab
+else
+	patch triangle.c ../triangle.c.patch.python
+fi
+
+#Compile triangle
+make
+
+#Patch triangle.h
+patch triangle.h ../triangle.h.patch
Index: /issm/branches/trunk-jpl-damage/externalpackages/triangle/install-macosx64.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/triangle/install-macosx64.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/triangle/install-macosx64.sh	(revision 12004)
@@ -1,3 +1,7 @@
 #!/bin/bash
+
+#use matlab? 
+matlab=0
+
 
 #Some cleanup 
@@ -15,5 +19,9 @@
 
 #Patch triangle.c 
-patch triangle.c ../triangle.c.patch
+if [[ $matlab == "1" ]];then
+	patch triangle.c ../triangle.c.patch.matlab
+else
+	patch triangle.c ../triangle.c.patch.python
+fi
 
 #Compile triangle
Index: /issm/branches/trunk-jpl-damage/externalpackages/triangle/makefile
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/triangle/makefile	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/triangle/makefile	(revision 12004)
@@ -4,5 +4,15 @@
 include ./configure.make
 
-AR = ar
+ifeq "$(origin CC)" "undefined"
+	CC = cc
+endif
+
+ifeq "$(origin AR)" "undefined"
+	AR = ar
+endif
+
+ifeq "$(origin RANLIB)" "undefined"
+	RANLIB = ranlib
+endif
 
 TRILIBDEFS = -DTRILIBRARY
@@ -13,6 +23,6 @@
 
 triangle.$(LIB_EXT): $(OBJECTS)
-	ar cr  triangle.$(LIB_EXT) $(OBJECTS)
-	ranlib triangle.$(LIB_EXT)
+	$(AR) cr  triangle.$(LIB_EXT) $(OBJECTS)
+	$(RANLIB) triangle.$(LIB_EXT)
 
 triangle.$(OBJ_EXT): triangle.c triangle.h
Index: /issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch.matlab
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch.matlab	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch.matlab	(revision 12004)
@@ -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/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch.python
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch.python	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.c.patch.python	(revision 12004)
@@ -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/branches/trunk-jpl-damage/externalpackages/triangle/triangle.h.patch
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.h.patch	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/triangle/triangle.h.patch	(revision 12004)
@@ -1,17 +1,25 @@
-249a250,253
+249a250,251
+> #ifndef _TRIANGLE_LIBRARY_H_
+> #define _TRIANGLE_LIBRARY_H_
+251c253,259
+< struct triangulateio {
+---
+> 
 > #ifndef REAL
 > typedef double REAL;
 > typedef void VOID;
 > #endif
-251c255
-< struct triangulateio {
----
+> 
 > extern "C" struct triangulateio {
-283c287
+283c291
 < void triangulate(char *, struct triangulateio *, struct triangulateio *,
 ---
 > extern "C" void triangulate(char *, struct triangulateio *, struct triangulateio *,
-285c289
+285c293
 < void trifree(VOID *memptr);
 ---
 > extern "C" void trifree(VOID *memptr);
+289a298,300
+> 
+> 
+> #endif //#ifndef _TRIANGLE_LIBRARY_H_
Index: /issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/c.vim
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/c.vim	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/vim/addons/vim/syntax/c.vim	(revision 12004)
@@ -406,5 +406,5 @@
 syn keyword	cType		Constraints DataSet Elements Inputs Loads Materials Nodes Parameters Results Vertices
 "Petsc
-syn keyword	cType		Vec Mat 
+syn keyword	cType		Vec Mat
 "other ISSM's syntax
 syn keyword	cType		mxArray ErrorException
@@ -427,4 +427,5 @@
 syn keyword cType GaussTria
 syn keyword cType GaussPenta
+syn keyword cType Load
 syn keyword cType Friction
 syn keyword cType Icefront
@@ -501,4 +502,6 @@
 syn keyword cType ElementMatrix
 syn keyword cType ElementVector
+syn keyword cType Vector
+syn keyword cType Matrix
 syn keyword cType BoolParam
 syn keyword cType DoubleMatParam
@@ -512,6 +515,6 @@
 syn keyword cType FileParam
 syn keyword cType Param
-syn keyword cType PetscMatParam
-syn keyword cType PetscVecParam
+syn keyword cType MatrixParam
+syn keyword cType VectorParam
 syn keyword cType StringArrayParam
 syn keyword cType StringParam
@@ -608,4 +611,5 @@
 syn keyword cConstant InversionIscontrolEnum
 syn keyword cConstant InversionTaoEnum
+syn keyword cConstant InversionIncompleteAdjointEnum
 syn keyword cConstant InversionMaxParametersEnum
 syn keyword cConstant InversionMaxiterPerStepEnum
@@ -689,6 +693,5 @@
 syn keyword cConstant SteadystateRequestedOutputsEnum
 syn keyword cConstant SurfaceEnum
-syn keyword cConstant SurfaceforcingsAblationRateEnum
-syn keyword cConstant SurfaceforcingsAccumulationRateEnum
+syn keyword cConstant SurfaceforcingsPrecipitationEnum
 syn keyword cConstant SurfaceforcingsMassBalanceEnum
 syn keyword cConstant ThermalMaxiterEnum
@@ -793,6 +796,6 @@
 syn keyword cConstant PentaEnum
 syn keyword cConstant PentaP1InputEnum
-syn keyword cConstant PetscMatParamEnum
-syn keyword cConstant PetscVecParamEnum
+syn keyword cConstant MatrixParamEnum
+syn keyword cConstant VectorParamEnum
 syn keyword cConstant RiftfrontEnum
 syn keyword cConstant SegmentEnum
Index: /issm/branches/trunk-jpl-damage/externalpackages/windows/InstallInstructions.txt
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/windows/InstallInstructions.txt	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/windows/InstallInstructions.txt	(revision 12004)
@@ -8,5 +8,7 @@
 -Make sure that when you install Matlab, you choose C:\MATLAB\R2011b as directory 
 for the installation. Failing to do so could preclude the sdk compiler from 
-finding the Matlab header files. 
+finding the Matlab header files.  Define environment variable:
+MATLAB_DIR="C:/MATLAB/R2011b" after you 'source $ISSM_TIER/etc/environment.sh'
+as described in the ISSM installation instructions below.
 
 -Also pay attention to what version of Matlab you are using, 32 or 64 bits, 
@@ -17,6 +19,6 @@
 Cygwin: 
 
--You will need cygwin installed on your Windows platform to manage the compilation. 
-The compilation will still be carried out by the windows sdk compiler, but the 
+-You will need cygwin installed on your Windows platform to manage the compilation.  Cygwin emulates
+unix behaviour on windows machines.  The compilation will still be carried out by the windows sdk compiler, but the
 environment driving the compilation will be the unix-like cygwin. When you download
 cygwin, make sure that you install it in the C:\Cygwin directory. 
@@ -60,5 +62,5 @@
 This is by far the most tricky part. 
 
-Follow Figure 2 for more details. You have to launch sdk 7.1 command prompt, go to the 
+Follow Sdk1.png and Sdk2.png for more details. You have to launch sdk 7.1 command prompt, go to the 
 cygwin directory and fire up Cygwin by executing Cygwin.bat. Once this is done,dump the 
 results of the export command onto a file, called  sdk7.1.win7.64.sh 
@@ -69,10 +71,10 @@
 Downloading issm: 
 
-Download issm onto the C:\ directory. Do not download it in your Documents or Desktop
+Download issm into the C:\ directory. Do not download it in your Documents or Desktop
 folder. 
 
 In cygwin: 
 cd /cygdrive/c/
-svn co http://issm.ess.uci.edi/svn/issm/issm
+svn co http://issm.ess.uci.edu/svn/issm/issm
 
 Once you download it, in your home directory, edit .bashrc: 
@@ -101,14 +103,12 @@
 cl hello.cpp
 
-If this does not work, do not go any further! The settings of your cl compiler are found 
-in externalpackages/windows/configs/ 
-if there is a significant different between you sdk7.1.win7.64.sh file (see above section Compiler) 
-and the file that is being sourced in the windows/configs directory, place your new file in 
-the configs directory. Relaunch bash, and try to run cl hello.cpp again. Beware, you might 
-have to erase some lines in your file, as cygwin might not like some of the stuff that your 
-Windows platform is trying to define. 
-
-
-
+If this does not work, do not go any further! The settings of your cl compiler are found
+in externalpackages/windows/configs/. If there is a significant different between your
+sdk7.1.win7.64.sh file (see above section Compiler) and the file that is being sourced in the windows/configs directory, place your new file in
+the configs directory. Relaunch bash, and try to run cl hello.cpp once more. Beware, you will likely
+have to erase some lines in your file, as cygwin might not like some of the stuff that your
+Windows platform is trying to define. To make sure that the correct bit compiler is
+being sourced in windows/configs (e.g. sdk7.1.win7-64.sh or sdk7.1.win7-32.sh) see
+section "One note about 32 vs 64 bit compile" below.
 
 Once the cl.exe compiler works, you can start installing the following packages: 
@@ -120,5 +120,8 @@
 For triangle, use install-win7.sh
 
-Once these externlapackages have been compiled, you can compile issm: 
+Once this is complete run the install.sh scripts in the autoconf and automake
+externalpackages directory
+
+Once these externalpackages have been compiled, you can compile issm: 
 
 ./scripts/autoremakererun.sh
@@ -131,21 +134,19 @@
 
 
-
-
 One note about 32 vs 64 bit compile: 
-depending on your Matlab version, you will need to do a 32 or 64 bit compile. The only 
-difference between both compiles is the setup of the cl.exe compiler. For ease of use, 
-you will find in externalpackages/windows/windows_environment.sh a switch to go from 32 
-to 64 bit compile. When you type cl.exe \help at the command prompt, cl.exe should report 
-what system it is compiling for. 
-Beware, switching 32 to 64 or vice-versa implies recompiling everything from scratch. 
-
-
-
+Depending on your Matlab version, you will need to do a 32 or 64 bit compile. The only
+difference between both compiles is the setup of the cl.exe compiler. For ease of use,
+you will find in externalpackages/windows/windows_environment.sh a switch to go from 32
+to 64 bit compile. When you type cl.exe \help at the command prompt, cl.exe should report
+what system it is compiling for. Beware, switching 32 to 64 or vice-versa implies recompiling everything from scratch.
 
 
 
 How to setup a Cron job? 
-downlaod exim and cron from cygwin. run exim-config (don't forget to launch your cygwin terminal as 
+Download exim and cron from cygwin setup. Run exim-config (don't forget to launch your cygwin terminal as
 Administrator). If asked for a daemon name, type ntsec. Also, if cron complains about sendmail,
-symlink /usr/lib/sendmail and /usr/bin/exim. 
+symlink /usr/lib/sendmail to /usr/sbin/sendmail.  Then link /usr/sbin/sendmail
+to /usr/bin/exim. Alternatively, if you have an smtp server, you can download and configure
+ssmtp.  Run ssmtp-config
+as Administrator and link /usr/sbin/sendmail to /usr/bin/ssmtp. After the email has been configured,
+run cron-config as Administrator.
Index: /issm/branches/trunk-jpl-damage/externalpackages/windows/configs/sdk7.1.win7-32.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/windows/configs/sdk7.1.win7-32.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/windows/configs/sdk7.1.win7-32.sh	(revision 12004)
@@ -1,10 +1,6 @@
 declare -x ALLUSERSPROFILE="C:\\ProgramData"
-declare -x APPDATA="C:\\Users\\larour\\AppData\\Roaming"
-declare -x APPVER="6.1"
 declare -x CL="/AI C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319"
 declare -x COMMONPROGRAMFILES="C:\\Program Files (x86)\\Common Files"
-declare -x COMPUTERNAME="WIN-IH1FCG0JVB1"
 declare -x COMSPEC="C:\\Windows\\system32\\cmd.exe"
-declare -x CURRENT_CPU="x64"
 declare -x CommandPromptType="Cross"
 declare -x CommonProgramW6432="C:\\Program Files\\Common Files"
@@ -12,10 +8,5 @@
 declare -x FP_NO_HOST_CHECK="NO"
 declare -x FrameworkVersion="v4.0.30319"
-declare -x GREP_COLOR="00;38;5;226"
-declare -x GREP_OPTIONS="--binary-file=without-match"
-declare -x HOME="/home/larour"
 declare -x HOMEDRIVE="C:"
-declare -x HOMEPATH="\\Users\\larour"
-declare -x HOSTNAME="WIN-IH1FCG0JVB1"
 declare -x INCLUDE="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\INCLUDE;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\INCLUDE\\gl;C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\INCLUDE;"
 declare -x INFOPATH="/usr/local/info:/usr/share/info:/usr/info:"
@@ -23,12 +14,7 @@
 declare -x LIB="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Lib;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Windows\\Microsoft.NET\\Framework\\v3.5;;C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\ATLMFC\\LIB;"
 declare -x LIBPATH="C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Windows\\Microsoft.NET\\Framework\\v3.5;;C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Lib;"
-declare -x LOCALAPPDATA="C:\\Users\\larour\\AppData\\Local"
-declare -x LOGONSERVER="\\\\WIN-IH1FCG0JVB1"
 declare -x MANPATH="/usr/local/man:/usr/share/man:/usr/man:"
-declare -x NUMBER_OF_PROCESSORS="8"
-declare -x OS="Windows_NT"
 declare -x PATH="/usr/local/bin:/usr/bin:/cygdrive/c/Windows/Microsoft.NET/Framework/v4.0.30319:/cygdrive/c/Windows/Microsoft.NET/Framework/v3.5:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/VCPackages:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin/NETFX 4.0 Tools:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft Windows Performance Toolkit:/cygdrive/c/MATLAB/R2011b32/runtime/win32:/cygdrive/c/MATLAB/R2011b32/bin:/cygdrive/c/MATLAB/R2011b/runtime/win64:/cygdrive/c/MATLAB/R2011b/bin:/cygdrive/c/Program Files (x86)/Microsoft SQL Server/100/Tools/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/100/Tools/Binn:/cygdrive/c/Program Files/Microsoft SQL Server/100/DTS/Binn:/cygdrive/c/Program Files/Microsoft Network Monitor 3"
 declare -x PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
-declare -x PRINTER="137.78.140.129#:1"
 declare -x PROCESSOR_ARCHITECTURE="x86"
 declare -x PROCESSOR_ARCHITEW6432="AMD64"
@@ -37,30 +23,14 @@
 declare -x PROCESSOR_REVISION="2a07"
 declare -x PROGRAMFILES="C:\\Program Files (x86)"
-declare -x PROMPT="\$P\$G"
-declare -x PS1="\\[\\e]0;\\w\\a\\]\\n\\[\\e[32m\\]\\u@\\h \\[\\e[33m\\]\\w\\[\\e[0m\\]\\n\\\$ "
 declare -x PSModulePath="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\"
 declare -x PUBLIC="C:\\Users\\Public"
-declare -x PWD="/cygdrive/c/issm-uci/trunk-jpl-32/externalpackages/win7"
 declare -x PlatformToolset="Windows7.1SDK"
 declare -x ProgramData="C:\\ProgramData"
 declare -x ProgramW6432="C:\\Program Files"
-declare -x REPO="jpl"
-declare -x SESSIONNAME="Console"
 declare -x SHELL="/bin/bash"
-declare -x SHLVL="1"
-declare -x SVN_EDITOR="/usr/bin/vim"
 declare -x SYSTEMDRIVE="C:"
 declare -x SYSTEMROOT="C:\\Windows"
-declare -x TARGET_CPU="x86"
 declare -x TARGET_PLATFORM="WIN7"
-declare -x TEMP="/tmp"
 declare -x TERM="cygwin"
-declare -x TMP="/tmp"
-declare -x TZ="America/Los_Angeles"
-declare -x ToolsVersion="4.0"
-declare -x USER="larour"
-declare -x USERDOMAIN="WIN-IH1FCG0JVB1"
-declare -x USERNAME="larour"
-declare -x USERPROFILE="C:\\Users\\larour"
 declare -x VS100COMNTOOLS="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools\\"
 declare -x WINDIR="C:\\Windows"
@@ -68,6 +38,2 @@
 declare -x WindowsSDKVersionOverride="v7.1"
 declare -x sdkdir="C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\"
-declare -x temp="C:\\Users\\larour\\AppData\\Local\\Temp"
-declare -x tmp="C:\\Users\\larour\\AppData\\Local\\Temp"
-declare -x windows_tracing_flags="3"
-declare -x windows_tracing_logfile="C:\\BVTBin\\Tests\\installpackage\\csilogfile.log"
Index: /issm/branches/trunk-jpl-damage/externalpackages/windows/configs/sdk7.1.win7-64.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/windows/configs/sdk7.1.win7-64.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/windows/configs/sdk7.1.win7-64.sh	(revision 12004)
@@ -1,9 +1,5 @@
 declare -x ALLUSERSPROFILE="C:\\ProgramData"
-declare -x APPDATA="C:\\Users\\larour\\AppData\\Roaming"
-declare -x APPVER="6.1"
 declare -x CL="/AI C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319"
 declare -x COMMONPROGRAMFILES="C:\\Program Files (x86)\\Common Files"
-declare -x COMPUTERNAME="WIN-IH1FCG0JVB1"
-declare -x COMSPEC="C:\\Windows\\system32\\cmd.exe"
 declare -x CURRENT_CPU="x64"
 declare -x CommandPromptType="Native"
@@ -12,10 +8,4 @@
 declare -x FP_NO_HOST_CHECK="NO"
 declare -x FrameworkVersion="v4.0.30319"
-declare -x GREP_COLOR="00;38;5;226"
-declare -x GREP_OPTIONS="--binary-file=without-match"
-declare -x HOME="/home/larour"
-declare -x HOMEDRIVE="C:"
-declare -x HOMEPATH="\\Users\\larour"
-declare -x HOSTNAME="WIN-IH1FCG0JVB1"
 declare -x INCLUDE="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\INCLUDE;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\INCLUDE\\gl;"
 declare -x INFOPATH="/usr/local/info:/usr/share/info:/usr/info:"
@@ -23,13 +13,8 @@
 declare -x LIB="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Lib\\amd64;C:\\Program Files\\Microsoft SDKs\\Windows\\v7.1\\Lib\\X64;"
 declare -x LIBPATH="C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319;C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319;C:\\Windows\\Microsoft.NET\\Framework64\\v3.5;C:\\Windows\\Microsoft.NET\\Framework\\v3.5;;C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\Lib\\amd64;"
-declare -x LOCALAPPDATA="C:\\Users\\larour\\AppData\\Local"
-declare -x LOGONSERVER="\\\\WIN-IH1FCG0JVB1"
+declare -x LOCALAPPDATA="C:\\Users\\schlegel\\AppData\\Local"
 declare -x MANPATH="/usr/local/man:/usr/share/man:/usr/man:"
-declare -x NUMBER_OF_PROCESSORS="1"
-declare -x OLDPWD="/cygdrive/c/issm-uci/trunk-jpl/externalpackages"
-declare -x OS="Windows_NT"
-declare -x PATH="/usr/local/bin:/usr/bin:/cygdrive/c/Windows/Microsoft.NET/Framework64/v4.0.30319:/cygdrive/c/Windows/Microsoft.NET/Framework/v4.0.30319:/cygdrive/c/Windows/Microsoft.NET/Framework64/v3.5:/cygdrive/c/Windows/Microsoft.NET/Framework/v3.5:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/VCPackages:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin/NETFX 4.0 Tools/x64:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin/x64:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft Windows Performance Toolkit:/cygdrive/c/MATLAB/R2011b/runtime/win64:/cygdrive/c/MATLAB/R2011b/bin"
+declare -x PATH="/usr/local/bin:/usr/bin:/usr/include:/cygdrive/c/cygwin/usr/bin:/cygdrive/c/cygwin/usr/include:/cygdrive/c/Windows/Microsoft.NET/Framework64/v4.0.30319:/cygdrive/c/Windows/Microsoft.NET/Framework/v4.0.30319:/cygdrive/c/Windows/Microsoft.NET/Framework64/v3.5:/cygdrive/c/Windows/Microsoft.NET/Framework/v3.5:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/Tools:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64:/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/VCPackages:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin/NETFX 4.0 Tools/x64:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin/x64:/cygdrive/c/Program Files/Microsoft SDKs/Windows/v7.1/Bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files/Microsoft Windows Performance Toolkit:/cygdrive/c/MATLAB/R2011b/runtime/win64:/cygdrive/b/MATLAB/R2011b/bin:/cygdrive/c/MATLAB/R2011b/extern/include:/cygdrive/c/MATLAB/R2011a/runtime/win64:/cygdrive/c/MATLAB/R2011a/bin:/cygdrive/c/MATLAB/R2011a/extern/include"
 declare -x PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC"
-declare -x PRINTER="137.78.140.129#:1"
 declare -x PROCESSOR_ARCHITECTURE="x86"
 declare -x PROCESSOR_ARCHITEW6432="AMD64"
@@ -39,8 +24,6 @@
 declare -x PROGRAMFILES="C:\\Program Files (x86)"
 declare -x PROMPT="\$P\$G"
-declare -x PS1="\\[\\e]0;\\w\\a\\]\\n\\[\\e[32m\\]\\u@\\h \\[\\e[33m\\]\\w\\[\\e[0m\\]\\n\\\$ "
 declare -x PSModulePath="C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\"
 declare -x PUBLIC="C:\\Users\\Public"
-declare -x PWD="/cygdrive/c/issm-uci/trunk-jpl/externalpackages/win7"
 declare -x PlatformToolset="Windows7.1SDK"
 declare -x ProgramData="C:\\ProgramData"
@@ -49,4 +32,5 @@
 declare -x SESSIONNAME="Console"
 declare -x SHLVL="1"
+declare -x HOMEDRIVE="C:"
 declare -x SYSTEMDRIVE="C:"
 declare -x SYSTEMROOT="C:\\Windows"
@@ -57,8 +41,6 @@
 declare -x TMP="/tmp"
 declare -x ToolsVersion="4.0"
-declare -x USER="larour"
-declare -x USERDOMAIN="WIN-IH1FCG0JVB1"
-declare -x USERNAME="larour"
-declare -x USERPROFILE="C:\\Users\\larour"
+declare -x USER="schlegel"
+declare -x USERNAME="schlegel"
 declare -x VS100COMNTOOLS="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\Tools\\"
 declare -x WINDIR="C:\\Windows"
Index: /issm/branches/trunk-jpl-damage/externalpackages/windows/windows_environment.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/externalpackages/windows/windows_environment.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/externalpackages/windows/windows_environment.sh	(revision 12004)
@@ -10,5 +10,5 @@
 # 4: intel compiler on WinXP
 
-compiler=1;
+compiler=2;
 
 #source corresponding environment variables: 
Index: sm/branches/trunk-jpl-damage/install-sh
===================================================================
--- /issm/branches/trunk-jpl-damage/install-sh	(revision 12003)
+++ 	(revision )
@@ -1,519 +1,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2006-12-25.00
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" ""	$nl"
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit=${DOITPROG-}
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
-stripcmd=
-
-src=
-dst=
-dir_arg=
-dst_arg=
-
-copy_on_change=false
-no_target_directory=
-
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
-     --help     display this help and exit.
-     --version  display version info and exit.
-
-  -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
-  -d            create directories instead of installing files.
-  -g GROUP      $chgrpprog installed files to GROUP.
-  -m MODE       $chmodprog installed files to MODE.
-  -o USER       $chownprog installed files to USER.
-  -s            $stripprog installed files.
-  -t DIRECTORY  install into DIRECTORY.
-  -T            report an error if DSTFILE is a directory.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
-  RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
-  case $1 in
-    -c) ;;
-
-    -C) copy_on_change=true;;
-
-    -d) dir_arg=true;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-	shift;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) mode=$2
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-	shift;;
-
-    -o) chowncmd="$chownprog $2"
-	shift;;
-
-    -s) stripcmd=$stripprog;;
-
-    -t) dst_arg=$2
-	shift;;
-
-    -T) no_target_directory=true;;
-
-    --version) echo "$0 $scriptversion"; exit $?;;
-
-    --)	shift
-	break;;
-
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
-
-    *)  break;;
-  esac
-  shift
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $@.
-  for arg
-  do
-    if test -n "$dst_arg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dst_arg"
-      shift # fnord
-    fi
-    shift # arg
-    dst_arg=$arg
-  done
-fi
-
-if test $# -eq 0; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call `install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
-
-if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
-
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
-
-for src
-do
-  # Protect names starting with `-'.
-  case $src in
-    -*) src=./$src;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
-
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dst_arg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-
-    dst=$dst_arg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst;;
-    esac
-
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
-    if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dst_arg: Is a directory" >&2
-	exit 1
-      fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
-      test -d "$dstdir"
-      dstdir_status=$?
-    fi
-  fi
-
-  obsolete_mkdir_used=false
-
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
-	else
-	  mkdir_mode=
-	fi
-
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
-    esac
-
-    if
-      $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
-
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-	/*) prefix='/';;
-	-*) prefix='./';;
-	*)  prefix='';;
-      esac
-
-      eval "$initialize_posix_glob"
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob set -f
-      set fnord $dstdir
-      shift
-      $posix_glob set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-	test -z "$d" && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
-      done
-
-      if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
-      fi
-    fi
-  fi
-
-  if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
-  else
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
-    # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
-    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
-    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # If -C, don't bother to copy if it wouldn't change the file.
-    if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
-       set X $old && old=:$2:$4:$5:$6 &&
-       set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
-       test "$old" = "$new" &&
-       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
-    then
-      rm -f "$dsttmp"
-    else
-      # Rename the file to the real destination.
-      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
-      # The rename failed, perhaps because mv can't rename something else
-      # to itself, or perhaps because mv is so ancient that it does not
-      # support -f.
-      {
-	# Now remove or move aside any old file at destination location.
-	# We try this two ways since rm can't unlink itself on some
-	# systems and the destination file might be busy for other
-	# reasons.  In this case, the final cleanup might fail but the new
-	# file should still install successfully.
-	{
-	  test ! -f "$dst" ||
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-	  } ||
-	  { echo "$0: cannot unlink or rename $dst" >&2
-	    (exit 1); exit 1
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
-      }
-    fi || exit 1
-
-    trap '' 0
-  fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
Index: /issm/branches/trunk-jpl-damage/m4/issm_options.m4
===================================================================
--- /issm/branches/trunk-jpl-damage/m4/issm_options.m4	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/m4/issm_options.m4	(revision 12004)
@@ -4,17 +4,17 @@
 
 	dnl ISSM's internal options
-	dnl Debugging {{{1
-	AC_ARG_ENABLE([debugging],AS_HELP_STRING([--enable-debugging],
-					 [turn debug support on]),
-		[enable_debugging=$enableval],[enable_debugging=no])
+	dnl Debugging {{{
+	AC_ARG_ENABLE([debugging],                                        dnl feature
+		AS_HELP_STRING([--enable-debugging],[turn debug support on]),  dnl help string
+		[enable_debugging=$enableval],                                 dnl action if given
+		[enable_debugging=no])                                         dnl action if not given
 	if test "x$enable_debugging" = xyes; then
-	 AC_DEFINE([_ISSM_DEBUG_],[1],[Macro to enable debugging in ISSM.])
-	fi
-	dnl }}}
-	dnl Serial build {{{1
+		AC_DEFINE([_ISSM_DEBUG_],[1],[Macro to enable debugging in ISSM])
+	fi
+	dnl }}}
+	dnl Serial build {{{
 	AC_ARG_WITH([serial],
-			  AS_HELP_STRING([--with-serial = value],
-							 [serial compilation. ]),
-			  [SERIAL_VALUE=$withval],[SERIAL_VALUE="yes"])
+		AS_HELP_STRING([--with-serial = value],[serial compilation. ]),
+		[SERIAL_VALUE=$withval],[SERIAL_VALUE="yes"])
 	AC_MSG_CHECKING(for serial compilation)
 	AM_CONDITIONAL([NOSERIAL], [test $SERIAL_VALUE = no])
@@ -22,9 +22,8 @@
 	AC_MSG_RESULT($SERIAL_VALUE) 
 	dnl }}}
-	dnl Parallel build {{{1
+	dnl Parallel build {{{
 	AC_ARG_WITH([parallel],
-			  AS_HELP_STRING([--with-parallel = value],
-							 [parallel compilation. ]),
-			  [PARALLEL_VALUE=$withval],[PARALLEL_VALUE="yes"])
+		AS_HELP_STRING([--with-parallel = value], [parallel compilation. ]),
+		[PARALLEL_VALUE=$withval],[PARALLEL_VALUE="yes"])
 	AC_MSG_CHECKING(for parallel compilation)
 	AM_CONDITIONAL([NOPARALLEL], [test $PARALLEL_VALUE = no])
@@ -34,9 +33,9 @@
 	AC_SUBST([ISSMEXT])
 	dnl }}}
-	dnl Serial or Parallel check {{{1
+	dnl Serial or Parallel check {{{
 	dnl Check that at least serial or parallel builds have been requested!
 	if test "$SERIAL_VALUE" != "yes" ; then
 		if test "$PARALLEL_VALUE" != "yes"; then
-		AC_MSG_ERROR([cannot request --with-serial=no and --with-parallel=no at the same time!])
+			AC_MSG_ERROR([cannot request --with-serial=no and --with-parallel=no at the same time!])
 		fi
 	fi
@@ -44,7 +43,8 @@
 
 	dnl ISSM's externalpackages
-	dnl vendor{{{1
+	dnl vendor{{{
 	AC_ARG_WITH([vendor],
-			  AS_HELP_STRING([--with-vendor = VENDOR], [vendor name, ex: intel]), [VENDOR=$withval],[VENDOR=""]) 
+	  AS_HELP_STRING([--with-vendor = VENDOR], [vendor name, ex: intel]),
+	  [VENDOR=$withval],[VENDOR=""]) 
 	AC_MSG_CHECKING(for vendor compilers)
 	if test -n "$VENDOR"; then
@@ -88,19 +88,89 @@
 	AC_MSG_RESULT(done)
 	dnl }}}
-	dnl Matlab {{{1
+	dnl Matlab{{{
+
+	dnl 1. See if matlab has been provided
 	AC_ARG_WITH([matlab-dir],
-			  AS_HELP_STRING([--with-matlab-dir = DIR],
-							 [matlab root directory. necessary for serial build.]),
-			 [MATLAB_ROOT=$withval],[MATLAB_ROOT=""]) 
-	
+		AS_HELP_STRING([--with-matlab-dir = DIR], [matlab root directory. necessary for serial build.]),
+		[MATLAB_ROOT=$withval],[MATLAB_ROOT=""]) 
+
+	AC_MSG_CHECKING([wether Matlab is enabled])
 	if test -d "$MATLAB_ROOT"; then
-
-		dnl matlab version (matlab.m4)
-		AX_MATLAB_VERSION
-
+		HAVE_MATLAB=yes
+	else
+		HAVE_MATLAB=no
+	fi
+	if test x$HAVE_MATLAB = xyes; then
+		AC_DEFINE([_HAVE_MATLAB_],[1],[with Matlab in ISSM src])
+	fi
+	AC_MSG_RESULT($HAVE_MATLAB)
+	AM_CONDITIONAL([MATLAB], [test x$HAVE_MATLAB = xyes])
+
+	dnl 2. if matlab is provided, get version number
+	if test x$HAVE_MATLAB = xyes; then
+		AC_MSG_CHECKING([for Matlab version])
+		MATLAB_VERSION=""
+
+		dnl For Matlab R2008a and more, the version number is stored in .VERSION
+		if test -f "$MATLAB_ROOT/.VERSION" ; then
+			MATLAB_VERSION=$(cat $MATLAB_ROOT/.VERSION)
+		fi
+		dnl Otherwise find version in file stored in bin/util/mex/version.txt
+		if test -f "$MATLAB_ROOT/bin/util/mex/version.txt" ; then
+			MATLAB_VERSION=$(cat $MATLAB_ROOT/bin/util/mex/version.txt)
+		fi
+
+		dnl check that we found the version
+		if test -z "$MATLAB_VERSION" ; then
+			AC_MSG_ERROR([Matlab version not found])
+		fi
+
+		case $MATLAB_VERSION in
+			@<:@1-9@:>@.@<:@0-9@:>@ | @<:@1-9@:>@@<:@0-9@:>@.@<:@0-9@:>@ | @<:@1-9@:>@.@<:@1-9@:>@@<:@0-9@:>@)
+				MATLAB_MAJOR=$(echo $MATLAB_VERSION | sed -e "s/^\(@<:@0-9@:>@*\)\.@<:@0-9@:>@*.*/\1/")
+				MATLAB_MINOR=$(echo $MATLAB_VERSION | sed -e "s/^@<:@0-9@:>@*\.\(@<:@0-9@:>@*\).*/\1/")
+				;;
+			R2007a)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=4
+			  ;;
+			R2008a)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=6
+			  ;;
+			R2009a)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=8
+			  ;;
+			R2010a)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=10
+			  ;;
+			R2010b)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=11
+			  ;;
+			R2011a)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=12
+			  ;;
+			R2011b)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=13
+			  ;;
+			R2012a)
+			  MATLAB_MAJOR=7
+			  MATLAB_MINOR=14
+			  ;;
+			*)
+			  AC_MSG_ERROR([can not determine Matlab version number])
+			esac
+		AC_SUBST([MATLAB_VERSION])
+		AC_SUBST([MATLAB_MAJOR])
+		AC_SUBST([MATLAB_MINOR])
+		AC_MSG_RESULT($MATLAB_VERSION ($MATLAB_MAJOR.$MATLAB_MINOR))
+
+		dnl 3. Get Matlab libraries
 		AC_MSG_CHECKING(for Matlab headers and libraries in $MATLAB_ROOT)
-
-		dnl defaults
-		HAVE_MATLAB=yes
 		MATLABINCL=-I"$MATLAB_ROOT/extern/include";
 		
@@ -120,5 +190,4 @@
 			;;
 			*darwin*)
-
 				dnl mex -v gives all the flags for compilation of mex files
 				dnl if matlab version is 7.10 or more, we must use mexmaci64 (64 bits)
@@ -131,10 +200,6 @@
 					 fi
 				fi
-
 				MEXEXT=`$MATLAB_ROOT/bin/mexext`
 				MEXEXT=".$MEXEXT"
-
-				dnl Old MEXLINK
-				dnl MEXLINK="-Wl,-twolevel_namespace -undefined error -arch i386 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -bundle -Wl,-exported_symbols_list,$MATLAB_ROOT/extern/lib/maci/mexFunction.map"
 			;;
 			*cygwin*) 
@@ -148,57 +213,15 @@
 			;;
 		esac
-
-		AC_DEFINE([_HAVE_MATLAB_],[1],[with Matlab in ISSM src])
+	   AC_MSG_RESULT(done)
+
 		AC_SUBST([MATLABINCL])
 		AC_SUBST([MEX])
-		AC_SUBST([MEXEXT])
+		WRAPPEREXT=$MEXEXT
+		AC_SUBST([WRAPPEREXT])
 		AC_SUBST([MEXLIB]) 
 		AC_SUBST([MEXLINK])
-	
-		AC_MSG_RESULT($HAVE_MATLAB)
-	else
-		HAVE_MATLAB=no
-	fi
-
-	
-	if test $HAVE_MATLAB = no; then
-		if test "$SERIAL_VALUE" = "yes" ; then
-			AC_MSG_ERROR([--with-matlab-dir  missing. Matlab is needed to run ISSM serially!])
-		fi
-	fi
-
-	dnl should we use large arrays compilation (Matlab 7.5 and upper?)
-	if test $HAVE_MATLAB = yes; then
-		
-		dnl  if matlab version is 7.5 and more, and if platform is x86_64, then compile with largearray
-		dnl  default is no 
-		largearrays=no
-		if test $MATLAB_MAJOR -ge 7; then 
-			if test $MATLAB_MINOR -ge 5; then 
-				case "${host_os}" in
-					*linux*)
-						if test "${host_cpu}" = "x86_64"; then
-							largearrays=yes 
-						fi
-					;;
-					*cygwin*)
-						largearrays=yes 
-					;;
-
-					*darwin*)
-						if test $MATLAB_MAJOR -ge 7; then 
-							if test $MATLAB_MINOR -ge 10; then
-								largearrays=yes
-							fi
-						fi
-					;;
-				esac
-			fi
-		fi
-	fi
-	AM_CONDITIONAL(LARGEARRAYS, test x$largearrays = xyes)
-	
-	dnl }}}
-	dnl triangle {{{1
+	fi
+	dnl }}}
+	dnl triangle {{{
 	AC_ARG_WITH([triangle-dir],
 			  AS_HELP_STRING([--with-triangle-dir = DIR], [triangle root directory. necessary for serial build]),
@@ -241,8 +264,8 @@
 	AC_MSG_RESULT(ok)
 	dnl }}}
-	dnl dakota{{{1
+	dnl dakota{{{
 	AC_ARG_WITH([dakota-dir],
-			  AS_HELP_STRING([--with-dakota-dir = DIR], [dakota root directory. necessary for serial build]),
-			 [DAKOTA_ROOT=$withval],[DAKOTA_ROOT=""]) 
+	  AS_HELP_STRING([--with-dakota-dir = DIR], [dakota root directory. necessary for serial build]),
+	  [DAKOTA_ROOT=$withval],[DAKOTA_ROOT=""]) 
 	AC_MSG_CHECKING(for Dakota)
 	
@@ -274,8 +297,73 @@
 	AC_MSG_RESULT($HAVE_DAKOTA)
 	dnl }}}
-	dnl chaco{{{1
+	dnl boost{{{
+	AC_ARG_WITH([boost-dir],
+	  AS_HELP_STRING([--with-boost-dir = DIR], [boost root directory.]),
+	  [BOOST_ROOT=$withval],[BOOST_ROOT=""]) 
+	AC_MSG_CHECKING(for Boost)
+	
+	if test -d "$BOOST_ROOT"; then
+		dnl defaults
+		HAVE_BOOST=yes
+		BOOSTINCL=-I$BOOST_ROOT/include
+		BOOSTLIB="-L$BOOST_ROOT/lib -lboost_python"
+
+		AC_DEFINE([_HAVE_BOOST_],[1],[with Boost in ISSM src])
+		AC_SUBST([BOOSTINCL])
+		AC_SUBST([BOOSTLIB])
+	else
+		HAVE_BOOST=no
+	fi
+	AM_CONDITIONAL([BOOST], [test x$HAVE_BOOST = xyes])
+	AC_MSG_RESULT($HAVE_BOOST)
+	dnl }}}
+	dnl python{{{
+	AC_ARG_WITH([python-dir],
+	  AS_HELP_STRING([--with-python-dir = DIR], [python root directory.]),
+	  [PYTHON_ROOT=$withval],[PYTHON_ROOT=""]) 
+	AC_MSG_CHECKING(for Python)
+	
+	if test -d "$PYTHON_ROOT"; then
+		dnl defaults
+		HAVE_PYTHON=yes
+		PYTHONINCL=-I$PYTHON_ROOT/include
+		PYTHONLIB="-L$PYTHON_ROOT/lib -lpython3.2"
+		PYTHONEXT=.so
+		PYTHONLINK="-dynamiclib"
+
+		AC_DEFINE([_HAVE_PYTHON_],[1],[with Python in ISSM src])
+		AC_SUBST([PYTHONINCL])
+		AC_SUBST([PYTHONLIB])
+		WRAPPEREXT=$PYTHONEXT
+		AC_SUBST([WRAPPEREXT])
+		AC_SUBST([PYTHONLINK])
+	else
+		HAVE_PYTHON=no
+	fi
+	AM_CONDITIONAL([PYTHON], [test x$HAVE_PYTHON = xyes])
+	AC_MSG_RESULT($HAVE_PYTHON)
+	dnl }}}
+	dnl python-numpy{{{
+	AC_ARG_WITH([python-numpy-dir],
+	  AS_HELP_STRING([--with-python-numpy-dir = DIR], [python-numpy root directory.]),
+	  [PYTHON_NUMPY_ROOT=$withval],[PYTHON_NUMPY_ROOT=""]) 
+	AC_MSG_CHECKING(for Python-Numpy)
+	
+	if test -d "$PYTHON_NUMPY_ROOT"; then
+		dnl defaults
+		HAVE_PYTHON_NUMPY=yes
+		PYTHON_NUMPYINCL=-I$PYTHON_NUMPY_ROOT
+
+		AC_DEFINE([_HAVE_PYTHON_NUMPY_],[1],[with Python-Numpy in ISSM src])
+		AC_SUBST([PYTHON_NUMPYINCL])
+	else
+		HAVE_PYTHON_NUMPY=no
+	fi
+	AC_MSG_RESULT($HAVE_PYTHON_NUMPY)
+	dnl }}}
+	dnl chaco{{{
 	AC_ARG_WITH([chaco-dir],
-			  AS_HELP_STRING([--with-chaco-dir = DIR], [chaco root directory.]),
-			 [CHACO_ROOT=$withval],[CHACO_ROOT=""]) 
+	  AS_HELP_STRING([--with-chaco-dir = DIR], [chaco root directory.]),
+	  [CHACO_ROOT=$withval],[CHACO_ROOT=""]) 
 	AC_MSG_CHECKING(for Chaco)
 	
@@ -296,8 +384,8 @@
 	AC_MSG_RESULT($HAVE_CHACO)
 	dnl }}}
-	dnl scotch{{{1
+	dnl scotch{{{
 	AC_ARG_WITH([scotch-dir],
-			  AS_HELP_STRING([--with-scotch-dir = DIR], [scotch root directory.]),
-			 [SCOTCH_ROOT=$withval],[SCOTCH_ROOT=""]) 
+	  AS_HELP_STRING([--with-scotch-dir = DIR], [scotch root directory.]),
+	  [SCOTCH_ROOT=$withval],[SCOTCH_ROOT=""]) 
 	AC_MSG_CHECKING(for Scotch)
 	
@@ -309,5 +397,4 @@
 		SCOTCHLIB="-L$SCOTCH_ROOT/lib -lnfioscotch -lnfioscotcherr -lnfioscotcherrexit -lscotchmetis"
 
-
 		AC_DEFINE([_HAVE_SCOTCH_],[1],[with Scotch in ISSM src])
 		AC_SUBST([SCOTCHINCL])
@@ -319,8 +406,8 @@
 	AC_MSG_RESULT($HAVE_SCOTCH)
 	dnl }}}
-	dnl adolc{{{1
+	dnl adolc{{{
 	AC_ARG_WITH([adolc-dir],
-			  AS_HELP_STRING([--with-adolc-dir = DIR], [adolc root directory.]),
-			 [ADOLC_ROOT=$withval],[ADOLC_ROOT="no"]) 
+		AS_HELP_STRING([--with-adolc-dir = DIR], [adolc root directory.]),
+		[ADOLC_ROOT=$withval],[ADOLC_ROOT="no"]) 
 	AC_MSG_CHECKING(for ADOLC)
 
@@ -347,8 +434,8 @@
 	AC_MSG_RESULT($HAVE_ADOLC)
 	dnl }}}
-	dnl adic2{{{1
+	dnl adic2{{{
 	AC_ARG_WITH([adic2-dir],
-			  AS_HELP_STRING([--with-adic2-dir = DIR], [adic2 root directory.]),
-			 [ADIC2_ROOT=$withval],[ADIC2_ROOT="no"]) 
+	  AS_HELP_STRING([--with-adic2-dir = DIR], [adic2 root directory.]),
+	  [ADIC2_ROOT=$withval],[ADIC2_ROOT="no"]) 
 	AC_MSG_CHECKING(for ADIC2)
 
@@ -375,8 +462,31 @@
 	AC_MSG_RESULT($HAVE_ADIC2)
 	dnl }}}
-	dnl rose{{{1
+	dnl gsl{{{
+	AC_ARG_WITH([gsl-dir],
+	  AS_HELP_STRING([--with-gsl-dir = DIR], [gsl root directory.]),
+	  [GSL_ROOT=$withval],[GSL_ROOT=""]) 
+	AC_MSG_CHECKING(for Gsl)
+	
+	if test -d "$GSL_ROOT"; then
+
+		dnl defaults
+		HAVE_GSL=yes
+		GSLINCL="-I$GSL_ROOT/include"
+		GSLLIB="-L$GSL_ROOT/lib/ -lgsl -lgslcblas -lm"
+
+		AC_DEFINE([_HAVE_GSL_],[1],[with gsl in ISSM src])
+		AC_SUBST([GSLINCL])
+		AC_SUBST([GSLLIB])
+
+	else
+		HAVE_GSL=no
+	fi
+	AM_CONDITIONAL([GSL], [test x$HAVE_GSL = xyes])
+	AC_MSG_RESULT($HAVE_GSL)
+	dnl }}}
+	dnl rose{{{
 	AC_ARG_WITH([rose-dir],
-			  AS_HELP_STRING([--with-rose-dir = DIR], [rose root directory.]),
-			 [ROSE_ROOT=$withval],[ROSE_ROOT=""]) 
+	  AS_HELP_STRING([--with-rose-dir = DIR], [rose root directory.]),
+	  [ROSE_ROOT=$withval],[ROSE_ROOT=""]) 
 	AC_MSG_CHECKING(for Rose)
 	
@@ -398,9 +508,8 @@
 	AC_MSG_RESULT($HAVE_ROSE)
 	dnl }}}
-	dnl metis{{{1
+	dnl metis{{{
 	AC_ARG_WITH([metis-dir],
-			  AS_HELP_STRING([--with-metis-dir = DIR],
-							 [metis root directory. necessary for serial build]),
-			  [METIS_ROOT=$withval],[METIS_ROOT=""])
+	  AS_HELP_STRING([--with-metis-dir = DIR],[metis root directory. necessary for serial build]),
+	  [METIS_ROOT=$withval],[METIS_ROOT=""])
 
 	if test -d "$METIS_ROOT"; then
@@ -417,6 +526,5 @@
 		dnl defaults
 		HAVE_METIS=yes
-		
-					                          
+
 		if test "$METIS_VERSION" = "4" ; then
    			
@@ -454,5 +562,4 @@
 		fi
 
-
 		AC_DEFINE([_HAVE_METIS_],[1],[with Metis in ISSM src])
 		AC_SUBST([METISINCL])
@@ -463,37 +570,28 @@
 
 	if test $HAVE_METIS = no; then
-	AC_MSG_ERROR([--with-metis-dir  missing. Metis is needed to run ISSM]);
-	else
-	AC_MSG_RESULT($HAVE_METIS)
-	fi
-	dnl }}}
-	dnl mpi{{{1
+		AC_MSG_ERROR([--with-metis-dir  missing. Metis is needed to run ISSM]);
+	else
+		AC_MSG_RESULT($HAVE_METIS)
+	fi
+	dnl }}}
+	dnl mpi{{{
 	AC_MSG_CHECKING(for mpi)
 	AC_ARG_WITH([mpi-lib],
-			  AS_HELP_STRING([--with-mpi-lib = otions],
-							 [mpi options, for ex: "-L$MPIROOT -lmpich]),
-			  [MPILIB=$withval],[MPILIB=""])
+		AS_HELP_STRING([--with-mpi-lib = otions],[mpi options, for ex: "-L$MPIROOT -lmpich]),
+		[MPILIB=$withval],[MPILIB=""])
 	
 	AC_ARG_WITH([mpi-include],
-			  AS_HELP_STRING([--with-mpi-include = DIR],
-							 [mpi include directory, necessary for parallel build]),
-			  [MPI_INCLUDE=$withval],[MPI_INCLUDE=""])
-
-	dnl check that --with-mpi-include and --with-mpi-lib have been provided
+	  AS_HELP_STRING([--with-mpi-include = DIR],[mpi include directory, necessary for parallel build]),
+	  [MPI_INCLUDE=$withval],[MPI_INCLUDE=""])
+	
 	if test -z "$MPILIB" ; then
-		if test "$PARALLEL_VALUE" = "yes" ; then
-			AC_MSG_ERROR([empty --with-mpi-lib options! MPI is needed to run ISSM in parallel!])
-		fi
+		HAVE_MPI=no
 	else
 		if test -z "$MPI_INCLUDE" ; then
-			if test "$PARALLEL_VALUE" = "yes" ; then
-				AC_MSG_ERROR([empty --with-mpi-include directory! MPI is needed to run ISSM in parallel!])
-			fi
+			HAVE_MPI=no
 		else
-			HAVE_MPI=yes
 			MPIINCL=-I"$MPI_INCLUDE/"
-			
 			AC_DEFINE([_HAVE_MPI_],[1],[with Mpi in ISSM src])
-			AC_DEFINE([HAVE_MPI],[1],[with Mpi in ISSM src])
+			AC_DEFINE([HAVE_MPI],[1],[Mpi Flag for Dakota (DO NOT REMOVE)])
 			AC_SUBST([MPIINCL])
 			AC_SUBST([MPILIB])
@@ -502,40 +600,32 @@
 	AC_MSG_RESULT(done)
 	dnl }}}
-	dnl petsc{{{1
+	dnl petsc{{{
 	AC_ARG_WITH([petsc-dir],
-			  AS_HELP_STRING([--with-petsc-dir = DIR],
-							 [petsc root directory, necessary for parallel build]),
-			  [PETSC_ROOT=$withval],[PETSC_ROOT=""])
+	  AS_HELP_STRING([--with-petsc-dir = DIR],[PETSc root directory, necessary for parallel build]),
+	  [PETSC_ROOT=$withval],[PETSC_ROOT=""])
 		
-	dnl Used to be necessary, not anymore. 
-	dnl if test "$PARALLEL_VALUE" = "yes" ; then
-		dnl if test "$PETSC_ROOT" = "" ; then
-			dnl AC_MSG_ERROR([missing --with-petsc-dir argument for parallel compilation!])
-		dnl fi
-	dnl fi
-
 	if test -d "$PETSC_ROOT"; then
-		AC_MSG_CHECKING(for petsc version)
+		AC_MSG_CHECKING(for PETSc version)
 		PETSC_MAJOR=`cat $PETSC_ROOT/include/petscversion.h | grep "#define PETSC_VERSION_MAJOR" | sed 's/#define PETSC_VERSION_MAJOR//' | sed 's/ //g'`
 		PETSC_MINOR=`cat $PETSC_ROOT/include/petscversion.h | grep "#define PETSC_VERSION_MINOR" | sed 's/#define PETSC_VERSION_MINOR//' | sed 's/ //g'`
-		AC_DEFINE_UNQUOTED([_PETSC_MAJOR_],$PETSC_MAJOR,[ Petsc version major])
-		AC_DEFINE_UNQUOTED([_PETSC_MINOR_],$PETSC_MINOR,[ Petsc version minor])
+		AC_DEFINE_UNQUOTED([_PETSC_MAJOR_],$PETSC_MAJOR,[PETSc version major])
+		AC_DEFINE_UNQUOTED([_PETSC_MINOR_],$PETSC_MINOR,[PETSc version minor])
 		AC_MSG_RESULT($PETSC_MAJOR.$PETSC_MINOR)
+
+		PETSC_VERSION_DATE_HG=`cat $PETSC_ROOT/include/petscversion.h | grep "#define PETSC_VERSION_DATE_HG" | sed 's/#define PETSC_VERSION_DATE_HG//' | sed 's/ //g' | sed -e 's/\"//g' `
+		AC_MSG_CHECKING(wether PETSc is the development version)
+		if test x$PETSC_VERSION_DATE_HG = xunknown; then
+			AC_DEFINE([_HAVE_PETSCDEV_],[1],[with PETSc-dev])
+			AC_MSG_RESULT(yes)
+		else
+			AC_MSG_RESULT(no)
+		fi
 	fi
 	
 	AC_ARG_WITH([petsc-arch],
-			  AS_HELP_STRING([--with-petsc-arch = DIR],
-							 [petsc arch , necessary for parallel build]),
-			  [PETSC_ARCH=$withval],[PETSC_ARCH=""])
-
-	dnl Used to be necessary, not anymore. 
-	dnl if test "$PARALLEL_VALUE" = "yes" ; then
-		dnl if test "$PETSC_ARCH" = "" ; then
-			dnl AC_MSG_ERROR([missing --with-petsc-arch argument for parallel compilation!])
-		dnl fi
-	dnl fi
-	
-	AC_MSG_CHECKING(for Petsc headers and libraries in $PETSC_ROOT for architecture $PETSC_ARCH)
-	
+	  AS_HELP_STRING([--with-petsc-arch = DIR],[PETSc arch , necessary for parallel build]),
+	  [PETSC_ARCH=$withval],[PETSC_ARCH=""])
+
+	AC_MSG_CHECKING(for PETSc headers and libraries in $PETSC_ROOT for architecture $PETSC_ARCH)
 	
 	if test -d "$PETSC_ROOT"; then
@@ -567,5 +657,5 @@
 		esac
 
-		AC_DEFINE([_HAVE_PETSC_],[1],[with Petsc in ISSM src])
+		AC_DEFINE([_HAVE_PETSC_],[1],[with PETSc in ISSM src])
 		AC_SUBST([PETSCINCL])
 		AC_SUBST([PETSCLIB])
@@ -575,38 +665,29 @@
 		HAVE_PETSC=no
 	fi
-
-	dnl used to e necessary, not anymore. 
-	dnl if test $HAVE_PETSC = no; then
-		dnl AC_MSG_ERROR([could not find petsc. user should specify --with-petsc-dir and --with-petsc-arch options. Petsc is needed to run ISSM!])
-	dnl else
-	dnl AC_MSG_RESULT($HAVE_PETSC)
-	dnl fi
 	
 	AM_CONDITIONAL([PETSC], [test x$HAVE_PETSC = xyes])
 	AC_MSG_RESULT($HAVE_PETSC)
 	dnl }}}
-	dnl tao{{{1
+	dnl tao{{{
 	AC_ARG_WITH([tao-dir],
-				AS_HELP_STRING([--with-tao-dir = DIR], [tao root directory.]),
-				[TAO_ROOT=$withval],[TAO_ROOT=""]) 
-	  AC_MSG_CHECKING(for Tao)
-
-	  if test -d "$TAO_ROOT"; then
-
-		dnl defaults
-		  HAVE_TAO=yes
-		  TAOINCL="-I$TAO_ROOT/ -I$TAO_ROOT/include -I$TAO_ROOT/bmake/ "
-		  TAOLIB="-L$TAO_ROOT/lib -ltao -lpetsc"
-
-		  AC_DEFINE([_HAVE_TAO_],[1],[with Tao in ISSM src])
-		  AC_SUBST([TAOINCL])
-		  AC_SUBST([TAOLIB])
-
-	  else
+		AS_HELP_STRING([--with-tao-dir = DIR], [tao root directory.]),
+		[TAO_ROOT=$withval],[TAO_ROOT=""]) 
+	AC_MSG_CHECKING(for Tao)
+
+	if test -d "$TAO_ROOT"; then
+
+	  HAVE_TAO=yes
+	  TAOINCL="-I$TAO_ROOT/ -I$TAO_ROOT/include -I$TAO_ROOT/bmake/ "
+	  TAOLIB="-L$TAO_ROOT/lib -ltao -lpetsc"
+
+	  AC_DEFINE([_HAVE_TAO_],[1],[with Tao in ISSM src])
+	  AC_SUBST([TAOINCL])
+	  AC_SUBST([TAOLIB])
+	else
 		HAVE_TAO=no
-		fi
-		AC_MSG_RESULT($HAVE_TAO)
-	dnl }}}
-	dnl mpiuni{{{1
+	fi
+	AC_MSG_RESULT($HAVE_TAO)
+	dnl }}}
+	dnl mpiuni{{{
 	dnl when running in serial mode, MPI must be ignored, and set to internal petsc mpiuni: 
 	if test "$PARALLEL_VALUE" = "no" ; then
@@ -627,20 +708,15 @@
 								  
 		AC_DEFINE([_HAVE_MPI_],[1],[with Mpi in ISSM src])
-		AC_DEFINE([HAVE_MPI],[1],[with Mpi in ISSM src])
 		AC_SUBST([MPIINCL])
 		AC_SUBST([MPILIB])
 	fi
 	dnl }}}
-	dnl slepc{{{1
+	dnl slepc{{{
 	AC_ARG_WITH([slepc-dir],
-			  AS_HELP_STRING([--with-slepc-dir = DIR],
-							 [slepc root directory]),
-			  [SLEPC_ROOT=$withval],[SLEPC_ROOT=""])
+	  AS_HELP_STRING([--with-slepc-dir = DIR],[slepc root directory]),
+	  [SLEPC_ROOT=$withval],[SLEPC_ROOT=""])
 			  
 	AC_MSG_CHECKING(for Slepc headers and libraries in $SLEPC_ROOT)
 	if test -d "$SLEPC_ROOT"; then
-
-
-		dnl defaults
 		HAVE_SLEPC=yes
 		SLEPCINCL=-I"$SLEPC_ROOT/include"
@@ -655,14 +731,12 @@
 	AC_MSG_RESULT($HAVE_SLEPC)
 	dnl }}}
-	dnl shapelib{{{1
+	dnl shapelib{{{
 	AC_ARG_WITH([shapelib-dir],
-			  AS_HELP_STRING([--with-shapelib-dir = DIR],
-							 [shapelib root directory]),
-			  [SHAPELIB_ROOT=$withval],[SHAPELIB_ROOT=""])
+	  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
@@ -678,14 +752,12 @@
 	AC_MSG_RESULT($HAVE_SHAPELIB)
 	dnl }}}
-	dnl scalapack{{{1
+	dnl scalapack{{{
 	AC_ARG_WITH([scalapack-dir],
-			  AS_HELP_STRING([--with-scalapack-dir = DIR],
-							 [scalapack root directory]),
-			  [SCALAPACK_ROOT=$withval],[SCALAPACK_ROOT=""])
+	  AS_HELP_STRING([--with-scalapack-dir = DIR],[scalapack root directory]),
+	  [SCALAPACK_ROOT=$withval],[SCALAPACK_ROOT=""])
 			  
 	AC_MSG_CHECKING(for Scalapack headers and libraries in $SCALAPACK_ROOT)
 	if test -d "$SCALAPACK_ROOT"; then
 
-
 		dnl defaults
 		HAVE_SCALAPACK=yes
@@ -699,13 +771,11 @@
 	AC_MSG_RESULT($HAVE_SCALAPACK)
 	dnl }}}
-	dnl blas{{{1
+	dnl blas{{{
 	AC_ARG_WITH([blas-lapack-dir],
-			  AS_HELP_STRING([--with-blas-lapack-dir = DIR],
-							 [blas-lapack root directory]),
-			  [BLASLAPACK_ROOT=$withval],[BLASLAPACK_ROOT=""])
+	  AS_HELP_STRING([--with-blas-lapack-dir = DIR],[blas-lapack root directory]),
+	  [BLASLAPACK_ROOT=$withval],[BLASLAPACK_ROOT=""])
 			  
 	AC_MSG_CHECKING(for Blas and Lapack headers and libraries in $BLASLAPACK_ROOT)
 	if test -d "$BLASLAPACK_ROOT"; then
-
 
 		dnl defaults
@@ -725,6 +795,4 @@
 			;;
 		esac
-								  
-
 
 		AC_DEFINE([_HAVE_BLASLAPACK_],[1],[with blas lapack in ISSM src])
@@ -736,9 +804,8 @@
 	AC_MSG_RESULT($HAVE_BLASLAPACK)
 	dnl }}}
-	dnl mkl{{{1
+	dnl mkl{{{
 	AC_ARG_WITH([mkl-dir],
-			  AS_HELP_STRING([--with-mkl-dir = DIR],
-							 [mkl root directory]),
-			  [MKL_ROOT=$withval],[MKL_ROOT=""])
+	  AS_HELP_STRING([--with-mkl-dir = DIR],[mkl root directory]),
+	  [MKL_ROOT=$withval],[MKL_ROOT=""])
 			  
 	AC_MSG_CHECKING(for mkl headers and libraries in $MKL_ROOT)
@@ -757,9 +824,8 @@
 	AC_MSG_RESULT($HAVE_MKL)
 	dnl }}}
-	dnl plapack{{{1
+	dnl plapack{{{
 	AC_ARG_WITH([plapack-lib],
-			  AS_HELP_STRING([--with-plapack-lib = lib],
-							 [plapack library]),
-			  [PLAPACK_LIB=$withval],[PLAPACK_LIB=""])
+	  AS_HELP_STRING([--with-plapack-lib = lib],[plapack library]),
+	  [PLAPACK_LIB=$withval],[PLAPACK_LIB=""])
 	AC_MSG_CHECKING(for Plapack libraries)
 	
@@ -789,11 +855,8 @@
 	AC_MSG_RESULT($HAVE_PLAPACK)
 	dnl }}}
-	dnl mumps{{{1
-
-	dnl Mumps directory
+	dnl mumps{{{
 	AC_ARG_WITH([mumps-dir],
-			  AS_HELP_STRING([--with-mumps-dir = DIR],
-							 [mumps root directory]),
-			  [MUMPS_ROOT=$withval],[MUMPS_ROOT=""])
+	  AS_HELP_STRING([--with-mumps-dir = DIR],[mumps root directory]),
+	  [MUMPS_ROOT=$withval],[MUMPS_ROOT=""])
 			  
 	AC_MSG_CHECKING(for Mumps headers and libraries in $MUMPS_ROOT)
@@ -817,8 +880,7 @@
 	AC_MSG_RESULT($HAVE_MUMPS)
 	dnl }}}
-	dnl blacs{{{1
+	dnl blacs{{{
 	AC_ARG_WITH([blacs-dir],
-			  AS_HELP_STRING([--with-blacs-dir = DIR],
-							 [blacs root directory]),
+		AS_HELP_STRING([--with-blacs-dir = DIR],[blacs root directory]),
 			  [BLACS_ROOT=$withval],[BLACS_ROOT=""])
 			  
@@ -839,8 +901,7 @@
 	AC_MSG_RESULT($HAVE_BLACS)
 	dnl }}}
-	dnl hypre{{{1
+	dnl hypre{{{
 	AC_ARG_WITH([hypre-dir],
-			  AS_HELP_STRING([--with-hypre-dir = DIR],
-							 [hypre root directory]),
+	  AS_HELP_STRING([--with-hypre-dir = DIR],[hypre root directory]),
 			  [HYPRE_ROOT=$withval],[HYPRE_ROOT=""])
 			  
@@ -861,8 +922,7 @@
 	AC_MSG_RESULT($HAVE_HYPRE)
 	dnl }}}
-	dnl ml{{{1
+	dnl ml{{{
 	AC_ARG_WITH([ml-dir],
-			  AS_HELP_STRING([--with-ml-dir = DIR],
-							 [ml root directory]),
+	  AS_HELP_STRING([--with-ml-dir = DIR],[ml root directory]),
 			  [ML_ROOT=$withval],[ML_ROOT=""])
 			  
@@ -883,10 +943,9 @@
 	AC_MSG_RESULT($HAVE_ML)
 	dnl }}}
-	dnl math{{{1
+	dnl math{{{
 	AC_MSG_CHECKING(for math library)
 	AC_ARG_WITH([math-lib],
-			  AS_HELP_STRING([--with-math-lib = otions],
-							 [math options, for ex: "/usr/lib/libm.a]),
-			  [MATH_LIB=$withval],[MATH_LIB=""])
+	  AS_HELP_STRING([--with-math-lib = otions],[math options, for ex: "/usr/lib/libm.a]),
+	  [MATH_LIB=$withval],[MATH_LIB=""])
 
 	dnl check that --with-math-lib may have been provided
@@ -900,11 +959,10 @@
 	AC_MSG_RESULT(done)
 	dnl }}}
-	dnl fortran{{{1
+	dnl fortran{{{
 	dnl fortran library  option
 	AC_MSG_CHECKING(for fortran library)
 	AC_ARG_WITH([fortran-lib],
-			  AS_HELP_STRING([--with-fortran-lib = options],
-							 [fortran options, for ex: "/usr/lib/gfortran.a]),
-			  [FORTRAN_LIB=$withval],[FORTRAN_LIB=""])
+	  AS_HELP_STRING([--with-fortran-lib = options],[fortran options, for ex: "/usr/lib/gfortran.a]),
+		[FORTRAN_LIB=$withval],[FORTRAN_LIB=""])
 
 	dnl check that --with-fortran-lib may have been provided
@@ -918,10 +976,9 @@
 	AC_MSG_RESULT(done)
 	dnl }}}
-	dnl graphics{{{1
+	dnl graphics{{{
 	AC_MSG_CHECKING(for graphics library)
 	AC_ARG_WITH([graphics-lib],
-			  AS_HELP_STRING([--with-graphics-lib = options],
-							 [graphics options, for ex: "/usr/X11/lib/libX11.a]),
-			  [GRAPHICS_LIB=$withval],[GRAPHICS_LIB=""])
+	  AS_HELP_STRING([--with-graphics-lib = options],[graphics options, for ex: "/usr/X11/lib/libX11.a]),
+	  [GRAPHICS_LIB=$withval],[GRAPHICS_LIB=""])
 
 	dnl check that --with-graphics-lib may have been provided
@@ -935,6 +992,8 @@
 	AC_MSG_RESULT(done)
 	dnl }}}
-	dnl with-steadystate{{{1
-	AC_ARG_WITH([steadystate],AS_HELP_STRING([--with-steadystate = YES], [compile with steadystate capabilities (default is yes)]),[STEADYSTATE=$withval],[STEADYSTATE=yes]) 
+	dnl with-steadystate{{{
+	AC_ARG_WITH([steadystate],
+		AS_HELP_STRING([--with-steadystate = YES],[compile with steadystate capabilities (default is yes)]),
+		[STEADYSTATE=$withval],[STEADYSTATE=yes]) 
 	AC_MSG_CHECKING(for steadystate capability compilation)
 
@@ -951,6 +1010,8 @@
 	AC_MSG_RESULT($HAVE_STEADYSTATE)
 	dnl }}}
-	dnl with-transient{{{1
-	AC_ARG_WITH([transient],AS_HELP_STRING([--with-transient = YES], [compile with transient capabilities (default is yes)]),[TRANSIENT=$withval],[TRANSIENT=yes]) 
+	dnl with-transient{{{
+	AC_ARG_WITH([transient],
+		AS_HELP_STRING([--with-transient = YES], [compile with transient capabilities (default is yes)]),
+		[TRANSIENT=$withval],[TRANSIENT=yes]) 
 	AC_MSG_CHECKING(for transient capability compilation)
 
@@ -967,6 +1028,8 @@
 	AC_MSG_RESULT($HAVE_TRANSIENT)
 	dnl }}}
-	dnl with-thermal{{{1
-	AC_ARG_WITH([thermal],AS_HELP_STRING([--with-thermal = YES], [compile with thermal capabilities (default is yes)]),[THERMAL=$withval],[THERMAL=yes]) 
+	dnl with-thermal{{{
+	AC_ARG_WITH([thermal],
+		AS_HELP_STRING([--with-thermal = YES], [compile with thermal capabilities (default is yes)]),
+		[THERMAL=$withval],[THERMAL=yes]) 
 	AC_MSG_CHECKING(for thermal capability compilation)
 
@@ -983,6 +1046,8 @@
 	AC_MSG_RESULT($HAVE_THERMAL)
 	dnl }}}
-	dnl with-prognostic{{{1
-	AC_ARG_WITH([prognostic],AS_HELP_STRING([--with-prognostic = YES], [compile with prognostic capabilities (default is yes)]),[PROGNOSTIC=$withval],[PROGNOSTIC=yes]) 
+	dnl with-prognostic{{{
+	AC_ARG_WITH([prognostic],
+		AS_HELP_STRING([--with-prognostic = YES], [compile with prognostic capabilities (default is yes)]),
+		[PROGNOSTIC=$withval],[PROGNOSTIC=yes]) 
 	AC_MSG_CHECKING(for prognostic capability compilation)
 
@@ -999,6 +1064,8 @@
 	AC_MSG_RESULT($HAVE_PROGNOSTIC)
 	dnl }}}
-	dnl with-control{{{1
-	AC_ARG_WITH([control],AS_HELP_STRING([--with-control = YES], [compile with control capabilities (default is yes)]),[CONTROL=$withval],[CONTROL=yes]) 
+	dnl with-control{{{
+	AC_ARG_WITH([control],
+		AS_HELP_STRING([--with-control = YES], [compile with control capabilities (default is yes)]),
+		[CONTROL=$withval],[CONTROL=yes]) 
 	AC_MSG_CHECKING(for control capability compilation)
 
@@ -1015,6 +1082,8 @@
 	AC_MSG_RESULT($HAVE_CONTROL)
 	dnl }}}
-	dnl with-hydrology{{{1
-	AC_ARG_WITH([hydrology],AS_HELP_STRING([--with-hydrology = YES], [compile with hydrology capabilities (default is yes)]),[HYDROLOGY=$withval],[HYDROLOGY=yes]) 
+	dnl with-hydrology{{{
+	AC_ARG_WITH([hydrology],
+		AS_HELP_STRING([--with-hydrology = YES], [compile with hydrology capabilities (default is yes)]),
+		[HYDROLOGY=$withval],[HYDROLOGY=yes]) 
 	AC_MSG_CHECKING(for hydrology capability compilation)
 
@@ -1031,6 +1100,8 @@
 	AC_MSG_RESULT($HAVE_HYDROLOGY)
 	dnl }}}
-	dnl with-diagnostic{{{1
-	AC_ARG_WITH([diagnostic],AS_HELP_STRING([--with-diagnostic = YES], [compile with diagnostic capabilities (default is yes)]),[DIAGNOSTIC=$withval],[DIAGNOSTIC=yes]) 
+	dnl with-diagnostic{{{
+	AC_ARG_WITH([diagnostic],
+		AS_HELP_STRING([--with-diagnostic = YES], [compile with diagnostic capabilities (default is yes)]),
+		[DIAGNOSTIC=$withval],[DIAGNOSTIC=yes]) 
 	AC_MSG_CHECKING(for diagnostic capability compilation)
 
@@ -1047,6 +1118,8 @@
 	AC_MSG_RESULT($HAVE_DIAGNOSTIC)
 	dnl }}}
-	dnl with-balanced{{{1
-	AC_ARG_WITH([balanced],AS_HELP_STRING([--with-balanced = YES], [compile with balanced capabilities (default is yes)]),[BALANCED=$withval],[BALANCED=yes]) 
+	dnl with-balanced{{{
+	AC_ARG_WITH([balanced],
+		AS_HELP_STRING([--with-balanced = YES], [compile with balanced capabilities (default is yes)]),
+		[BALANCED=$withval],[BALANCED=yes]) 
 	AC_MSG_CHECKING(for balanced capability compilation)
 
@@ -1063,6 +1136,8 @@
 	AC_MSG_RESULT($HAVE_BALANCED)
 	dnl }}}
-	dnl with-responses{{{1
-	AC_ARG_WITH([responses],AS_HELP_STRING([--with-responses = YES], [compile with responses capabilities (default is yes)]),[RESPONSES=$withval],[RESPONSES=yes]) 
+	dnl with-responses{{{
+	AC_ARG_WITH([responses],
+		AS_HELP_STRING([--with-responses = YES], [compile with responses capabilities (default is yes)]),
+		[RESPONSES=$withval],[RESPONSES=yes]) 
 	AC_MSG_CHECKING(for responses capability compilation)
 
@@ -1079,6 +1154,8 @@
 	AC_MSG_RESULT($HAVE_RESPONSES)
 	dnl }}}
-	dnl with-slope{{{1
-	AC_ARG_WITH([slope],AS_HELP_STRING([--with-slope = YES], [compile with slope capabilities (default is yes)]),[SLOPE=$withval],[SLOPE=yes]) 
+	dnl with-slope{{{
+	AC_ARG_WITH([slope],
+		AS_HELP_STRING([--with-slope = YES], [compile with slope capabilities (default is yes)]),
+		[SLOPE=$withval],[SLOPE=yes]) 
 	AC_MSG_CHECKING(for slope capability compilation)
 
@@ -1095,6 +1172,8 @@
 	AC_MSG_RESULT($HAVE_SLOPE)
 	dnl }}}
-	dnl with-groundingline{{{1
-	AC_ARG_WITH([groundingline],AS_HELP_STRING([--with-groundingline = YES], [compile with groundingline capabilities (default is yes)]),[GROUNDINGLINE=$withval],[GROUNDINGLINE=yes]) 
+	dnl with-groundingline{{{
+	AC_ARG_WITH([groundingline],
+		AS_HELP_STRING([--with-groundingline = YES], [compile with groundingline capabilities (default is yes)]),
+		[GROUNDINGLINE=$withval],[GROUNDINGLINE=yes]) 
 	AC_MSG_CHECKING(for groundingline capability compilation)
 
@@ -1111,6 +1190,8 @@
 	AC_MSG_RESULT($HAVE_GROUNDINGLINE)
 	dnl }}}
-	dnl with-rifts{{{1
-	AC_ARG_WITH([rifts],AS_HELP_STRING([--with-rifts = YES], [compile with rifts capabilities (default is yes)]),[RIFTS=$withval],[RIFTS=yes]) 
+	dnl with-rifts{{{
+	AC_ARG_WITH([rifts],
+		AS_HELP_STRING([--with-rifts = YES], [compile with rifts capabilities (default is yes)]),
+		[RIFTS=$withval],[RIFTS=yes]) 
 	AC_MSG_CHECKING(for rifts capability compilation)
 
@@ -1127,6 +1208,8 @@
 	AC_MSG_RESULT($HAVE_RIFTS)
 	dnl }}}
-	dnl with-3d{{{1
-	AC_ARG_WITH([3d],AS_HELP_STRING([--with-3d = YES], [compile with 3d capabilities (default is yes)]),[THREED=$withval],[THREED=yes]) 
+	dnl with-3d{{{
+	AC_ARG_WITH([3d],
+		AS_HELP_STRING([--with-3d = YES], [compile with 3d capabilities (default is yes)]),
+		[THREED=$withval],[THREED=yes]) 
 	AC_MSG_CHECKING(for 3d capability compilation)
 
@@ -1134,20 +1217,44 @@
 
 		dnl defaults
-		HAVE_THREED=yes
-
-		AC_DEFINE([_HAVE_THREED_],[1],[with 3d capability])
-	else
-		HAVE_THREED=no
-	fi
-	AM_CONDITIONAL([THREED], [test x$HAVE_THREED = xyes])
-	AC_MSG_RESULT($HAVE_THREED)
+		HAVE_3D=yes
+
+		AC_DEFINE([_HAVE_3D_],[1],[with 3d capability])
+	else
+		HAVE_3D=no
+	fi
+	AM_CONDITIONAL([THREED], [test x$HAVE_3D = xyes])
+	AC_MSG_RESULT($HAVE_3D)
+	dnl }}}
+	dnl checks{{{
+	AC_MSG_CHECKING(consistency between all libraries)
+	
+	dnl check that if petsc is requested in parallel, mpi should be specified
+	if test "$HAVE_PETSC" = "yes" ; then
+		if test "$HAVE_MPI" = "NO";  then
+			AC_MSG_ERROR([petsc requires mpi!]);
+		fi
+	fi
+
+	dnl check that we have either python or matlab support if we only compile serially
+	if test "$PARALLEL_VALUE" = "no"  && test "$HAVE_MATLAB" = "no" && test "$HAVE_PYTHON" = "no"; then
+		AC_MSG_ERROR([need at least python or matlab support to compile only in serial mode!]);
+	fi
+
+	dnl check that we don't have with-matlab and with-python at the same time
+	if test "$HAVE_PYTHON" = "yes" ; then
+		if test "$HAVE_MATLAB" = "yes";  then
+			AC_MSG_ERROR([cannot create matlab and python wrappers simultaneously! Please choose one or the other.]);
+		fi
+	fi
+
+	AC_MSG_RESULT(done)
 	dnl }}}
 
 	dnl other options
-	dnl optimization{{{1
+	dnl optimization{{{
 	dnl bypass standard optimization -g -O2 ? 
 	AC_ARG_WITH([cxxoptflags],
-			  AS_HELP_STRING([--with-cxxoptflags = CXXOPTFLAGS], [optimization using CXX flags, ex: --with-cxxoptflags=-march=opteron -O3]),
-			 [CXXOPTFLAGS=$withval],[CXXOPTFLAGS="-g -O2"]) 
+	  AS_HELP_STRING([--with-cxxoptflags = CXXOPTFLAGS], [optimization using CXX flags, ex: --with-cxxoptflags=-march=opteron -O3]),
+	  [CXXOPTFLAGS=$withval],[CXXOPTFLAGS="-g -O2"]) 
 	AC_MSG_CHECKING(for C++ optimization flags)
 	AC_SUBST([CXXOPTFLAGS])
@@ -1155,9 +1262,8 @@
 
 	dnl }}}
-	dnl multithreading{{{1
+	dnl multithreading{{{
 	AC_ARG_WITH([numthreads],
-			  AS_HELP_STRING([--with-numthreads = NUMTHREADS_VALUE],
-							 [numthreads, default is 1. ]),
-			  [NUMTHREADS_VALUE=$withval],[NUMTHREADS_VALUE=1])
+	  AS_HELP_STRING([--with-numthreads = NUMTHREADS_VALUE],[numthreads, default is 1. ]),
+	  [NUMTHREADS_VALUE=$withval],[NUMTHREADS_VALUE=1])
 	AC_MSG_CHECKING(for number of threads)
 	dnl defaults
@@ -1185,10 +1291,9 @@
 	AC_MSG_RESULT($NUMTHREADS_VALUE) 
 	dnl }}}
-	dnl 64bit {{{1
+	dnl 64bit {{{
 	AC_ARG_WITH([64bit-indices],
-			  AS_HELP_STRING([--with-64bit-indices = bool], [use 64 bit integers, default 0, ex: --with-64bit-indices=1]),
-			 [USE_64BIT_INDICES=$withval],[USE_64BIT_INDICES=0]) 
+	  AS_HELP_STRING([--with-64bit-indices = bool], [use 64 bit integers, default 0, ex: --with-64bit-indices=1]),
+	  [USE_64BIT_INDICES=$withval],[USE_64BIT_INDICES=0]) 
 	AC_MSG_CHECKING(for 64 bit indices)
-
 
 	if test "$USE_64BIT_INDICES" == "1"; then
@@ -1199,4 +1304,3 @@
 	AC_MSG_RESULT($USE_64BIT_INDICES)
 	dnl }}}
-
 ])
Index: sm/branches/trunk-jpl-damage/m4/matlab.m4
===================================================================
--- /issm/branches/trunk-jpl-damage/m4/matlab.m4	(revision 12003)
+++ 	(revision )
@@ -1,1170 +1,0 @@
-##### http://autoconf-archive.cryp.to/ax_cflags_warn_all.html
-#
-# SYNOPSIS
-#
-#   AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
-#
-# DESCRIPTION
-#
-#   Try to find a compiler option that enables most reasonable
-#   warnings. This macro is directly derived from VL_PROG_CC_WARNINGS
-#   which is split up into two AX_CFLAGS_WARN_ALL and
-#   AX_CFLAGS_WARN_ALL_ANSI
-#
-#   For the GNU CC compiler it will be -Wall (and -ansi -pedantic) The
-#   result is added to the shellvar being CFLAGS by default.
-#
-#   Currently this macro knows about GCC, Solaris C compiler, Digital
-#   Unix C compiler, C for AIX Compiler, HP-UX C compiler, IRIX C
-#   compiler, NEC SX-5 (Super-UX 10) C compiler, and Cray J90 (Unicos
-#   10.0.0.8) C compiler.
-#
-#    - $1 shell-variable-to-add-to : CFLAGS
-#    - $2 add-value-if-not-found : nothing
-#    - $3 action-if-found : add value to shellvariable
-#    - $4 action-if-not-found : nothing
-#
-# LAST MODIFICATION
-#
-#   2006-12-12
-#
-# COPYLEFT
-#
-#   Copyright (c) 2006 Guido U. Draheim <guidod@gmx.de>
-#
-#   This program is free software; you can redistribute it and/or
-#   modify it under the terms of the GNU General Public License as
-#   published by the Free Software Foundation; either version 2 of the
-#   License, or (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#   General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program; if not, write to the Free Software
-#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-#   02111-1307, USA.
-#
-#   As a special exception, the respective Autoconf Macro's copyright
-#   owner gives unlimited permission to copy, distribute and modify the
-#   configure scripts that are the output of Autoconf when processing
-#   the Macro. You need not follow the terms of the GNU General Public
-#   License when using or distributing such scripts, even though
-#   portions of the text of the Macro appear in them. The GNU General
-#   Public License (GPL) does govern all other use of the material that
-#   constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the
-#   Autoconf Macro released by the Autoconf Macro Archive. When you
-#   make and distribute a modified version of the Autoconf Macro, you
-#   may extend this special exception to the GPL to apply to your
-#   modified version as well.
-
-AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
-AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl
-AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl
-AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
-VAR,[VAR="no, unknown"
- AC_LANG_SAVE
- AC_LANG_C
- ac_save_[]FLAGS="$[]FLAGS"
-for ac_arg dnl
-in "-pedantic  % -Wall"       dnl   GCC
-   "-xstrconst % -v"          dnl Solaris C
-   "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
-   "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
-   "-ansi -ansiE % -fullwarn" dnl IRIX
-   "+ESlit     % +w1"         dnl HP-UX C
-   "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
-   "-h conform % -h msglevel 2" dnl Cray C (Unicos)
-   #
-do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
-   AC_TRY_COMPILE([],[return 0;],
-   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
-done
- FLAGS="$ac_save_[]FLAGS"
- AC_LANG_RESTORE
-])
-case ".$VAR" in
-     .ok|.ok,*) m4_ifvaln($3,$3) ;;
-   .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
-        AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
-                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
-   *) m4_ifvaln($3,$3,[
-   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
-   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
-   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
-                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
-   fi ]) ;;
-esac
-AS_VAR_POPDEF([VAR])dnl
-AS_VAR_POPDEF([FLAGS])dnl
-])
-
-dnl the only difference - the LANG selection... and the default FLAGS
-
-AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
-AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl
-AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all])dnl
-AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
-VAR,[VAR="no, unknown"
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- ac_save_[]FLAGS="$[]FLAGS"
-for ac_arg dnl
-in "-pedantic  % -Wall"       dnl   GCC
-   "-xstrconst % -v"          dnl Solaris C
-   "-std1      % -verbose -w0 -warnprotos" dnl Digital Unix
-   "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
-   "-ansi -ansiE % -fullwarn" dnl IRIX
-   "+ESlit     % +w1"         dnl HP-UX C
-   "-Xc        % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
-   "-h conform % -h msglevel 2" dnl Cray C (Unicos)
-   #
-do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
-   AC_TRY_COMPILE([],[return 0;],
-   [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
-done
- FLAGS="$ac_save_[]FLAGS"
- AC_LANG_RESTORE
-])
-case ".$VAR" in
-     .ok|.ok,*) m4_ifvaln($3,$3) ;;
-   .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[
-        AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])
-                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;;
-   *) m4_ifvaln($3,$3,[
-   if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null
-   then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR])
-   else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"])
-                      m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"
-   fi ]) ;;
-esac
-AS_VAR_POPDEF([VAR])dnl
-AS_VAR_POPDEF([FLAGS])dnl
-])
-
-dnl  implementation tactics:
-dnl   the for-argument contains a list of options. The first part of
-dnl   these does only exist to detect the compiler - usually it is
-dnl   a global option to enable -ansi or -extrawarnings. All other
-dnl   compilers will fail about it. That was needed since a lot of
-dnl   compilers will give false positives for some option-syntax
-dnl   like -Woption or -Xoption as they think of it is a pass-through
-dnl   to later compile stages or something. The "%" is used as a
-dnl   delimimiter. A non-option comment can be given after "%%" marks
-dnl   which will be shown but not added to the respective C/CXXFLAGS.
-
-
-
-
-
-
-
-
-dnl matlabdir.m4 --- define Matlab directory names.
-dnl
-dnl Copyright (C) 2002, 2003 Ralph Schleicher
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2,
-dnl or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; see the file COPYING.  If not, write to
-dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-dnl Boston, MA 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if
-dnl you distribute this file as part of a program that contains a
-dnl configuration script generated by GNU Autoconf, you may include
-dnl it under the same distribution terms that you use for the rest
-dnl of that program.
-dnl
-dnl Code:
-
-# AX_MATLAB_DIR
-# -------------
-# Define Matlab directory names.
-AC_DEFUN([AX_MATLAB_DIR],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AX_MATLAB_VERSION])
-AC_REQUIRE([AC_CANONICAL_HOST])
-ax_matlab_dir="\${datadir}/matlab"
-AC_ARG_WITH([matlab-dir], AC_HELP_STRING([--with-matlab-dir=ARG], [use ARG as the top-level installation directory for Matlab files [[$(datadir)/matlab]]]),
-[case $withval in
-  yes | no)
-    AC_MSG_ERROR([invalid value '$withval' for --with-matlab-dir])
-    ;;
-  *)
-    ax_matlab_dir=$withval
-    ;;
-esac])
-AC_MSG_CHECKING([for top-level installation directory for Matlab files])
-AC_MSG_RESULT([$ax_matlab_dir])
-matlabdir=$ax_matlab_dir
-AC_SUBST([matlabdir])
-matlabverdir="\${matlabdir}/$MATLAB_VERSION"
-AC_SUBST([matlabverdir])
-matlabarchdir="\${matlabverdir}/$host"
-AC_SUBST([matlabarchdir])
-matlabprivatedir="\${matlabdir}/private"
-AC_SUBST([matlabprivatedir])
-matlabprivateverdir="\${matlabverdir}/private"
-AC_SUBST([matlabprivateverdir])
-matlabprivatearchdir="\${matlabarchdir}/private"
-AC_SUBST([matlabprivatearchdir])
-])
-
-dnl matlabdir.m4 ends here
-
-dnl matlabver.m4 --- check for Matlab version number.
-dnl
-dnl Copyright (C) 2000--2003 Ralph Schleicher
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2,
-dnl or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; see the file COPYING.  If not, write to
-dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-dnl Boston, MA 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if
-dnl you distribute this file as part of a program that contains a
-dnl configuration script generated by GNU Autoconf, you may include
-dnl it under the same distribution terms that you use for the rest
-dnl of that program.
-dnl
-dnl Code:
-
-# AX_MATLAB_VERSION
-# -----------------
-# Check for Matlab version number.
-AC_DEFUN([AX_MATLAB_VERSION],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AX_MATLAB])
-AC_CACHE_CHECK([for Matlab version], [ax_cv_matlab_version],
-[if test "${MATLAB_VERSION+set}" = set ; then
-    ax_cv_matlab_version=$MATLAB_VERSION
-else
-    ax_cv_matlab_version=
-    # Loop over all known architectures.  The final dot covers
-    # Matlab R11 and Matlab V4 for Windows.
-    for ax_arch in alpha glnxa64 glnx86 hp700 hpux ibm_rs sgi sol2 win32 mac maci . ; do
-        for ax_exec_name in matlab$EXEEXT MATLAB ; do
-		ax_matlab_exec=$MATLAB/bin/$ax_arch/${ax_exec_name}
-		if test -f $ax_matlab_exec ; then
-	    		# For Matlab R12, the version number is stored in a
-	    		# shared library.
-	    		ax_matlab_exec_2=`find $MATLAB/bin/$ax_arch -type f -name libmwservices\* -print 2> /dev/null`
-	    		if test -n "$ax_matlab_exec_2" ; then
-				ax_cv_matlab_version=`strings $ax_matlab_exec_2 2> /dev/null | egrep '^\|build_version_\|@<:@0-9@:>@+\.@<:@0-9@:>@+\.@<:@0-9@:>@+\.@<:@0-9@:>@+' | head -1 | sed 's/^|build_version_|\(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
-				if test -n "$ax_cv_matlab_version" ; then
-		    			break
-				fi
-	    		fi
-	    		# For Matlab R11 and Matlab V4, the version number
-	    		# is stored in the executable program.
-	    		ax_cv_matlab_version=`strings $ax_matlab_exec 2> /dev/null | egrep '^@<:@0-9@:>@+\.@<:@0-9@:>@+\.@<:@0-9@:>@+\.@<:@0-9@:>@+' | head -1 | sed 's/^\(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
-	    		if test -n "$ax_cv_matlab_version" ; then
-				break
-	    		fi
-				
-				# For Matlab R2008a and more, the version number is stored in .VERSION
-				if test -f "$MATLAB/.VERSION" ; then
-					ax_cv_matlab_version=`cat $MATLAB/.VERSION`
-					if test -n "$ax_cv_matlab_version" ; then
-					break
-					fi
-				fi
-
-				#Last  hope, find version in file stored in bin/util/mex/version.txt
-				#
-				ax_cv_matlab_version=`cat $MATLAB/bin/util/mex/version.txt`
-				if test -n "$ax_cv_matlab_version" ; then
-				break
-				fi
-		fi
-    	done
-	if test -n "$ax_cv_matlab_version" ; then
-		break
-	fi
-    done
-    if test -z "$ax_cv_matlab_version" ; then
-	ax_cv_matlab_version="not found"
-    fi
-fi])
-case $ax_cv_matlab_version in
-	@<:@1-9@:>@.@<:@0-9@:>@ | @<:@1-9@:>@@<:@0-9@:>@.@<:@0-9@:>@ | @<:@1-9@:>@.@<:@1-9@:>@@<:@0-9@:>@)
-	MATLAB_VERSION=$ax_cv_matlab_version
-	MATLAB_MAJOR=`echo $MATLAB_VERSION | sed -e 's/^\(@<:@0-9@:>@*\)\.@<:@0-9@:>@*.*/\1/'`
-	MATLAB_MINOR=`echo $MATLAB_VERSION | sed -e 's/^@<:@0-9@:>@*\.\(@<:@0-9@:>@*\).*/\1/'`
-	;;
-	R2007a)
-	MATLAB_VERSION=R2007a
-	MATLAB_MAJOR=7
-	MATLAB_MINOR=4
-	;;
-	R2008a)
-	MATLAB_VERSION=R2008a
-	MATLAB_MAJOR=7
-	MATLAB_MINOR=6
-	;;
-	R2009a)
-	MATLAB_VERSION=R2009a
-	MATLAB_MAJOR=7
-	MATLAB_MINOR=8
-	;;
-	R2010a)
-	MATLAB_VERSION=R2010a
-	MATLAB_MAJOR=7
-	MATLAB_MINOR=10
-	;;
-	R2010b)
-	MATLAB_VERSION=R2010b
-	MATLAB_MAJOR=7
-	MATLAB_MINOR=11
-	;;
-	R2011a)
-	MATLAB_VERSION=R2011a
-	MATLAB_MAJOR=7
-	MATLAB_MINOR=12
-	;;
-	R2011b)
-	MATLAB_VERSION=R2011b
-	MATLAB_MAJOR=7
-	MATLAB_MINOR=13
-	;;
-
-  *)
-    if test x$ax_enable_matlab = xyes ; then
-	AC_MSG_ERROR([can not determine Matlab version number])
-    fi
-    MATLAB_VERSION=
-    MATLAB_MAJOR=
-    MATLAB_MINOR=
-    ;;
-esac
-AC_SUBST([MATLAB_VERSION])
-AC_SUBST([MATLAB_MAJOR])
-AC_SUBST([MATLAB_MINOR])
-if test x$MATLAB_VERSION != x ; then
-    AC_DEFINE_UNQUOTED([MATLAB_MAJOR], [$MATLAB_MAJOR], [Define to the Matlab major version number.])
-    AC_DEFINE_UNQUOTED([MATLAB_MINOR], [$MATLAB_MINOR], [Define to the Matlab minor version number.])
-fi
-])
-
-# AX_REQUIRE_MATLAB_VERSION([MINIMUM-VERSION])
-# --------------------------------------------
-# Check if Matlab version number is sufficient.
-AC_DEFUN([AX_REQUIRE_MATLAB_VERSION],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AX_MATLAB_VERSION])
-if test x$MATLAB_VERSION = x ; then
-    AC_MSG_ERROR([can not determine Matlab version number])
-fi
-m4_if([$1], [], [],
-[AC_MSG_CHECKING([if Matlab version is sufficient])
-ax_version='$1'
-case $ax_version in
-  @<:@1-9@:>@ | @<:@1-9@:>@@<:@0-9@:>@)
-    ax_major=$ax_version
-    ax_minor=''
-    ;;
-  @<:@1-9@:>@.@<:@0-9@:>@ | @<:@1-9@:>@@<:@0-9@:>@.@<:@0-9@:>@)
-    ax_major=`echo $ax_version | sed 's/^\(@<:@0-9@:>@*\)\.@<:@0-9@:>@*.*/\1/'`
-    ax_minor=`echo $ax_version | sed 's/^@<:@0-9@:>@*\.\(@<:@0-9@:>@*\).*/\1/'`
-    ;;
-  *)
-    AC_MSG_RESULT([failure])
-    AC_MSG_NOTICE([report this bug to the responsible package maintainer])
-    AC_MSG_ERROR([invalid Matlab version number argument to AX_REQUIRE_MATLAB_VERSION])
-    ;;
-esac
-ax_ans=yes
-if test $MATLAB_MAJOR -eq $ax_major ; then
-    if test x$ax_minor != x && test $MATLAB_MINOR -lt $ax_minor ; then
-	ax_ans=no
-    fi
-elif test $MATLAB_MAJOR -lt $ax_major ; then
-    ax_ans=no
-fi
-AC_MSG_RESULT([$ax_ans])
-if test x$ax_ans = xno ; then
-    AC_MSG_ERROR([require Matlab version $ax_version or above])
-fi])
-])
-
-dnl matlabver.m4 ends here
-
-dnl matlab.m4 --- check for Matlab.
-dnl
-dnl Copyright (C) 2000--2003 Ralph Schleicher
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2,
-dnl or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; see the file COPYING.  If not, write to
-dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-dnl Boston, MA 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if
-dnl you distribute this file as part of a program that contains a
-dnl configuration script generated by GNU Autoconf, you may include
-dnl it under the same distribution terms that you use for the rest
-dnl of that program.
-dnl
-dnl Code:
-
-# AX_MATLAB
-# ---------
-# Check for Matlab.
-AC_DEFUN([AX_MATLAB],
-[dnl
-AC_PREREQ([2.50])
-ax_enable_matlab=
-AC_ARG_WITH([matlab-dir], AC_HELP_STRING([--with-matlab-dir=ARG], [check for Matlab [[yes]]]),
-[case $withval in
-  yes | no)
-    # Explicitly enable or disable Matlab but determine
-    # Matlab prefix automatically.
-    ax_enable_matlab=$withval
-    ;;
-  *)
-    # Enable Matlab and use ARG as the Matlab prefix.
-    # ARG must be an existing directory.
-    ax_enable_matlab=yes
-    MATLAB=`cd "${withval-/}" > /dev/null 2>&1 && pwd`
-    if test -z "$MATLAB" ; then
-	AC_MSG_ERROR([invalid value '$withval' for --with-matlab])
-    fi
-    ;;
-esac])
-if test x$ax_enable_matlab != xno ; then
-AC_CACHE_CHECK([for Matlab prefix], [ax_cv_matlab],
-[if test "${MATLAB+set}" = set ; then
-    ax_cv_matlab=`cd "${MATLAB-/}" > /dev/null 2>&1 && pwd`
-else
-    ax_cv_matlab=
-    IFS=${IFS= 	} ; ax_ifs=$IFS ; IFS=:
-    for ax_dir in ${PATH-/opt/bin:/usr/local/bin:/usr/bin:/bin} ; do
-	if test -z "$ax_dir" ; then
-	    ax_dir=.
-	fi
-	if test -x "$ax_dir/matlab" ; then
-	    ax_dir=`echo "$ax_dir" | sed 's,/bin$,,'`
-	    # Directory sanity check.
-	    ax_cv_matlab=`cd "${ax_dir-/}" > /dev/null 2>&1 && pwd`
-	    if test -n "$ax_cv_matlab" ; then
-		break
-	    fi
-	fi
-    done
-    IFS=$ax_ifs
-fi
-if test -z "$ax_cv_matlab" ; then
-    ax_cv_matlab="not found"
-fi])
-if test "$ax_cv_matlab" = "not found" ; then
-    unset MATLAB
-else
-    # Strip trailing dashes.
-    MATLAB=`echo "$ax_cv_matlab" | sed 's,/*$,,'`
-fi
-AC_MSG_CHECKING([whether to enable Matlab support])
-if test x$ax_enable_matlab != xno ; then
-    if test "${MATLAB+set}" = set && test -d "$MATLAB/extern/include" ; then
-	ax_enable_matlab=yes
-    elif test x$ax_enable_matlab = x ; then
-	ax_enable_matlab=no
-    else
-	# Fail if Matlab was explicitly enabled.
-	AC_MSG_RESULT([failure])
-	AC_MSG_ERROR([check your Matlab setup])
-    fi
-fi
-AC_MSG_RESULT([$ax_enable_matlab])
-if test x$ax_enable_matlab = xyes ; then
-    AC_DEFINE([HAVE_MATLAB], [1], [Define if you have Matlab.])
-fi
-fi
-AC_SUBST([MATLAB])
-])
-
-# AX_REQUIRE_MATLAB
-# -----------------
-# Like AX_MATLAB but fail if Matlab support is disabled.
-AC_DEFUN([AX_REQUIRE_MATLAB],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AX_MATLAB])
-if test x$ax_enable_matlab = xno ; then
-    AC_MSG_ERROR([can not enable Matlab support])
-fi
-])
-
-# AX_MATLAB_CONDITIONAL
-# ---------------------
-# Define Matlab conditional for GNU Automake.
-AC_DEFUN([AX_MATLAB_CONDITIONAL],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AX_MATLAB])
-AM_CONDITIONAL([MATLAB], [test x$ax_enable_matlab = xyes])
-])
-
-dnl matlab.m4 ends here
-
-dnl mex.m4 --- check for mex(1) command.
-dnl
-dnl Copyright (C) 2000--2003 Ralph Schleicher
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2,
-dnl or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; see the file COPYING.  If not, write to
-dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-dnl Boston, MA 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if
-dnl you distribute this file as part of a program that contains a
-dnl configuration script generated by GNU Autoconf, you may include
-dnl it under the same distribution terms that you use for the rest
-dnl of that program.
-dnl
-dnl Code:
-
-# AX_PATH_MEX
-# -----------
-# Check for mex(1) command.
-AC_DEFUN([AX_PATH_MEX],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AX_MATLAB])
-AC_REQUIRE([AX_MEX_OPTIONS])
-AC_REQUIRE([AC_CANONICAL_HOST])
-if test "${MEX+set}" != set ; then
-    case $host_os in
-      *cygwin* | *mingw32*)
-	ax_list='mextool mex mex.bat'
-	;;
-      *)
-	ax_list='mex'
-	;;
-    esac
-    AC_PATH_PROGS([MEX], $ax_list, mex, $MATLAB/bin:$PATH)
-fi
-AC_SUBST([MEX])
-if test "${MEXFLAGS+set}" != set ; then
-    MEXFLAGS=-O
-fi
-AC_SUBST([MEXFLAGS])
-if test "${MEXLDADD+set}" != set ; then
-    MEXLDADD=
-fi
-AC_SUBST([MEXLDADD])
-])
-
-dnl mex.m4 ends here
-
-dnl mexopt.m4 --- check for MEX options file.
-dnl
-dnl Copyright (C) 2001--2003 Ralph Schleicher
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2,
-dnl or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; see the file COPYING.  If not, write to
-dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-dnl Boston, MA 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if
-dnl you distribute this file as part of a program that contains a
-dnl configuration script generated by GNU Autoconf, you may include
-dnl it under the same distribution terms that you use for the rest
-dnl of that program.
-dnl
-dnl Code:
-
-# AX_MEX_OPTIONS
-# --------------
-# Check for MEX options file.
-AC_DEFUN([AX_MEX_OPTIONS],
-[dnl
-AC_PREREQ([2.50])
-mex_options=yes
-AC_ARG_WITH([mex-options], AC_HELP_STRING([--with-mex-options=ARG], [use MEX options file ARG [[standard]]]),
-[mex_options=$withval])
-AC_MSG_CHECKING([for MEX options file handling])
-case $mex_options in
-  yes)
-    AC_MSG_RESULT([standard])
-    mexopts_sh=
-    ;;
-  no)
-    AC_MSG_RESULT([disabled])
-    mexopts_sh=$ac_aux_dir/noopts.sh
-    ;;
-  *)
-    AC_MSG_RESULT([enabled])
-    mexopts_sh=$mex_options
-    ;;
-esac
-if test -n "$mexopts_sh" ; then
-    AC_MSG_CHECKING([whether MEX options file exists])
-    if test -f "$mexopts_sh" ; then
-	AC_MSG_RESULT([yes])
-	# Canonicalize file name.
-	mexopts_sh_dir=`echo "$mexopts_sh" | sed 's,[[^/]]*$,,'`
-	mexopts_sh_dir=`cd "${mexopts_sh_dir-.}" && pwd`
-	mexopts_sh_name=`echo "$mexopts_sh" | sed 's,.*/,,'`
-	mexopts_sh="$mexopts_sh_dir/$mexopts_sh_name"
-    else
-	AC_MSG_RESULT([no])
-	AC_MSG_ERROR([$mexopts_sh: no such file])
-    fi
-    MEXOPTS="-f $mexopts_sh"
-else
-    MEXOPTS=
-fi
-AC_SUBST([mexopts_sh])
-AC_SUBST([MEXOPTS])
-])
-
-dnl mexopt.m4 ends here
-
-dnl mexext.m4 --- check for MEX-file suffix.
-dnl
-dnl Copyright (C) 2000--2003 Ralph Schleicher
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2,
-dnl or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; see the file COPYING.  If not, write to
-dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-dnl Boston, MA 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if
-dnl you distribute this file as part of a program that contains a
-dnl configuration script generated by GNU Autoconf, you may include
-dnl it under the same distribution terms that you use for the rest
-dnl of that program.
-dnl
-dnl Code:
-
-# AX_MEXEXT
-# ---------
-# Check for MEX-file suffix.
-AC_DEFUN([AX_MEXEXT],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AX_PATH_MEX])
-AC_CACHE_CHECK([for MEX-file suffix], [ax_cv_mexext],
-[if test "${MEXEXT+set}" = set ; then
-    ax_cv_mexext="$MEXEXT"
-else
-    if test -x ${MATLAB}/bin/mexext ; then
-      ax_cv_mexext=`${MATLAB}/bin/mexext`
-    fi
-fi
-if test "x${ax_cv_mexext}" = "x" ; then
-    echo 'mexFunction () {}' > ax_c_test.c
-    $MEX $MEXOPTS $MEXFLAGS -output ax_c_test ax_c_test.c $MEXLDADD 2> /dev/null 1>&2
-    if test -f ax_c_test.dll ; then
-	ax_cv_mexext=dll
-    elif test -f ax_c_test.mex ; then
-	ax_cv_mexext=mex
-    elif test -f ax_c_test.mexaxp ; then
-	ax_cv_mexext=mexaxp
-    elif test -f ax_c_test.mexglx ; then
-	ax_cv_mexext=mexglx
-    elif test -f ax_c_test.mexa64 ; then
-	ax_cv_mexext=mexa64
-    elif test -f ax_c_test.mexmac ; then
-	ax_cv_mexext=mexmac
-    elif test -f ax_c_test.mexmaci ; then
-	ax_cv_mexext=mexmaci
-    elif test -f ax_c_test.mexhp7 ; then
-	ax_cv_mexext=mexhp7
-    elif test -f ax_c_test.mexhpux ; then
-	ax_cv_mexext=mexhpux
-    elif test -f ax_c_test.mexrs6 ; then
-	ax_cv_mexext=mexrs6
-    elif test -f ax_c_test.mexsg ; then
-	ax_cv_mexext=mexsg
-    elif test -f ax_c_test.mexsol ; then
-	ax_cv_mexext=mexsol
-    elif test -f ax_c_test.mexs64 ; then
-	ax_cv_mexext=mexs64
-    elif test -f ax_c_test.mexw32 ; then
-	ax_cv_mexext=mexw32
-    elif test -f ax_c_test.mexw64 ; then
-	ax_cv_mexext=mexw64
-    else
-	ax_cv_mexext=unknown
-    fi
-    rm -f ax_c_test*
-fi])
-MEXEXT="$ax_cv_mexext"
-AC_SUBST([MEXEXT])
-])
-
-# AX_DOT_MEXEXT
-# -------------
-# Check for MEX-file suffix with leading dot.
-AC_DEFUN([AX_DOT_MEXEXT],
-[dnl
-AC_REQUIRE([AX_MEXEXT])
-case $MEXEXT in
-  .*)
-    ;;
-  unknown)
-    ;;
-  *)
-    if test -n "$MEXEXT" ; then
-	MEXEXT=.$MEXEXT
-	AC_MSG_RESULT([setting MEX-file suffix to $MEXEXT])
-	AC_SUBST([MEXEXT])
-    fi
-    ;;
-esac
-])
-
-dnl mexext.m4 ends here
-
-dnl ccmex.m4 --- check how to compile c programs using mex
-dnl
-dnl Copyright (C) 2007 Duncan Brown
-dnl
-dnl This program is free software; you can redistribute it and/or
-dnl modify it under the terms of the GNU General Public License as
-dnl published by the Free Software Foundation; either version 2,
-dnl or (at your option) any later version.
-dnl
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-dnl GNU General Public License for more details.
-dnl
-dnl You should have received a copy of the GNU General Public License
-dnl along with this program; see the file COPYING.  If not, write to
-dnl the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
-dnl Boston, MA 02111-1307, USA.
-dnl
-dnl As a special exception to the GNU General Public License, if
-dnl you distribute this file as part of a program that contains a
-dnl configuration script generated by GNU Autoconf, you may include
-dnl it under the same distribution terms that you use for the rest
-dnl of that program.
-dnl
-dnl Code:    
-
-# AX_CC_MEX
-# ------------
-# Check for the flags needed to build a file with mex
-AC_DEFUN([AX_CC_MEX],
-[dnl
-AC_REQUIRE([AX_PATH_MEX])
-AC_REQUIRE([AX_DOT_MEXEXT])
-AC_LANG([C])
-
-dnl Source code for the test matlab C program
-ac_mex_source='[#include "mex.h"
-void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { return; }]'
-
-dnl Check that the test C program can be compiled with mex
-ac_exeext_save=$ac_exeext
-ac_exeext=$MEXEXT
-ac_link_save=$ac_link
-ac_link='$MEX $MEXOPTS $MEXFLAGS -output conftest$ac_exeext conftest.$ac_ext $MEXLDADD >&AS_MESSAGE_LOG_FD'
-AC_MSG_CHECKING([if mex works])
-AC_LINK_IFELSE([AC_LANG_SOURCE($ac_mex_source)],
-[AC_MSG_RESULT([yes])],
-[AC_MSG_RESULT([no])])
-
-dnl Try to figure out how mex compiles a C program
-ax_cv_mex_version=
-ac_cv_mex_cppflags=
-ac_cv_mex_includes=
-ac_cv_mex_cflags=
-ac_cv_mex_libs=
-ac_cv_mex_ldflags=
-
-dnl Variable that will be subsituted
-MEX_VERSION_C=
-MEX_LDFLAGS=
-MEX_CPPFLAGS=
-MEX_INCLUDES=
-MEX_CFLAGS=
-MEX_LIBS=
-MEX_LDFLAGS=
-
-AC_MSG_CHECKING([if mex -n works])
-ac_save_MEXOPTS=$MEXOPTS
-MEXOPTS="-n $MEXOPTS"
-AC_LANG_CONFTEST([AC_LANG_SOURCE($ac_mex_source)])
-(eval echo $as_me:__oline__: \"$ac_link\") >&AS_MESSAGE_LOG_FD
-ac_cv_mex_n_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1`
-ac_cv_mex_n_result=$?
-echo "$ac_cv_mex_n_output" >&AS_MESSAGE_LOG_FD
-MEXOPTS=$ac_save_MEXOPTS
-rm -f conftest*
-ac_exeext=$ac_exeext_save
-ac_link=$ac_link_save
-
-if test $ac_cv_mex_n_result -eq 0 ; then
-  ac_cv_mex_working=yes
-  AC_MSG_RESULT([$ac_cv_mex_working])
-
-  dnl Save positional arguments (if any)
-  ac_save_positional="$[@]"
-
-  set X $ac_cv_mex_n_output
-  while test $[@%:@] != 1; do
-    shift
-      ac_arg=$[1]
-      case $ac_arg in
-        *mexversion.c)
-          ax_cv_mex_version=$ac_arg
-          ;;
-        -pthread)
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_cppflags, ,
-            ac_cv_mex_cppflags="$ac_cv_mex_cppflags $ac_arg")
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_cflags, ,
-            ac_cv_mex_cflags="$ac_cv_mex_cflags $ac_arg")
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_ldflags, ,
-            ac_cv_mex_ldflags="$ac_cv_mex_ldflags $ac_arg")
-          ;;
-        -mt)
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_cppflags, ,
-            ac_cv_mex_cppflags="$ac_cv_mex_cppflags $ac_arg")
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_cflags, ,
-            ac_cv_mex_cflags="$ac_cv_mex_cflags $ac_arg")
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_ldflags, ,
-            ac_cv_mex_ldflags="$ac_cv_mex_ldflags $ac_arg")
-          ;;
-        -ansi)
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_cppflags, ,
-            ac_cv_mex_cppflags="$ac_cv_mex_cppflags $ac_arg")
-          ;;
-        -D*)
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_cppflags, ,
-            ac_cv_mex_cppflags="$ac_cv_mex_cppflags $ac_arg")
-          ;;
-        -I*)
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_includes, ,
-            ac_cv_mex_includes="$ac_cv_mex_includes $ac_arg")
-          ;;
-        -f* | -O* | -xO* | -xlibmil )
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_cflags, ,
-            ac_cv_mex_cflags="$ac_cv_mex_cflags $ac_arg")
-          ;;
-        -l*)
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_libs, ,
-            ac_cv_mex_libs="$ac_cv_mex_libs $ac_arg")
-          ;;
-        -L)
-          # When -L is seen by itself, it takes an argument
-          # We remove the space between option and argument and re-iterate
-          # unless we find an empty arg or a new option (starting with -)
-          case $[2] in
-             "" | -*);;
-             *)
-             ac_arg="$ac_arg$[2]"
-             shift; shift
-             set X $ac_arg "$[@]"
-             ;;
-           esac
-           ;;
-        -L* | -Wl,* | -shared | -bundle | -G)
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_ldflags, ,
-            ac_cv_mex_ldflags="$ac_cv_mex_ldflags $ac_arg")
-          ;;
-        -undefined)
-          # the darwin linker undefined option takes and argument
-          ac_arg="$ac_arg $[2]"
-          shift
-          _AC_LIST_MEMBER_IF($ac_arg, $ac_cv_mex_ldflags, ,
-            ac_cv_mex_ldflags="$ac_cv_mex_ldflags $ac_arg")
-          ;;   
-          # ignore everything else
-      esac
-  done
-  
-  # restore positional arguments
-  set X $ac_save_positional; shift
-
-  MEX_VERSION_C=$ax_cv_mex_version
-
-  AC_MSG_CHECKING([for CPPFLAGS needed to build mex objects])
-  if test "x$ac_cv_mex_cppflags" = "x" ; then
-    AC_MSG_RESULT([none])
-  else
-    MEX_CPPFLAGS=`echo $ac_cv_mex_cppflags | sed 's/^[ \t]*//;s/[ \t]*$//'`
-    AC_MSG_RESULT([$MEX_CPPFLAGS])
-  fi
-  AC_MSG_CHECKING([for INCLUDES needed to build mex objects])
-  if test "x$ac_cv_mex_includes" = "x" ; then
-    AC_MSG_RESULT([none])
-  else
-    MEX_INCLUDES=`echo $ac_cv_mex_includes | sed 's/^[ \t]*//;s/[ \t]*$//'`
-    AC_MSG_RESULT([$MEX_INCLUDES])
-  fi
-  AC_MSG_CHECKING([for CFLAGS needed to build mex objects])
-  if test "x$ac_cv_mex_cflags" = "x" ; then
-    AC_MSG_RESULT([none])
-  else
-    MEX_CFLAGS=`echo $ac_cv_mex_cflags | sed 's/^[ \t]*//;s/[ \t]*$//'`
-    AC_MSG_RESULT([$MEX_CFLAGS])
-  fi
-  AC_MSG_CHECKING([for LIBS needed to build mex objects])
-  if test "x$ac_cv_mex_libs" = "x" ; then
-    AC_MSG_RESULT([none])
-  else
-    MEX_LIBS=`echo $ac_cv_mex_libs | sed 's/^[ \t]*//;s/[ \t]*$//'`
-    AC_MSG_RESULT([$MEX_LIBS])
-  fi
-  AC_MSG_CHECKING([for LDFLAGS needed to build mex objects])
-  if test "x$ac_cv_mex_ldflags" = "x" ; then
-    AC_MSG_RESULT([none])
-  else
-    MEX_LDFLAGS=`echo $ac_cv_mex_ldflags | sed 's/^[ \t]*//;s/[ \t]*$//'`
-    AC_MSG_RESULT([$MEX_LDFLAGS])
-  fi
-else
-  ac_cv_mex_working=no
-  AC_MSG_RESULT([$ac_cv_mex_working])
-fi
-
-AC_SUBST(MEX_VERSION_C)
-AC_SUBST(MEX_CPPFLAGS)
-AC_SUBST(MEX_INCLUDES)
-AC_SUBST(MEX_CFLAGS)
-AC_SUBST(MEX_LIBS)
-AC_SUBST(MEX_LDFLAGS)
-
-])
-
-# AX_MEX_CONDITIONAL
-# ---------------------
-# Define Matlab conditional for GNU Automake.
-AC_DEFUN([AX_MEX_CONDITIONAL],
-[dnl
-AC_PREREQ([2.50])
-AC_REQUIRE([AX_CC_MEX])
-AM_CONDITIONAL(MEX, test x$ac_cv_mex_working = xyes)
-AM_CONDITIONAL(MEX_VERSION_C, test x$ax_cv_mex_version != x)
-])
-
-dnl ccmex.m4 ends here
-
-# AX_MATLAB_SYS_ZLIB
-# ------------
-# Matlab preloads an old version of zlib which means that we cannot
-# just dynamically link against the libz.so found by the linker.
-# Instead we search for a working version of zlib in the system 
-# location and use that.
-AC_DEFUN([AX_MATLAB_SYS_ZLIB],
-[dnl
-AC_REQUIRE([AX_PATH_MEX])
-AC_LANG([C])
-
-ax_matlab_sys_zlib=
-
-if test x$ax_cv_mexext != xunknown && test x$ax_cv_mexext != x ; then
-  # Where should we search for libraries
-  ax_sys_lib_search_path="/lib /usr/lib /usr/local/lib"
-
-  # If this is a 64 bit link box look in the place where redhat keeps libs
-  if test x$ax_cv_mexext = xmexa64; then
-    ax_sys_lib_search_path="/lib64 /usr/lib64 /usr/local/lib64 $ax_sys_lib_search_path"
-  fi
-
-  # set the extension of the library we are looking for
-  if test x$ax_cv_mexext = xmexmac || test x$ax_cv_mexext = xmexmaci ; then
-    ax_zlib_lib_ext=".dylib"
-  else
-    ax_zlib_lib_ext=".a"
-  fi
-
-  for lib_path in $ax_sys_lib_search_path ; do
-    ax_matlab_search_zlib=$lib_path/libz$ax_zlib_lib_ext
-
-   AC_CHECK_FILE([$ax_matlab_search_zlib],
-     [
-       AC_MSG_CHECKING([for gzungetc in $ax_matlab_search_zlib])
-       ac_save_LIBS=$LIBS
-       LIBS="$ax_matlab_search_zlib $LIBS"
-       AC_LINK_IFELSE(
-         [ AC_LANG_PROGRAM( ,[[gzungetc();]]) ],
-         [ 
-           AC_MSG_RESULT([yes]) 
-           ax_matlab_sys_zlib=$ax_matlab_search_zlib
-         ],
-         [ AC_MSG_RESULT([no]) ]
-       )
-       LIBS=$ac_save_LIBS
-     ], )
-    
-    if test x$ax_matlab_sys_zlib != x ; then
-      break
-    fi
-  done
-fi
-
-MATLAB_SYS_ZIB=$ax_matlab_sys_zlib
-
-AC_SUBST([MATLAB_SYS_ZIB])
-
-])
-
-
-##### http://autoconf-archive.cryp.to/check_zlib.html
-#
-# SYNOPSIS
-#
-#   CHECK_ZLIB()
-#
-# DESCRIPTION
-#
-#   This macro searches for an installed zlib library. If nothing was
-#   specified when calling configure, it searches first in /usr/local
-#   and then in /usr. If the --with-zlib=DIR is specified, it will try
-#   to find it in DIR/include/zlib.h and DIR/lib/libz.a. If
-#   --without-zlib is specified, the library is not searched at all.
-#
-#   If either the header file (zlib.h) or the library (libz) is not
-#   found, the configuration exits on error, asking for a valid zlib
-#   installation directory or --without-zlib.
-#
-#   The macro defines the symbol HAVE_LIBZ if the library is found. You
-#   should use autoheader to include a definition for this symbol in a
-#   config.h file. Sample usage in a C/C++ source is as follows:
-#
-#     #ifdef HAVE_LIBZ
-#     #include <zlib.h>
-#     #endif /* HAVE_LIBZ */
-#
-# LAST MODIFICATION
-#
-#   2004-09-20
-#
-# COPYLEFT
-#
-#   Copyright (c) 2004 Loic Dachary <loic@senga.org>
-#
-#   This program is free software; you can redistribute it and/or
-#   modify it under the terms of the GNU General Public License as
-#   published by the Free Software Foundation; either version 2 of the
-#   License, or (at your option) any later version.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-#   General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program; if not, write to the Free Software
-#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-#   02111-1307, USA.
-#
-#   As a special exception, the respective Autoconf Macro's copyright
-#   owner gives unlimited permission to copy, distribute and modify the
-#   configure scripts that are the output of Autoconf when processing
-#   the Macro. You need not follow the terms of the GNU General Public
-#   License when using or distributing such scripts, even though
-#   portions of the text of the Macro appear in them. The GNU General
-#   Public License (GPL) does govern all other use of the material that
-#   constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the
-#   Autoconf Macro released by the Autoconf Macro Archive. When you
-#   make and distribute a modified version of the Autoconf Macro, you
-#   may extend this special exception to the GPL to apply to your
-#   modified version as well.
-
-AC_DEFUN([CHECK_ZLIB], [
-AC_ARG_WITH([zlib], [AS_HELP_STRING([--with-zlib=DIR], [root directory path of zlib installation (defaults to /usr/local or /usr if not found in /usr/local), --without-zlib to disable zlib usage completely])], [], [with_zlib=yes])
-
-if test "x$with_zlib" != xno ; then
-  if test "x$with_zlib" != xyes ; then
-    ZLIB_HOME=$with_zlib
-  else
-    # default locations
-    ZLIB_HOME=/usr/local
-    if test ! -f "${ZLIB_HOME}/include/zlib.h"
-    then
-      ZLIB_HOME=/usr
-    fi
-  fi
-
-  ZLIB_OLD_LDFLAGS=$LDFLAGS
-  ZLIB_OLD_CPPFLAGS=$LDFLAGS
-  LDFLAGS="$LDFLAGS -L${ZLIB_HOME}/lib"
-  CPPFLAGS="$CPPFLAGS -I${ZLIB_HOME}/include"
-  AC_LANG_PUSH([C])
-  AC_CHECK_HEADERS([zlib.h])
-  AC_CHECK_LIB([z], [inflateEnd])
-  AC_LANG_POP([C])
-
-  if test "x$ac_cv_header_zlib_h" = "xyes" -a "x$ac_cv_lib_z_inflateEnd" = "xyes" ; then
-    AC_MSG_RESULT([zlib found in $ZLIB_HOME])
-    AC_SUBST([HAVE_LIBZ], [$ac_cv_lib_z_inflateEnd])
-  else
-    LDFLAGS="$ZLIB_OLD_LDFLAGS"
-    CPPFLAGS="$ZLIB_OLD_CPPFLAGS"
-    AC_MSG_ERROR(either specify a valid zlib installation with --with-zlib=DIR or disable zlib usage with --without-zlib)
-  fi
-fi])
Index: sm/branches/trunk-jpl-damage/missing
===================================================================
--- /issm/branches/trunk-jpl-damage/missing	(revision 12003)
+++ 	(revision )
@@ -1,367 +1,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2006-05-10.23
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-#   Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
-  exit 1
-fi
-
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Send bug reports to <bug-automake@gnu.org>."
-    exit $?
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing $scriptversion (GNU Automake)"
-    exit $?
-    ;;
-
-  -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
-    exit 1
-    ;;
-
-esac
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).
-case $1 in
-  lex|yacc)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  tar)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $1 in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison|yacc)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex|flex)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit 1
-    fi
-    ;;
-
-  makeinfo)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
-
-  tar)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-	case $firstarg in
-	*o*)
-	    firstarg=`echo "$firstarg" | sed s/o//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-	case $firstarg in
-	*h*)
-	    firstarg=`echo "$firstarg" | sed s/h//`
-	    tar "$firstarg" "$@" && exit 0
-	    ;;
-	esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
Index: /issm/branches/trunk-jpl-damage/scripts/issmconfiguration.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/scripts/issmconfiguration.sh	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/scripts/issmconfiguration.sh	(revision 12004)
@@ -0,0 +1,58 @@
+#/bin/bash
+#This script picks up whatever configuration files exists in trunk/configs, 
+#and offers the user the choice to reconfigure the ISSM compilation using
+#a given configuration file: 
+
+#keep track of present directory: 
+presendir=`pwd`
+
+if test -d "$ISSM_TIER/configs" ; then
+	cd $ISSM_TIER/configs
+	LIST=`ls`
+	
+	if [[  $# == "0" ]]; then 
+		COUNT=0;
+		for STEP in $LIST
+		do
+			let COUNT=$COUNT+1
+			printf '%3i: %s\n' $COUNT $STEP
+		done
+
+		echo -n "Configuration choice: "
+		read choice 
+	else
+		choice=$1
+	fi
+
+	#Now go backto the list and retrieve the name of the configuration file: 
+	COUNT=0;
+	for STEP in $LIST
+	do
+		let COUNT=$COUNT+1
+		if [[ $COUNT == $choice ]]; then
+			configurename=$STEP
+		fi
+	done
+
+	#Now go ahead and configure: 
+	echo ""
+	echo "Configuring ISSM with following configs: $configurename"
+	echo ""
+
+	cd $ISSM_TIER 
+	source ./scripts/automakererun.sh 
+	source configs/$configurename
+	
+	#we are done, go back to original directory: 
+	cd $presendir
+else
+	echo "Configuration directory does not exist!"
+	exit
+fi
+
+
+
+
+
+
+#alias aut='a=`pwd` && cd $ISSM_TIER && ./scripts/automakererun.sh && ./configs/config-macosx64-larour-nopetsc.sh'
Index: /issm/branches/trunk-jpl-damage/scripts/report.sh
===================================================================
--- /issm/branches/trunk-jpl-damage/scripts/report.sh	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/scripts/report.sh	(revision 12004)
@@ -33,5 +33,5 @@
 
 TABLE_STYLE='width="800px" rules=none bgcolor="#ffffdd" border=1 bordercolor="#000000" cellpadding="3"'
-TABLE_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14; font-weight: normal;" align="left"'
+TABLE_FONT='style="color:#404040; font-family:Arial, Verdana, Tahoma; font-size:14px; font-weight: normal;" align="left"'
 
 MATLAB_STYLE='width="1000px" rules=none'
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/AndroidManifest.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/AndroidManifest.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/AndroidManifest.xml	(revision 12004)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.example.helloworld"
+      android:versionCode="1"
+      android:versionName="1.0">
+    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
+        <activity android:name="HelloWorldActivity"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/ant.properties
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/ant.properties	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/ant.properties	(revision 12004)
@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked in Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+#  'source.dir' for the location of your java source folder and
+#  'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+#  'key.store' for the location of your keystore and
+#  'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/build.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/build.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/build.xml	(revision 12004)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="HelloWorldProject" default="help">
+
+    <!-- The local.properties file is created and updated by the 'android' tool.
+         It contains the path to the SDK. It should *NOT* be checked into
+         Version Control Systems. -->
+    <property file="local.properties" />
+
+    <!-- The ant.properties file can be created by you. It is only edited by the
+         'android' tool to add properties to it.
+         This is the place to change some Ant specific build properties.
+         Here are some properties you may want to change/update:
+
+         source.dir
+             The name of the source directory. Default is 'src'.
+         out.dir
+             The name of the output directory. Default is 'bin'.
+
+         For other overridable properties, look at the beginning of the rules
+         files in the SDK, at tools/ant/build.xml
+
+         Properties related to the SDK location or the project target should
+         be updated using the 'android' tool with the 'update' action.
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems.
+
+         -->
+    <property file="ant.properties" />
+
+    <!-- The project.properties file is created and updated by the 'android'
+         tool, as well as ADT.
+
+         This contains project specific properties such as project target, and library
+         dependencies. Lower level build properties are stored in ant.properties
+         (or in .classpath for Eclipse projects).
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems. -->
+    <loadproperties srcFile="project.properties" />
+
+    <!-- quick check on sdk.dir -->
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
+            unless="sdk.dir"
+    />
+
+
+<!-- extension targets. Uncomment the ones where you want to do custom work
+     in between standard targets -->
+<!--
+    <target name="-pre-build">
+    </target>
+    <target name="-pre-compile">
+    </target>
+
+    /* This is typically used for code obfuscation.
+       Compiled code location: ${out.classes.absolute.dir}
+       If this is not done in place, override ${out.dex.input.absolute.dir} */
+    <target name="-post-compile">
+    </target>
+-->
+
+    <!-- Import the actual build file.
+
+         To customize existing targets, there are two options:
+         - Customize only one target:
+             - copy/paste the target into this file, *before* the
+               <import> task.
+             - customize it to your needs.
+         - Customize the whole content of build.xml
+             - copy/paste the content of the rules files (minus the top node)
+               into this file, replacing the <import> task.
+             - customize to your needs.
+
+         ***********************
+         ****** IMPORTANT ******
+         ***********************
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+         in order to avoid having your file be overridden by tools such as "android update project"
+    -->
+    <!-- version-tag: 1 -->
+    <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/gen/R.java.d
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/gen/R.java.d	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/gen/R.java.d	(revision 12004)
@@ -0,0 +1,10 @@
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/gen/com/example/helloworld/R.java \
+ : /Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/res/drawable-hdpi/ic_launcher.png \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/res/drawable-ldpi/ic_launcher.png \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/res/drawable-mdpi/ic_launcher.png \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/res/layout/main.xml \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/res/values/strings.xml \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/bin/res/drawable-hdpi/ic_launcher.png \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/bin/res/drawable-ldpi/ic_launcher.png \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/bin/res/drawable-mdpi/ic_launcher.png \
+/Users/gperez/issm/trunk-jpl/src/android/HelloWorldProject/AndroidManifest.xml \
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/gen/com/example/helloworld/R.java
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/gen/com/example/helloworld/R.java	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/gen/com/example/helloworld/R.java	(revision 12004)
@@ -0,0 +1,22 @@
+/* AUTO-GENERATED FILE.  DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found.  It
+ * should not be modified by hand.
+ */
+
+package com.example.helloworld;
+
+public final class R {
+    public static final class attr {
+    }
+    public static final class drawable {
+        public static final int ic_launcher=0x7f020000;
+    }
+    public static final class layout {
+        public static final int main=0x7f030000;
+    }
+    public static final class string {
+        public static final int app_name=0x7f040000;
+    }
+}
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/makefile
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/makefile	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/makefile	(revision 12004)
@@ -0,0 +1,7 @@
+.PHONY build :
+	# $(ANDROID_SDK_DIR)/tools/emulator -avd Android-4.0.3
+	$(ANDROID_ANT_DIR)/bin/ant debug
+	# $(ANDROID_SDK_DIR)/platform-tools/adb install ./bin/HelloWorldProject-debug.apk
+	
+clean :
+	rm -rf bin
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/proguard.cfg
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/proguard.cfg	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/proguard.cfg	(revision 12004)
@@ -0,0 +1,40 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/project.properties
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/project.properties	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/project.properties	(revision 12004)
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-15
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/res/layout/main.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/res/layout/main.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/res/layout/main.xml	(revision 12004)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+<TextView
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:text="Hello World, HelloWorldActivity"
+    />
+</LinearLayout>
+
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/res/values/strings.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/res/values/strings.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/res/values/strings.xml	(revision 12004)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">HelloWorldActivity</string>
+</resources>
Index: /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/src/com/example/helloworld/HelloWorldActivity.java
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/src/com/example/helloworld/HelloWorldActivity.java	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/HelloWorldProject/src/com/example/helloworld/HelloWorldActivity.java	(revision 12004)
@@ -0,0 +1,15 @@
+package com.example.helloworld;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class HelloWorldActivity extends Activity
+{
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.main);
+    }
+}
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/AndroidManifest.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/AndroidManifest.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/AndroidManifest.xml	(revision 12004)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.example.twolibs"
+      android:versionCode="1"
+      android:versionName="1.0">
+    <uses-sdk android:minSdkVersion="3" />
+    <application android:label="@string/app_name">
+        <activity android:name=".TwoLibs"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest> 
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/build.prop
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/build.prop	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/build.prop	(revision 12004)
@@ -0,0 +1,10 @@
+#Last build type
+#Wed, 21 Mar 2012 11:35:09 -0700
+
+build.last.target=debug
+
+build.last.is.instrumented=false
+
+build.last.is.packaging.debug=true
+
+build.last.is.signing.debug=true
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/classes.dex.d
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/classes.dex.d	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/classes.dex.d	(revision 12004)
@@ -0,0 +1,1 @@
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/bin/classes.dex : \
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/two-libs-debug-unaligned.apk.d
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/two-libs-debug-unaligned.apk.d	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/two-libs-debug-unaligned.apk.d	(revision 12004)
@@ -0,0 +1,4 @@
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/bin/two-libs-debug-unaligned.apk : \
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/bin/two-libs.ap_ \
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/bin/classes.dex \
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/libs/armeabi/libtwolib-second.so \
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/two-libs.ap_.d
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/two-libs.ap_.d	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/bin/two-libs.ap_.d	(revision 12004)
@@ -0,0 +1,3 @@
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/bin/two-libs.ap_ \
+ : /Users/gperez/issm/trunk-jpl/src/android/two-libs/res/values/strings.xml \
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/AndroidManifest.xml \
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/build.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/build.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/build.xml	(revision 12004)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="two-libs" default="help">
+
+    <!-- The local.properties file is created and updated by the 'android' tool.
+         It contains the path to the SDK. It should *NOT* be checked into
+         Version Control Systems. -->
+    <property file="local.properties" />
+
+    <!-- The ant.properties file can be created by you. It is only edited by the
+         'android' tool to add properties to it.
+         This is the place to change some Ant specific build properties.
+         Here are some properties you may want to change/update:
+
+         source.dir
+             The name of the source directory. Default is 'src'.
+         out.dir
+             The name of the output directory. Default is 'bin'.
+
+         For other overridable properties, look at the beginning of the rules
+         files in the SDK, at tools/ant/build.xml
+
+         Properties related to the SDK location or the project target should
+         be updated using the 'android' tool with the 'update' action.
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems.
+
+         -->
+    <property file="ant.properties" />
+
+    <!-- The project.properties file is created and updated by the 'android'
+         tool, as well as ADT.
+
+         This contains project specific properties such as project target, and library
+         dependencies. Lower level build properties are stored in ant.properties
+         (or in .classpath for Eclipse projects).
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems. -->
+    <loadproperties srcFile="project.properties" />
+
+    <!-- quick check on sdk.dir -->
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
+            unless="sdk.dir"
+    />
+
+
+<!-- extension targets. Uncomment the ones where you want to do custom work
+     in between standard targets -->
+<!--
+    <target name="-pre-build">
+    </target>
+    <target name="-pre-compile">
+    </target>
+
+    /* This is typically used for code obfuscation.
+       Compiled code location: ${out.classes.absolute.dir}
+       If this is not done in place, override ${out.dex.input.absolute.dir} */
+    <target name="-post-compile">
+    </target>
+-->
+
+    <!-- Import the actual build file.
+
+         To customize existing targets, there are two options:
+         - Customize only one target:
+             - copy/paste the target into this file, *before* the
+               <import> task.
+             - customize it to your needs.
+         - Customize the whole content of build.xml
+             - copy/paste the content of the rules files (minus the top node)
+               into this file, replacing the <import> task.
+             - customize to your needs.
+
+         ***********************
+         ****** IMPORTANT ******
+         ***********************
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+         in order to avoid having your file be overridden by tools such as "android update project"
+    -->
+    <!-- version-tag: 1 -->
+    <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/gen/R.java.d
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/gen/R.java.d	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/gen/R.java.d	(revision 12004)
@@ -0,0 +1,3 @@
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/gen/com/example/twolibs/R.java \
+ : /Users/gperez/issm/trunk-jpl/src/android/two-libs/res/values/strings.xml \
+/Users/gperez/issm/trunk-jpl/src/android/two-libs/AndroidManifest.xml \
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/gen/com/example/twolibs/R.java
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/gen/com/example/twolibs/R.java	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/gen/com/example/twolibs/R.java	(revision 12004)
@@ -0,0 +1,16 @@
+/* AUTO-GENERATED FILE.  DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found.  It
+ * should not be modified by hand.
+ */
+
+package com.example.twolibs;
+
+public final class R {
+    public static final class attr {
+    }
+    public static final class string {
+        public static final int app_name=0x7f020000;
+    }
+}
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/Android.mk
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/Android.mk	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/Android.mk	(revision 12004)
@@ -0,0 +1,42 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# the purpose of this sample is to demonstrate how one can
+# generate two distinct shared libraries and have them both
+# uploaded in
+#
+
+LOCAL_PATH:= $(call my-dir)
+
+# first lib, which will be built statically
+#
+include $(CLEAR_VARS)
+
+# TEST := $(shell echo $(origin CLEAR_VARS))
+LOCAL_MODULE    := libtwolib-first
+LOCAL_SRC_FILES := first.c
+
+include $(BUILD_STATIC_LIBRARY)
+
+# second lib, which will depend on and include the first one
+#
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := libtwolib-second
+LOCAL_SRC_FILES := second.c
+
+LOCAL_STATIC_LIBRARIES := libtwolib-first
+
+include $(BUILD_SHARED_LIBRARY)
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/first.c
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/first.c	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/first.c	(revision 12004)
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include "first.h"
+
+int  first(int  x, int  y)
+{
+    return x + y;
+}
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/first.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/first.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/first.h	(revision 12004)
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#ifndef FIRST_H
+#define FIRST_H
+
+extern int first(int  x, int  y);
+
+#endif /* FIRST_H */
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/second.c
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/second.c	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/jni/second.c	(revision 12004)
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+#include "first.h"
+#include <jni.h>
+
+jint
+Java_com_example_twolibs_TwoLibs_add( JNIEnv*  env,
+                                      jobject  this,
+                                      jint     x,
+                                      jint     y )
+{
+    return first(x, y);
+}
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/obj/local/armeabi/objs/twolib-first/first.o.d
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/obj/local/armeabi/objs/twolib-first/first.o.d	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/obj/local/armeabi/objs/twolib-first/first.o.d	(revision 12004)
@@ -0,0 +1,3 @@
+obj/local/armeabi/objs/twolib-first/first.o: jni/first.c jni/first.h
+
+jni/first.h:
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/obj/local/armeabi/objs/twolib-second/second.o.d
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/obj/local/armeabi/objs/twolib-second/second.o.d	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/obj/local/armeabi/objs/twolib-second/second.o.d	(revision 12004)
@@ -0,0 +1,6 @@
+obj/local/armeabi/objs/twolib-second/second.o: jni/second.c jni/first.h \
+ /Users/gperez/issm/trunk-jpl/externalpackages/android-ndk/install/platforms/android-3/arch-arm/usr/include/jni.h
+
+jni/first.h:
+
+/Users/gperez/issm/trunk-jpl/externalpackages/android-ndk/install/platforms/android-3/arch-arm/usr/include/jni.h:
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/proguard.cfg
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/proguard.cfg	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/proguard.cfg	(revision 12004)
@@ -0,0 +1,40 @@
+-optimizationpasses 5
+-dontusemixedcaseclassnames
+-dontskipnonpubliclibraryclasses
+-dontpreverify
+-verbose
+-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
+
+-keep public class * extends android.app.Activity
+-keep public class * extends android.app.Application
+-keep public class * extends android.app.Service
+-keep public class * extends android.content.BroadcastReceiver
+-keep public class * extends android.content.ContentProvider
+-keep public class * extends android.app.backup.BackupAgentHelper
+-keep public class * extends android.preference.Preference
+-keep public class com.android.vending.licensing.ILicensingService
+
+-keepclasseswithmembernames class * {
+    native <methods>;
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet);
+}
+
+-keepclasseswithmembers class * {
+    public <init>(android.content.Context, android.util.AttributeSet, int);
+}
+
+-keepclassmembers class * extends android.app.Activity {
+   public void *(android.view.View);
+}
+
+-keepclassmembers enum * {
+    public static **[] values();
+    public static ** valueOf(java.lang.String);
+}
+
+-keep class * implements android.os.Parcelable {
+  public static final android.os.Parcelable$Creator *;
+}
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/project.properties
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/project.properties	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/project.properties	(revision 12004)
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-15
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/res/values/strings.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/res/values/strings.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/res/values/strings.xml	(revision 12004)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">TwoLib</string>
+</resources>
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/src/com/example/twolibs/TwoLibs.java
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/src/com/example/twolibs/TwoLibs.java	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/src/com/example/twolibs/TwoLibs.java	(revision 12004)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.example.twolibs;
+
+import android.app.Activity;
+import android.widget.TextView;
+import android.os.Bundle;
+
+public class TwoLibs extends Activity
+{
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+
+        TextView  tv = new TextView(this);
+        int       x  = 1000;
+        int       y  = 42;
+
+        // here, we dynamically load the library at runtime
+        // before calling the native method.
+        //
+        System.loadLibrary("twolib-second");
+
+        int  z = add(x, y);
+
+        tv.setText( "The sum of " + x + " and " + y + " is " + z );
+        setContentView(tv);
+    }
+
+    public native int add(int  x, int  y);
+}
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/AndroidManifest.xml
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/AndroidManifest.xml	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/AndroidManifest.xml	(revision 12004)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          package="com.example.TwoLib.tests"
+          android:versionCode="1"
+          android:versionName="1.0">
+    <!-- We add an application tag here just so that we can indicate that
+         this package needs to link against the android.test library,
+         which is needed when building test cases. -->
+    <application>
+        <uses-library android:name="android.test.runner" />
+    </application>
+    <!--
+    This declares that this application uses the instrumentation test runner targeting
+    the package of com.example.TwoLib.  To run the tests use the command:
+    "adb shell am instrument -w com.example.TwoLib.tests/android.test.InstrumentationTestRunner"
+    -->
+    <instrumentation android:name="android.test.InstrumentationTestRunner"
+                     android:targetPackage="com.example.TwoLib"
+                     android:label="Tests for TwoLib"/>
+</manifest>
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/default.properties
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/default.properties	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/default.properties	(revision 12004)
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+# 
+# This file must be checked in Version Control Systems.
+# 
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-3
Index: /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/src/com/example/TwoLib/TwoLibTest.java
===================================================================
--- /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/src/com/example/TwoLib/TwoLibTest.java	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/android/two-libs/tests/src/com/example/TwoLib/TwoLibTest.java	(revision 12004)
@@ -0,0 +1,21 @@
+package com.example.TwoLib;
+
+import android.test.ActivityInstrumentationTestCase;
+
+/**
+ * This is a simple framework for a test of an Application.  See
+ * {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
+ * how to write and extend Application tests.
+ * <p/>
+ * To run this test, you can type:
+ * adb shell am instrument -w \
+ * -e class com.example.TwoLib.TwoLibTest \
+ * com.example.TwoLib.tests/android.test.InstrumentationTestRunner
+ */
+public class TwoLibTest extends ActivityInstrumentationTestCase<TwoLib> {
+
+    public TwoLibTest() {
+        super("com.example.TwoLib", TwoLib.class);
+    }
+
+}
Index: /issm/branches/trunk-jpl-damage/src/c/Container/DataSet.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/Container/DataSet.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/Container/DataSet.cpp	(revision 12004)
@@ -230,5 +230,5 @@
 				dataset->AddObject(triavertexinput);}
 				break;
-			#ifdef _HAVE_THREED_
+			#ifdef _HAVE_3D_
 			case PentaP1InputEnum:{
 				PentaP1Input* pentavertexinput=NULL;
@@ -264,5 +264,5 @@
 				dataset->AddObject(triavertexelementresult);}
 				break;
-			 #ifdef _HAVE_THREED_
+			 #ifdef _HAVE_3D_
 			case PentaP1ElementResultEnum:{
 				PentaP1ElementResult* pentavertexelementresult=NULL;
Index: /issm/branches/trunk-jpl-damage/src/c/Container/Options.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/Container/Options.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/Container/Options.cpp	(revision 12004)
@@ -20,5 +20,5 @@
 #include "../shared/shared.h"
 #include "../EnumDefinitions/EnumDefinitions.h"
-#ifdef _SERIAL_
+#if _SERIAL_
 #include "../io/io.h"
 #endif
@@ -31,5 +31,5 @@
 }
 /*}}}*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION Options::Options(int istart, int nrhs, const mxArray* prhs[]){{{1*/
 Options::Options(int istart, int nrhs, const mxArray* prhs[]){
@@ -43,5 +43,5 @@
 		if (!mxIsClass(prhs[i],"char")) _error_("Argument %d must be name of option.",i+1);
 
-		FetchMatlabData(&name,prhs[i]);
+		FetchData(&name,prhs[i]);
 		if (i+1 == nrhs) _error_("Argument %d must exist and be value of option \"%s\".",i+2,name);
 
Index: /issm/branches/trunk-jpl-damage/src/c/Container/Options.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/Container/Options.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/Container/Options.h	(revision 12004)
@@ -15,5 +15,5 @@
 		/*constructors, destructors*/
 		Options();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		Options(int istart, int nrhs, const mxArray* prhs[]);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/Container/Results.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/Container/Results.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/Container/Results.cpp	(revision 12004)
@@ -65,5 +65,5 @@
 /*}}}*/
 /*FUNCTION Results::Write{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void Results::Write(mxArray** pdataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/Container/Results.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/Container/Results.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/Container/Results.h	(revision 12004)
@@ -26,5 +26,5 @@
 		/*numerics: {{{1*/
 		Results* SpawnTriaResults(int* indices);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void Write(mxArray** pdataref);
 		#else 
Index: /issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/EnumDefinitions.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/EnumDefinitions.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/EnumDefinitions/EnumDefinitions.h	(revision 12004)
@@ -151,4 +151,8 @@
 	SettingsResultsAsPatchesEnum,
 	SettingsWaitonlockEnum,
+	DebugPetscProfilingEnum,
+	PetscProfilingCurrentMemEnum,
+	PetscProfilingCurrentFlopsEnum,
+	PetscProfilingSolutionTimeEnum,
 	SteadystateMaxiterEnum,
 	SteadystateNumRequestedOutputsEnum,
@@ -166,6 +170,7 @@
 	ThermalIsenthalpyEnum,
 	ThicknessEnum,
+	TimesteppingStartTimeEnum,
+	TimesteppingFinalTimeEnum,
 	TimesteppingCflCoefficientEnum,
-	TimesteppingFinalTimeEnum,
 	TimesteppingTimeAdaptEnum,
 	TimesteppingTimeStepEnum,
@@ -237,4 +242,5 @@
 	BoolInputEnum,
 	BoolParamEnum,
+	ContourEnum,
 	ControlInputEnum,
 	DatasetInputEnum,
@@ -387,4 +393,5 @@
 	/*}}}*/
 	/*Results{{{1*/
+	SaveResultsEnum,
 	BoolElementResultEnum,
 	BoolExternalResultEnum,
@@ -401,4 +408,5 @@
 	PetscVecExternalResultEnum,
 	StringExternalResultEnum,
+	StepEnum,
 	TimeEnum,
 	TriaP1ElementResultEnum,
Index: /issm/branches/trunk-jpl-damage/src/c/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/Makefile.am	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/Makefile.am	(revision 12004)
@@ -1,3 +1,4 @@
-INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@  @METISINCL@  @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@  @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@  @TRIANGLEINCL@ @HYPREINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@
+INCLUDES = @DAKOTAINCL@ @SHAPELIBINCL@ @PETSCINCL@ @SLEPCINCL@ @MPIINCL@ @MATLABINCL@ @METISINCL@ @CHACOINCL@ @SCOTCHINCL@ @PLAPACKINCL@ @BLASLAPACKINCL@ @MKLINCL@ @MUMPSINCL@ @TRIANGLEINCL@ @HYPREINCL@ @MLINCL@ @TAOINCL@ @ADIC2INCL@ @ADOLCINCL@ @GSLINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
+
 EXEEXT=$(ISSMEXT)
 
@@ -12,5 +13,5 @@
 else
 if NOPARALLEL
-lib_LIBRARIES = libISSM.a  libOverload.a
+lib_LIBRARIES = libISSM.a libOverload.a
 else
 lib_LIBRARIES = libISSM.a libpISSM.a libOverload.a
@@ -21,5 +22,5 @@
 #sources
 #Core sources{{{1
-core_sources   = ./include/macros.h\
+core_sources = ./include/macros.h\
 					./include/typedefs.h\
 					./include/types.h\
@@ -207,4 +208,7 @@
 					./shared/Elements/GetNumberOfDofs.cpp\
 					./shared/String/sharedstring.h\
+					./shared/Wrapper/wrappershared.h\
+					./shared/Wrapper/ModuleBoot.cpp\
+					./shared/Wrapper/ModuleEnd.cpp\
 					./toolkits/mpi/mpiincludes.h\
 					./toolkits/mpi/patches/mpipatches.h\
@@ -214,4 +218,9 @@
 					./toolkits/mpi/patches/MPI_Boundariesfromrange.cpp\
 					./toolkits/metis/metisincludes.h\
+					./toolkits/issm/issmtoolkit.h\
+					./toolkits/issm/SeqVec.h\
+					./toolkits/issm/SeqVec.cpp\
+					./toolkits/issm/SeqMat.h\
+					./toolkits/issm/SeqMat.cpp\
 					./toolkits/metis/patches/metispatches.h\
 					./toolkits/metis/patches/METIS_PartMeshNodalPatch.cpp\
@@ -237,4 +246,6 @@
 					./modules/ModelProcessorx/CreateNumberNodeToElementConnectivity.cpp\
 					./modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp\
+					./modules/ParsePetscOptionsx/ParsePetscOptionsx.h\
+					./modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp\
 					./modules/NodesDofx/NodesDofx.h\
 					./modules/NodesDofx/NodesDofx.cpp\
@@ -387,7 +398,5 @@
 
 thermal_psources = ./solutions/thermal_core.cpp\
-					    ./solutions/thermal_core_step.cpp\
 					    ./solutions/enthalpy_core.cpp\
-					    ./solutions/enthalpy_core_step.cpp\
 					    ./solvers/solver_thermal_nonlinear.cpp
 #}}}
@@ -441,5 +450,5 @@
 					  ./solutions/controlrestart.cpp\
 					  ./solutions/controlconvergence.cpp\
-					  ./solutions/objectivefunctionC.cpp\
+					  ./solutions/objectivefunction.cpp\
 					  ./solutions/gradient_core.cpp\
 					  ./solutions/adjointdiagnostic_core.cpp\
@@ -686,21 +695,21 @@
 #}}}
 #Matlab sources  {{{1
-matlab_sources= ./shared/Matlab/matlabshared.h\
-				    ./shared/Matlab/ModuleBoot.cpp\
-				    ./shared/Matlab/ModuleEnd.cpp\
-				    ./shared/Matlab/mxGetAssignedField.cpp\
-				    ./shared/Matlab/mxGetField.cpp\
-				    ./shared/Matlab/CheckNumMatlabArguments.cpp\
-				    ./toolkits/matlab/matlabincludes.h\
+matlab_sources= ./toolkits/matlab/matlabincludes.h\
 				    ./toolkits/matlab/MatlabNArrayToNArray.cpp\
-				    ./toolkits/matlab/MatlabMatrixToMatrix.cpp\
-				    ./toolkits/matlab/MatlabVectorToVector.cpp\
 				    ./toolkits/double/MatlabVectorToDoubleVector.cpp\
 				    ./toolkits/double/double.h\
 				    ./toolkits/double/MatlabMatrixToDoubleMatrix.cpp\
 				    ./io/Matlab/matlabio.h\
+				    ./io/Matlab/CheckNumMatlabArguments.cpp\
+				    ./io/Matlab/mxGetAssignedField.cpp\
 				    ./io/Matlab/WriteMatlabData.cpp\
 				    ./io/Matlab/FetchMatlabData.cpp\
 				    ./io/Matlab/OptionParse.cpp
+#}}}
+#Python sources  {{{1
+python_sources=     ./io/Python/pythonio.h\
+				    ./io/Python/WritePythonData.cpp\
+				    ./io/Python/CheckNumPythonArguments.cpp\
+				    ./io/Python/FetchPythonData.cpp
 #}}}
 #Petsc sources  {{{1
@@ -732,12 +741,15 @@
 					./toolkits/petsc/patches/MatInvert.cpp\
 					./toolkits/petsc/patches/MatMultPatch.cpp\
+					./toolkits/petsc/patches/ISSMToPetscMatrixType.cpp\
 					./toolkits/petsc/patches/ISSMToPetscInsertMode.cpp\
 					./toolkits/petsc/patches/ISSMToPetscNormMode.cpp\
 					./toolkits/petsc/petscincludes.h\
 					./shared/Numerics/PetscOptionsFromAnalysis.cpp\
-					./modules/ParsePetscOptionsx/ParsePetscOptionsx.h\
-					./modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp\
 					./modules/Solverx/SolverxPetsc.cpp\
 					./modules/Solverx/DofTypesToIndexSet.cpp
+
+#}}}
+#Gsl sources  {{{1
+gsl_sources= ./modules/Solverx/SolverxGsl.cpp
 
 #}}}
@@ -781,4 +793,6 @@
 			./modules/TriaSearchx/TriaSearchx.h\
 			./modules/TriaSearchx/TriaSearchx.cpp\
+			./modules/TriMeshx/TriMeshx.h\
+			./modules/TriMeshx/TriMeshx.cpp\
 			./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.h\
 			./modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp\
@@ -846,4 +860,10 @@
 endif
 
+if GSL
+issm_sources  +=  $(gsl_sources)
+issm_psources +=  $(gsl_psources)
+endif
+
+
 if TRANSIENT
 issm_sources  +=  $(transient_sources)
@@ -914,12 +934,16 @@
 libISSM_a_SOURCES += $(bamg_sources)
 libISSM_a_SOURCES += $(kml_sources)
+libISSM_a_CXXFLAGS = -fPIC -D_SERIAL_ -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS) 
+#libISSM_a_CXXFLAGS = -D_SERIAL_ -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER   $(CXXFLAGS) $(CXXOPTFLAGS) 
+
+if PYTHON
+libISSM_a_CXXFLAGS+=  -DNPY_NO_DEPRECATED_API 
+libISSM_a_SOURCES += $(python_sources)
+endif
+
+if MATLAB
 libISSM_a_SOURCES += $(matlab_sources)
-
-libISSM_a_CXXFLAGS = -fPIC -DMATLAB -D_SERIAL_ -D_GNU_SOURCE -fno-omit-frame-pointer -pthread -D_CPP_  $(CXXFLAGS) $(CXXOPTFLAGS) 
-if LARGEARRAYS
-libISSM_a_CXXFLAGS += -D__GCC4BUILD__  
-else
-libISSM_a_CXXFLAGS += -DMX_COMPAT_32 
-endif
+endif
+
 endif
 #}}}
@@ -940,15 +964,15 @@
 bin_PROGRAMS = 
 else 
-bin_PROGRAMS = issm
+bin_PROGRAMS = issm 
 endif
 
 #Standard libraries
-LDADD =      ./libpISSM.a ./libOverload.a
+LDADD = ./libpISSM.a ./libOverload.a
 
 #External packages
-LDADD += $(PETSCLIB) $(TAOLIB) $(FLIBS) $(PLAPACKLIB)  $(MUMPSLIB) $(SCALAPACKLIB)  $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB)  $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS)
+LDADD += $(PETSCLIB) $(TAOLIB) $(FLIBS) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)
 
 issm_SOURCES = solutions/issm.cpp
-issm_CXXFLAGS= -fPIC -D_PARALLEL_  $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
+issm_CXXFLAGS= -fPIC -D_PARALLEL_ $(CXXFLAGS) $(CXXOPTFLAGS) $(COPTFLAGS) 
 #}}}
 #Automatic differentiation: append this fold to the end of the src/c/Makefile.am to get this Makefile.am {{{
Index: /issm/branches/trunk-jpl-damage/src/c/include/globals.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/include/globals.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/include/globals.h	(revision 12004)
@@ -6,6 +6,6 @@
 #define GLOBALS_H_
 
-int my_rank;
-int num_procs;
+int my_rank=0;
+int num_procs=1;
 
 #endif
Index: /issm/branches/trunk-jpl-damage/src/c/include/macros.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/include/macros.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/include/macros.h	(revision 12004)
@@ -34,5 +34,5 @@
 #ifdef _ISSM_DEBUG_ 
 #define _assert_(statement)\
-  if (!(statement)) _error_("Assertion \"%s\" failed, please report bug to ISSM developers",#statement)
+  if (!(statement)) _error_("Assertion \"%s\" failed, please report bug to %s",#statement,PACKAGE_BUGREPORT)
 #else
 #define _assert_(ignore)\
@@ -40,10 +40,13 @@
 #endif
 /*}}}*/
+
 /* MODULEBOOT/MODULEEND {{{1*/
+
 /*The following macros hide the error exception handling in a matlab module. Just put 
  * MODULEBOOT(); and MODULEEND(); at the beginning and end of a module, and c++ exceptions 
  * will be trapped. Really nifty!*/
+
 #ifdef _SERIAL_
-
+#ifdef _HAVE_MATLAB_ //{{{2
 #define MODULEBOOT(); ModuleBoot(); \
 	try{
@@ -58,7 +61,14 @@
 		mexErrMsgTxt(" ");\
 	}
+#endif //}}}
+#ifdef _HAVE_PYTHON_ //{{{2
+#define MODULEBOOT(); ModuleBoot();  \
+	PyObject* output = PyTuple_New(NLHS); if (!output) return NULL;
 
+#define MODULEEND();  ModuleEnd(); \
+						 return output;
+#endif //}}}
 #else 
-
+//{{{2
 #define MODULEBOOT(); \
 	try{
@@ -73,6 +83,49 @@
 		return 1;\
 	}
+//}}}
+#endif
+/*}}}*/
+/* WRAPPER {{{1*/
+#ifdef _HAVE_MATLAB_
+#define WRAPPER(modulename,...) void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) 
+#endif
+#ifdef _HAVE_PYTHON_
+#define WRAPPER(modulename,...)  \
+\
+static PyObject* modulename(PyObject* self,PyObject* args);\
+static PyMethodDef modulename##_funcs[] = {\
+	{#modulename, (PyCFunction)modulename, METH_VARARGS, ""},\
+	{NULL,NULL,0,NULL}\
+};\
+\
+static struct PyModuleDef modulename##module= {\
+	PyModuleDef_HEAD_INIT,\
+	#modulename,   /* name of module */\
+	NULL, /* module documentation, may be NULL */\
+	-1,       /* size of per-interpreter state of the module,\
+				 or -1 if the module keeps state in global variables. */\
+	modulename##_funcs\
+};\
+\
+PyMODINIT_FUNC PyInit_##modulename(void){\
+\
+	import_array();\
+	return PyModule_Create(&modulename##module);\
+}\
+\
+static PyObject* modulename(PyObject* self,PyObject* args)
+
+#endif
+
+/*}}}*/
+/* CHECKARGUMENTS {{{1*/
+#ifdef _HAVE_MATLAB_
+#define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,functionpointer)
+#endif
+#ifdef _HAVE_PYTHON_
+#define CHECKARGUMENTS(NLHS,NRHS,functionpointer) CheckNumPythonArguments(args, NRHS,functionpointer)
 #endif
 /*}}}*/
 
+
 #endif
Index: /issm/branches/trunk-jpl-damage/src/c/include/types.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/include/types.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/include/types.h	(revision 12004)
@@ -16,5 +16,5 @@
 
 /*Define abstract type for I/O: */
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 typedef const mxArray* ConstDataHandle;  //serially, we are reading data from a matlab array.
Index: /issm/branches/trunk-jpl-damage/src/c/io/Matlab/CheckNumMatlabArguments.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Matlab/CheckNumMatlabArguments.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Matlab/CheckNumMatlabArguments.cpp	(revision 12004)
@@ -0,0 +1,35 @@
+/*!\file CheckNumMatlabArguments.cpp:
+ * \brief: check number of arguments and report an usage error message.
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+
+#include "../../shared/Exceptions/exceptions.h"
+#include "../../include/include.h"
+#include "mex.h"
+
+int CheckNumMatlabArguments(int nlhs,int NLHS, int nrhs,int NRHS, const char* __FUNCT__, void (*function)( void )){
+	
+	/*checks on arguments on the matlab side: */
+	if (nrhs==0 && nlhs==0) {
+		/*unless NLHS=0 and NRHS=0, we are just asking for documentation: */
+		if (NRHS==0 && NLHS==0)return 1;
+		/* special case: */
+		function();
+		_error_("usage: see above");
+	}
+	else if (nlhs!=NLHS || nrhs!=NRHS ) {
+		function(); 
+		_error_("usage error.");
+	}
+	return 1;
+}
+
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/io/Matlab/FetchMatlabData.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Matlab/FetchMatlabData.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Matlab/FetchMatlabData.cpp	(revision 12004)
@@ -1,3 +1,3 @@
-/*\file FetchMatlabData.cpp:
+/*\file FetchData.cpp:
  * \brief: general I/O interface to fetch data in matlab
  */
@@ -12,8 +12,8 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
-/*FUNCTION FetchMatlabData(DataSet** pdataset,const mxArray* dataref){{{1*/
-void FetchMatlabData(DataSet** pdataset,const mxArray* dataref){
+/*FUNCTION FetchData(DataSet** pdataset,const mxArray* dataref){{{1*/
+void FetchData(DataSet** pdataset,const mxArray* dataref){
 
 	/*output*/
@@ -48,6 +48,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
-void FetchMatlabData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){
+/*FUNCTION FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
+void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref){
 
 	double*  outmatrix=NULL;
@@ -84,6 +84,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
-void FetchMatlabData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
+/*FUNCTION FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
+void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
 
 	double*  outmatrix=NULL;
@@ -127,6 +127,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
-void FetchMatlabData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){
+/*FUNCTION FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
+void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref){
 
 	int     i,outmatrix_rows,outmatrix_cols;
@@ -169,6 +169,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
-void FetchMatlabData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){
+/*FUNCTION FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){{{1*/
+void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref){
 
 	int     i,outmatrix_rows,outmatrix_cols;
@@ -211,6 +211,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
-void FetchMatlabData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
+/*FUNCTION FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
+void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
 
 	int      i;
@@ -276,6 +276,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(Matrix** pmatrix,const mxArray* dataref){{{1*/
-void FetchMatlabData(Matrix** pmatrix,const mxArray* dataref){
+/*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{1*/
+void FetchData(Matrix** pmatrix,const mxArray* dataref){
 	
 	Matrix* outmatrix=NULL;
@@ -283,14 +283,8 @@
 
 	if (mxIsClass(dataref,"double") ){
-
-		/*Check dataref is not pointing to NaN: */
-		if ( mxIsNaN(*(mxGetPr(dataref))) && (mxGetM(dataref)==1) && (mxGetN(dataref)==1) ){
-			outmatrix=NULL;
-		}
-		else{
-
-			/*Convert matlab matrix to petsc matrix: */
-			outmatrix=MatlabMatrixToMatrix(dataref);
-		}
+			
+		/*Convert matlab matrix to matrix: */
+		outmatrix=MatlabMatrixToMatrix(dataref);
+
 	}
 	else{
@@ -303,6 +297,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(double** pvector,int* pM,const mxArray* dataref){{{1*/
-void FetchMatlabData(double** pvector,int* pM,const mxArray* dataref){
+/*FUNCTION FetchData(double** pvector,int* pM,const mxArray* dataref){{{1*/
+void FetchData(double** pvector,int* pM,const mxArray* dataref){
 
 	double* outvector=NULL;
@@ -330,6 +324,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(int** pvector,int* pM,const mxArray* dataref){{{1*/
-void FetchMatlabData(int** pvector,int* pM,const mxArray* dataref){
+/*FUNCTION FetchData(int** pvector,int* pM,const mxArray* dataref){{{1*/
+void FetchData(int** pvector,int* pM,const mxArray* dataref){
 
 	int    i;
@@ -362,6 +356,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(bool** pvector,int* pM,const mxArray* dataref){{{1*/
-void FetchMatlabData(bool** pvector,int* pM,const mxArray* dataref){
+/*FUNCTION FetchData(bool** pvector,int* pM,const mxArray* dataref){{{1*/
+void FetchData(bool** pvector,int* pM,const mxArray* dataref){
 
 	int    i;
@@ -394,6 +388,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(float** pvector,int* pM,const mxArray* dataref){{{1*/
-void FetchMatlabData(float** pvector,int* pM,const mxArray* dataref){
+/*FUNCTION FetchData(float** pvector,int* pM,const mxArray* dataref){{{1*/
+void FetchData(float** pvector,int* pM,const mxArray* dataref){
 
 	int    i;
@@ -426,7 +420,7 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(Vector** pvector,const mxArray* dataref){{{1*/
-void FetchMatlabData(Vector** pvector,const mxArray* dataref){
-
+/*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{1*/
+void FetchData(Vector** pvector,const mxArray* dataref){
+	
 	Vector* vector=NULL;
 	int dummy;
@@ -434,5 +428,5 @@
 	if(mxIsEmpty(dataref)){
 		/*Nothing to pick up. Just initialize matrix pointer to NULL: */
-		vector=NULL;
+		vector=new Vector(0);
 	}
 	else if (mxIsClass(dataref,"double") ){
@@ -450,6 +444,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(char** pstring,const mxArray* dataref){{{1*/
-void FetchMatlabData(char** pstring,const mxArray* dataref){
+/*FUNCTION FetchData(char** pstring,const mxArray* dataref){{{1*/
+void FetchData(char** pstring,const mxArray* dataref){
 
 	char* outstring=NULL;
@@ -472,6 +466,6 @@
 	*pstring=outstring;
 }
-/*FUNCTION FetchMatlabData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
-void FetchMatlabData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
+/*FUNCTION FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){{{1*/
+void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref){
 
 	int      outmatrix_numel,outmatrix_ndims;
@@ -515,6 +509,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(double* pscalar,const mxArray* dataref){{{1*/
-void FetchMatlabData(double* pscalar,const mxArray* dataref){
+/*FUNCTION FetchData(double* pscalar,const mxArray* dataref){{{1*/
+void FetchData(double* pscalar,const mxArray* dataref){
 
 	double scalar;
@@ -532,6 +526,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(int* pinteger,const mxArray* dataref){{{1*/
-void FetchMatlabData(int* pinteger,const mxArray* dataref){
+/*FUNCTION FetchData(int* pinteger,const mxArray* dataref){{{1*/
+void FetchData(int* pinteger,const mxArray* dataref){
 
 	int integer;
@@ -549,6 +543,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(bool* pboolean,const mxArray* dataref){{{1*/
-void FetchMatlabData(bool* pboolean,const mxArray* dataref){
+/*FUNCTION FetchData(bool* pboolean,const mxArray* dataref){{{1*/
+void FetchData(bool* pboolean,const mxArray* dataref){
 
 	bool* mxbool_ptr=NULL;
@@ -566,6 +560,6 @@
 }
 /*}}}*/
-/*FUNCTION FetchMatlabData(Parameters** pparameters, DataHandle dataref){{{1*/
-void FetchMatlabData(Parameters** pparameters, DataHandle dataref){
+/*FUNCTION FetchData(Parameters** pparameters, DataHandle dataref){{{1*/
+void FetchData(Parameters** pparameters, DataHandle dataref){
 
 	int i,j;
@@ -609,10 +603,9 @@
 		if (mxIsClass(pfield,"double")){
 			
-			/*could be  DOUBLE, DOUBLEVEC or DOUBLEMAT, depends on dimensions: */
 			M=mxGetM(pfield);
 			N=mxGetN(pfield);
 
 			if (M==0 | N==0){
-				_error_("%s%i (%s) %s%i%s%i%s","array in parameters structure field ",count,name," is of size (",M,",",N,")");
+				_error_("array in parameters structure field %s is of size 0",name);
 			}
 			if (M==1 && N==1){
@@ -649,4 +642,22 @@
 
 		}
+		else if (mxIsClass(pfield,"logical")){
+
+			M=mxGetM(pfield);
+			N=mxGetN(pfield);
+
+			if (M==0 | N==0){
+				_error_("array in parameters structure field %s is of size 0",name);
+			}
+			if (M==1 && N==1){
+				/*we have a simple bool: */
+				param= new BoolParam(enum_type,*mxGetLogicals(pfield));
+				parameters->AddObject(param);
+
+			}
+			else{
+				_error_("Matrices of Booleans not supported yet in parameters");
+			}
+		}
 		else if (mxIsClass(pfield,"char")){
 			/* we have a string parameter:*/
@@ -678,5 +689,5 @@
 					char* descriptor=NULL;
 					pfield2=mxGetCell(pfield,i);
-					FetchMatlabData(&descriptor,pfield2);
+					FetchData(&descriptor,pfield2);
 					stringarray[i]=descriptor;
 				}
@@ -705,5 +716,5 @@
 					int     m,n;
 					pfield2=mxGetCell(pfield,i);
-					FetchMatlabData(&matrix,&m,&n,pfield2);
+					FetchData(&matrix,&m,&n,pfield2);
 					array[i]=matrix;
 					mdims_array[i]=m;
@@ -724,10 +735,9 @@
 			}
 		}
-		else _error_("%s%i","unknow type in parameters structure field ",i);
+		else _error_("Parameters structure field %s has a format that is not supported: %s",name,mxGetClassName(pfield));
 	}
 
 	/*Assign output pointers:*/
 	*pparameters=parameters;
-
 }
 /*}}}*/
Index: /issm/branches/trunk-jpl-damage/src/c/io/Matlab/OptionParse.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Matlab/OptionParse.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Matlab/OptionParse.cpp	(revision 12004)
@@ -13,5 +13,5 @@
 #include "./matlabio.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 
@@ -31,5 +31,5 @@
 	}
 
-	FetchMatlabData(&odouble->values,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]);
+	FetchData(&odouble->values,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]);
 
 	return(odouble);
@@ -50,5 +50,5 @@
 	}
 
-	FetchMatlabData(&ological->values,&ological->numel,&ological->ndims,&ological->size,prhs[0]);
+	FetchData(&ological->values,&ological->numel,&ological->ndims,&ological->size,prhs[0]);
 
 	return(ological);
@@ -69,5 +69,5 @@
 	}
 
-	FetchMatlabData(&ochar->values,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]);
+	FetchData(&ochar->values,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]);
 
 	return(ochar);
Index: /issm/branches/trunk-jpl-damage/src/c/io/Matlab/PrintfFunction.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Matlab/PrintfFunction.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Matlab/PrintfFunction.cpp	(revision 12004)
@@ -0,0 +1,64 @@
+/*\file PrintfFunction.c
+ *\brief: this function is used by the _printf_ macro, to take into account the 
+ *fact we may be running on a cluster. 
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include "../../shared/shared.h"
+#include "../../include/include.h"
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+#include "mex.h"
+#endif
+
+int PrintfFunction(char* format,...){
+	/*http://linux.die.net/man/3/vsnprintf*/
+
+	/*string to be printed: */
+	char *buffer = NULL;
+	int   n,size = 100;
+	int         string_size;
+	extern int  my_rank;
+	extern int  num_procs;
+                                                                                                                                                                                                     
+	//variable list of arguments
+	va_list args;
+
+	while(true){
+
+		/*allocate buffer for given string size*/
+		buffer=(char*)xmalloc(size*sizeof(char));
+
+		/* Try to print in the allocated space. */
+		va_start(args, format);
+#ifndef WIN32
+		n=vsnprintf(buffer,size,format,args);
+#else
+		n=vsnprintf(buffer,size,format,args);
+#endif
+		va_end(args);
+
+		/* If that worked, return the string. */
+		if(n>-1 && n<size) break;
+
+		/* Else try again with more space. */
+		if(n>-1)   /* glibc 2.1 */
+		 size=n+1; /* precisely what is needed */
+		else       /* glibc 2.0 */
+		 size*=2;  /* twice the old size */
+
+		xfree((void**)&buffer);
+	}
+
+	/*Ok, if we are running in parallel, get node 0 to print*/
+#if defined(_PARALLEL_)
+	if(my_rank==0)printf(buffer);
+#else
+	mexPrintf(buffer);
+#endif
+
+	/*Clean up and return*/
+	xfree((void**)&buffer);
+	return 1;
+}
Index: /issm/branches/trunk-jpl-damage/src/c/io/Matlab/WriteMatlabData.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Matlab/WriteMatlabData.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Matlab/WriteMatlabData.cpp	(revision 12004)
@@ -1,3 +1,3 @@
-/* \file WriteMatlabData.c:
+/* \file WriteData.c:
  * \brief: general interface for writing data
  */
@@ -12,9 +12,9 @@
 #include "../../shared/shared.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 
-/*FUNCTION WriteMatlabData(mxArray** pdataref,DataSet* dataset){{{1*/
-void WriteMatlabData(mxArray** pdataref,DataSet* dataset){
+/*FUNCTION WriteData(mxArray** pdataref,DataSet* dataset){{{1*/
+void WriteData(mxArray** pdataref,DataSet* dataset){
 
 	mxArray* dataref=NULL;
@@ -41,6 +41,6 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,Matrix* matrix){{{1*/
-void WriteMatlabData(mxArray** pdataref,Matrix* matrix){
+/*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{1*/
+void WriteData(mxArray** pdataref,Matrix* matrix){
 		
 	mxArray* dataref=NULL;
@@ -58,6 +58,6 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,double* matrix, int M,int N){{{1*/
-void WriteMatlabData(mxArray** pdataref,double* matrix, int M,int N){
+/*FUNCTION WriteData(mxArray** pdataref,double* matrix, int M,int N){{{1*/
+void WriteData(mxArray** pdataref,double* matrix, int M,int N){
 	
 	mxArray* dataref=NULL;
@@ -81,6 +81,6 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,int* matrix, int M,int N){{{1*/
-void WriteMatlabData(mxArray** pdataref,int* matrix, int M,int N){
+/*FUNCTION WriteData(mxArray** pdataref,int* matrix, int M,int N){{{1*/
+void WriteData(mxArray** pdataref,int* matrix, int M,int N){
 
 	mxArray* dataref=NULL;
@@ -108,11 +108,10 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,Vector* vector){{{1*/
-void WriteMatlabData(mxArray** pdataref,Vector* vector){
+/*FUNCTION WriteData(mxArray** pdataref,Vector* vector){{{1*/
+void WriteData(mxArray** pdataref,Vector* vector){
 	
 	mxArray* dataref=NULL;
 	
 	if(vector){
-		
 		/*call toolkit routine: */
 		dataref=vector->ToMatlabVector();
@@ -125,6 +124,6 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,double* vector, int M){{{1*/
-void WriteMatlabData(mxArray** pdataref,double* vector, int M){
+/*FUNCTION WriteData(mxArray** pdataref,double* vector, int M){{{1*/
+void WriteData(mxArray** pdataref,double* vector, int M){
 	
 	mxArray* dataref=NULL;
@@ -145,12 +144,12 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,double scalar){{{1*/
-void WriteMatlabData(mxArray** pdataref,double scalar){
+/*FUNCTION WriteData(mxArray** pdataref,double scalar){{{1*/
+void WriteData(mxArray** pdataref,double scalar){
 
 	*pdataref=mxCreateDoubleScalar(scalar);
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,int integer){{{1*/
-void WriteMatlabData(mxArray** pdataref,int integer){
+/*FUNCTION WriteData(mxArray** pdataref,int integer){{{1*/
+void WriteData(mxArray** pdataref,int integer){
 
 		*pdataref=mxCreateDoubleScalar((double)integer);
@@ -158,6 +157,6 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,int boolean){{{1*/
-void WriteMatlabData(mxArray** pdataref,bool boolean){
+/*FUNCTION WriteData(mxArray** pdataref,int boolean){{{1*/
+void WriteData(mxArray** pdataref,bool boolean){
 
 	*pdataref=mxCreateDoubleScalar((double)boolean);
@@ -165,12 +164,12 @@
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,char* string){{{1*/
-void WriteMatlabData(mxArray** pdataref,char* string){
+/*FUNCTION WriteData(mxArray** pdataref,char* string){{{1*/
+void WriteData(mxArray** pdataref,char* string){
 
 		*pdataref=mxCreateString(string);
 }
 /*}}}*/
-/*FUNCTION WriteMatlabData(mxArray** pdataref,Parameters* parameters){{{1*/
-void WriteMatlabData(mxArray** pdataref,Parameters* parameters){
+/*FUNCTION WriteData(mxArray** pdataref,Parameters* parameters){{{1*/
+void WriteData(mxArray** pdataref,Parameters* parameters){
 
 	int i;
Index: /issm/branches/trunk-jpl-damage/src/c/io/Matlab/matlabio.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Matlab/matlabio.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Matlab/matlabio.h	(revision 12004)
@@ -5,4 +5,10 @@
 #ifndef _MATLAB_IO_H_
 #define _MATLAB_IO_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif 
 
 #include "../../objects/objects.h"
@@ -13,36 +19,36 @@
 class Parameters;
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
-void WriteMatlabData(mxArray** pdataref,DataSet* dataset);
-void WriteMatlabData(mxArray** pdataref,Matrix* matrix);
-void WriteMatlabData(mxArray** pdataref,double* matrix, int M,int N);
-void WriteMatlabData(mxArray** pdataref,int*    matrix, int M,int N);
-void WriteMatlabData(mxArray** pdataref,Vector* vector);
-void WriteMatlabData(mxArray** pdataref,double* vector, int M);
-void WriteMatlabData(mxArray** pdataref,int integer);
-void WriteMatlabData(mxArray** pdataref,bool boolean);
-void WriteMatlabData(mxArray** pdataref,double scalar);
-void WriteMatlabData(mxArray** pdataref,char* string);
-void WriteMatlabData(DataHandle* pdataref,Parameters* parameters);
+void WriteData(mxArray** pdataref,DataSet* dataset);
+void WriteData(mxArray** pdataref,Matrix* matrix);
+void WriteData(mxArray** pdataref,double* matrix, int M,int N);
+void WriteData(mxArray** pdataref,int*    matrix, int M,int N);
+void WriteData(mxArray** pdataref,Vector* vector);
+void WriteData(mxArray** pdataref,double* vector, int M);
+void WriteData(mxArray** pdataref,int integer);
+void WriteData(mxArray** pdataref,bool boolean);
+void WriteData(mxArray** pdataref,double scalar);
+void WriteData(mxArray** pdataref,char* string);
+void WriteData(DataHandle* pdataref,Parameters* parameters);
 
-void FetchMatlabData(DataSet** pdataset,const mxArray* dataref);
-void FetchMatlabData(double** pmatrix,int* pM,int *pN,const mxArray* dataref);
-void FetchMatlabData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
-void FetchMatlabData(int** pmatrix,int* pM,int *pN,const mxArray* dataref);
-void FetchMatlabData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref);
-void FetchMatlabData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
-void FetchMatlabData(Matrix** pmatrix,const mxArray* dataref);
-void FetchMatlabData(int** pvector,int* pM,const mxArray* dataref);
-void FetchMatlabData(float** pvector,int* pM,const mxArray* dataref);
-void FetchMatlabData(double** pvector,int* pM,const mxArray* dataref);
-void FetchMatlabData(bool** pvector,int* pM,const mxArray* dataref);
-void FetchMatlabData(Vector** pvector,const mxArray* dataref);
-void FetchMatlabData(char** pstring,const mxArray* dataref);
-void FetchMatlabData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
-void FetchMatlabData(double* pscalar,const mxArray* dataref);
-void FetchMatlabData(int* pinteger,const mxArray* dataref);
-void FetchMatlabData(bool* pbool,const mxArray* dataref);
-void FetchMatlabData(Parameters** pparameters, DataHandle dataref);
+void FetchData(DataSet** pdataset,const mxArray* dataref);
+void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref);
+void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
+void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref);
+void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref);
+void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
+void FetchData(Matrix** pmatrix,const mxArray* dataref);
+void FetchData(int** pvector,int* pM,const mxArray* dataref);
+void FetchData(float** pvector,int* pM,const mxArray* dataref);
+void FetchData(double** pvector,int* pM,const mxArray* dataref);
+void FetchData(bool** pvector,int* pM,const mxArray* dataref);
+void FetchData(Vector** pvector,const mxArray* dataref);
+void FetchData(char** pstring,const mxArray* dataref);
+void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
+void FetchData(double* pscalar,const mxArray* dataref);
+void FetchData(int* pinteger,const mxArray* dataref);
+void FetchData(bool* pbool,const mxArray* dataref);
+void FetchData(Parameters** pparameters, DataHandle dataref);
 
 Option* OptionParse(char* name, const mxArray* prhs[]);
@@ -52,4 +58,8 @@
 OptionStruct*   OptionStructParse( char* name, const mxArray* prhs[]);
 OptionCell*     OptionCellParse( char* name, const mxArray* prhs[]);
+
+mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number, const char* field);
+int CheckNumMatlabArguments(int nlhs,int NLHS, int nrhs,int NRHS, const char* THISFUNCTION, void (*function)( void ));
+
 #endif
 #endif	/* _IO_H_ */
Index: /issm/branches/trunk-jpl-damage/src/c/io/Matlab/mxGetAssignedField.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Matlab/mxGetAssignedField.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Matlab/mxGetAssignedField.cpp	(revision 12004)
@@ -0,0 +1,47 @@
+/*!\file: mxGetAssignedField.c: 
+ * \brief: abstract interface on parallel side for i/o, so it ressembles the serial i/o.
+ *
+ * In serial mode, this routine takes care of returning the field coming 
+ * from the model. If largesize is 1, we are running out of core models in 
+ * matlab, and we need to call the subsref private method from the model object
+ * in order to correctly load the data from disk.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#else
+#error "Cannot compile without HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+#include "mex.h"
+
+mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number,const char* field){
+
+	//output
+	mxArray* mxfield=NULL;
+	
+	//input
+	mxArray    *inputs[2];
+	mxArray    *pindex      = NULL;
+	const char *fnames[2];
+	mwSize      ndim        = 2;
+	mwSize      onebyone[2] = {1,1};
+
+	//We want to call the subsasgn method, and get the returned array.This ensures that if we are running 
+	//large sized problems, the data is truly loaded from disk by the model subsasgn class method.
+	inputs[0]=(mxArray*)pmxa_array; //this is the model
+
+	//create index structure used in the assignment (index.type='.' and index.subs='x' for field x for ex)
+	fnames[0] = "type";
+	fnames[1] = "subs";
+	pindex=mxCreateStructArray( ndim,onebyone,2,fnames);
+	mxSetField( pindex, 0, "type",mxCreateString("."));
+	mxSetField( pindex, 0, "subs",mxCreateString(field));
+	inputs[1]=pindex;
+
+	mexCallMATLAB( 1, &mxfield, 2, (mxArray**)inputs, "subsref");
+
+	return mxfield;
+}
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/io/PrintfFunction.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/PrintfFunction.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/io/PrintfFunction.cpp	(revision 12004)
@@ -9,5 +9,5 @@
 #include "../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -53,8 +53,8 @@
 
 	/*Ok, if we are running in parallel, get node 0 to print*/
-#if defined(_PARALLEL_)
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+	mexPrintf(buffer);
+#else
 	if(my_rank==0)printf(buffer);
-#else
-	mexPrintf(buffer);
 #endif
 
Index: /issm/branches/trunk-jpl-damage/src/c/io/Python/CheckNumPythonArguments.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Python/CheckNumPythonArguments.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Python/CheckNumPythonArguments.cpp	(revision 12004)
@@ -0,0 +1,40 @@
+/*!\file CheckNumPythonArguments.cpp:
+ * \brief: check number of arguments and report an usage error message.
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+
+#if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
+
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#define NO_IMPORT
+
+#include "../../toolkits/toolkits.h"
+#include "../../shared/Exceptions/exceptions.h"
+#include "../../include/include.h"
+
+int CheckNumPythonArguments(PyObject* inputs,int NRHS, void (*function)( void )){
+
+	Py_ssize_t size=0;
+
+	/*figure out size of tuple in input: */
+	size=PyTuple_Size(inputs);
+	
+	/*check on requested size: */
+	if (size==0){
+		function();
+		_error_("usage: see above");
+	}
+	else if (size!=NRHS ) {
+		function(); 
+		_error_("usage error.");
+	}
+	return 1;
+}
+
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/io/Python/FetchPythonData.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Python/FetchPythonData.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Python/FetchPythonData.cpp	(revision 12004)
@@ -0,0 +1,74 @@
+/*\file FetchData.cpp:
+ * \brief: general I/O interface to fetch data in python
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#define NO_IMPORT
+
+#include "../../toolkits/toolkits.h"
+#include "../../include/include.h"
+#include "../../shared/shared.h"
+
+#if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
+/*FUNCTION FetchData(char** pstring,PyObject* py_unicode){{{1*/
+void FetchData(char** pstring,PyObject* py_unicode){
+
+	PyObject* py_bytes;
+	char* string=NULL;
+
+	
+	/*convert to bytes format: */
+	PyUnicode_FSConverter(py_unicode,&py_bytes);
+
+	/*convert from bytes to string: */
+	string=PyBytes_AS_STRING(py_bytes);
+	
+	*pstring=string;
+}
+/*FUNCTION FetchData(double* pscalar,PyObject* py_float){{{1*/
+void FetchData(double* pscalar,PyObject* py_float){
+
+	double scalar;
+
+	/*return internal value: */
+	scalar=PyFloat_AsDouble(py_float);
+
+	/*output: */
+	*pscalar=scalar;
+}
+/*}}}*/
+/*FUNCTION FetchData(int* pinteger,PyObject* py_long){{{1*/
+void FetchData(int* pinteger, PyObject* py_long){
+
+	int integer;
+
+	/*return internal value: */
+	integer=(int)PyLong_AsLong(py_long);
+
+	/*output: */
+	*pinteger=integer;
+}
+/*}}}*/
+/*FUNCTION FetchData(bool* pboolean,PyObject* py_boolean){{{1*/
+void FetchData(bool* pboolean,PyObject* py_boolean){
+
+	bool boolean;
+	
+	/*check this is indeed a subtype of long type: */
+	if(!PyBool_Check(py_boolean))_error_("expecting a boolean in input!");
+
+	/*extract boolean: */
+	boolean=(bool)PyLong_AsLong(py_boolean);
+
+	/*simple copy: */
+	*pboolean=boolean;
+	
+}
+/*}}}*/
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/io/Python/WritePythonData.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Python/WritePythonData.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Python/WritePythonData.cpp	(revision 12004)
@@ -0,0 +1,69 @@
+/* \file WriteData.c:
+ * \brief: general interface for writing data
+ */
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
+
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#define NO_IMPORT
+
+#include "../../toolkits/toolkits.h"
+#include "../../include/include.h"
+#include "../../modules/modules.h"
+#include "../../Container/Container.h"
+#include "../../shared/shared.h"
+#include "../../io/io.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+
+
+/*FUNCTION WriteData(PyObject* py_tuple,int index,char* string){{{1*/
+void WriteData(PyObject* py_tuple, int index, char* string){
+	
+	PyTuple_SetItem(py_tuple, index, PyUnicode_FromString(string));
+
+}
+/*}}}*/
+/*FUNCTION WriteData(PyObject* tuple,int index,Matrix* matrix){{{1*/
+void WriteData(PyObject* tuple,int index,Matrix* matrix){
+	
+	int M,N;
+	double* buffer=NULL;
+	npy_intp dims[2]={0,0};
+	PyObject* array=NULL;
+	
+	buffer=matrix->ToSerial();
+	matrix->GetSize(&M,&N);
+	dims[0]=(npy_intp)M;
+	dims[1]=(npy_intp)N;
+	array=PyArray_SimpleNewFromData(2,dims,NPY_DOUBLE,buffer);
+	
+	PyTuple_SetItem(tuple, index, array);
+
+
+}
+/*FUNCTION WriteData(PyObject* py_tuple,int index,Vector* vector){{{1*/
+void WriteData(PyObject* tuple,int index,Vector* vector){
+	
+	int M;
+	double* buffer=NULL;
+	npy_intp dim=10;
+	PyObject* array=NULL;
+	
+	buffer=vector->ToMPISerial();
+	vector->GetSize(&M);
+	dim=(npy_intp)M;
+	array=PyArray_SimpleNewFromData(1,&dim,NPY_DOUBLE,buffer);
+	
+	PyTuple_SetItem(tuple, index, array);
+
+
+}
+/*}}}*/
+
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/io/Python/pythonio.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/Python/pythonio.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/io/Python/pythonio.h	(revision 12004)
@@ -0,0 +1,60 @@
+/*\file pythonio.h
+ *\brief: I/O for ISSM in python mode
+ */
+
+#ifndef _PYTHON_IO_H_
+#define _PYTHON_IO_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif 
+
+
+#include "../../objects/objects.h"
+#include "../../Container/Container.h"
+#include "../../include/include.h"
+
+class DataSet;
+class Parameters;
+
+#if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
+
+//void WriteData(mxArray** pdataref,DataSet* dataset);
+//void WriteData(mxArray** pdataref,double* matrix, int M,int N);
+//void WriteData(mxArray** pdataref,int*    matrix, int M,int N);
+//void WriteData(mxArray** pdataref,double* vector, int M);
+//void WriteData(mxArray** pdataref,int integer);
+//void WriteData(mxArray** pdataref,bool boolean);
+//void WriteData(mxArray** pdataref,double scalar);
+//void WriteData(DataHandle* pdataref,Parameters* parameters);
+void WriteData(PyObject* py_tuple, int index, char* string);
+void WriteData(PyObject* py_tuple, int index, Matrix* matrix);
+void WriteData(PyObject* py_tuple, int index, Vector* vector);
+
+
+//void FetchData(DataSet** pdataset,const mxArray* dataref);
+//void FetchData(double** pmatrix,int* pM,int *pN,const mxArray* dataref);
+//void FetchData(double** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
+//void FetchData(int** pmatrix,int* pM,int *pN,const mxArray* dataref);
+//void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref);
+//void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
+//void FetchData(Matrix** pmatrix,const mxArray* dataref);
+//void FetchData(int** pvector,int* pM,const mxArray* dataref);
+//void FetchData(float** pvector,int* pM,const mxArray* dataref);
+//void FetchData(double** pvector,int* pM,const mxArray* dataref);
+//void FetchData(bool** pvector,int* pM,const mxArray* dataref);
+//void FetchData(Vector** pvector,const mxArray* dataref);
+//void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
+//void FetchData(Parameters** pparameters, DataHandle dataref);
+void FetchData(char** pstring,PyObject* py_unicode);
+void FetchData(double* pscalar,PyObject* py_float);
+void FetchData(int* pinteger,PyObject* py_long);
+void FetchData(bool* pbool,PyObject* py_boolean);
+
+int CheckNumPythonArguments(PyObject* inputs,int NRHS, void (*function)( void ));
+
+#endif
+
+#endif	/* _IO_H_ */
Index: /issm/branches/trunk-jpl-damage/src/c/io/io.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/io/io.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/io/io.h	(revision 12004)
@@ -3,6 +3,6 @@
  */
 
-#ifndef _IO_H_
-#define _IO_H_
+#ifndef _ISSM_IO_H_
+#define _ISSM_IO_H_
 
 #ifdef HAVE_CONFIG_H //config.h {{{1
@@ -15,6 +15,10 @@
 #include "./Disk/diskio.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "./Matlab/matlabio.h"
+#endif
+
+#if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
+#include "./Python/pythonio.h"
 #endif
 
Index: /issm/branches/trunk-jpl-damage/src/c/modules/CostFunctionx/CostFunctionx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/CostFunctionx/CostFunctionx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/CostFunctionx/CostFunctionx.cpp	(revision 12004)
@@ -11,12 +11,12 @@
 #include "../Responsex/Responsex.h"
 
-void CostFunctionx( double* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+void CostFunctionx(double* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
 
 	/*Intermediary*/
-	int    i;
-	int     num_responses;
-	double S;
-	Element* element=NULL;
-	int*     responses=NULL;
+	int      i;
+	int      num_responses;
+	double   S;
+	Element *element       = NULL;
+	int     *responses     = NULL;
 
 	/*output: */
Index: /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.cpp	(revision 12004)
@@ -51,5 +51,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void Dakotax(mxArray* femmodel){ 
 #else
@@ -69,6 +69,6 @@
 
 	/*Retrieve parameters: */
-	#ifdef _SERIAL_
-	FetchMatlabData((Parameters**)&parameters,mxGetField((mxArray*)femmodel,0,"parameters"));
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+	FetchData((Parameters**)&parameters,mxGetField((mxArray*)femmodel,0,"parameters"));
 	#else
 	parameters=femmodel->parameters;
@@ -86,5 +86,5 @@
 		// Instantiate/initialize the parallel library and problem description
 		// database objects.
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 			Dakota::ParallelLibrary parallel_lib; //use Dakota's standard library mode constructor
 		#else
@@ -143,5 +143,5 @@
 	xfree((void**)&dakota_output_file);
 
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	delete parameters;
 	#endif
Index: /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/Dakotax.h	(revision 12004)
@@ -13,5 +13,5 @@
 int  DescriptorIndex(char* root, int* pindex,char* descriptor);
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void Dakotax(mxArray* femmodel);
 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel,int counter);
Index: /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCore.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCore.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCore.cpp	(revision 12004)
@@ -21,5 +21,5 @@
 	/*Branch into a serial SpawnCore and a parallel SpawnCore: */
 
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		SpawnCoreSerial(responses, numresponses, variables, variables_descriptors,numvariables, (mxArray*)femmodel, counter);
 	#else
Index: /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCoreSerial.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCoreSerial.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/Dakotax/SpawnCoreSerial.cpp	(revision 12004)
@@ -18,4 +18,5 @@
 #include "../../include/include.h"
 
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* femmodel, int counter){
 
@@ -68,2 +69,3 @@
 
 }
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/modules/EnumToStringx/EnumToStringx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 12004)
@@ -155,4 +155,8 @@
 		case SettingsResultsAsPatchesEnum : return "SettingsResultsAsPatches";
 		case SettingsWaitonlockEnum : return "SettingsWaitonlock";
+		case DebugPetscProfilingEnum : return "DebugPetscProfiling";
+		case PetscProfilingCurrentMemEnum : return "PetscProfilingCurrentMem";
+		case PetscProfilingCurrentFlopsEnum : return "PetscProfilingCurrentFlops";
+		case PetscProfilingSolutionTimeEnum : return "PetscProfilingSolutionTime";
 		case SteadystateMaxiterEnum : return "SteadystateMaxiter";
 		case SteadystateNumRequestedOutputsEnum : return "SteadystateNumRequestedOutputs";
@@ -170,6 +174,7 @@
 		case ThermalIsenthalpyEnum : return "ThermalIsenthalpy";
 		case ThicknessEnum : return "Thickness";
+		case TimesteppingStartTimeEnum : return "TimesteppingStartTime";
+		case TimesteppingFinalTimeEnum : return "TimesteppingFinalTime";
 		case TimesteppingCflCoefficientEnum : return "TimesteppingCflCoefficient";
-		case TimesteppingFinalTimeEnum : return "TimesteppingFinalTime";
 		case TimesteppingTimeAdaptEnum : return "TimesteppingTimeAdapt";
 		case TimesteppingTimeStepEnum : return "TimesteppingTimeStep";
@@ -233,4 +238,5 @@
 		case BoolInputEnum : return "BoolInput";
 		case BoolParamEnum : return "BoolParam";
+		case ContourEnum : return "Contour";
 		case ControlInputEnum : return "ControlInput";
 		case DatasetInputEnum : return "DatasetInput";
@@ -373,4 +379,5 @@
 		case P1Enum : return "P1";
 		case P1DGEnum : return "P1DG";
+		case SaveResultsEnum : return "SaveResults";
 		case BoolElementResultEnum : return "BoolElementResult";
 		case BoolExternalResultEnum : return "BoolExternalResult";
@@ -387,4 +394,5 @@
 		case PetscVecExternalResultEnum : return "PetscVecExternalResult";
 		case StringExternalResultEnum : return "StringExternalResult";
+		case StepEnum : return "Step";
 		case TimeEnum : return "Time";
 		case TriaP1ElementResultEnum : return "TriaP1ElementResult";
Index: /issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.cpp	(revision 12004)
@@ -9,12 +9,17 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void InputToResultx(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type,int step, double time){
+void InputToResultx(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type){
 
 	/*intermediary:*/
-	int      i;
+	int      step;
+	double   time;
 	Element *element = NULL;
 
+	/*Get time and step*/
+	parameters->FindParam(&step,StepEnum);
+	parameters->FindParam(&time,TimeEnum);
+
 	/*Go through elemnets, and ask each element to transfer the enum_type input into the results dataset, with step and time information: */
-	for(i=0;i<elements->Size();i++){
+	for(int i=0;i<elements->Size();i++){
 
 		element=(Element*)elements->GetObjectByOffset(i);
Index: /issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/InputToResultx/InputToResultx.h	(revision 12004)
@@ -9,6 +9,5 @@
 
 /* local prototypes: */
-void InputToResultx(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type,int step=1, double time=0);
+void InputToResultx(Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters,int enum_type);
 
 #endif  /* _INPUTTORESULTX_H */
-
Index: /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h	(revision 12004)
@@ -6,4 +6,5 @@
 #define _INTERPFROMGRIDTOMESHX_H
 
+#include "../../objects/objects.h"
 #include "../../toolkits/toolkits.h"
 #include "../../EnumDefinitions/EnumDefinitions.h"
Index: /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp	(revision 12004)
@@ -50,5 +50,5 @@
 
 	/*Set debug to 1 if there are lots of elements*/
-	debug=(bool)((double)ncols*nlines*nels >= pow((double)10,(double)10));
+	debug=(bool)((double)ncols*nlines*nels >= 5*pow(10.,10.));
 
 	/*figure out if x or y are flipped*/
Index: /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h	(revision 12004)
@@ -7,4 +7,5 @@
 
 #include "../../toolkits/toolkits.h"
+#include "../../objects/objects.h"
 
 int InterpFromMeshToMesh3dx( Vector** pdata_prime,double* index_data, double* x_data, double* y_data, double* z_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, double* z_prime, int nods_prime,double default_value);
Index: /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp	(revision 12004)
@@ -46,5 +46,5 @@
 	/*Fetch data needed: */
 	iomodel->FetchData(5,MeshElementsEnum,MeshElementconnectivityEnum,MaterialsRheologyBEnum,MaterialsRheologyNEnum,MaterialsRheologyZEnum);
-	#ifdef _HAVE_THREED_
+	#ifdef _HAVE_3D_
 	if(dim==3)iomodel->FetchData(2,MeshUpperelementsEnum,MeshLowerelementsEnum);
 	#endif
@@ -57,5 +57,5 @@
 			/*Create and add tria element to elements dataset: */
 			if(dim==2) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels));
-	        #ifdef _HAVE_THREED_
+	        #ifdef _HAVE_3D_
 			else       elements->AddObject(new Penta(i+1,i,i,iomodel,nummodels));
 	        #endif
Index: /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateParameters.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 12004)
@@ -45,7 +45,8 @@
 	parameters->AddObject(iomodel->CopyConstantObject(SteadystateMaxiterEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(ConstantsYtsEnum));
-	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeStepEnum));
+	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingStartTimeEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingFinalTimeEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeAdaptEnum));
+	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingTimeStepEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(TimesteppingCflCoefficientEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(PrognosticHydrostaticAdjustmentEnum));
@@ -56,4 +57,5 @@
 	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyFactorEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(SettingsLowmemEnum));
+	parameters->AddObject(iomodel->CopyConstantObject(DebugPetscProfilingEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(MeshAverageVertexConnectivityEnum));
 	parameters->AddObject(iomodel->CopyConstantObject(ConstantsReferencetemperatureEnum));
@@ -92,7 +94,11 @@
 	parameters->AddObject(new IntParam(AnalysisTypeEnum,analysis_type));
 	parameters->AddObject(new IntParam(AnalysisCounterEnum,analysis_counter));
-	parameters->AddObject(new DoubleParam(TimeEnum,0.0));  //start at time 0 by default for all solutions
+	parameters->AddObject(new DoubleParam(TimeEnum,0.0));  //start at time 0 by default for all solutions FIXME: to be deleted
+	parameters->AddObject(new IntParam(StepEnum,1));  //start at time 0 by default for all solutions FIXME: to be deleted
 
-	/*Requested output?*/
+	/*By default, save all results*/
+	parameters->AddObject(new BoolParam(SaveResultsEnum,true));
+
+	/*Requested outputs*/
 	iomodel->FetchData(&requestedoutputs,&numoutputs,NULL,DiagnosticRequestedOutputsEnum);
 	parameters->AddObject(new IntParam(DiagnosticNumRequestedOutputsEnum,numoutputs));
Index: /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/ModelProcessorx/Prognostic/UpdateElementsPrognostic.cpp	(revision 12004)
@@ -44,5 +44,4 @@
 	iomodel->FetchDataToInput(elements,MaskElementonfloatingiceEnum);
 	iomodel->FetchDataToInput(elements,MaskElementonwaterEnum);
-	iomodel->FetchDataToInput(elements,SurfaceforcingsPrecipitationEnum);
 	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 12004)
@@ -16,8 +16,8 @@
 #include "../../objects/objects.h"
 		
-#ifdef _SERIAL_
-void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results** presults){
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
 #else 
-void OutputResultsx(                    Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results** presults){
+void OutputResultsx(                    Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Results* results){
 #endif
 
@@ -29,8 +29,7 @@
 	int         solutiontype;
 	char*       solutiontypestring      = NULL;
-	Results    *results                 = NULL;
 	bool        dakota_analysis         = false;
 	
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	const char **fnames      = NULL;
 	mwSize       onebyone[2] = {0,0};
@@ -39,7 +38,4 @@
 	#endif
 
-	/*recover results dataset: */
-	results=*presults;
-
 	/*retrieve parameters: */
 	parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
@@ -47,5 +43,5 @@
 	if(dakota_analysis){
 		//no need to output anything, Dakota analysis has different outputs
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		*pdataref=mxCreateStructArray( ndim,onebyone,nfields,fnames);
 		#endif
@@ -95,5 +91,5 @@
 
 	/*Write results to disk (in parallel), or to memory (in serial mode): */
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		results->Write(pdataref);
 	#else
@@ -103,5 +99,5 @@
 	/*Delete and reinitialize results, in parallel: */
 	#ifdef _PARALLEL_
-		delete results; results=new Results();
+		results->clear();
 
 		/*Close output file? :*/
@@ -115,6 +111,3 @@
 		*/
 	#endif
-
-	/*Assign output pointers:*/
-	*presults=results;
 }
Index: /issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 12004)
@@ -14,9 +14,9 @@
 #include "../../Container/Container.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
-void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results** presults);
+void OutputResultsx(mxArray** pdataref, Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results* results);
 #else
-void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results** presults);
+void OutputResultsx(Elements* elements, Nodes* nodes, Vertices* vertices, Loads* loads,  Materials* materials, Parameters* parameters, Results* results);
 #endif
 
Index: /issm/branches/trunk-jpl-damage/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/ParsePetscOptionsx/ParsePetscOptionsx.cpp	(revision 12004)
@@ -102,4 +102,7 @@
 	for(i=0;i<numanalyses;i++){
 		char* string=strings[i];
+		if(my_rank==0){
+			if(string==NULL) _error_("PETSc options for analysis %s have been declared but were not found",EnumToStringx((int)analyses[i]));
+		}
 		if(my_rank==0)stringlength=(strlen(string)+1)*sizeof(char);
 		MPI_Bcast(&stringlength,1,MPI_INT,0,MPI_COMM_WORLD);
Index: /issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.cpp	(revision 12004)
@@ -9,14 +9,19 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void RequestedOutputsx(Results* results,Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters, int* requested_outputs, int numoutputs, int step, double time){
+void RequestedOutputsx(Results* results,Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters, int* requested_outputs, int numoutputs){
 
-	int  i,j;
-	int  output_enum;
-	double output_value;
-	Element* element=NULL;
+	int      output_enum;
+	int      step;
+	double   time;
+	double   output_value;
+	Element *element      = NULL;
 
-	/*retrieve parameters: */
+	/*Get time and step*/
+	parameters->FindParam(&step,StepEnum);
+	parameters->FindParam(&time,TimeEnum);
+
+	/*retrieve Inputs*/
 	if(numoutputs){
-		for(i=0;i<numoutputs;i++){
+		for(int i=0;i<numoutputs;i++){
 			output_enum=requested_outputs[i];
 
@@ -29,5 +34,5 @@
 				default:
 					/*create this output in the element inputs, and then transfer to results:*/
-					for(j=0;j<elements->Size();j++){
+					for(int j=0;j<elements->Size();j++){
 						element=(Element*)elements->GetObjectByOffset(j);
 						element->RequestedOutput(output_enum,step,time);
Index: /issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/RequestedOutputsx/RequestedOutputsx.h	(revision 12004)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void RequestedOutputsx(Results* results,Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters, int* requested_outputs, int numoutputs, int step=1, double time=0);
+void RequestedOutputsx(Results* results,Elements* elements,Nodes* nodes,Vertices* vertices,Loads* loads,Materials* materials,Parameters* parameters, int* requested_outputs, int numoutputs);
 
 #endif  /* _INPUTTORESULTX_H */
Index: /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.cpp	(revision 12004)
@@ -16,27 +16,49 @@
 void	Solverx(Vector** puf, Matrix* Kff, Vector* pf, Vector* uf0,Vector* df, Parameters* parameters){
 
-	/*output: */
-	Vector* uf=NULL;
-	uf=new Vector();
-
 	/*Intermediary: */
 	int analysis_type;
 
+	/*output: */
+	Vector *uf=NULL;
+
+	/*In debugging mode, check that stiffness matrix and load vectors are not NULL (they can be empty)*/
+	_assert_(Kff);
+	_assert_(pf);
+
 	#ifdef _HAVE_PETSC_
-	Vec uf0_vector = NULL;
-	Vec df_vector  = NULL;
-	if(uf0) uf0_vector=uf0->vector;
-	if(df)  df_vector = df->vector;
+		Vec uf0_vector = NULL;
+		Vec df_vector  = NULL;
+		Vec uf_vector  = NULL;
+		if(uf0) uf0_vector = uf0->vector;
+		if(df)  df_vector  = df->vector;
 
-	/*In serial mode, the Petsc Options database has not been initialized properly: */
-	#ifdef _SERIAL_
-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	PetscOptionsFromAnalysis(parameters,analysis_type);
-	#endif
+		/*In serial mode, the Petsc Options database has not been initialized properly: */
+		#ifdef _SERIAL_
+		parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+		PetscOptionsFromAnalysis(parameters,analysis_type);
+		#endif
 
-	SolverxPetsc(&uf->vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters);
-	VecGetSize(uf->vector,&uf->M);
+		SolverxPetsc(&uf_vector,Kff->matrix,pf->vector,uf0_vector,df_vector,parameters);
+
+		/*Create vector out of petsc vector: */
+		uf=new Vector(uf_vector);
+
+		/*Free ressources: */
+		VecFree(&uf_vector);
 	#else
-	_error_("not supported yet!");
+		#ifdef _HAVE_GSL_
+		SeqVec* uf_vector=NULL;
+
+		SolverxGsl(&uf_vector,Kff->matrix,pf->vector);
+
+		/*Create vector out of SeqVec vector: */
+		uf=new Vector(uf_vector);
+
+		/*Free ressources: */
+		delete uf_vector;
+
+		#else
+			_error_("GSL support not compiled in!");
+		#endif
 	#endif
 
Index: /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/Solverx.h	(revision 12004)
@@ -22,4 +22,8 @@
 #endif
 
+#ifdef _HAVE_GSL_
+void	SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf);
+#endif
+
 #endif  /* _SOLVERX_H */
 
Index: /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/SolverxGsl.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/SolverxGsl.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/Solverx/SolverxGsl.cpp	(revision 12004)
@@ -0,0 +1,71 @@
+/*!\file SolverxGsl
+ * \brief Gsl implementation of solver
+ */
+
+#include "./Solverx.h"
+#include "../../shared/shared.h"
+#include "../../include/include.h"
+#include "../../io/io.h"
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+ 
+#include <gsl/gsl_linalg.h>
+
+void	SolverxGsl(SeqVec** puf,SeqMat* Kff, SeqVec* pf){
+
+	/*intermediary: */
+	SeqMat* KffCopy=NULL;
+
+	/*Output: */
+	SeqVec*        uf               = NULL;
+
+	
+	/*GSL Matrices and vectors: */
+	gsl_matrix_view m;
+	gsl_vector_view b;
+	gsl_vector* x=NULL;
+	gsl_permutation* p=NULL;
+	
+	/*We are going to do an in place LU decomp, so we need to save the matrix with its original structure: */
+	KffCopy=Kff->Duplicate();
+
+
+	/*Intermediary: */
+	int M,N,N2,s;
+
+	Kff->GetSize(&M,&N);
+	pf->GetSize(&N2);
+
+	if(N!=N2)_error_("Right hand side vector of size %i, when matrix is of size %i-%i !",N2,M,N);
+	if(M!=N)_error_("Stiffness matrix should be square!");
+
+	/*Initialize gsl matrices and vectors: */
+	m = gsl_matrix_view_array (KffCopy->matrix, M, N);
+	b = gsl_vector_view_array (pf->vector, N);
+	x = gsl_vector_alloc (N);
+
+	/*Run LU and solve: */
+	p = gsl_permutation_alloc (N);
+	gsl_linalg_LU_decomp (&m.matrix, p, &s);
+	gsl_linalg_LU_solve (&m.matrix, p, &b.vector, x);
+
+	//printf ("x = \n");
+	//gsl_vector_fprintf (stdout, x, "%g");
+
+	/*Get uf initialized with the results: */
+	uf=new SeqVec(gsl_vector_ptr(x,0),M);
+
+	/*Free resources:*/
+	gsl_permutation_free (p);
+	gsl_vector_free (x);
+
+	delete KffCopy;
+
+
+	/*Assign output pointers:*/
+	*puf=uf;
+}
Index: /issm/branches/trunk-jpl-damage/src/c/modules/StringToEnumx/StringToEnumx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 12004)
@@ -159,4 +159,8 @@
 	      else if (strcmp(name,"SettingsResultsAsPatches")==0) return SettingsResultsAsPatchesEnum;
 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+	      else if (strcmp(name,"DebugPetscProfiling")==0) return DebugPetscProfilingEnum;
+	      else if (strcmp(name,"PetscProfilingCurrentMem")==0) return PetscProfilingCurrentMemEnum;
+	      else if (strcmp(name,"PetscProfilingCurrentFlops")==0) return PetscProfilingCurrentFlopsEnum;
+	      else if (strcmp(name,"PetscProfilingSolutionTime")==0) return PetscProfilingSolutionTimeEnum;
 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
@@ -174,6 +178,7 @@
 	      else if (strcmp(name,"ThermalIsenthalpy")==0) return ThermalIsenthalpyEnum;
 	      else if (strcmp(name,"Thickness")==0) return ThicknessEnum;
+	      else if (strcmp(name,"TimesteppingStartTime")==0) return TimesteppingStartTimeEnum;
+	      else if (strcmp(name,"TimesteppingFinalTime")==0) return TimesteppingFinalTimeEnum;
 	      else if (strcmp(name,"TimesteppingCflCoefficient")==0) return TimesteppingCflCoefficientEnum;
-	      else if (strcmp(name,"TimesteppingFinalTime")==0) return TimesteppingFinalTimeEnum;
 	      else if (strcmp(name,"TimesteppingTimeAdapt")==0) return TimesteppingTimeAdaptEnum;
 	      else if (strcmp(name,"TimesteppingTimeStep")==0) return TimesteppingTimeStepEnum;
@@ -237,4 +242,5 @@
 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
+	      else if (strcmp(name,"Contour")==0) return ContourEnum;
 	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
@@ -257,5 +263,8 @@
 	      else if (strcmp(name,"MacAyeal2dIceFront")==0) return MacAyeal2dIceFrontEnum;
 	      else if (strcmp(name,"MacAyeal3dIceFront")==0) return MacAyeal3dIceFrontEnum;
-	      else if (strcmp(name,"Matice")==0) return MaticeEnum;
+         else stage=3;
+   }
+   if(stage==3){
+	      if (strcmp(name,"Matice")==0) return MaticeEnum;
 	      else if (strcmp(name,"Matpar")==0) return MatparEnum;
 	      else if (strcmp(name,"Node")==0) return NodeEnum;
@@ -380,4 +389,8 @@
 	      else if (strcmp(name,"P1")==0) return P1Enum;
 	      else if (strcmp(name,"P1DG")==0) return P1DGEnum;
+         else stage=4;
+   }
+   if(stage==4){
+	      if (strcmp(name,"SaveResults")==0) return SaveResultsEnum;
 	      else if (strcmp(name,"BoolElementResult")==0) return BoolElementResultEnum;
 	      else if (strcmp(name,"BoolExternalResult")==0) return BoolExternalResultEnum;
@@ -397,4 +410,5 @@
 	      else if (strcmp(name,"PetscVecExternalResult")==0) return PetscVecExternalResultEnum;
 	      else if (strcmp(name,"StringExternalResult")==0) return StringExternalResultEnum;
+	      else if (strcmp(name,"Step")==0) return StepEnum;
 	      else if (strcmp(name,"Time")==0) return TimeEnum;
 	      else if (strcmp(name,"TriaP1ElementResult")==0) return TriaP1ElementResultEnum;
Index: /issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.cpp	(revision 12004)
@@ -0,0 +1,182 @@
+/*!\file TriMeshx
+ * \brief: x code for TriMesh mesher
+ */
+
+/*Header files: {{{*/
+#include "./TriMeshx.h"
+#include "../../shared/shared.h"
+#include "../../include/include.h"
+#include "../../io/io.h"
+#include "../../toolkits/toolkits.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+/*}}}*/
+
+
+void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order){
+
+	/*indexing: */
+	int i,j;
+
+	/*output: */
+	double* index=NULL;
+	Matrix* index_matrix=NULL;
+	double* x=NULL;
+	double* y=NULL;
+	double* segments=NULL;
+	Matrix* segments_matrix=NULL;
+	double* segmentmarkerlist=NULL;
+
+	/*intermediary: */
+	int      counter,backcounter;
+	Contour* contour=NULL;
+
+	/* Triangle structures needed to call Triangle library routines: */
+	struct triangulateio in,out;
+	char   options[256];
+
+	/*Create initial triangulation to call triangulate(). First number of points:*/
+	in.numberofpoints=0;
+	for (i=0;i<domain->Size();i++){
+		contour=(Contour*)domain->GetObjectByOffset(i);
+		in.numberofpoints+=contour->nods;
+	}
+	/*number of point attributes: */
+	in.numberofpointattributes=1;
+
+	/*fill in the point list: */
+	in.pointlist = (REAL *) xmalloc(in.numberofpoints * 2 * sizeof(REAL));
+
+	counter=0;
+	for (i=0;i<domain->Size();i++){
+		contour=(Contour*)domain->GetObjectByOffset(i);
+		for (j=0;j<contour->nods;j++){
+			in.pointlist[2*counter+0]=contour->x[j];
+			in.pointlist[2*counter+1]=contour->y[j];
+			counter++;
+		}
+	}
+	
+	/*fill in the point attribute list: */
+	in.pointattributelist = (REAL *) xmalloc(in.numberofpoints * in.numberofpointattributes * sizeof(REAL));
+	for (i=0;i<in.numberofpoints;i++) in.pointattributelist[i] = 0.0;
+	
+	/*fill in the point marker list: */
+	in.pointmarkerlist = (int *) xmalloc(in.numberofpoints * sizeof(int));
+	for(i=0;i<in.numberofpoints;i++) in.pointmarkerlist[i] = 0;
+
+
+	/*Build segments. First figure out number of segments: holes and closed outlines have as many segments as vertices: */
+	in.numberofsegments=0;
+	for (i=0;i<domain->Size();i++){
+		contour=(Contour*)domain->GetObjectByOffset(i);
+		in.numberofsegments+=contour->nods;
+	}
+	
+	in.segmentlist = (int *) xmalloc(in.numberofsegments * 2 * sizeof(int));
+	in.segmentmarkerlist = (int *) xcalloc(in.numberofsegments,sizeof(int));
+	counter=0;
+	backcounter=0;
+	for (i=0;i<domain->Size();i++){
+		contour=(Contour*)domain->GetObjectByOffset(i);
+		for (j=0;j<contour->nods-1;j++){
+			in.segmentlist[2*counter+0]=counter;
+			in.segmentlist[2*counter+1]=counter+1;
+			in.segmentmarkerlist[counter]=0;
+			counter++;
+		}
+		/*Close this profile: */
+		 in.segmentlist[2*counter+0]=counter;
+		 in.segmentlist[2*counter+1]=backcounter;
+		 in.segmentmarkerlist[counter]=0;
+		 counter++;
+		 backcounter=counter;
+	}
+
+	
+	/*Build regions: */
+	in.numberofregions = 0;
+
+	/*Build holes: */
+	in.numberofholes = domain->Size()-1; /*everything is a hole, but for the first profile.*/
+	if(in.numberofholes){
+		in.holelist = (REAL *) xmalloc(in.numberofholes * 2 * sizeof(REAL));
+		for (i=0;i<domain->Size()-1;i++){
+			contour=(Contour*)domain->GetObjectByOffset(i+1);
+			GridInsideHole(&in.holelist[2*i+0],&in.holelist[2*i+1],contour->nods,contour->x,contour->y);
+		}
+	}
+
+	/* Make necessary initializations so that Triangle can return a triangulation in `out': */
+
+	out.pointlist = (REAL *) NULL;            
+	out.pointattributelist = (REAL *) NULL;
+	out.pointmarkerlist = (int *) NULL; 
+	out.trianglelist = (int *) NULL;          
+	out.triangleattributelist = (REAL *) NULL;
+	out.neighborlist = (int *) NULL;         
+	out.segmentlist = (int *) NULL;
+	out.segmentmarkerlist = (int *) NULL;
+	out.edgelist = (int *) NULL;             
+	out.edgemarkerlist = (int *) NULL;   
+
+	/* Triangulate the points:.  Switches are chosen to read and write a  */
+	/*   PSLG (p), preserve the convex hull (c), number everything from  */
+	/*   zero (z), assign a regional attribute to each element (A), and  */
+	/*   produce an edge list (e), a Voronoi diagram (v), and a triangle */
+	/*   neighbor list (n).                                              */
+
+	sprintf(options,"%s%lf","pQzDq30ia",area); /*replace V by Q to quiet down the logging*/
+
+  
+	triangulate(options, &in, &out, NULL);
+
+	/*report(&out, 0, 1, 1, 1, 1, 0);*/
+
+
+	/*Allocate index, x and y: */
+	index=(double*)xmalloc(3*out.numberoftriangles*sizeof(double));
+	x=(double*)xmalloc(out.numberofpoints*sizeof(double));
+	y=(double*)xmalloc(out.numberofpoints*sizeof(double));
+	segments=(double*)xmalloc(3*out.numberofsegments*sizeof(double));
+	segmentmarkerlist=(double*)xmalloc(out.numberofsegments*sizeof(double));
+
+	for (i = 0; i < out.numberoftriangles; i++) {
+		for (j = 0; j < out.numberofcorners; j++) {
+			*(index+3*i+j)=(double)out.trianglelist[i * out.numberofcorners + j]+1;
+		}
+	}
+	for (i = 0; i < out.numberofpoints; i++) {
+		x[i]=out.pointlist[i * 2 + 0];
+		y[i]=out.pointlist[i * 2 + 1];
+	}
+	
+	for (i = 0; i < out.numberofsegments; i++) {
+		segments[3*i+0]=(double)out.segmentlist[i*2+0]+1;
+		segments[3*i+1]=(double)out.segmentlist[i*2+1]+1;
+		segmentmarkerlist[i]=(double)out.segmentmarkerlist[i];
+	}
+
+
+
+	/*Associate elements with segments: */
+	AssociateSegmentToElement(&segments,out.numberofsegments,index,out.numberoftriangles);
+
+	/*Order segments so that their normals point outside the domain: */
+	if(order){
+		OrderSegments(&segments,out.numberofsegments, index,out.numberoftriangles);
+	}
+
+
+	/*Output : */
+	index_matrix=new Matrix(index,out.numberoftriangles,3,1); 
+	index_matrix->Convert(DENSE_SEQUENTIAL);
+	*pindex=index_matrix;
+	
+	segments_matrix=new Matrix(segments,out.numberofsegments,3,1); segments_matrix->Convert(DENSE_SEQUENTIAL);
+	*psegments=segments_matrix;
+
+	*px=new Vector(x,out.numberofpoints);
+	*py=new Vector(y,out.numberofpoints);
+	*psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments);
+
+}
Index: /issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/TriMeshx/TriMeshx.h	(revision 12004)
@@ -0,0 +1,27 @@
+/*!\file:  TriMeshx.h
+ * \brief header file for TriMeshx module
+ */ 
+
+#ifndef _TRIMESHX_H_
+#define _TRIMESHX_H_
+
+
+
+/*ANSI_DECLARATORS needed to call triangle library: */
+#ifndef ANSI_DECLARATORS
+#define ANSI_DECLARATORS
+#include "triangle.h"
+#undef ANSI_DECLARATORS
+#else
+#include "triangle.h"
+#endif
+
+#include "string.h"
+
+#include "../../Container/Container.h"
+#include "../../objects/objects.h"
+
+/* local prototypes: */
+void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,double area,bool order);
+
+#endif  /* _TRIMESHX_H */
Index: /issm/branches/trunk-jpl-damage/src/c/modules/modules.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/modules/modules.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/modules/modules.h	(revision 12004)
@@ -111,4 +111,7 @@
 #include "./TimeAdaptx/TimeAdaptx.h"
 #include "./TriaSearchx/TriaSearchx.h"
+#ifdef _SERIAL_
+#include "./TriMeshx/TriMeshx.h"
+#endif
 #include "./ThicknessAbsMisfitx/ThicknessAbsMisfitx.h"
 #include "./ThicknessAbsGradientx/ThicknessAbsGradientx.h"
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgGeom.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgGeom.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgGeom.cpp	(revision 12004)
@@ -2,4 +2,5 @@
 #include "../objects.h"
 #include "../../io/io.h"
+#include "../../shared/shared.h"
 
 /*Constructors/Destructors*/
@@ -19,15 +20,15 @@
 /*}}}*/
 /*FUNCTION BamgGeom::BamgGeom(mxArray* matlab_struct){{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 BamgGeom::BamgGeom(mxArray* matlab_struct){
 
-	FetchMatlabData(&this->Vertices,        &this->VerticesSize[0],        &this->VerticesSize[1],        mxGetAssignedField(matlab_struct,0,"Vertices"));
-	FetchMatlabData(&this->Edges,           &this->EdgesSize[0],           &this->EdgesSize[1],           mxGetAssignedField(matlab_struct,0,"Edges"));
+	FetchData(&this->Vertices,        &this->VerticesSize[0],        &this->VerticesSize[1],        mxGetAssignedField(matlab_struct,0,"Vertices"));
+	FetchData(&this->Edges,           &this->EdgesSize[0],           &this->EdgesSize[1],           mxGetAssignedField(matlab_struct,0,"Edges"));
 	this->TangentAtEdgesSize[0]=0,    this->TangentAtEdgesSize[1]=0;    this->TangentAtEdges=NULL;
-	FetchMatlabData(&this->Corners,         &this->CornersSize[0],         &this->CornersSize[1],         mxGetAssignedField(matlab_struct,0,"Corners"));
-	FetchMatlabData(&this->RequiredVertices,&this->RequiredVerticesSize[0],&this->RequiredVerticesSize[1],mxGetAssignedField(matlab_struct,0,"RequiredVertices"));
-	FetchMatlabData(&this->RequiredEdges,   &this->RequiredEdgesSize[0],   &this->RequiredEdgesSize[1],   mxGetAssignedField(matlab_struct,0,"RequiredEdges"));
-	FetchMatlabData(&this->CrackedEdges,    &this->CrackedEdgesSize[0],    &this->CrackedEdgesSize[1],    mxGetAssignedField(matlab_struct,0,"CrackedEdges"));
-	FetchMatlabData(&this->SubDomains,      &this->SubDomainsSize[0],      &this->SubDomainsSize[1],      mxGetAssignedField(matlab_struct,0,"SubDomains"));
+	FetchData(&this->Corners,         &this->CornersSize[0],         &this->CornersSize[1],         mxGetAssignedField(matlab_struct,0,"Corners"));
+	FetchData(&this->RequiredVertices,&this->RequiredVerticesSize[0],&this->RequiredVerticesSize[1],mxGetAssignedField(matlab_struct,0,"RequiredVertices"));
+	FetchData(&this->RequiredEdges,   &this->RequiredEdgesSize[0],   &this->RequiredEdgesSize[1],   mxGetAssignedField(matlab_struct,0,"RequiredEdges"));
+	FetchData(&this->CrackedEdges,    &this->CrackedEdgesSize[0],    &this->CrackedEdgesSize[1],    mxGetAssignedField(matlab_struct,0,"CrackedEdges"));
+	FetchData(&this->SubDomains,      &this->SubDomainsSize[0],      &this->SubDomainsSize[1],      mxGetAssignedField(matlab_struct,0,"SubDomains"));
 
 }
@@ -51,5 +52,5 @@
 /*Methods*/
 /*FUNCTION BamgGeom::SetMatlabStructureFields{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgGeom::SetMatlabStructureFields(mxArray** matlab_struct){
 
@@ -94,5 +95,5 @@
 /*}}}*/
 /*FUNCTION BamgGeom::SetMatlabStructureField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgGeom::SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgGeom.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgGeom.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgGeom.h	(revision 12004)
@@ -5,5 +5,5 @@
 #define _BAMGGEOM_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -30,10 +30,10 @@
 
 		BamgGeom();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		BamgGeom(mxArray* matlab_struct);
 		#endif
 		~BamgGeom();
 
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void SetMatlabStructureFields(mxArray** matlab_struct);
 		void SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgMesh.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgMesh.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgMesh.cpp	(revision 12004)
@@ -2,4 +2,5 @@
 #include "../objects.h"
 #include "../../io/io.h"
+#include "../../shared/shared.h"
 
 /*Constructors/Destructors*/
@@ -32,12 +33,12 @@
 /*}}}*/
 /*FUNCTION BamgMesh::BamgMesh(mxArray* matlab_struct){{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 BamgMesh::BamgMesh(mxArray* matlab_struct){
 
 	int lines,cols;
 
-	FetchMatlabData(&this->Vertices,            &this->VerticesSize[0],            &this->VerticesSize[1],            mxGetAssignedField(matlab_struct,0,"Vertices"));
-	FetchMatlabData(&this->Edges,               &this->EdgesSize[0],               &this->EdgesSize[1],               mxGetAssignedField(matlab_struct,0,"Edges"));
-	FetchMatlabData(&this->Triangles,           &this->TrianglesSize[0],           &this->TrianglesSize[1],           mxGetAssignedField(matlab_struct,0,"Triangles"));
+	FetchData(&this->Vertices,            &this->VerticesSize[0],            &this->VerticesSize[1],            mxGetAssignedField(matlab_struct,0,"Vertices"));
+	FetchData(&this->Edges,               &this->EdgesSize[0],               &this->EdgesSize[1],               mxGetAssignedField(matlab_struct,0,"Edges"));
+	FetchData(&this->Triangles,           &this->TrianglesSize[0],           &this->TrianglesSize[1],           mxGetAssignedField(matlab_struct,0,"Triangles"));
 	this->QuadrilateralsSize[0]=0,        this->QuadrilateralsSize[1]=0;     this->Quadrilaterals=NULL;
 
@@ -45,12 +46,12 @@
 	this->SubDomainsFromGeomSize[0]=0,    this->SubDomainsFromGeomSize[1]=0; this->SubDomainsFromGeom=NULL;
 	this->CrackedVerticesSize[0]=0,       this->CrackedVerticesSize[1]=0;    this->CrackedVertices=NULL;
-	FetchMatlabData(&this->CrackedEdges,        &this->CrackedEdgesSize[0],        &this->CrackedEdgesSize[1],        mxGetAssignedField(matlab_struct,0,"CrackedEdges"));
+	FetchData(&this->CrackedEdges,        &this->CrackedEdgesSize[0],        &this->CrackedEdgesSize[1],        mxGetAssignedField(matlab_struct,0,"CrackedEdges"));
 
-	FetchMatlabData(&this->VerticesOnGeomEdge,  &this->VerticesOnGeomEdgeSize[0],  &this->VerticesOnGeomEdgeSize[1],  mxGetAssignedField(matlab_struct,0,"VerticesOnGeomEdge"));
-	FetchMatlabData(&this->VerticesOnGeomVertex,&this->VerticesOnGeomVertexSize[0],&this->VerticesOnGeomVertexSize[1],mxGetAssignedField(matlab_struct,0,"VerticesOnGeomVertex"));
-	FetchMatlabData(&this->EdgesOnGeomEdge,     &this->EdgesOnGeomEdgeSize[0],     &this->EdgesOnGeomEdgeSize[1],     mxGetAssignedField(matlab_struct,0,"EdgesOnGeomEdge"));
+	FetchData(&this->VerticesOnGeomEdge,  &this->VerticesOnGeomEdgeSize[0],  &this->VerticesOnGeomEdgeSize[1],  mxGetAssignedField(matlab_struct,0,"VerticesOnGeomEdge"));
+	FetchData(&this->VerticesOnGeomVertex,&this->VerticesOnGeomVertexSize[0],&this->VerticesOnGeomVertexSize[1],mxGetAssignedField(matlab_struct,0,"VerticesOnGeomVertex"));
+	FetchData(&this->EdgesOnGeomEdge,     &this->EdgesOnGeomEdgeSize[0],     &this->EdgesOnGeomEdgeSize[1],     mxGetAssignedField(matlab_struct,0,"EdgesOnGeomEdge"));
 
 	this->IssmEdgesSize[0]=0,             this->IssmEdgesSize[1]=0;          this->IssmEdges=NULL;
-	FetchMatlabData(&this->IssmSegments,        &this->IssmSegmentsSize[0],        &this->IssmSegmentsSize[1],        mxGetAssignedField(matlab_struct,0,"IssmSegments"));
+	FetchData(&this->IssmSegments,        &this->IssmSegmentsSize[0],        &this->IssmSegmentsSize[1],        mxGetAssignedField(matlab_struct,0,"IssmSegments"));
 
 	this->ElementConnectivitySize[0]=0,      this->ElementConnectivitySize[1]=0;      this->ElementConnectivity=NULL;
@@ -91,5 +92,5 @@
 /*Methods*/
 /*FUNCTION BamgMesh::SetMatlabStructureFields{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgMesh::SetMatlabStructureFields(mxArray** matlab_struct){
 
@@ -152,5 +153,5 @@
 /*}}}*/
 /*FUNCTION BamgMesh::SetMatlabStructureField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BamgMesh::SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgMesh.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgMesh.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgMesh.h	(revision 12004)
@@ -5,5 +5,5 @@
 #define _BAMGMESH_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -51,10 +51,10 @@
 
 		BamgMesh();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		BamgMesh(mxArray* matlab_struct);
 		#endif
 		~BamgMesh();
 
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void SetMatlabStructureFields(mxArray** matlab_struct);
 		void SetMatlabStructureField(mxArray* matlab_struct,const char* fieldname,int fieldrows,int fieldcols,double* fieldpointer);
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgOpts.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgOpts.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgOpts.cpp	(revision 12004)
@@ -42,36 +42,36 @@
 /*}}}*/
 /*FUNCTION BamgOpts::BamgOpts(mxArray* matlab_struct){{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 BamgOpts::BamgOpts(mxArray* matlab_struct){
 
-	FetchMatlabData(&this->anisomax,mxGetField(matlab_struct,0,"anisomax"));
-	FetchMatlabData(&this->cutoff,mxGetField(matlab_struct,0,"cutoff"));
-	FetchMatlabData(&this->coeff,mxGetField(matlab_struct,0,"coeff"));
-	FetchMatlabData(&this->errg,mxGetField(matlab_struct,0,"errg"));
-	FetchMatlabData(&this->gradation,mxGetField(matlab_struct,0,"gradation"));
-	FetchMatlabData(&this->Hessiantype,mxGetField(matlab_struct,0,"Hessiantype"));
-	FetchMatlabData(&this->MaxCornerAngle,mxGetField(matlab_struct,0,"MaxCornerAngle"));
-	FetchMatlabData(&this->maxnbv,mxGetField(matlab_struct,0,"maxnbv"));
-	FetchMatlabData(&this->maxsubdiv,mxGetField(matlab_struct,0,"maxsubdiv"));
-	FetchMatlabData(&this->Metrictype,mxGetField(matlab_struct,0,"Metrictype"));
-	FetchMatlabData(&this->nbjacobi,mxGetField(matlab_struct,0,"nbjacobi"));
-	FetchMatlabData(&this->nbsmooth,mxGetField(matlab_struct,0,"nbsmooth"));
-	FetchMatlabData(&this->omega,mxGetField(matlab_struct,0,"omega"));
-	FetchMatlabData(&this->power,mxGetField(matlab_struct,0,"power"));
-	FetchMatlabData(&this->verbose,mxGetField(matlab_struct,0,"verbose"));
+	FetchData(&this->anisomax,mxGetField(matlab_struct,0,"anisomax"));
+	FetchData(&this->cutoff,mxGetField(matlab_struct,0,"cutoff"));
+	FetchData(&this->coeff,mxGetField(matlab_struct,0,"coeff"));
+	FetchData(&this->errg,mxGetField(matlab_struct,0,"errg"));
+	FetchData(&this->gradation,mxGetField(matlab_struct,0,"gradation"));
+	FetchData(&this->Hessiantype,mxGetField(matlab_struct,0,"Hessiantype"));
+	FetchData(&this->MaxCornerAngle,mxGetField(matlab_struct,0,"MaxCornerAngle"));
+	FetchData(&this->maxnbv,mxGetField(matlab_struct,0,"maxnbv"));
+	FetchData(&this->maxsubdiv,mxGetField(matlab_struct,0,"maxsubdiv"));
+	FetchData(&this->Metrictype,mxGetField(matlab_struct,0,"Metrictype"));
+	FetchData(&this->nbjacobi,mxGetField(matlab_struct,0,"nbjacobi"));
+	FetchData(&this->nbsmooth,mxGetField(matlab_struct,0,"nbsmooth"));
+	FetchData(&this->omega,mxGetField(matlab_struct,0,"omega"));
+	FetchData(&this->power,mxGetField(matlab_struct,0,"power"));
+	FetchData(&this->verbose,mxGetField(matlab_struct,0,"verbose"));
 
-	FetchMatlabData(&this->Crack,mxGetField(matlab_struct,0,"Crack"));
-	FetchMatlabData(&this->geometricalmetric,mxGetField(matlab_struct,0,"geometricalmetric"));
-	FetchMatlabData(&this->KeepVertices,mxGetField(matlab_struct,0,"KeepVertices"));
-	FetchMatlabData(&this->splitcorners,mxGetField(matlab_struct,0,"splitcorners"));
+	FetchData(&this->Crack,mxGetField(matlab_struct,0,"Crack"));
+	FetchData(&this->geometricalmetric,mxGetField(matlab_struct,0,"geometricalmetric"));
+	FetchData(&this->KeepVertices,mxGetField(matlab_struct,0,"KeepVertices"));
+	FetchData(&this->splitcorners,mxGetField(matlab_struct,0,"splitcorners"));
 
-	FetchMatlabData(&this->hmin,mxGetField(matlab_struct,0,"hmin"));
-	FetchMatlabData(&this->hmax,mxGetField(matlab_struct,0,"hmax"));
-	FetchMatlabData(&this->hminVertices,&this->hminVerticesSize[0],&this->hminVerticesSize[1],mxGetField(matlab_struct,0,"hminVertices"));
-	FetchMatlabData(&this->hmaxVertices,&this->hmaxVerticesSize[0],&this->hmaxVerticesSize[1],mxGetField(matlab_struct,0,"hmaxVertices"));
-	FetchMatlabData(&this->hVertices,&this->hVerticesSize[0],&this->hVerticesSize[1],mxGetField(matlab_struct,0,"hVertices"));
-	FetchMatlabData(&this->metric,&this->metricSize[0],&this->metricSize[1],mxGetField(matlab_struct,0,"metric"));
-	FetchMatlabData(&this->field,&this->fieldSize[0],&this->fieldSize[1],mxGetField(matlab_struct,0,"field"));
-	FetchMatlabData(&this->err,&this->errSize[0],&this->errSize[1],mxGetField(matlab_struct,0,"err"));
+	FetchData(&this->hmin,mxGetField(matlab_struct,0,"hmin"));
+	FetchData(&this->hmax,mxGetField(matlab_struct,0,"hmax"));
+	FetchData(&this->hminVertices,&this->hminVerticesSize[0],&this->hminVerticesSize[1],mxGetField(matlab_struct,0,"hminVertices"));
+	FetchData(&this->hmaxVertices,&this->hmaxVerticesSize[0],&this->hmaxVerticesSize[1],mxGetField(matlab_struct,0,"hmaxVertices"));
+	FetchData(&this->hVertices,&this->hVerticesSize[0],&this->hVerticesSize[1],mxGetField(matlab_struct,0,"hVertices"));
+	FetchData(&this->metric,&this->metricSize[0],&this->metricSize[1],mxGetField(matlab_struct,0,"metric"));
+	FetchData(&this->field,&this->fieldSize[0],&this->fieldSize[1],mxGetField(matlab_struct,0,"field"));
+	FetchData(&this->err,&this->errSize[0],&this->errSize[1],mxGetField(matlab_struct,0,"err"));
 
 	/*Additional checks*/
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgOpts.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgOpts.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Bamg/BamgOpts.h	(revision 12004)
@@ -6,5 +6,5 @@
 #define _BAMGOPTS_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -54,5 +54,5 @@
 
 		BamgOpts();
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		BamgOpts(mxArray* matlab_struct);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Contour.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Contour.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Contour.cpp	(revision 12004)
@@ -13,12 +13,149 @@
 #include "../io/io.h"
 
-void ContourEcho(Contour* contour){
+/*Contour constructors and destructors:*/
+/*FUNCTION Contour::Contour() default constructor {{{1*/
+Contour::Contour(){
+	this->id=0;
+	this->nods=0;
+	this->x=NULL;
+	this->y=NULL;
+	this->closed=false;
+}
+/*}}}*/
+/*FUNCTION Contour::Contour(int pid, int nods, double* x, double* y,bool closed) {{{1*/
+Contour::Contour(int pid,int pnods, double* px, double* py,bool pclosed){
+	
+	this->id=pid;
+	this->nods=pnods;
+	this->closed=pclosed;
+	if(nods){
+		this->x=(double*)xmalloc(nods*sizeof(double));
+		memcpy(this->x,px,nods*sizeof(double));
+		this->y=(double*)xmalloc(nods*sizeof(double));
+		memcpy(this->y,py,nods*sizeof(double));
+	}
+}
+/*}}}*/
+/*FUNCTION Contour::Contour() default constructor {{{1*/
+Contour::~Contour(){
+	xfree((void**)&this->x);
+	xfree((void**)&this->y);
+}
+/*}}}*/
+
+
+/*Object virtual function resolutoin: */
+/*FUNCTION Contour::Echo(){{{1*/
+void Contour::Echo(void){
 
 	int i;
 
-	_printf_(true,"Number of nodes in contour: %i\n",contour->nods);
-	_printf_(true,"Node coordinates: \n");
-	for (i=0;i<contour->nods;i++){
-		_printf_(true,"%lf %lf\n",*(contour->x+i),*(contour->y+i));
+	printf("Contour: %i:\n",id);
+	printf("   nods: %i\n",nods);
+	printf("   closed: %s\n",closed?"true":"false");
+	if(nods){
+		printf("   x,y:\n");
+		for(i=0;i<nods;i++){
+			printf("%i: %g|%g\n",i,x[i],y[i]);
+		}
 	}
 }
+/*}}}*/
+/*FUNCTION Contour::DeepEcho(){{{1*/
+void Contour::DeepEcho(void){
+	this->Echo();
+}
+/*}}}*/
+/*FUNCTION Contour::Id(){{{1*/
+int Contour::Id(void){
+	return id;
+}
+/*}}}*/
+/*FUNCTION Contour::MyRank{{{1*/
+int    Contour::MyRank(void){ 
+	extern int my_rank;
+
+	return my_rank; 
+}
+/*}}}*/
+#ifdef _SERIAL_
+/*FUNCTION Contour::Marshall{{{1*/
+void  Contour::Marshall(char** pmarshalled_dataset){
+
+	char* marshalled_dataset=NULL;
+	int   enum_type=0;
+	char* marshalled_inputs=NULL;
+	int   marshalled_inputssize;
+
+	/*recover marshalled_dataset: */
+	marshalled_dataset=*pmarshalled_dataset;
+
+	/*get enum type of Contour: */
+	enum_type=ContourEnum;
+	
+	/*marshall enum: */
+	memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
+	
+	/*marshall Contour data: */
+	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(marshalled_dataset,&nods,sizeof(nods));marshalled_dataset+=sizeof(nods);
+	memcpy(marshalled_dataset,&closed,sizeof(closed));marshalled_dataset+=sizeof(closed);
+	memcpy(marshalled_dataset,x,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+	memcpy(marshalled_dataset,y,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+
+	*pmarshalled_dataset=marshalled_dataset;
+	return;
+}
+/*}}}*/
+/*FUNCTION Contour::MarshallSize{{{1*/
+int   Contour::MarshallSize(){
+
+	return sizeof(id)+
+		sizeof(nods)+
+		sizeof(closed)+
+		2*nods*sizeof(double)+
+		sizeof(int); //sizeof(int) for enum type
+}
+/*}}}*/
+/*FUNCTION Contour::Demarshall{{{1*/
+void  Contour::Demarshall(char** pmarshalled_dataset){
+
+	char* marshalled_dataset=NULL;
+
+	/*recover marshalled_dataset: */
+	marshalled_dataset=*pmarshalled_dataset;
+
+	/*this time, no need to get enum type, the pointer directly points to the beginning of the 
+	 *object data (thanks to DataSet::Demarshall):*/
+
+	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
+	memcpy(&nods,marshalled_dataset,sizeof(nods));marshalled_dataset+=sizeof(nods);
+	memcpy(&closed,marshalled_dataset,sizeof(closed));marshalled_dataset+=sizeof(closed);
+
+	if(nods){
+		this->x=(double*)xmalloc(nods*sizeof(double));
+		this->y=(double*)xmalloc(nods*sizeof(double));
+		memcpy(x,marshalled_dataset,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+		memcpy(y,marshalled_dataset,nods*sizeof(double));marshalled_dataset+=nods*sizeof(double);
+	}
+
+	/*return: */
+	*pmarshalled_dataset=marshalled_dataset;
+	return;
+}
+/*}}}*/
+#endif
+/*FUNCTION Contour::ObjectEnum{{{1*/
+int Contour::ObjectEnum(void){
+
+	return ContourEnum;
+
+}
+/*}}}*/
+/*FUNCTION Contour::copy {{{1*/
+Object* Contour::copy() {
+
+	return new Contour(*this); 
+
+}
+/*}}}*/
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Contour.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Contour.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Contour.h	(revision 12004)
@@ -1,5 +1,4 @@
-/*! \file Contour.h
- *  \brief structure object to hold contour profiles from an 
- *  Argus domain outline file, or from any cad system.
+/*!\file Contour.h
+ * \brief: header file for Contour object
  */
 
@@ -7,13 +6,43 @@
 #define _CONTOUR_H_
 
-/*!Contour declaration: */
-struct Contour {
-	int	nods;
-	double* x;
-	double* y;
+/*Headers:*/
+/*{{{1*/
+#include "./Object.h"
+#include "../shared/Exceptions/exceptions.h"
+#include "../toolkits/toolkits.h"
+#include "../include/include.h"
+/*}}}*/
+
+class Contour: public Object{
+
+	public: 
+
+		int     id;
+		int	  nods;  //number of vertices in the contour
+		double* x;
+		double* y;
+		bool    closed; //is this contour closed?
+
+		/*Contour constructors, destructors {{{1*/
+		Contour();
+		Contour(int id, int nods, double* x, double* y,bool closed);
+		~Contour();
+		/*}}}*/
+		/*Object virtual functions{{{1*/
+		void  Echo(void);
+		void  DeepEcho(void);
+		int   Id(void);
+		int   MyRank(void);
+		#ifdef _SERIAL_
+		void  Marshall(char** pmarshalled_dataset);
+		int   MarshallSize(void);
+		void  Demarshall(char** pmarshalled_dataset);
+		#endif
+		int   ObjectEnum(void);
+		Object* copy(void);
+		/*}}}*/
+
+
 };
 
-/*!Methods: */
-void ContourEcho(Contour* contour);
-
-#endif  /* CONTOUR_H_ */
+#endif  /* _CONTOUR_H_ */
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Elements/Tria.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Elements/Tria.cpp	(revision 12004)
@@ -1879,5 +1879,5 @@
 			this->inputs->AddInput(transientinput);
 		}
-		else _error_("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long",numberofvertices,M);
+		else _error_("nodal vector is either numberofnodes or numberofnodes+1 long. Field provided (%s) is %i long",EnumToStringx(vector_enum),M);
 	}
 	else if(vector_type==2){ //element vector
@@ -3777,5 +3777,5 @@
 	//	vx_input->GetInputValue(&vx,gauss);
 	//	vy_input->GetInputValue(&vy,gauss);
-	//	grade_g[iv] = -2*drag*alpha_complement*(lambda*vx+mu*vy)/((double)connectivity[iv]);
+	//	grade_g[iv] = -2*1.e+7*drag*alpha_complement*(lambda*vx+mu*vy)/((double)connectivity[iv]);
 	//}
 	/*End Analytical gradient*/
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/BoolExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/BoolExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/BoolExternalResult.cpp	(revision 12004)
@@ -186,5 +186,5 @@
 /*}}}*/
 /*FUNCTION BoolExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void BoolExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/BoolExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/BoolExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/BoolExternalResult.h	(revision 12004)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -59,5 +59,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-	    #ifdef _SERIAL_
+	    #if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleExternalResult.cpp	(revision 12004)
@@ -182,5 +182,5 @@
 /*}}}*/
 /*FUNCTION DoubleExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void DoubleExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleExternalResult.h	(revision 12004)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -60,5 +60,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleMatExternalResult.cpp	(revision 12004)
@@ -223,5 +223,5 @@
 /*}}}*/
 /*FUNCTION DoubleMatExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void DoubleMatExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleMatExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleMatExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleMatExternalResult.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -61,5 +61,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleVecExternalResult.cpp	(revision 12004)
@@ -207,5 +207,5 @@
 /*}}}*/
 /*FUNCTION DoubleVecExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void DoubleVecExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleVecExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleVecExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/DoubleVecExternalResult.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -60,5 +60,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/ExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/ExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/ExternalResult.h	(revision 12004)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -33,5 +33,5 @@
 		virtual void  WriteData(FILE* fid,bool io_gather)=0;
 		virtual void  GetResultName(char**)=0;
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		virtual void  SetMatlabField(mxArray* dataref)=0;
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/IntExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/IntExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/IntExternalResult.cpp	(revision 12004)
@@ -186,5 +186,5 @@
 /*}}}*/
 /*FUNCTION IntExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void IntExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/IntExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/IntExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/IntExternalResult.h	(revision 12004)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -58,5 +58,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/PetscVecExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/PetscVecExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/PetscVecExternalResult.cpp	(revision 12004)
@@ -245,5 +245,5 @@
 /*}}}*/
 /*FUNCTION PetscVecExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  PetscVecExternalResult::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/PetscVecExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/PetscVecExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/PetscVecExternalResult.h	(revision 12004)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -60,5 +60,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/StringExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/StringExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/StringExternalResult.cpp	(revision 12004)
@@ -198,5 +198,5 @@
 /*}}}*/
 /*FUNCTION StringExternalResult::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  StringExternalResult::SetMatlabField(mxArray* dataref){
 	
Index: /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/StringExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/StringExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/ExternalResults/StringExternalResult.h	(revision 12004)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -48,7 +48,9 @@
 		int   Id(); 
 		int   MyRank();
+		#ifdef _SERIAL_
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
 		void  Demarshall(char** pmarshalled_dataset);
+		#endif
 		int   ObjectEnum();
 		Object* copy();
@@ -58,5 +60,5 @@
 		void  WriteData(FILE* fid,bool io_gather);
 		void  GetResultName(char**);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Loads/Icefront.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Loads/Icefront.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Loads/Icefront.cpp	(revision 12004)
@@ -458,5 +458,5 @@
 		case MacAyeal2dIceFrontEnum:
 			return CreatePVectorDiagnosticMacAyeal2d();
-        #ifdef _HAVE_THREED_
+        #ifdef _HAVE_3D_
 		case MacAyeal3dIceFrontEnum:
 			return CreatePVectorDiagnosticMacAyeal3d();
@@ -563,5 +563,5 @@
 /*}}}*/
 #endif
-#ifdef _HAVE_THREED_
+#ifdef _HAVE_3D_
 /*FUNCTION Icefront::CreatePVectorDiagnosticMacAyeal3d{{{1*/
 ElementVector* Icefront::CreatePVectorDiagnosticMacAyeal3d(void){
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Loads/Icefront.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Loads/Icefront.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Loads/Icefront.h	(revision 12004)
@@ -93,5 +93,5 @@
 		ElementVector* CreatePVectorDiagnosticMacAyeal2d(void);
 		#endif
-        #ifdef _HAVE_THREED_
+        #ifdef _HAVE_3D_
 		ElementVector* CreatePVectorDiagnosticMacAyeal3d(void);
 		ElementVector* CreatePVectorDiagnosticPattyn(void);
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Materials/Matice.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Materials/Matice.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Materials/Matice.cpp	(revision 12004)
@@ -880,5 +880,5 @@
 
 	/*if 3d*/
-	#ifdef _HAVE_THREED_
+	#ifdef _HAVE_3D_
 	else if(dim==3){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/ElementMatrix.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/ElementMatrix.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/ElementMatrix.cpp	(revision 12004)
@@ -260,45 +260,41 @@
 	this->CheckConsistency();
 
-	#ifdef _HAVE_PETSC_
-		if(this->dofsymmetrical){
-			/*only use row dofs to add values into global matrices: */
-			
-			if(this->row_fsize){
-				/*first, retrieve values that are in the f-set from the g-set values matrix: */
-				localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
-				for(i=0;i<this->row_fsize;i++){
-					for(j=0;j<this->row_fsize;j++){
-						*(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
-					}
+	if(this->dofsymmetrical){
+		/*only use row dofs to add values into global matrices: */
+
+		if(this->row_fsize){
+			/*first, retrieve values that are in the f-set from the g-set values matrix: */
+			localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
+			for(i=0;i<this->row_fsize;i++){
+				for(j=0;j<this->row_fsize;j++){
+					*(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
 				}
-				/*add local values into global  matrix, using the fglobaldoflist: */
-				MatSetValues(Kff->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES);
-
-				/*Free ressources:*/
-				xfree((void**)&localvalues);
-			}
-
-
-			if((this->row_ssize!=0) && (this->row_fsize!=0)){
-				/*first, retrieve values that are in the f and s-set from the g-set values matrix: */
-				localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));
-				for(i=0;i<this->row_fsize;i++){
-					for(j=0;j<this->row_ssize;j++){
-						*(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);
-					}
+			}
+			/*add local values into global  matrix, using the fglobaldoflist: */
+			Kff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
+
+			/*Free ressources:*/
+			xfree((void**)&localvalues);
+		}
+
+
+		if((this->row_ssize!=0) && (this->row_fsize!=0)){
+			/*first, retrieve values that are in the f and s-set from the g-set values matrix: */
+			localvalues=(double*)xmalloc(this->row_fsize*this->row_ssize*sizeof(double));
+			for(i=0;i<this->row_fsize;i++){
+				for(j=0;j<this->row_ssize;j++){
+					*(localvalues+this->row_ssize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_slocaldoflist[j]);
 				}
-				/*add local values into global  matrix, using the fglobaldoflist: */
-				MatSetValues(Kfs->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,(const double*)localvalues,ADD_VALUES);
-
-				/*Free ressources:*/
-				xfree((void**)&localvalues);
-			}
-		}
-		else{
-			_error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
-		}
-	#else
-		_error_("not supported yet!");
-	#endif
+			}
+			/*add local values into global  matrix, using the fglobaldoflist: */
+			Kfs->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_ssize,this->row_sglobaldoflist,localvalues,ADD_VAL);
+
+			/*Free ressources:*/
+			xfree((void**)&localvalues);
+		}
+	}
+	else{
+		_error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
+	}
 
 }
@@ -316,30 +312,26 @@
 	this->CheckConsistency();
 
-	#ifdef _HAVE_PETSC_
-		if(this->dofsymmetrical){
-			/*only use row dofs to add values into global matrices: */
-
-			if(this->row_fsize){
-				/*first, retrieve values that are in the f-set from the g-set values matrix: */
-				localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
-				for(i=0;i<this->row_fsize;i++){
-					for(j=0;j<this->row_fsize;j++){
-						*(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
-					}
+	if(this->dofsymmetrical){
+		/*only use row dofs to add values into global matrices: */
+
+		if(this->row_fsize){
+			/*first, retrieve values that are in the f-set from the g-set values matrix: */
+			localvalues=(double*)xmalloc(this->row_fsize*this->row_fsize*sizeof(double));
+			for(i=0;i<this->row_fsize;i++){
+				for(j=0;j<this->row_fsize;j++){
+					*(localvalues+this->row_fsize*i+j)=*(this->values+this->ncols*this->row_flocaldoflist[i]+this->row_flocaldoflist[j]);
 				}
-				/*add local values into global  matrix, using the fglobaldoflist: */
-				MatSetValues(Jff->matrix,this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,(const double*)localvalues,ADD_VALUES);
-
-				/*Free ressources:*/
-				xfree((void**)&localvalues);
-			}
-
-		}
-		else{
-			_error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
-		}
-	#else
-		_error_("not supported yet!");
-	#endif
+			}
+			/*add local values into global  matrix, using the fglobaldoflist: */
+			Jff->SetValues(this->row_fsize,this->row_fglobaldoflist,this->row_fsize,this->row_fglobaldoflist,localvalues,ADD_VAL);
+
+			/*Free ressources:*/
+			xfree((void**)&localvalues);
+		}
+
+	}
+	else{
+		_error_(" non dofsymmetrical matrix AddToGlobal routine not support yet!");
+	}
 
 }
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/ElementVector.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/ElementVector.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/ElementVector.cpp	(revision 12004)
@@ -166,20 +166,16 @@
 	double* localvalues=NULL;
 
-	#ifdef _HAVE_PETSC_
-		if(this->fsize){
-			/*first, retrieve values that are in the f-set from the g-set values vector: */
-			localvalues=(double*)xmalloc(this->fsize*sizeof(double));
-			for(i=0;i<this->fsize;i++){
-				localvalues[i]=this->values[this->flocaldoflist[i]];
-			}
-			/*add local values into global  vector, using the fglobaldoflist: */
-			VecSetValues(pf->vector,this->fsize,this->fglobaldoflist,(const double*)localvalues,ADD_VALUES);
-
-			/*Free ressources:*/
-			xfree((void**)&localvalues);
-		}
-	#else
-		_error_("not supported yet!");
-	#endif
+	if(this->fsize){
+		/*first, retrieve values that are in the f-set from the g-set values vector: */
+		localvalues=(double*)xmalloc(this->fsize*sizeof(double));
+		for(i=0;i<this->fsize;i++){
+			localvalues[i]=this->values[this->flocaldoflist[i]];
+		}
+		/*add local values into global  vector, using the fglobaldoflist: */
+		pf->SetValues(this->fsize,this->fglobaldoflist,localvalues,ADD_VAL);
+
+		/*Free ressources:*/
+		xfree((void**)&localvalues);
+	}
 	
 }
@@ -191,20 +187,16 @@
 	double* localvalues=NULL;
 
-	#ifdef _HAVE_PETSC_
-		if(this->fsize){
-			/*first, retrieve values that are in the f-set from the g-set values vector: */
-			localvalues=(double*)xmalloc(this->fsize*sizeof(double));
-			for(i=0;i<this->fsize;i++){
-				localvalues[i]=this->values[this->flocaldoflist[i]];
-			}
-			/*add local values into global  vector, using the fglobaldoflist: */
-			VecSetValues(pf->vector,this->fsize,this->fglobaldoflist,(const double*)localvalues,INSERT_VALUES);
-
-			/*Free ressources:*/
-			xfree((void**)&localvalues);
-		}
-	#else
-		_error_("not supported yet!");
-	#endif
+	if(this->fsize){
+		/*first, retrieve values that are in the f-set from the g-set values vector: */
+		localvalues=(double*)xmalloc(this->fsize*sizeof(double));
+		for(i=0;i<this->fsize;i++){
+			localvalues[i]=this->values[this->flocaldoflist[i]];
+		}
+		/*add local values into global  vector, using the fglobaldoflist: */
+		pf->SetValues(this->fsize,this->fglobaldoflist,localvalues,INS_VAL);
+
+		/*Free ressources:*/
+		xfree((void**)&localvalues);
+	}
 
 }
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Matrix.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Matrix.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Matrix.cpp	(revision 12004)
@@ -26,7 +26,4 @@
 Matrix::Matrix(){
 
-	this->M=0;
-	this->N=0;
-
 	#ifdef _HAVE_PETSC_
 	this->matrix=NULL;
@@ -40,55 +37,43 @@
 /*}}}*/
 /*FUNCTION Matrix::Matrix(int M,int N){{{1*/
-Matrix::Matrix(int pM,int pN){
-
-	this->M=pM;
-	this->N=pN;
-
-	#ifdef _HAVE_PETSC_
-	this->matrix=NewMat(pM,pN);
-	#else
-	this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
-	#endif
-	#ifdef _HAVE_ADOLC_
-	this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble));
+Matrix::Matrix(int M,int N){
+
+	#ifdef _HAVE_PETSC_
+	this->matrix=NewMat(M,N);
+	#else
+	this->matrix=new SeqMat(M,N);
+	#endif
+	#ifdef _HAVE_ADOLC_
+	this->amatrix=(adouble*)xmalloc(M*N*sizeof(adouble));
 	#endif
 }
 /*}}}*/
 /*FUNCTION Matrix::Matrix(int M,int N,double sparsity){{{1*/
-Matrix::Matrix(int pM,int pN,double sparsity){
-
-	this->M=pM;
-	this->N=pN;
-
-	#ifdef _HAVE_PETSC_
-	this->matrix=NewMat(pM,pN,sparsity);
-	#else
-	this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
-	#endif
-	#ifdef _HAVE_ADOLC_
-	this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble));
+Matrix::Matrix(int M,int N,double sparsity){
+
+	#ifdef _HAVE_PETSC_
+	this->matrix=NewMat(M,N,sparsity);
+	#else
+	this->matrix=new SeqMat(M,N,sparsity);
+	#endif
+	#ifdef _HAVE_ADOLC_
+	this->amatrix=(adouble*)xmalloc(M*N*sizeof(adouble));
 	#endif
 }
 /*}}}*/
 /*FUNCTION Matrix::Matrix(double* serial_mat, int M,int N,double sparsity){{{1*/
-Matrix::Matrix(double* serial_mat, int pM,int pN,double sparsity){
-
-	this->M=pM;
-	this->N=pN;
+Matrix::Matrix(double* serial_mat, int M,int N,double sparsity){
 
 	#ifdef _HAVE_PETSC_
 	int     i;
-	int*    idxm=NULL;
-	int*    idxn=NULL;
-
-	this->matrix=NewMat(pM,pN,sparsity);
-
-	idxm=(int*)xmalloc(M*sizeof(int));
-	idxn=(int*)xmalloc(N*sizeof(int));
+
+
+	int* idxm=(int*)xmalloc(M*sizeof(int));
+	int* idxn=(int*)xmalloc(N*sizeof(int));
 	for(i=0;i<M;i++)idxm[i]=i;
 	for(i=0;i<N;i++)idxn[i]=i;
 
+	this->matrix=NewMat(M,N,sparsity);
 	MatSetValues(this->matrix,M,idxm,N,idxn,serial_mat,INSERT_VALUES);
-
 	MatAssemblyBegin(this->matrix,MAT_FINAL_ASSEMBLY);
 	MatAssemblyEnd(this->matrix,MAT_FINAL_ASSEMBLY);
@@ -97,24 +82,21 @@
 	xfree((void**)&idxn);
 	#else
-	this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
-	#endif
-	#ifdef _HAVE_ADOLC_
-	this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble));
+	this->matrix=new SeqMat(serial_mat,M,N,sparsity);
+	#endif
+	#ifdef _HAVE_ADOLC_
+	this->amatrix=(adouble*)xmalloc(M*N*sizeof(adouble));
 	#endif
 }
 /*}}}*/
 /*FUNCTION Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode){{{1*/
-Matrix::Matrix(int pM,int pN,int connectivity,int numberofdofspernode){
-	
-	this->M=pM;
-	this->N=pN;
-
-	#ifdef _HAVE_PETSC_
-	this->matrix=NewMat(pM,pN,connectivity,numberofdofspernode);
-	#else
-	this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
-	#endif
-	#ifdef _HAVE_ADOLC_
-	this->amatrix=(adouble*)xmalloc(pM*pN*sizeof(adouble));
+Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode){
+	
+	#ifdef _HAVE_PETSC_
+	this->matrix=NewMat(M,N,connectivity,numberofdofspernode);
+	#else
+	this->matrix=new SeqMat(M,N,connectivity,numberofdofspernode);
+	#endif
+	#ifdef _HAVE_ADOLC_
+	this->amatrix=(adouble*)xmalloc(M*N*sizeof(adouble));
 	#endif
 }
@@ -126,5 +108,5 @@
 	MatFree(&this->matrix);
 	#else
-	xfree((void**)&this->matrix);
+	delete this->matrix;
 	#endif
 	#ifdef _HAVE_ADOLC_
@@ -143,11 +125,5 @@
 	MatView(this->matrix,PETSC_VIEWER_STDOUT_WORLD);
 	#else
-	printf("Matrix size: %i-%i\n",M,N);
-	for(i=0;i<M;i++){
-		for(j=0;j<N;j++){
-			printf("%g ",*(matrix+N*i+j));
-		}
-		printf("\n");
-	}
+	this->matrix->Echo();
 	#endif
 
@@ -165,5 +141,5 @@
 /*}}}*/
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION Matrix::ToMatlabMatrix{{{1*/
 mxArray* Matrix::ToMatlabMatrix(void){
@@ -173,8 +149,26 @@
 	PetscMatrixToMatlabMatrix(&dataref,this->matrix);
 	#else
-	_error_("not implemented yet!");
+	dataref=this->matrix->ToMatlabMatrix();
 	#endif
 	return dataref;
 
+}
+/*}}}*/
+/*FUNCTION MatlabMatrixToMatrix{{{1*/
+Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix){
+
+	int dummy;
+	Matrix* matrix=NULL;
+
+	/*allocate matrix object: */
+	matrix=new Matrix();
+
+	#ifdef _HAVE_PETSC_
+	MatlabMatrixToPetscMatrix(&matrix->matrix,NULL,NULL,mxmatrix);
+	#else
+	matrix->matrix=MatlabMatrixToSeqMat(mxmatrix);
+	#endif
+	
+	return matrix;
 }
 /*}}}*/
@@ -183,4 +177,5 @@
 void Matrix::Assemble(void){
 	#ifdef _HAVE_PETSC_
+		_assert_(this->matrix);
 		MatAssemblyBegin(this->matrix,MAT_FINAL_ASSEMBLY);
 		MatAssemblyEnd(this->matrix,MAT_FINAL_ASSEMBLY);
@@ -189,5 +184,5 @@
 		#endif
 	#else
-		/*do nothing:*/
+		this->matrix->Assemble();
 	#endif
 
@@ -199,7 +194,8 @@
 	double norm=0;
 	#ifdef _HAVE_PETSC_
-	    MatNorm(this->matrix,ISSMToPetscNormMode(norm_type),&norm);
-	#else
-		_error_("not implemented yet!");
+		_assert_(this->matrix);
+		MatNorm(this->matrix,ISSMToPetscNormMode(norm_type),&norm);
+	#else
+		norm=this->matrix->Norm(norm_type);
 	#endif
 	return norm;
@@ -210,7 +206,8 @@
 	
 	#ifdef _HAVE_PETSC_
-	    MatGetSize(this->matrix,pM,pN);
-	#else
-		_error_("not implemented yet!");
+		_assert_(this->matrix);
+		MatGetSize(this->matrix,pM,pN);
+	#else
+		this->matrix->GetSize(pM,pN);
 	#endif
 }
@@ -220,7 +217,8 @@
 	
 	#ifdef _HAVE_PETSC_
-	    MatGetLocalSize(this->matrix,pM,pN);
-	#else
-		_error_("not implemented yet!");
+		_assert_(this->matrix);
+		MatGetLocalSize(this->matrix,pM,pN);
+	#else
+		this->matrix->GetLocalSize(pM,pN);
 	#endif
 }
@@ -230,7 +228,9 @@
 
 	#ifdef _HAVE_PETSC_
-	    MatMultPatch(this->matrix,X->vector,AX->vector);
-	#else
-		_error_("not implemented yet!");
+		_assert_(this->matrix);
+		_assert_(X->vector);
+		MatMultPatch(this->matrix,X->vector,AX->vector);
+	#else
+		this->matrix->MatMult(X->vector,AX->vector);
 	#endif
 }
@@ -243,9 +243,12 @@
 	output=new Matrix();
 
-	#ifdef _HAVE_PETSC
+	#ifdef _HAVE_PETSC_
+		_assert_(this->matrix);
 		MatDuplicate(this->matrix,MAT_COPY_VALUES,&output->matrix);
 	#else
-		_error_("not implemented yet!");
-	#endif
+		output->matrix=this->matrix->Duplicate();
+	#endif
+	
+	return output;
 }
 /*}}}*/
@@ -255,10 +258,30 @@
 	double* output=NULL;
 
-	#ifdef _HAVE_PETSC
+	#ifdef _HAVE_PETSC_
 		MatToSerial(&output,this->matrix);
 	#else
-		_error_("not implemented yet!");
+		output=this->matrix->ToSerial();
 	#endif
 	return output;
 }
 /*}}}*/
+/*FUNCTION Matrix::SetValues{{{1*/
+void Matrix::SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode){
+
+	#ifdef _HAVE_PETSC_
+		MatSetValues(this->matrix,m,idxm,n,idxn,values,ISSMToPetscInsertMode(mode));
+	#else
+		this->matrix->SetValues(m,idxm,n,idxn,values,mode);
+	#endif
+}
+/*}}}*/
+/*FUNCTION Matrix::Convert{{{1*/
+void Matrix::Convert(MatrixType type){
+
+	#ifdef _HAVE_PETSC_
+		MatConvert(this->matrix,ISSMToPetscMatrixType(type),MAT_REUSE_MATRIX,&this->matrix);
+	#else
+		this->matrix->Convert(type);
+	#endif
+}
+/*}}}*/
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Matrix.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Matrix.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Matrix.h	(revision 12004)
@@ -1,4 +1,4 @@
 /*!\file:  Matrix.h
- * \brief wrapper to matrix objects. The goal is to control which API (PETSC,Scalpack, Plapack?) 
+ * \brief wrapper to matrix objects. The goal is to control which API (PETSc,Scalpack, Plapack?) 
  * implements our underlying matrix format.
  */ 
@@ -21,5 +21,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -32,10 +32,8 @@
 	public:
 	
-		int M,N; 
-
 		#ifdef _HAVE_PETSC_
 		Mat matrix; 
 		#else
-		double* matrix; 
+		SeqMat* matrix; 
 		#endif
 		#ifdef _HAVE_ADOLC_
@@ -53,5 +51,5 @@
 		/*Matrix specific routines {{{1*/
 		void Echo(void);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		mxArray* ToMatlabMatrix(void);
 		#endif
@@ -63,6 +61,13 @@
 		Matrix* Duplicate(void);
 		double* ToSerial(void);
+		void SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode);
+		void Convert(MatrixType type);
 		/*}}}*/
 
 };
+/*API: */
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix);
+#endif
+
 #endif //#ifndef _MATRIX_H_
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Vector.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Vector.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Vector.cpp	(revision 12004)
@@ -25,5 +25,4 @@
 Vector::Vector(){
 
-	this->M=0;
 	#ifdef _HAVE_PETSC_
 	this->vector=NULL;
@@ -42,6 +41,5 @@
 	this->vector=NewVec(pM,fromlocalsize);
 	#else
-	this->M=pM;
-	this->vector=(double*)xcalloc(pM,sizeof(double));
+	this->vector=new SeqVec(pM,fromlocalsize);
 	#endif
 	#ifdef _HAVE_ADOLC_
@@ -51,28 +49,21 @@
 /*}}}*/
 /*FUNCTION Vector::Vector(double* serial_vec,int M){{{1*/
-Vector::Vector(double* serial_vec,int pM){
-
-	int i,j;
-
-	#ifdef _HAVE_PETSC_
-		int* idxm=NULL;
-
-		this->vector=NewVec(pM);
-		
-		idxm=(int*)xmalloc(M*sizeof(int));
-		for(i=0;i<M;i++)idxm[i]=i;
+Vector::Vector(double* serial_vec,int M){
+
+	#ifdef _HAVE_PETSC_
+		int* idxm=(int*)xmalloc(M*sizeof(int));
+		for(int i=0;i<M;i++) idxm[i]=i;
+
+		this->vector=NewVec(M);
 		VecSetValues(this->vector,M,idxm,serial_vec,INSERT_VALUES);
-
 		VecAssemblyBegin(this->vector);
 		VecAssemblyEnd(this->vector);
 
 		xfree((void**)&idxm);
-
-	#else
-		this->M=pM;
-		this->vector=(double*)xcalloc(pM,sizeof(double));
-	#endif
-	#ifdef _HAVE_ADOLC_
-		this->avector=(adouble*)xmalloc(pM*sizeof(adouble));
+	#else
+		this->vector=new SeqVec(serial_vec,M);
+	#endif
+	#ifdef _HAVE_ADOLC_
+		this->avector=(adouble*)xmalloc(M*sizeof(adouble));
 	#endif
 }
@@ -82,14 +73,31 @@
 Vector::Vector(Vec petsc_vec){
 
-	/*Get Vector size*/
-	VecGetSize(petsc_vec,&this->M);
-
-	/*copy vector*/
-	VecDuplicate(petsc_vec,&this->vector);
-	VecCopy(petsc_vec,this->vector);
+	if(petsc_vec==NULL){
+		this->vector=NewVec(0);
+	}
+	else{
+		/*copy vector*/
+		VecDuplicate(petsc_vec,&this->vector);
+		VecCopy(petsc_vec,this->vector);
+	}
 
 }
 /*}}}*/
 #endif
+#ifdef _HAVE_GSL_
+/*FUNCTION Vector::Vector(SeqVec* seq_vec){{{1*/
+Vector::Vector(SeqVec*  seq_vec){
+
+	if(seq_vec==NULL){
+		this->vector=NULL;
+	}
+	else{
+		/*copy vector*/
+		this->vector=seq_vec->Duplicate();
+	}
+}
+/*}}}*/
+#endif
+
 		/*FUNCTION Vector::~Vector(){{{1*/
 Vector::~Vector(){
@@ -98,5 +106,5 @@
 	VecFree(&this->vector);
 	#else
-	xfree((void**)&this->vector);
+	delete this->vector;
 	#endif
 	#ifdef _HAVE_ADOLC_
@@ -113,23 +121,17 @@
 
 	#ifdef _HAVE_PETSC_
+	_assert_(this->vector);
 	VecView(this->vector,PETSC_VIEWER_STDOUT_WORLD);
 	#else
-	printf("Vector size: %i\n",M);
-	for(i=0;i<M;i++){
-		printf("%g\n ",*(vector+i));
-	}
-	#endif
-
-	#ifdef _HAVE_ADOLC_
-	/*Not sure about that one. Should we use the overloaded operator >>?*/
-	printf("ADOLC Vector equivalent:" );
-	for(i=0;i<M;i++){
-		printf("%g\n ",*(avector+i));
-	}
-	#endif
-}
-/*}}}*/
-
-#ifdef _SERIAL_
+	this->vector->Echo();
+	#endif
+
+	#ifdef _HAVE_ADOLC_
+	/*do nothing for now: */
+	#endif
+}
+/*}}}*/
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 /*FUNCTION Vector::ToMatlabVector{{{1*/
 mxArray* Vector::ToMatlabVector(void){
@@ -139,8 +141,26 @@
 	PetscVectorToMatlabVector(&dataref,this->vector);
 	#else
-	_error_("not implemented yet!");
+	dataref=this->vector->ToMatlabVector();
 	#endif
 	return dataref;
 
+}
+/*}}}*/
+/*FUNCTION MatlabVectorToVector{{{1*/
+Vector* MatlabVectorToVector(const mxArray* mxvector){
+
+	int dummy;
+	Vector* vector=NULL;
+
+	/*allocate vector object: */
+	vector=new Vector();
+
+	#ifdef _HAVE_PETSC_
+	MatlabVectorToPetscVector(&vector->vector,&dummy,mxvector);
+	#else
+	vector->vector=MatlabVectorToSeqVec(mxvector);
+	#endif
+	
+	return vector;
 }
 /*}}}*/
@@ -150,8 +170,9 @@
 		
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecAssemblyBegin(this->vector); 
 		VecAssemblyEnd(this->vector);
 	#else
-		/*do nothing*/
+		this->vector->Assemble();
 	#endif
 
@@ -163,7 +184,8 @@
 		
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecSetValues(this->vector,ssize,list,values,ISSMToPetscInsertMode(mode));
 	#else
-		_error_("not implemented yet!");
+		this->vector->SetValues(ssize,list,values,mode);
 	#endif
 
@@ -173,9 +195,9 @@
 void Vector::SetValue(int dof, double value, InsMode mode){
 		
-		
-	#ifdef _HAVE_PETSC_
+	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecSetValues(this->vector,1,&dof,&value,ISSMToPetscInsertMode(mode));
 	#else
-		_error_("not implemented yet!");
+		this->vector->SetValue(dof,value,mode);
 	#endif
 
@@ -185,23 +207,36 @@
 void Vector::GetValue(double* pvalue,int dof){
 		
-		
-	#ifdef _HAVE_PETSC_
-	VecGetValues(this->vector,1,&dof,pvalue);
-	#else
-		_error_("not implemented yet!");
-	#endif
-
-}
-/*}}}*/
-		
+	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
+		VecGetValues(this->vector,1,&dof,pvalue);
+	#else
+	this->vector->GetValue(pvalue,dof);
+	#endif
+}
+/*}}}*/
 /*FUNCTION Vector::GetSize{{{1*/
 void Vector::GetSize(int* pM){
 		
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecGetSize(this->vector,pM);
 	#else
-		_error_("not implemented yet!");
-	#endif
-
+		this->vector->GetSize(pM);
+	#endif
+
+}
+/*}}}*/
+/*FUNCTION Vector::IsEmpty{{{1*/
+bool Vector::IsEmpty(void){
+
+	int M;
+
+	_assert_(this->vector);
+	this->GetSize(&M);
+
+	if(M==0) 
+	 return true;
+	else
+	 return false;
 }
 /*}}}*/
@@ -210,7 +245,8 @@
 		
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecGetLocalSize(this->vector,pM);
 	#else
-		_error_("not implemented yet!");
+		this->vector->GetLocalSize(pM);
 	#endif
 
@@ -221,12 +257,13 @@
 	
 	Vector* output=NULL;
-	output=new Vector();
-	#ifdef _HAVE_PETSC_
+	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		Vec vec_output=NULL;
 		VecDuplicate(this->vector,&vec_output);
-		output->vector=vec_output;
-		VecGetSize(output->vector,&output->M);
-	#else
-		_error_("not implemented yet!");
+		output=new Vector(vec_output);
+		VecFree(&vec_output);
+	#else
+		output=new Vector();
+		output->vector=this->vector->Duplicate();
 	#endif
 	return output;
@@ -238,7 +275,8 @@
 	
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecSet(this->vector,value);
 	#else
-		_error_("not implemented yet!");
+		this->vector->Set(value);
 	#endif
 
@@ -249,7 +287,8 @@
 	
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecAXPY(this->vector,a,X->vector);
 	#else
-		_error_("not implemented yet!");
+		this->vector->AXPY(X->vector,a);
 	#endif
 }
@@ -259,7 +298,8 @@
 	
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecAYPX(this->vector,a,X->vector);
 	#else
-		_error_("not implemented yet!");
+		this->vector->AYPX(X->vector,a);
 	#endif
 
@@ -274,5 +314,5 @@
 		VecToMPISerial(&vec_serial, this->vector);
 	#else
-		_error_("not implemented yet!");
+		vec_serial=this->vector->ToMPISerial();
 	#endif
 
@@ -285,7 +325,7 @@
 
 	#ifdef _HAVE_PETSC_
-		VecCopy(this->vector,to->vector);
-	#else
-		_error_("not implemented yet!");
+		if(this->vector) VecCopy(this->vector,to->vector);
+	#else
+		this->vector->Copy(to->vector);
 	#endif
 
@@ -297,7 +337,8 @@
 	double norm=0;
 	#ifdef _HAVE_PETSC_
-	    VecNorm(this->vector,ISSMToPetscNormMode(norm_type),&norm);
-	#else
-		_error_("not implemented yet!");
+		_assert_(this->vector);
+		VecNorm(this->vector,ISSMToPetscNormMode(norm_type),&norm);
+	#else
+		norm=this->vector->Norm(norm_type);
 	#endif
 	return norm;
@@ -308,18 +349,20 @@
 	
 	#ifdef _HAVE_PETSC_
-	    VecScale(this->vector,scale_factor); 
-	#else
-		_error_("not implemented yet!");
-	#endif
-}
-/*}}}*/
-/*FUNCTION Vector::Scale{{{1*/
+		_assert_(this->vector);
+		VecScale(this->vector,scale_factor); 
+	#else
+		this->vector->Scale(scale_factor);
+	#endif
+}
+/*}}}*/
+/*FUNCTION Vector::Dot{{{1*/
 double Vector::Dot(Vector* vector){
 
 	double dot;
 	#ifdef _HAVE_PETSC_
-	    VecDot(this->vector,vector->vector,&dot);
-	#else
-		_error_("not implemented yet!");
+		_assert_(this->vector);
+		VecDot(this->vector,vector->vector,&dot);
+	#else
+		dot=this->vector->Dot(vector->vector);
 	#endif
 	return dot;
@@ -330,8 +373,9 @@
 
 	#ifdef _HAVE_PETSC_
+		_assert_(this->vector);
 		VecPointwiseDivide(this->vector,x->vector,y->vector);
 	#else
-		_error_("not implemented yet!");
-	#endif
-}
-/*}}}*/
+		this->vector->PointwiseDivide(x->vector,y->vector);
+	#endif
+}
+/*}}}*/
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Vector.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Vector.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Numerics/Vector.h	(revision 12004)
@@ -1,4 +1,4 @@
 /*!\file:  Vector.h
- * \brief wrapper to vector objects. The goal is to control which API (PETSC,Scalpack, Plapack?) 
+ * \brief wrapper to vector objects. The goal is to control which API (PETSc,Scalpack, Plapack?) 
  * implements our underlying vector format.
  */ 
@@ -21,5 +21,5 @@
 #endif
 		
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -31,13 +31,11 @@
 	public:
 	
-		int M;
-
 		#ifdef _HAVE_PETSC_
-		Vec vector; 
+			Vec vector; 
 		#else
-		double* vector; 
+			SeqVec* vector;
 		#endif
 		#ifdef _HAVE_ADOLC_
-		adouble* avector;
+			adouble* avector;
 		#endif
 
@@ -49,28 +47,38 @@
 		Vector(Vec petsc_vec);
 		#endif
+		#ifdef _HAVE_GSL_
+		Vector(SeqVec*  seq_vec);
+		#endif
 		~Vector();
 		/*}}}*/
 		/*Vector specific routines {{{1*/
 		void Echo(void);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		mxArray* ToMatlabVector(void);
 		#endif
-		void Assemble(void);
-		void SetValues(int ssize, int* list, double* values, InsMode mode);
-		void SetValue(int dof, double value, InsMode  mode);
-		void GetValue(double* pvalue, int dof);
-		void GetSize(int* pM);
-		void GetLocalSize(int* pM);
-		Vector* Duplicate(void);
-		void Set(double value);
-		void AXPY(Vector* X, double a);
-		void AYPX(Vector* X, double a);
-		double* ToMPISerial(void);
-		void Copy(Vector* to);
-		double Norm(NormMode norm_type);
-		void Scale(double scale_factor);
-		void PointwiseDivide(Vector* x,Vector* y);
-		double Dot(Vector* vector);
+		void    AXPY(Vector *X, double a);
+		void    AYPX(Vector *X, double a);
+		void    Assemble(void);
+		void    Copy(Vector *to);
+		double  Dot(Vector *vector);
+		Vector *Duplicate(void);
+		void    GetValue(double *pvalue, int dof);
+		void    GetSize(int *pM);
+		void    GetLocalSize(int *pM);
+		bool    IsEmpty(void);
+		double  Norm(NormMode norm_type);
+		void    PointwiseDivide(Vector  *x,Vector*y);
+		void    Scale(double scale_factor);
+		void    Set(double value);
+		void    SetValues(int ssize, int *list, double*values, InsMode mode);
+		void    SetValue(int dof, double value, InsMode mode);
+		double *ToMPISerial(void);
 		/*}}}*/
 };
+
+/*API: */
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+Vector* MatlabVectorToVector(const mxArray* mxvector);
+#endif
+
 #endif //#ifndef _VECTOR_H_
Index: /issm/branches/trunk-jpl-damage/src/c/objects/OptArgs.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/OptArgs.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/OptArgs.h	(revision 12004)
@@ -6,5 +6,5 @@
 #define _OPTARGS_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 #include "mex.h"
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/BoolParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/BoolParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/BoolParam.cpp	(revision 12004)
@@ -135,5 +135,5 @@
 /*}}}*/
 /*FUNCTION BoolParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  BoolParam::SetMatlabField(mxArray* dataref){
 	char* name=NULL;
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/BoolParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/BoolParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/BoolParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -81,5 +81,5 @@
 		
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatArrayParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatArrayParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatArrayParam.cpp	(revision 12004)
@@ -309,5 +309,5 @@
 /*}}}*/
 /*FUNCTION StringArrayParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleMatArrayParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatArrayParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatArrayParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatArrayParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -84,5 +84,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatParam.cpp	(revision 12004)
@@ -169,5 +169,5 @@
 /*FUNCTION DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
 void  DoubleMatParam::GetParameterValue(int** pintarray,int* pM,int* pN){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 	int  i;
@@ -191,5 +191,5 @@
 /*}}}*/
 /*FUNCTION DoubleMatParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleMatParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleMatParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -84,5 +84,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleParam.cpp	(revision 12004)
@@ -133,5 +133,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(int* pinteger){{{1*/
 void DoubleParam::GetParameterValue(int* pinteger){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	*pinteger=(int)value;
 #else
@@ -142,5 +142,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(bool* pbool){{{1*/
 void DoubleParam::GetParameterValue(bool* pbool){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 	/*If debugging mode, cheeck that the double is 0 or 1*/
@@ -155,5 +155,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM){{{1*/
 void DoubleParam::GetParameterValue(int** pintarray,int* pM){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 
@@ -171,5 +171,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){{{1*/
 void DoubleParam::GetParameterValue(int** pintarray,int* pM,int* pN){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 
@@ -188,5 +188,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM){{{1*/
 void DoubleParam::GetParameterValue(double** pdoublearray,int* pM){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	double* output=NULL;
 
@@ -204,5 +204,5 @@
 /*FUNCTION DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){{{1*/
 void DoubleParam::GetParameterValue(double** pdoublearray,int* pM,int* pN){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	double* output=NULL;
 
@@ -220,5 +220,5 @@
 /*}}}*/
 /*FUNCTION DoubleParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleTransientMatParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleTransientMatParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleTransientMatParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleVecParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleVecParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleVecParam.cpp	(revision 12004)
@@ -181,5 +181,5 @@
 /*FUNCTION DoubleVecParam::GetParameterValue(int** pintarray,int* pM){{{1*/
 void  DoubleVecParam::GetParameterValue(int** pintarray,int* pM){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 	int* output=NULL;
 	int i;
@@ -203,5 +203,5 @@
 /*}}}*/
 /*FUNCTION DoubleVecParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  DoubleVecParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleVecParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleVecParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/DoubleVecParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -82,5 +82,5 @@
 		
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/FileParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/FileParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/FileParam.cpp	(revision 12004)
@@ -102,5 +102,5 @@
 /*}}}*/
 /*FUNCTION FileParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  FileParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/FileParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/FileParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/FileParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -81,5 +81,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntMatParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntMatParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntMatParam.cpp	(revision 12004)
@@ -173,5 +173,5 @@
 /*}}}*/
 /*FUNCTION IntMatParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  IntMatParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntMatParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntMatParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntMatParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -83,5 +83,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntParam.cpp	(revision 12004)
@@ -135,5 +135,5 @@
 /*}}}*/
 /*FUNCTION IntParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  IntParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntVecParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntVecParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntVecParam.cpp	(revision 12004)
@@ -186,5 +186,5 @@
 /*}}}*/
 /*FUNCTION IntVecParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  IntVecParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntVecParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntVecParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/IntVecParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -83,5 +83,5 @@
 		
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/MatrixParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/MatrixParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/MatrixParam.cpp	(revision 12004)
@@ -191,5 +191,5 @@
 /*}}}*/
 /*FUNCTION MatrixParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  MatrixParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/MatrixParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/MatrixParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/MatrixParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/Param.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/Param.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/Param.h	(revision 12004)
@@ -16,5 +16,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -60,5 +60,5 @@
 		virtual void  UnitConversion(int direction_enum)=0;
 		virtual void  GetParameterName(char**pname)=0;
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		virtual void  SetMatlabField(mxArray* dataref)=0;
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringArrayParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringArrayParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringArrayParam.cpp	(revision 12004)
@@ -237,5 +237,5 @@
 /*}}}*/
 /*FUNCTION StringArrayParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  StringArrayParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringArrayParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringArrayParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringArrayParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -84,5 +84,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringParam.cpp	(revision 12004)
@@ -165,5 +165,5 @@
 /*}}}*/
 /*FUNCTION StringParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  StringParam::SetMatlabField(mxArray* dataref){
 	
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/StringParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/VectorParam.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/VectorParam.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/VectorParam.cpp	(revision 12004)
@@ -189,5 +189,5 @@
 /*}}}*/
 /*FUNCTION VectorParam::SetMatlabField{{{1*/
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 void  VectorParam::SetMatlabField(mxArray* dataref){
 
Index: /issm/branches/trunk-jpl-damage/src/c/objects/Params/VectorParam.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/Params/VectorParam.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/Params/VectorParam.h	(revision 12004)
@@ -15,5 +15,5 @@
 #endif
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -82,5 +82,5 @@
 
 		void GetParameterName(char**pname);
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		void  SetMatlabField(mxArray* dataref);
 		#endif
Index: /issm/branches/trunk-jpl-damage/src/c/objects/objects.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/objects/objects.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/objects/objects.h	(revision 12004)
@@ -30,4 +30,5 @@
 
 /*Loads: */
+#include "./Loads/Load.h"
 #include "./Loads/Friction.h"
 #include "./Loads/Icefront.h"
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Alloc/alloc.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Alloc/alloc.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Alloc/alloc.cpp	(revision 12004)
@@ -70,5 +70,5 @@
 
 	if (pv && *pv){
-		#ifdef _SERIAL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 			mxFree(*pv);
 		#else
@@ -91,5 +91,7 @@
 		/*Actually, still get rid of internal Petsc matrix. Quick fix until Matlab handles C++ 
 		 * correctly: */
-		MatFree(&(*pv)->matrix);
+		#ifdef _HAVE_PETSC_
+			MatFree(&(*pv)->matrix);
+		#endif
 		#endif
 		*pv=NULL;
@@ -108,5 +110,7 @@
 		/*Actually, still get rid of internal Petsc vector. Quick fix until Matlab handles C++ 
 		 * correctly: */
-		VecFree(&(*pv)->vector);
+		#ifdef _HAVE_PETSC_
+			VecFree(&(*pv)->vector);
+		#endif
 		#endif
 		*pv=NULL;
@@ -121,8 +125,8 @@
 	if(!size)_error_("attempting to realloc to zero");
 
-	#ifndef MATLAB
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+	value = (void*)mxRealloc(pv,size);
+	#else
 	value = (void*)realloc(pv,size);
-	#else
-	value = (void*)mxRealloc(pv,size);
 	#endif
 
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/Exceptions.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/Exceptions.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Exceptions/Exceptions.cpp	(revision 12004)
@@ -11,5 +11,5 @@
 #include "../shared.h"
 #include "../../include/include.h"
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 #endif
@@ -45,10 +45,10 @@
 	}
 	else{
-		#ifdef _PARALLEL_
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+			mexErrMsgTxt(exprintf("\n??? Error using ==> %s at %i\n%s error message: %s\n",
+							file_name.c_str(),file_line,function_name.c_str(),what()));
+		#else
 			printf("\n[%i] ??? Error using ==> %s:%i\n",my_rank,file_name.c_str(),file_line);
 			printf("[%i] %s error message: %s\n\n",my_rank,function_name.c_str(),what());
-		#else
-			mexErrMsgTxt(exprintf("\n??? Error using ==> %s at %i\n%s error message: %s\n",
-							file_name.c_str(),file_line,function_name.c_str(),what()));
 		#endif
 	}
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineRead.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineRead.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Exp/DomainOutlineRead.cpp	(revision 12004)
@@ -9,11 +9,12 @@
 #include "../Alloc/alloc.h"
 #include "../../include/include.h"
+#include "../../objects/objects.h"
 #include "../Exceptions/exceptions.h"
+#include "../../Container/DataSet.h"
 
 int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole=true){
 
 	
-	/*Error management: */
-	int noerr=1;
+	/*indexing: */
 	int i,counter;
 
@@ -39,5 +40,4 @@
 	if ((fid=fopen(domainname,"r"))==NULL){
 		_error_("%s%s","could not find domain file ",domainname); 
-		noerr=0; goto cleanupandreturn;
 	}
 
@@ -95,5 +95,5 @@
 		/*Read vertices: */
 		for (i=0;i<n;i++){
-			fscanf(fid,"%20lf %20lf\n",x+i,y+i);
+			fscanf(fid,"%20lf %20lf\n",&x[i],&y[i]);
 		}
 
@@ -117,12 +117,4 @@
 	fclose(fid);
 
-	cleanupandreturn: 
-	/*Free ressources: */
-	if(!noerr){
-		xfree((void**)&x);
-		xfree((void**)&y);
-		n=-1;
-	}
-	
 	/*Assign output pointers: */
 	*pnprof=nprof;
@@ -132,5 +124,32 @@
 	if(pclosed)*pclosed=closed;
 	else       xfree((void**)&closed);
-	return noerr;
 }
 
+DataSet* DomainOutlineRead(char* domainname,bool whole=true){
+
+	/*indexing: */
+	int i;
+
+	/*intermediary: */
+	int nprof;
+	int* profnvertices=NULL;
+	double** pprofx=NULL;
+	double** pprofy=NULL;
+
+	Contour* contour=NULL;
+
+	/*output: */
+	DataSet* domain=NULL;
+
+	/*get domain outline from intermediary function:*/
+	DomainOutlineRead(&nprof,&profnvertices,&pprofx, &pprofy, NULL,domainname,whole);
+
+	/*now create dataset of contours: */
+	domain=new DataSet(0);
+
+	for(i=0;i<nprof;i++){
+		domain->AddObject(new Contour(i,profnvertices[i],pprofx[i],pprofy[i],1));
+	}
+
+	return domain;
+}
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Exp/exp.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Exp/exp.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Exp/exp.h	(revision 12004)
@@ -7,4 +7,5 @@
 #define _EXP_H_
 
+#include "../../objects/objects.h"
 #include "../../toolkits/toolkits.h"
 
@@ -12,7 +13,10 @@
 int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue);
 int IsInPolySerial(double* in,double* xc,double* yc,int numvertices,double* x,double* y,int nods, int edgevalue);
-int DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole);
 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname,bool whole);
 int pnpoly(int npol, double *xp, double *yp, double x, double y, int edgevalue);
 
+int      DomainOutlineRead(int* pnprof,int** pprofnvertices,double*** ppprofx,double*** ppprofy,bool** pclosed,char* domainname,bool whole);
+DataSet* DomainOutlineRead(char* domainname,bool whole);
+
+
 #endif
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Matrix/MatrixUtils.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Matrix/MatrixUtils.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Matrix/MatrixUtils.cpp	(revision 12004)
@@ -8,5 +8,4 @@
 #include "../Exceptions/exceptions.h"
 #include "../Alloc/alloc.h"
-#include "../Matlab/matlabshared.h"
 #include <stdio.h>
 #include <sys/types.h>
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/GaussPoints.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/GaussPoints.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/GaussPoints.cpp	(revision 12004)
@@ -2,5 +2,4 @@
 
 #include "./GaussPoints.h"
-#include "../Matlab/matlabshared.h"
 #include "../Alloc/alloc.h"
 #include "../../include/include.h"
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptFunc.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptFunc.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptFunc.cpp	(revision 12004)
@@ -13,5 +13,5 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 double OptFunc(double scalar, OptArgs* optargs){
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptionsFromAnalysis.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptionsFromAnalysis.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/OptionsFromAnalysis.cpp	(revision 12004)
@@ -30,5 +30,5 @@
 	parameters->FindParam(&strings,&numanalyses,PetscOptionsStringsEnum);
 
-	#ifdef _SERIAL_ //do not take this away, because ISSM loads analyses as a Double Param instead of a DoubleVec Param  when running with only 1 analysis
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_) //do not take this away, because ISSM loads analyses as a Double Param instead of a DoubleVec Param  when running with only 1 analysis
 	if(numanalyses==1){ analyses=(double*)xmalloc(1*sizeof(double)); parameters->FindParam(analyses,PetscOptionsAnalysesEnum);
 	}
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/UnitConversion.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/UnitConversion.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/UnitConversion.cpp	(revision 12004)
@@ -47,29 +47,27 @@
 	double scale;
 	switch(type_enum){
-		case TimesteppingTimeStepEnum: scale=1.0/yts;break; //yr
-		case TimesteppingFinalTimeEnum:    scale=1.0/yts;break; //yr
-		case TimeEnum:        scale=1.0/yts;break; //yr
-		case HydrologyWaterVxEnum: scale=yts;break; //m/yr
-		case HydrologyWaterVyEnum: scale=yts;break; //m/yr
-		case VxEnum:          scale=yts;break; //m/yr
-		case InversionVxObsEnum:       scale=yts;break; //m/yr
-		case VyEnum:          scale=yts;break; //m/yr
-		case InversionVyObsEnum:       scale=yts;break; //m/yr
-		case VzEnum:          scale=yts;break; //m/yr
-		case InversionVzObsEnum:       scale=yts;break; //m/yr
-		case VelEnum:         scale=yts;break; //m/yr
-		case InversionVelObsEnum:      scale=yts;break; //m/yr
-		case BalancethicknessThickeningRateEnum:  scale=yts;break; //m/yr
-		case BasalforcingsMeltingRateEnum:        scale=yts;break; //m/yr
+		case TimesteppingStartTimeEnum:              scale=1.0/yts;break; //yr
+		case TimesteppingFinalTimeEnum:              scale=1.0/yts;break; //yr
+		case TimesteppingTimeStepEnum:               scale=1.0/yts;break; //yr
+		case TimeEnum:                               scale=1.0/yts;break; //yr
+		case HydrologyWaterVxEnum:                   scale=yts;break; //m/yr
+		case HydrologyWaterVyEnum:                   scale=yts;break; //m/yr
+		case VxEnum:                                 scale=yts;break; //m/yr
+		case InversionVxObsEnum:                     scale=yts;break; //m/yr
+		case VyEnum:                                 scale=yts;break; //m/yr
+		case InversionVyObsEnum:                     scale=yts;break; //m/yr
+		case VzEnum:                                 scale=yts;break; //m/yr
+		case InversionVzObsEnum:                     scale=yts;break; //m/yr
+		case VelEnum:                                scale=yts;break; //m/yr
+		case InversionVelObsEnum:                    scale=yts;break; //m/yr
+		case BalancethicknessThickeningRateEnum:     scale=yts;break; //m/yr
+		case BasalforcingsMeltingRateEnum:           scale=yts;break; //m/yr
 		case BasalforcingsMeltingRateCorrectionEnum: scale=yts;break; //m/yr
-		case SurfaceforcingsPrecipitationEnum:     scale=yts;break; //m/yr
-		case SurfaceforcingsMassBalanceEnum:      scale=yts;break; //m/yr
-		case MisfitEnum:      scale=pow(yts,2);break; //(m/yr)^2
-		case MassFluxEnum:    scale=pow((double)10,-12)*yts;break; // (GigaTon/year)
+		case SurfaceforcingsPrecipitationEnum:       scale=yts;break; //m/yr
+		case SurfaceforcingsMassBalanceEnum:         scale=yts;break; //m/yr
+		case MisfitEnum:                             scale=pow(yts,2);break; //(m/yr)^2
+		case MassFluxEnum:                           scale=pow((double)10,-12)*yts;break; // (GigaTon/year)
 		default: scale=1.0; break;
 	}
 	return scale;
 }
-
-
-
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/Verbosity.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/Verbosity.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/Verbosity.cpp	(revision 12004)
@@ -18,5 +18,5 @@
 #include "../../include/macros.h"
 #include "../Exceptions/exceptions.h"
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 #endif
@@ -39,5 +39,5 @@
 	if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 	mxArray* output=NULL;
@@ -54,5 +54,5 @@
 /*FUNCTION GetVerbosityLevel {{{*/
 int  GetVerbosityLevel(void){
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 	mxArray* output=NULL;
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/XZvectorsToCoordinateSystem.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/XZvectorsToCoordinateSystem.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Numerics/XZvectorsToCoordinateSystem.cpp	(revision 12004)
@@ -1,3 +1,3 @@
-#include "../Matlab/matlabshared.h"
+#include "../../io/Matlab/matlabio.h"
 #include "../Alloc/alloc.h"
 #include "../../include/include.h"
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/ModuleBoot.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/ModuleBoot.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/ModuleBoot.cpp	(revision 12004)
@@ -0,0 +1,59 @@
+/* \file ModuleBoot.cpp
+ * \brief Carry out operations needed to boot, for example, petsc, MPI, plapack, etc ... 
+ * at the beginning of a module
+ */
+
+#include "../../toolkits/toolkits.h"
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+
+int ModuleBoot(void){
+	
+	/*Some test for MPI_Init crash with mpich2 1.4 on larsen, just ignore*/
+	#ifdef _HAVE_PETSC_
+		#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 1
+		if(0){
+			int              mp_init = 0;
+			PetscErrorCode   ierr;
+			extern PetscBool PetscBeganMPI;
+			MPI_Initialized(&mp_init); 
+			if(mp_init!=1){
+				MPI_Init(NULL,NULL); 
+				PetscBeganMPI = PETSC_TRUE;
+				ierr=PetscInitializeNoArguments();CHKERRQ(ierr);
+			} 
+		}
+		else if (0){
+			PetscErrorCode   ierr;
+			PetscBool flg;
+			ierr=PetscInitialized(&flg);CHKERRQ(ierr);
+			if(flg){
+				extern PetscBool PetscBeganMPI;
+				PetscBeganMPI = PETSC_FALSE;
+				ierr=PetscFinalize();CHKERRQ(ierr);
+			}
+			ierr=PetscInitializeNoArguments();CHKERRQ(ierr);
+			ierr=PetscPopSignalHandler();CHKERRQ(ierr);
+		}
+		#endif
+
+		/*Initialize Petsc: */
+		PetscInitializeNoArguments();
+	#else
+		#ifdef _HAVE_MPI_
+		int mp_init = 0;
+		MPI_Initialized(&mp_init); 
+		if(!mp_init){
+			MPI_Init(NULL,NULL); 
+		}
+		#else
+		/*Do nothing*/
+		#endif
+	#endif
+	return 1;
+}
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/ModuleEnd.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/ModuleEnd.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/ModuleEnd.cpp	(revision 12004)
@@ -0,0 +1,31 @@
+/* \file ModuleBoot.cpp
+ * \brief Carry out operations needed to boot, for example, petsc, MPI, plapack, etc ... 
+ * at the beginning of a module
+ */
+
+#include "../../toolkits/toolkits.h"
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+int ModuleEnd(void){
+
+	#if _PETSC_MAJOR_ == 3 && _PETSC_MINOR_ < 1
+	if(0){
+		PetscBool        flg;
+		PetscErrorCode   ierr;
+		extern PetscBool PetscBeganMPI;
+
+		/*Close PETSc but do not close MPI*/
+		PetscBeganMPI = PETSC_FALSE;
+		ierr=PetscFinalize();CHKERRQ(ierr);
+	}
+	#else
+		/*Do nothing*/
+	#endif
+
+	return 1;
+}
Index: /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/wrappershared.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/wrappershared.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/Wrapper/wrappershared.h	(revision 12004)
@@ -0,0 +1,15 @@
+/* \file Wrapper.h
+ * \brief  header file for all routines related to wrapper.
+ */
+
+#ifndef _WRAPPER_SHARED_H_
+#define _WRAPPER_SHARED_H_
+
+#include "../../objects/objects.h"
+
+#ifdef _SERIAL_
+int ModuleBoot(void);
+int ModuleEnd(void);
+#endif
+
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/shared/shared.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/shared/shared.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/shared/shared.h	(revision 12004)
@@ -18,5 +18,5 @@
 #include "Threads/issm_threads.h"
 #include "Bamg/shared.h"
-#include "Matlab/matlabshared.h"
+#include "Wrapper/wrappershared.h"
 
 #endif
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/adjointbalancethickness_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/adjointbalancethickness_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/adjointbalancethickness_core.cpp	(revision 12004)
@@ -16,10 +16,8 @@
 	
 	/*parameters: */
-	bool control_analysis;
-	int  solution_type;
+	bool save_results;
 
 	/*retrieve parameters:*/
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	/*compute thickness */
@@ -37,5 +35,5 @@
 	
 	/*Save results*/
-	if(solution_type==AdjointSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"   saving results\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/adjointdiagnostic_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/adjointdiagnostic_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/adjointdiagnostic_core.cpp	(revision 12004)
@@ -17,12 +17,10 @@
 	/*parameters: */
 	bool isstokes;
-	bool control_analysis;
+	bool save_results;
 	bool conserve_loads   = true;
-	int  solution_type;
 
 	/*retrieve parameters:*/
 	femmodel->parameters->FindParam(&isstokes,FlowequationIsstokesEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	/*Compute velocities*/
@@ -40,5 +38,5 @@
 	
 	/*Save results*/
-	if(solution_type==AdjointSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"   saving results\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,AdjointxEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/balancethickness_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/balancethickness_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/balancethickness_core.cpp	(revision 12004)
@@ -16,7 +16,5 @@
 
 	/*parameters: */
-	int  dim;
-	int  solution_type;
-	bool control_analysis;
+	bool save_results;
 
 	/*activate formulation: */
@@ -24,12 +22,10 @@
 	
 	/*recover parameters: */
-	femmodel->parameters->FindParam(&dim,MeshDimensionEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	_printf_(VerboseSolution(),"call computational core:\n");
 	solver_linear(femmodel);
 
-	if(solution_type==BalancethicknessSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"   saving results\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/bedslope_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/bedslope_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/bedslope_core.cpp	(revision 12004)
@@ -14,14 +14,8 @@
 
 	/*parameters: */
-	int  dim;
-	bool isstokes;
-	bool ishutter;
-	bool control_analysis;
-	int  solution_type;
+	bool save_results;
 
 	/*Recover some parameters: */
-	femmodel->parameters->FindParam(&dim,MeshDimensionEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	_printf_(VerboseSolution(),"%s\n","   computing slope");
@@ -33,5 +27,5 @@
 	solver_linear(femmodel);
 	
-	if(solution_type==BedSlopeSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"   saving results\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedSlopeXEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/control_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/control_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/control_core.cpp	(revision 12004)
@@ -59,4 +59,5 @@
 	femmodel->parameters->FindParam(&isstokes,FlowequationIsstokesEnum);
 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+	femmodel->parameters->SetParam(false,SaveResultsEnum);
 
 	/*out of solution_type, figure out solution core and adjoint function pointer*/
@@ -66,5 +67,5 @@
 	/*Launch once a complete solution to set up all inputs*/
 	_printf_(VerboseControl(),"%s\n","   preparing initial solution");
-	if (isstokes) solutioncore(femmodel);
+	if(isstokes) solutioncore(femmodel);
 
 	/*Initialize responses: */
@@ -99,5 +100,5 @@
 		_printf_(VerboseControl(),"%s\n","   optimizing along gradient direction");
 		optpars.maxiter=(int)maxiter[n]; optpars.cm_jump=cm_jump[n];
-		BrentSearch(&search_scalar,J+n,&optpars,&objectivefunctionC,&optargs);
+		BrentSearch(&search_scalar,J+n,&optpars,&objectivefunction,&optargs);
 
 		_printf_(VerboseControl(),"%s\n","   updating parameter using optimized search scalar"); //true means update save controls
@@ -108,5 +109,5 @@
 
 	_printf_(VerboseControl(),"%s\n","   preparing final solution");
-	femmodel->parameters->SetParam(false,InversionIscontrolEnum); //needed to turn control result output in solutioncore
+	femmodel->parameters->SetParam(true,SaveResultsEnum);
 	solutioncore(femmodel);
 
@@ -125,6 +126,3 @@
 	xfree((void**)&cm_jump);
 	xfree((void**)&J);
-	
-	/*control_core might be used in Qmu, so leave everything similar to where it started: */
-	femmodel->parameters->SetParam(true,InversionIscontrolEnum);
 }
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/controlrestart.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/controlrestart.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/controlrestart.cpp	(revision 12004)
@@ -29,5 +29,5 @@
 
 		/*write to disk: */
-		OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results);
+		OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
 	}
 
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/controltao_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/controltao_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/controltao_core.cpp	(revision 12004)
@@ -49,4 +49,5 @@
 	femmodel->parameters->FindParam(&nsteps,InversionNstepsEnum);
 	femmodel->parameters->FindParam(&dummy,NULL,NULL,InversionMaxiterPerStepEnum);
+	femmodel->parameters->SetParam(false,SaveResultsEnum);
 	maxiter=nsteps*(int)dummy[0]; xfree((void**)&dummy);
 
@@ -88,5 +89,5 @@
 	/*Finalize*/
 	_printf_(VerboseControl(),"%s\n","   preparing final solution");
-	femmodel->parameters->SetParam(false,InversionIscontrolEnum); //needed to turn control result output in solutioncore
+	femmodel->parameters->SetParam(true,SaveResultsEnum);
 	void (*solutioncore)(FemModel*)=NULL;
 	CorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/convergence.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/convergence.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/convergence.cpp	(revision 12004)
@@ -33,5 +33,5 @@
 	/*If uf is NULL in input, f-set is nil, model is fully constrained, therefore converged from 
 	 * the get go: */
-	if(!uf){
+	if(uf->IsEmpty()){
 		*pconverged=true;
 		return;
@@ -58,6 +58,6 @@
 
 		//clean up
-		delete KU;
-		delete KUF;
+		xdelete(&KU);
+		xdelete(&KUF);
 	}
 
@@ -76,6 +76,6 @@
 
 	//clean up
-	delete KUold;
-	delete KUoldF;
+	xdelete(&KUold);
+	xdelete(&KUoldF);
 
 	//print
@@ -99,5 +99,5 @@
 
 		//clean up
-		delete duf;
+		xdelete(&duf);
 
 		//print
@@ -124,5 +124,5 @@
 
 		//clean up
-		delete duf;
+		xdelete(&duf);
 
 		//print
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/diagnostic_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/diagnostic_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/diagnostic_core.cpp	(revision 12004)
@@ -24,5 +24,5 @@
 	bool  conserve_loads    = true;
 	bool  modify_loads      = true;
-	bool  control_analysis;
+	bool  save_results;
 	int   solution_type;
 	int   numoutputs        = 0;
@@ -36,5 +36,5 @@
 	femmodel->parameters->FindParam(&isnewton,DiagnosticIsnewtonEnum);
 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
 	femmodel->parameters->FindParam(&numoutputs,DiagnosticNumRequestedOutputsEnum);
@@ -94,5 +94,5 @@
 
 
-	if(solution_type==DiagnosticSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"   saving results\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/enthalpy_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/enthalpy_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/enthalpy_core.cpp	(revision 12004)
@@ -15,44 +15,22 @@
 void enthalpy_core(FemModel* femmodel){
 
-	int i;
-
 	/*intermediary*/
-	double time;
-	int    nsteps;
-	double final_time;
-	double dt;
-	double melting_offset;
-	bool control_analysis;
-	int solution_type;
+	bool   save_results;
 
 	//first recover parameters common to all solutions
-	femmodel->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);
-	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
-	/*Compute number of time steps: */
-	if((dt==0)|| (final_time==0)){
-		dt=0;
-		nsteps=1;
-	}
-	else nsteps=(int)(final_time/dt);
+	_printf_(VerboseSolution(),"   computing enthalpy\n");
+	femmodel->SetCurrentConfiguration(EnthalpyAnalysisEnum);
+	solver_nonlinear(femmodel,true);
 
-	/*Loop through time: */
-	for(i=0;i<nsteps;i++){
-		
-		if(nsteps)_printf_(VerboseSolution(),"time step: %i/%i\n",i+1,nsteps);
-		time=(i+1)*dt;
+	/*transfer enthalpy to enthalpy picard for the next step: */
+	InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnthalpyEnum,EnthalpyPicardEnum);
 
-		/*call enthalpy_core_step: */
-		enthalpy_core_step(femmodel,i,time);
-
-		if(solution_type==EnthalpySolutionEnum && !control_analysis){
-			_printf_(VerboseSolution(),"   saving results\n");
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,i+1,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnthalpyEnum,i+1,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WaterfractionEnum,i+1,time);
-		}
-
+	if(save_results){
+		_printf_(VerboseSolution(),"   saving results\n");
+		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum);
+		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnthalpyEnum);
+		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WaterfractionEnum);
 	}
 }
Index: sm/branches/trunk-jpl-damage/src/c/solutions/enthalpy_core_step.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/enthalpy_core_step.cpp	(revision 12003)
+++ 	(revision )
@@ -1,26 +1,0 @@
-/*!\file: enthalpy_core_step.cpp
- * \brief: core of the enthalpy solution 
- */ 
-
-#include "../toolkits/toolkits.h"
-#include "../objects/objects.h"
-#include "../shared/shared.h"
-#include "../io/io.h"
-#include "../EnumDefinitions/EnumDefinitions.h"
-#include "./solutions.h"
-#include "../modules/modules.h"
-#include "../include/include.h"
-#include "../solvers/solvers.h"
-
-void enthalpy_core_step(FemModel* femmodel,int step, double time){
-	
-	bool modify_loads=true;
-
-	_printf_(VerboseSolution(),"   computing enthalpy\n");
-	femmodel->SetCurrentConfiguration(EnthalpyAnalysisEnum);
-	solver_nonlinear(femmodel,modify_loads);
-
-	/*transfer enthalpy to enthalpy picard for the next step: */
-	InputDuplicatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnthalpyEnum,EnthalpyPicardEnum);
-
-}
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/hydrology_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/hydrology_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/hydrology_core.cpp	(revision 12004)
@@ -19,15 +19,14 @@
 	double time;
 	int    nsteps;
-	double final_time;
+	double starttime,final_time;
 	double dt;
-	bool control_analysis;
-	int solution_type;
-	int output_frequency;
+	bool   save_results;
+	int    output_frequency;
 
 	//first recover parameters common to all solutions
+	femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
 	femmodel->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);
 	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 	femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum);
 	/*first compute slopes: */
@@ -40,5 +39,6 @@
 		nsteps=1;
 	}
-	else nsteps=(int)(final_time/dt);
+	else nsteps=(int)((final_time-starttime)/dt);
+	time=starttime;
 
 	/*Loop through time: */
@@ -46,5 +46,5 @@
 		
 		if(nsteps)_printf_(VerboseSolution(),"time step:%i/%i\n",i+1,nsteps);
-		time=(i+1)*dt;
+		time+=dt;
 		femmodel->parameters->SetParam(time,TimeEnum);
 
@@ -52,17 +52,14 @@
 		hydrology_core_step(femmodel,i,time);
 
-		if(solution_type==HydrologySolutionEnum && !control_analysis && ((i+1)%output_frequency==0 || (i+1)==nsteps)){
-			
+		if(save_results && ((i+1)%output_frequency==0 || (i+1)==nsteps)){
 			_printf_(VerboseSolution(),"   saving results \n");
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WatercolumnEnum,i+1,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVxEnum,i+1,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVyEnum,i+1,time);
+			//InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WatercolumnEnum,i+1,time);
+			//InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVxEnum,i+1,time);
+			//InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,HydrologyWaterVyEnum,i+1,time);
 			
 			/*unload results*/
 			_printf_(VerboseSolution(),"   saving temporary results\n");
-			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results);
-
+			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
 		}
-
 	}
 }
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/issm.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/issm.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/issm.cpp	(revision 12004)
@@ -7,8 +7,4 @@
 
 int main(int argc,char **argv){
-
-	/*MPI: */
-	extern int my_rank;
-	extern int num_procs;
 
 	/*I/O: */
@@ -41,5 +37,5 @@
 	MODULEBOOT();
 
-	#if !defined(_PARALLEL_) || (defined(_PARALLEL_) && !defined(_HAVE_PETSC_))
+	#ifndef _PARALLEL_
 	_error_(" parallel executable was compiled without support of parallel libraries!");
 	#endif
@@ -60,5 +56,8 @@
 
 	/*First process inputs*/
-	_printf_(true,"Launching solution sequence\n");
+	_printf_(true,"\n");
+	_printf_(true,"Ice Sheet System Model (%s) version %s\n",PACKAGE_NAME,PACKAGE_VERSION);
+	_printf_(true,"(website: %s contact: %s)\n",PACKAGE_URL,PACKAGE_BUGREPORT);
+	_printf_(true,"\n");
 	ProcessArguments(&solution_type,&binfilename,&outbinfilename,&petscfilename,&lockfilename,argc,argv);
 
@@ -114,5 +113,5 @@
 
 	_printf_(true,"write results to disk:\n");
-	OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results);
+	OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
 
 	/*Close output and petsc options file and write lock file if requested*/
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/objectivefunction.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/objectivefunction.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/objectivefunction.cpp	(revision 12004)
@@ -0,0 +1,76 @@
+/*!\file:  objectivefunction
+ * \brief  objective function that returns a misfit, for a certain parameter.
+ */ 
+
+/*include files: {{{1*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "../toolkits/toolkits.h"
+#include "../objects/objects.h"
+#include "../shared/shared.h"
+#include "../EnumDefinitions/EnumDefinitions.h"
+#include "../solvers/solvers.h"
+#include "./solutions.h"
+#include "../modules/modules.h"
+#include "../include/include.h"
+/*}}}*/
+
+double objectivefunction(double search_scalar,OptArgs* optargs){
+
+	int i;  
+	
+	/*output: */
+	double J;
+	
+	/*parameters: */
+	int        solution_type,analysis_type;
+	bool       isstokes       = false;
+	bool       conserve_loads = true;
+	FemModel  *femmodel       = NULL;
+
+	/*Recover finite element model: */
+	femmodel=optargs->femmodel;
+
+	/*Recover parameters: */
+	femmodel->parameters->FindParam(&isstokes,FlowequationIsstokesEnum);
+	femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+
+	/*set analysis type to compute velocity: */
+	if (solution_type==SteadystateSolutionEnum || solution_type==DiagnosticSolutionEnum){
+		femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum);
+	}
+	else if (solution_type==BalancethicknessSolutionEnum){
+		femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
+	}
+	else{
+		_error_("Solution %s not implemented yet",EnumToStringx(solution_type));
+	}
+
+	/*update parameter according to scalar: */ //false means: do not save control
+	InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,false);
+
+	/*Run diagnostic with updated inputs: */
+	if (solution_type==SteadystateSolutionEnum){
+		diagnostic_core(femmodel);	//We need a 3D velocity!! (vz is required for the next thermal run)
+	}
+	else if (solution_type==DiagnosticSolutionEnum){
+		solver_nonlinear(femmodel,conserve_loads); 
+	}
+	else if (solution_type==BalancethicknessSolutionEnum){
+		solver_linear(femmodel); 
+	}
+	else{
+		_error_("Solution %s not implemented yet",EnumToStringx(solution_type));
+	}
+
+	/*Compute misfit for this velocity field.*/
+	CostFunctionx(&J, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters);
+
+	/*Free ressources:*/
+	return J;
+}
Index: sm/branches/trunk-jpl-damage/src/c/solutions/objectivefunctionC.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/objectivefunctionC.cpp	(revision 12003)
+++ 	(revision )
@@ -1,76 +1,0 @@
-/*!\file:  objectivefunctionC
- * \brief  objective function that returns a misfit, for a certain parameter.
- */ 
-
-/*include files: {{{1*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include "../toolkits/toolkits.h"
-#include "../objects/objects.h"
-#include "../shared/shared.h"
-#include "../EnumDefinitions/EnumDefinitions.h"
-#include "../solvers/solvers.h"
-#include "./solutions.h"
-#include "../modules/modules.h"
-#include "../include/include.h"
-/*}}}*/
-
-double objectivefunctionC(double search_scalar,OptArgs* optargs){
-
-	int i;  
-	
-	/*output: */
-	double J;
-	
-	/*parameters: */
-	int        solution_type,analysis_type;
-	bool       isstokes       = false;
-	bool       conserve_loads = true;
-	FemModel  *femmodel       = NULL;
-
-	/*Recover finite element model: */
-	femmodel=optargs->femmodel;
-
-	/*Recover parameters: */
-	femmodel->parameters->FindParam(&isstokes,FlowequationIsstokesEnum);
-	femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
-
-	/*set analysis type to compute velocity: */
-	if (solution_type==SteadystateSolutionEnum || solution_type==DiagnosticSolutionEnum){
-		femmodel->SetCurrentConfiguration(DiagnosticHorizAnalysisEnum);
-	}
-	else if (solution_type==BalancethicknessSolutionEnum){
-		femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
-	}
-	else{
-		_error_("Solution %s not implemented yet",EnumToStringx(solution_type));
-	}
-
-	/*update parameter according to scalar: */ //false means: do not save control
-	InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,false);
-
-	/*Run diagnostic with updated inputs: */
-	if (solution_type==SteadystateSolutionEnum){
-		diagnostic_core(femmodel);	//We need a 3D velocity!! (vz is required for the next thermal run)
-	}
-	else if (solution_type==DiagnosticSolutionEnum){
-		solver_nonlinear(femmodel,conserve_loads); 
-	}
-	else if (solution_type==BalancethicknessSolutionEnum){
-		solver_linear(femmodel); 
-	}
-	else{
-		_error_("Solution %s not implemented yet",EnumToStringx(solution_type));
-	}
-
-	/*Compute misfit for this velocity field.*/
-	CostFunctionx(&J, femmodel->elements,femmodel->nodes, femmodel->vertices,femmodel->loads, femmodel->materials, femmodel->parameters);
-
-	/*Free ressources:*/
-	return J;
-}
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/prognostic_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/prognostic_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/prognostic_core.cpp	(revision 12004)
@@ -15,6 +15,5 @@
 
 	/*parameters: */
-	int solution_type;
-	bool control_analysis;
+	bool save_results;
 
 	/*activate formulation: */
@@ -22,15 +21,12 @@
 	
 	/*recover parameters: */
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	_printf_(VerboseSolution(),"   call computational core\n");
 	solver_linear(femmodel);
 		
-	if(solution_type==PrognosticSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"   saving results\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum);
 	}
-	
 }
-
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/solutions.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/solutions.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/solutions.h	(revision 12004)
@@ -20,7 +20,5 @@
 void hydrology_core_step(FemModel* femmodel,int step, double time);
 void thermal_core(FemModel* femmodel);
-void thermal_core_step(FemModel* femmodel,int step, double time);
 void enthalpy_core(FemModel* femmodel);
-void enthalpy_core_step(FemModel* femmodel,int step, double time);
 void surfaceslope_core(FemModel* femmodel);
 void bedslope_core(FemModel* femmodel);
@@ -32,5 +30,5 @@
 void steadystate_core(FemModel* femmodel);
 void transient_core(FemModel* femmodel);
-double objectivefunctionC(double search_scalar,OptArgs* optargs);
+double objectivefunction(double search_scalar,OptArgs* optargs);
 
 //convergence:
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/steadystate_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/steadystate_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/steadystate_core.cpp	(revision 12004)
@@ -25,7 +25,5 @@
 
 	/*parameters: */
-	bool control_analysis,isenthalpy;
-	int  dim;
-	int  solution_type;
+	bool save_results,isenthalpy;
 	int  maxiter;
 	int  numoutputs         = 0;
@@ -33,10 +31,9 @@
 	
 	/* recover parameters:*/
-	femmodel->parameters->FindParam(&dim,MeshDimensionEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 	femmodel->parameters->FindParam(&maxiter,SteadystateMaxiterEnum);
 	femmodel->parameters->FindParam(&numoutputs,SteadystateNumRequestedOutputsEnum);
 	femmodel->parameters->FindParam(&isenthalpy,ThermalIsenthalpyEnum);
+	femmodel->parameters->SetParam(false,SaveResultsEnum);
 	if(numoutputs) femmodel->parameters->FindParam(&requested_outputs,&numoutputs,SteadystateRequestedOutputsEnum);
 
@@ -81,5 +78,5 @@
 	}
 	
-	if(solution_type==SteadystateSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"   saving results\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/surfaceslope_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/surfaceslope_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/surfaceslope_core.cpp	(revision 12004)
@@ -14,14 +14,8 @@
 
 	/*parameters: */
-	int dim;
-	bool isstokes;
-	bool ishutter;
-	bool control_analysis;
-	int solution_type;
+	bool save_results;
 
 	/*Recover some parameters: */
-	femmodel->parameters->FindParam(&dim,MeshDimensionEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 
 	_printf_(VerboseSolution(),"%s\n","computing slope...");
@@ -33,5 +27,5 @@
 	solver_linear(femmodel);
 	
-	if(solution_type==SurfaceSlopeSolutionEnum && !control_analysis){
+	if(save_results){
 		_printf_(VerboseSolution(),"saving results:\n");
 		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceSlopeXEnum);
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/thermal_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/thermal_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/thermal_core.cpp	(revision 12004)
@@ -15,29 +15,12 @@
 void thermal_core(FemModel* femmodel){
 
-	int i;
-
 	/*intermediary*/
-	double time;
-	int    nsteps;
-	double final_time;
-	double dt;
 	double melting_offset;
-	bool control_analysis;
-	int solution_type;
-	bool   dakota_analysis         = false;
+	bool   save_results;
+	bool   dakota_analysis  = false;
 
 	//first recover parameters common to all solutions
-	femmodel->parameters->FindParam(&final_time,TimesteppingFinalTimeEnum);
-	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
-
-	/*Compute number of time steps: */
-	if((dt==0)|| (final_time==0)){
-		dt=0;
-		nsteps=1;
-	}
-	else nsteps=(int)(final_time/dt);
 
 	if(dakota_analysis){
@@ -46,20 +29,16 @@
 	}
 
-	/*Loop through time: */
-	for(i=0;i<nsteps;i++){
-		
-		if(nsteps)_printf_(VerboseSolution(),"time step: %i/%i\n",i+1,nsteps);
-		time=(i+1)*dt;
-		femmodel->parameters->SetParam(time,TimeEnum);
+	_printf_(VerboseSolution(),"   computing temperatures\n");
+	femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);
+	solver_thermal_nonlinear(femmodel);
 
-		/*call thermal_core_step: */
-		thermal_core_step(femmodel,i,time);
+	_printf_(VerboseSolution(),"   computing melting\n");
+	femmodel->SetCurrentConfiguration(MeltingAnalysisEnum);
+	solver_linear(femmodel);
 
-		if(solution_type==ThermalSolutionEnum && !control_analysis){
-			_printf_(VerboseSolution(),"   saving results\n");
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,i+1,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BasalforcingsMeltingRateEnum,i+1,time);
-		}
-
+	if(save_results){
+		_printf_(VerboseSolution(),"   saving results\n");
+		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum);
+		InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BasalforcingsMeltingRateEnum);
 	}
 }
Index: sm/branches/trunk-jpl-damage/src/c/solutions/thermal_core_step.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/thermal_core_step.cpp	(revision 12003)
+++ 	(revision )
@@ -1,24 +1,0 @@
-/*!\file: thermal_core_step.cpp
- * \brief: core of the thermal solution 
- */ 
-
-#include "../toolkits/toolkits.h"
-#include "../objects/objects.h"
-#include "../shared/shared.h"
-#include "../io/io.h"
-#include "../EnumDefinitions/EnumDefinitions.h"
-#include "./solutions.h"
-#include "../modules/modules.h"
-#include "../include/include.h"
-#include "../solvers/solvers.h"
-
-void thermal_core_step(FemModel* femmodel,int step, double time){
-
-	_printf_(VerboseSolution(),"   computing temperatures\n");
-	femmodel->SetCurrentConfiguration(ThermalAnalysisEnum);
-	solver_thermal_nonlinear(femmodel);
-
-	_printf_(VerboseSolution(),"   computing melting\n");
-	femmodel->SetCurrentConfiguration(MeltingAnalysisEnum);
-	solver_linear(femmodel);
-}
Index: /issm/branches/trunk-jpl-damage/src/c/solutions/transient_core.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/solutions/transient_core.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/solutions/transient_core.cpp	(revision 12004)
@@ -23,9 +23,8 @@
 
 	/*parameters: */
-	double finaltime,dt,yts;
-	bool   control_analysis,isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy;
-	bool   dakota_analysis=false;
+	double starttime,finaltime,dt,yts;
+	bool   isdiagnostic,isprognostic,isthermal,isgroundingline,isenthalpy;
+	bool   save_results,dakota_analysis;
 	bool   time_adapt=false;
-	int    solution_type;
 	int    output_frequency;
 	int    dim,groundingline_migration;
@@ -39,10 +38,9 @@
 	//first recover parameters common to all solutions
 	femmodel->parameters->FindParam(&dim,MeshDimensionEnum);
+	femmodel->parameters->FindParam(&starttime,TimesteppingStartTimeEnum);
 	femmodel->parameters->FindParam(&finaltime,TimesteppingFinalTimeEnum);
 	femmodel->parameters->FindParam(&dt,TimesteppingTimeStepEnum);
 	femmodel->parameters->FindParam(&yts,ConstantsYtsEnum);
-	femmodel->parameters->FindParam(&control_analysis,InversionIscontrolEnum);
 	femmodel->parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
 	femmodel->parameters->FindParam(&output_frequency,SettingsOutputFrequencyEnum);
 	femmodel->parameters->FindParam(&time_adapt,TimesteppingTimeAdaptEnum);
@@ -58,5 +56,5 @@
 	/*initialize: */
 	step=0;
-	time=0;
+	time=starttime;
 
 	/*for qmu analysis, reinitialize velocity so that fake sensitivities do not show up as a result of a different restart of the convergence at each trial.*/
@@ -86,15 +84,21 @@
 		time+=dt;
 		femmodel->parameters->SetParam(time,TimeEnum);
+		femmodel->parameters->SetParam(step,StepEnum);
 
 		_printf_(VerboseSolution(),"iteration %i/%g  time [yr]: %-7.3g (time step: %.2g)\n",step,floor((finaltime-time)/dt)+step,time/yts,dt/yts);
+		if(step%output_frequency==0 || time==finaltime)
+		 save_results=true;
+		else
+		 save_results=false;
+		femmodel->parameters->SetParam(save_results,SaveResultsEnum);
 
 		if(isthermal && dim==3){
-			_printf_(VerboseSolution(),"   computing temperatures:\n");
+			_printf_(VerboseSolution(),"   computing temperatures\n");
 			#ifdef _HAVE_THERMAL_
 			if(isenthalpy==0){
-				thermal_core_step(femmodel,step,time);
+				thermal_core(femmodel);
 			}
 			else{
-				enthalpy_core_step(femmodel,step,time);
+				enthalpy_core(femmodel);
 			}
 			#else
@@ -128,27 +132,15 @@
 		}
 
-		//save should be done by the analysis... see control_core
-		if(solution_type==TransientSolutionEnum && !control_analysis && (step%output_frequency==0 || time==finaltime)){
-			_printf_(VerboseSolution(),"   saving results\n");
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VzMeshEnum,step,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VxEnum,step,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VyEnum,step,time);
-			if(dim==3) InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VzEnum,step,time);
-			if(isdiagnostic)InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,VelEnum,step,time);
-			if(isdiagnostic)InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,PressureEnum,step,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,ThicknessEnum,step,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceEnum,step,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum,step,time);
-			if(dim==3 && isthermal) InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,TemperatureEnum,step,time);
-			if(isenthalpy) InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,WaterfractionEnum,step,time);
-			if(isenthalpy) InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,EnthalpyEnum,step,time);
-			if(!isenthalpy) InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BasalforcingsMeltingRateEnum,step,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceforcingsMassBalanceEnum,step,time);
-			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,MaskElementonfloatingiceEnum,step,time);
-			RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs,step,time);
+		/*unload results*/
+		if(save_results){
+			_printf_(VerboseSolution(),"   saving transient results\n");
+			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceEnum);
+			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,BedEnum);
+			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,SurfaceforcingsMassBalanceEnum);
+			InputToResultx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,MaskElementonfloatingiceEnum);
+			RequestedOutputsx(femmodel->results,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,requested_outputs,numoutputs);
 
-			/*unload results*/
 			_printf_(VerboseSolution(),"   saving temporary results\n");
-			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,&femmodel->results);
+			OutputResultsx(femmodel->elements, femmodel->nodes, femmodel->vertices, femmodel->loads, femmodel->materials, femmodel->parameters,femmodel->results);
 		}
 	}
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/double/MatlabMatrixToDoubleMatrix.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/double/MatlabMatrixToDoubleMatrix.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/double/MatlabMatrixToDoubleMatrix.cpp	(revision 12004)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Matlab includes: */
@@ -38,16 +38,19 @@
 		rows=mxGetM(mxmatrix);
 		cols=mxGetN(mxmatrix);
-		matrix=(double*)xcalloc(rows*cols,sizeof(double));
+		
+		if(rows*cols){
+			matrix=(double*)xcalloc(rows*cols,sizeof(double));
 
-		/*Now, get ir,jc and pr: */
-		ir=mxGetIr(mxmatrix);
-		jc=mxGetJc(mxmatrix);
+			/*Now, get ir,jc and pr: */
+			ir=mxGetIr(mxmatrix);
+			jc=mxGetJc(mxmatrix);
 
-		/*Now, start inserting data into double* matrix: */
-		count=0;
-		for(i=0;i<cols;i++){
-			for(j=0;j<(jc[i+1]-jc[i]);j++){
-				matrix[rows*ir[count]+i]=pmxdoublematrix[count];
-				count++;
+			/*Now, start inserting data into double* matrix: */
+			count=0;
+			for(i=0;i<cols;i++){
+				for(j=0;j<(jc[i+1]-jc[i]);j++){
+					matrix[rows*ir[count]+i]=pmxdoublematrix[count];
+					count++;
+				}
 			}
 		}
@@ -61,9 +64,11 @@
 		
 		/*Create serial matrix: */
-		matrix=(double*)xcalloc(rows*cols,sizeof(double));
+		if(rows*cols){
+			matrix=(double*)xcalloc(rows*cols,sizeof(double));
 
-		for(i=0;i<rows;i++){
-			for(j=0;j<cols;j++){
-				matrix[cols*i+j]=(double)pmxdoublematrix[rows*j+i];
+			for(i=0;i<rows;i++){
+				for(j=0;j<cols;j++){
+					matrix[cols*i+j]=(double)pmxdoublematrix[rows*j+i];
+				}
 			}
 		}
@@ -76,9 +81,11 @@
 
 		/*Create serial matrix: */
-		matrix=(double*)xcalloc(rows*cols,sizeof(double));
+		if(rows*cols){
+			matrix=(double*)xcalloc(rows*cols,sizeof(double));
 
-		for(i=0;i<rows;i++){
-			for(j=0;j<cols;j++){
-				matrix[cols*i+j]=(double)pmxsinglematrix[rows*j+i];
+			for(i=0;i<rows;i++){
+				for(j=0;j<cols;j++){
+					matrix[cols*i+j]=(double)pmxsinglematrix[rows*j+i];
+				}
 			}
 		}
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/double/MatlabVectorToDoubleVector.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/double/MatlabVectorToDoubleVector.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/double/MatlabVectorToDoubleVector.cpp	(revision 12004)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 #include <string.h>
@@ -52,17 +52,19 @@
 		nz=(int)((double)nnz/(double)rows);
 
-		vector=(double*)xcalloc(rows,sizeof(double));
+		if(rows){
+			vector=(double*)xcalloc(rows,sizeof(double));
 
-		/*Now, get ir,jc and pr: */
-		pr=mxGetPr(mxvector);
-		ir=mxGetIr(mxvector);
-		jc=mxGetJc(mxvector);
+			/*Now, get ir,jc and pr: */
+			pr=mxGetPr(mxvector);
+			ir=mxGetIr(mxvector);
+			jc=mxGetJc(mxvector);
 
-		/*Now, start inserting data into sparse vector: */
-		count=0;
-		for(i=0;i<cols;i++){
-			for(j=0;j<(jc[i+1]-jc[i]);j++){
-				vector[ir[count]]=pr[count];
-				count++;
+			/*Now, start inserting data into sparse vector: */
+			count=0;
+			for(i=0;i<cols;i++){
+				for(j=0;j<(jc[i+1]-jc[i]);j++){
+					vector[ir[count]]=pr[count];
+					count++;
+				}
 			}
 		}
@@ -80,6 +82,11 @@
 
 		/*allocate and memcpy*/
-		vector=(double*)xmalloc(rows*sizeof(double));
-		memcpy(vector,mxvector_ptr,rows*sizeof(double));
+		if(rows){
+			vector=(double*)xmalloc(rows*sizeof(double));
+			memcpy(vector,mxvector_ptr,rows*sizeof(double));
+		}
+		else{
+			vector=NULL;
+		}
 	}
 
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/double/double.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/double/double.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/double/double.h	(revision 12004)
@@ -6,5 +6,5 @@
 #define _DOUBLE_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 int MatlabMatrixToDoubleMatrix(double** pmatrix,int* pmatrix_rows,int* pmatrix_cols,const mxArray* mxmatrix);
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.cpp	(revision 12004)
@@ -0,0 +1,259 @@
+/*!\file SeqMat.cpp
+ * \brief: implementation of the SeqMat object
+ */
+
+/*Headers:*/
+/*{{{1*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include "../toolkits.h"
+#include "../../shared/shared.h"
+
+/*}}}*/
+
+/*SeqMat constructors and destructor*/
+/*FUNCTION SeqMat::SeqMat(){{{1*/
+SeqMat::SeqMat(){
+
+	this->M=0;
+	this->N=0;
+	this->matrix=NULL;
+}
+/*}}}*/
+/*FUNCTION SeqMat::SeqMat(int M,int N){{{1*/
+SeqMat::SeqMat(int pM,int pN){
+
+	this->M=pM;
+	this->N=pN;
+	this->matrix=NULL;
+	if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+}
+/*}}}*/
+/*FUNCTION SeqMat::SeqMat(int M,int N, double sparsity){{{1*/
+SeqMat::SeqMat(int pM,int pN, double sparsity){
+
+	this->M=pM;
+	this->N=pN;
+	this->matrix=NULL;
+	if(M*N) this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+}
+/*}}}*/
+/*FUNCTION SeqMat(double* serial_mat,int M,int N,double sparsity){{{1*/
+SeqMat::SeqMat(double* serial_mat,int pM,int pN,double sparsity){
+
+	int i,j;
+
+	this->M=pM;
+	this->N=pN;
+	this->matrix=NULL;
+	if(M*N){
+		this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+		memcpy(this->matrix,serial_mat,pM*pN*sizeof(double));
+	}
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::SeqMat(int M,int N, int connectivity, int numberofdofspernode){{{1*/
+SeqMat::SeqMat(int pM,int pN, int connectivity,int numberofdofspernode){
+
+	this->M=pM;
+	this->N=pN;
+	this->matrix=NULL;
+	if(M*N)this->matrix=(double*)xcalloc(pM*pN,sizeof(double));
+}
+/*}}}*/
+/*FUNCTION SeqMat::~SeqMat(){{{1*/
+SeqMat::~SeqMat(){
+
+	xfree((void**)&this->matrix);
+	M=0;
+	N=0;
+}
+/*}}}*/
+
+/*SeqMat specific routines: */
+/*FUNCTION SeqMat::Echo{{{1*/
+void SeqMat::Echo(void){
+
+	int i,j;
+	printf("SeqMat size %i-%i\n",this->M,this->N);
+	for(i=0;i<M;i++){
+		for(j=0;j<N;j++){
+			printf("%g ",this->matrix[N*i+j]);
+		}
+		printf("\n");
+	}
+}
+/*}}}*/
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+/*FUNCTION SeqMat::ToMatlabMatrix{{{1*/
+mxArray* SeqMat::ToMatlabMatrix(void){
+
+	/*Intermediary: */
+	double* buffer=NULL;
+	mxArray* pfield=NULL;
+	
+	/*output: */
+	mxArray* dataref=NULL;
+
+	/*copy vector into a new buffer: */
+	if(this->M*this->N){
+		buffer=(double*)xmalloc(this->M*this->N*sizeof(double));
+		memcpy(buffer,this->matrix,M*N*sizeof(double));
+
+		pfield=mxCreateDoubleMatrix(0,0,mxREAL);
+		mxSetM(pfield,this->N);
+		mxSetN(pfield,this->M);
+		mxSetPr(pfield,buffer);
+		
+		//transpose the matrix, written directly to matlab! from C to matlab.
+		mexCallMATLAB(1,&dataref, 1, &pfield, "transpose");
+	}
+	else dataref=mxCreateDoubleMatrix(0,0,mxREAL);
+
+	/*do not erase buffer!: */
+	return dataref;
+
+}
+
+
+	
+	
+/*}}}*/
+/*FUNCTION MatlabMatrixToSeqMat{{{1*/
+SeqMat* MatlabMatrixToSeqMat(const mxArray* dataref){
+
+	SeqMat* output=NULL;
+
+	output=new SeqMat();
+	MatlabMatrixToDoubleMatrix(&output->matrix,&output->M,&output->N,dataref);
+	return output;
+
+}
+/*}}}*/
+#endif
+/*FUNCTION SeqMat::Assemble{{{1*/
+void SeqMat::Assemble(void){
+		
+	/*do nothing*/
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::Norm{{{1*/
+double SeqMat::Norm(NormMode mode){
+
+	double norm;
+	double absolute;
+	int i,j;
+
+	switch(mode){
+		case NORM_INF:
+			norm=0;
+			for(i=0;i<this->M;i++){
+				absolute=0;
+				for(j=0;j<this->N;j++){
+					absolute+=fabs(this->matrix[N*i+j]);
+				}
+				norm=max(norm,absolute);
+			}
+			return norm;
+			break;
+		default:
+			_error_("unknown norm !");
+			break;
+	}
+}
+/*}}}*/
+/*FUNCTION SeqMat::GetSize{{{1*/
+void SeqMat::GetSize(int* pM,int* pN){
+
+	*pM=this->M;
+	*pN=this->N;
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::GetLocalSize{{{1*/
+void SeqMat::GetLocalSize(int* pM,int* pN){
+	
+	*pM=this->M;
+	*pN=this->N;
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::MatMult{{{1*/
+void SeqMat::MatMult(SeqVec* X,SeqVec* AX){
+
+	int i,j;
+	int XM,AXM;
+	double dummy;
+
+	X->GetSize(&XM);
+	AX->GetSize(&AXM);
+
+	if(M!=AXM)_error_("A and AX should have the same number of rows!");
+	if(N!=XM)_error_("A and X should have the same number of columns!");
+
+	for(i=0;i<M;i++){
+		dummy=0;
+		for(j=0;j<N;j++){
+			dummy+= this->matrix[N*i+j]*X->vector[j];
+		}
+		AX->vector[i]=dummy;
+	}
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::Duplicate{{{1*/
+SeqMat* SeqMat::Duplicate(void){
+
+	double dummy=0;
+
+	return new SeqMat(this->matrix,this->M,this->N,dummy);
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::ToSerial{{{1*/
+double* SeqMat::ToSerial(void){
+
+	double* buffer=NULL;
+
+	if(this->M*this->N){
+		buffer=(double*)xmalloc(this->M*this->N*sizeof(double));
+		memcpy(buffer,this->matrix,this->M*this->N*sizeof(double));
+	}
+	return buffer;
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::SetValues{{{1*/
+void SeqMat::SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode){
+	
+	int i,j;
+	switch(mode){
+		case ADD_VAL:
+			for(i=0;i<m;i++) for(j=0;j<n;j++) this->matrix[N*idxm[i]+idxn[j]]+=values[n*i+j];
+			break;
+		case INS_VAL:
+			for(i=0;i<m;i++) for(j=0;j<n;j++) this->matrix[N*idxm[i]+idxn[j]]=values[n*i+j];
+			break;
+		default:
+			_error_("unknown insert mode!");
+			break;
+	}
+
+}
+/*}}}*/
+/*FUNCTION SeqMat::Convert{{{1*/
+void SeqMat::Convert(MatrixType type){
+
+	/*do nothing*/
+
+}
+/*}}}*/
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqMat.h	(revision 12004)
@@ -0,0 +1,63 @@
+/*!\file:  SeqMat.h
+ * \brief wrapper to SeqMat objects, which are just wrappers to a simple double* buffer.
+ */ 
+
+#ifndef _SEQMAT_H_
+#define _SEQMAT_H_
+
+/*Headers:*/
+/*{{{1*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "../toolkitsenums.h"
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+#include "mex.h"
+#endif
+
+/*}}}*/
+class SeqVec;
+
+class SeqMat{
+
+	public:
+	
+		int M,N; 
+		double* matrix; 
+
+		/*SeqMat constructors, destructors {{{1*/
+		SeqMat();
+		SeqMat(int M,int N);
+		SeqMat(int M,int N,double sparsity);
+		SeqMat(double* serial_mat,int M,int N,double sparsity);
+		SeqMat(int M,int N,int connectivity,int numberofdofspernode);
+		~SeqMat();
+		/*}}}*/
+		/*SeqMat specific routines {{{1*/
+		void Echo(void);
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+		mxArray* ToMatlabMatrix(void);
+		#endif
+		void Assemble(void);
+		double Norm(NormMode norm_type);
+		void GetSize(int* pM,int* pN);
+		void GetLocalSize(int* pM,int* pN);
+		void MatMult(SeqVec* X,SeqVec* AX);
+		SeqMat* Duplicate(void);
+		double* ToSerial(void);
+		void SetValues(int m,int* idxm,int n,int* idxn,double* values,InsMode mode);
+		void Convert(MatrixType type);
+		/*}}}*/
+
+};
+		
+/*API :*/
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+SeqMat*  MatlabMatrixToSeqMat(const mxArray* dataref);
+#endif
+
+#endif //#ifndef _SEQMAT_H_
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.cpp	(revision 12004)
@@ -0,0 +1,275 @@
+/*!\file SeqVec.cpp
+ * \brief: implementation of the SeqVec object
+ */
+
+/*Headers:*/
+/*{{{1*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include "../toolkits.h"
+#include "../../shared/shared.h"
+
+/*}}}*/
+
+/*SeqVec constructors and destructor*/
+/*FUNCTION SeqVec::SeqVec(){{{1*/
+SeqVec::SeqVec(){
+
+	this->M=0;
+	this->vector=NULL;
+}
+/*}}}*/
+/*FUNCTION SeqVec::SeqVec(int M,bool fromlocalsize){{{1*/
+SeqVec::SeqVec(int pM,bool fromlocalsize){
+
+	this->M=pM;
+	this->vector=NULL;
+	if(this->M) this->vector=(double*)xcalloc(pM,sizeof(double));
+}
+/*}}}*/
+/*FUNCTION SeqVec::SeqVec(double* serial_vec,int M){{{1*/
+SeqVec::SeqVec(double* buffer,int pM){
+
+	int i,j;
+
+	this->M=pM;
+	this->vector=NULL;
+	if(this->M){
+		this->vector=(double*)xcalloc(pM,sizeof(double));
+		memcpy(this->vector,buffer,pM*sizeof(double));
+	}
+}
+/*}}}*/
+		/*FUNCTION SeqVec::~SeqVec(){{{1*/
+SeqVec::~SeqVec(){
+	xfree((void**)&this->vector);
+	M=0;
+}
+/*}}}*/
+
+/*SeqVec specific routines: */
+/*FUNCTION SeqVec::Echo{{{1*/
+void SeqVec::Echo(void){
+
+	int i;
+	printf("SeqVec size %i\n",this->M);
+	for(i=0;i<M;i++){
+		printf("%g\n ",vector[i]);
+	}
+}
+/*}}}*/
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+/*FUNCTION SeqVec::ToMatlabVector{{{1*/
+mxArray* SeqVec::ToMatlabVector(void){
+
+	double* buffer=NULL;
+	
+	mxArray* dataref=NULL;
+
+	/*copy vector into a new buffer: */
+	if(this->M){
+		buffer=(double*)xmalloc(this->M*sizeof(double));
+		memcpy(buffer,vector,M*sizeof(double));
+
+		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+		mxSetM(dataref,this->M);
+		mxSetN(dataref,1);
+		mxSetPr(dataref,buffer);	
+	}
+	else dataref = mxCreateDoubleMatrix(0,0,mxREAL);
+
+
+	/*do not erase buffer!: */
+	return dataref;
+
+}
+/*}}}*/
+/*FUNCTION MatlabVectorToSeqVec{{{1*/
+SeqVec* MatlabVectorToSeqVec(const mxArray* dataref){
+
+	SeqVec* output=NULL;
+
+	output=new SeqVec();
+	MatlabVectorToDoubleVector(&output->vector,&output->M,dataref);
+	return output;
+
+}
+/*}}}*/
+#endif
+/*FUNCTION SeqVec::Assemble{{{1*/
+void SeqVec::Assemble(void){
+		
+	/*do nothing*/
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::SetValues{{{1*/
+void SeqVec::SetValues(int ssize, int* list, double* values, InsMode mode){
+	
+	int i;
+	switch(mode){
+		case ADD_VAL:
+			for(i=0;i<ssize;i++) this->vector[list[i]]+=values[i];
+			break;
+		case INS_VAL:
+			for(i=0;i<ssize;i++) this->vector[list[i]]=values[i];
+			break;
+		default:
+			_error_("unknown insert mode!");
+			break;
+	}
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::SetValue{{{1*/
+void SeqVec::SetValue(int dof, double value, InsMode mode){
+
+	switch(mode){
+		case ADD_VAL:
+			this->vector[dof]+=value;
+			break;
+		case INS_VAL:
+			this->vector[dof]=value;
+			break;
+		default:
+			_error_("unknown insert mode!");
+			break;
+	}
+}
+/*}}}*/
+/*FUNCTION SeqVec::GetValue{{{1*/
+void SeqVec::GetValue(double* pvalue,int dof){
+
+	*pvalue=this->vector[dof];
+
+}
+/*}}}*/
+		
+/*FUNCTION SeqVec::GetSize{{{1*/
+void SeqVec::GetSize(int* pM){
+
+	*pM=this->M;
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::GetLocalSize{{{1*/
+void SeqVec::GetLocalSize(int* pM){
+	
+	*pM=this->M;
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::Duplicate{{{1*/
+SeqVec* SeqVec::Duplicate(void){
+	
+	return new SeqVec(this->vector,this->M);
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::Set{{{1*/
+void SeqVec::Set(double value){
+
+	int i;
+	for(i=0;i<this->M;i++)this->vector[i]=value;
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::AXPY{{{1*/
+void SeqVec::AXPY(SeqVec* X, double a){
+
+	int i;
+
+	/*y=a*x+y where this->vector is y*/
+	for(i=0;i<this->M;i++)this->vector[i]=a*X->vector[i]+this->vector[i];
+	
+}
+/*}}}*/
+/*FUNCTION SeqVec::AYPX{{{1*/
+void SeqVec::AYPX(SeqVec* X, double a){
+	
+	int i;
+
+	/*y=x+a*y where this->vector is y*/
+	for(i=0;i<this->M;i++)this->vector[i]=X->vector[i]+a*this->vector[i];
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::ToMPISerial{{{1*/
+double* SeqVec::ToMPISerial(void){
+
+	double* buffer=NULL;
+
+	if(this->M){
+		buffer=(double*)xmalloc(this->M*sizeof(double));
+		memcpy(buffer,this->vector,this->M*sizeof(double));
+	}
+	return buffer;
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::Copy{{{1*/
+void SeqVec::Copy(SeqVec* to){
+
+	int i;
+
+	to->M=this->M;
+	for(i=0;i<this->M;i++)to->vector[i]=this->vector[i];
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::Norm{{{1*/
+double SeqVec::Norm(NormMode mode){
+
+	double norm;
+	int i;
+
+	switch(mode){
+		case NORM_INF:
+			norm=0; for(i=0;i<this->M;i++)norm=max(norm,fabs(this->vector[i]));
+			return norm;
+			break;
+		case NORM_TWO:
+			norm=0; 
+			for(i=0;i<this->M;i++)norm+=pow(this->vector[i],2);
+			return sqrt(norm);
+			break;
+		default:
+			_error_("unknown norm !");
+			break;
+	}
+}
+/*}}}*/
+/*FUNCTION SeqVec::Scale{{{1*/
+void SeqVec::Scale(double scale_factor){
+
+	int i;
+	for(i=0;i<this->M;i++)this->vector[i]=scale_factor*this->vector[i];
+	
+}
+/*}}}*/
+/*FUNCTION SeqVec::Dot{{{1*/
+double SeqVec::Dot(SeqVec* input){
+
+	int i;
+
+	double dot=0;
+	for(i=0;i<this->M;i++)dot+=this->vector[i]*input->vector[i];
+	return dot;
+
+}
+/*}}}*/
+/*FUNCTION SeqVec::PointwiseDivide{{{1*/
+void SeqVec::PointwiseDivide(SeqVec* x,SeqVec* y){
+
+	int i;
+	/*pointwise w=x/y where this->vector is w: */
+	for(i=0;i<this->M;i++)this->vector[i]=x->vector[i]/y->vector[i];
+}
+/*}}}*/
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/SeqVec.h	(revision 12004)
@@ -0,0 +1,67 @@
+/*!\file:  SeqVec.h
+ * \brief wrapper to our SeqVec object, which is just a wrapper to a double* 
+ */ 
+
+#ifndef _SEQVEC_H_
+#define _SEQVEC_H_
+
+/*Headers:*/
+/*{{{1*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "../toolkitsenums.h"
+
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+#include "mex.h"
+#endif
+
+/*}}}*/
+
+class SeqVec{
+
+	public:
+	
+		double* vector;
+		int M;
+
+		/*SeqVec constructors, destructors {{{1*/
+		SeqVec();
+		SeqVec(int M,bool fromlocalsize=false);
+		SeqVec(double* buffer, int M);
+		~SeqVec();
+		/*}}}*/
+		/*SeqVec specific routines {{{1*/
+		void Echo(void);
+		#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+		mxArray* ToMatlabVector(void);
+		#endif
+		void Assemble(void);
+		void SetValues(int ssize, int* list, double* values, InsMode mode);
+		void SetValue(int dof, double value, InsMode  mode);
+		void GetValue(double* pvalue, int dof);
+		void GetSize(int* pM);
+		void GetLocalSize(int* pM);
+		SeqVec* Duplicate(void);
+		void Set(double value);
+		void AXPY(SeqVec* X, double a);
+		void AYPX(SeqVec* X, double a);
+		double* ToMPISerial(void);
+		void Copy(SeqVec* to);
+		double Norm(NormMode norm_type);
+		void Scale(double scale_factor);
+		void PointwiseDivide(SeqVec* x,SeqVec* y);
+		double Dot(SeqVec* vector);
+		/*}}}*/
+};
+
+
+/*API :*/
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+SeqVec*  MatlabVectorToSeqVec(const mxArray* dataref);
+#endif
+
+#endif //#ifndef _SEQVEC_H_
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/issmtoolkit.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/issmtoolkit.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/issm/issmtoolkit.h	(revision 12004)
@@ -0,0 +1,11 @@
+/* \file issmtoolkit.h
+ * \brief all includes for MPI layer
+ */
+
+#ifndef _ISSM_TOOLKIT_H_
+#define _ISSM_TOOLKIT_H_
+
+#include "./SeqMat.h"
+#include "./SeqVec.h"
+
+#endif
Index: sm/branches/trunk-jpl-damage/src/c/toolkits/matlab/MatlabMatrixToMatrix.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/MatlabMatrixToMatrix.cpp	(revision 12003)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/* \file MatlabMatrixToMatrix.cpp
- * \brief: convert a sparse or dense matlab matrix to a matrix:
- */
-
-
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-
-#ifdef _SERIAL_
-
-/*Matlab includes: */
-#include "mex.h"
-#include "../../objects/objects.h"
-
-Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix){
-
-	Matrix* matrix=NULL;
-
-	#ifdef _HAVE_PETSC_
-	/*allocate matrix object: */
-	matrix=new Matrix();
-	
-	/*Call Matlab to Petsc API: */
-	MatlabMatrixToPetscMatrix(&matrix->matrix,&matrix->M,&matrix->N,mxmatrix);
-
-	#else
-		_error_("not supported yet!");
-	#endif
-
-	return matrix;
-}
-#endif
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/MatlabNArrayToNArray.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/MatlabNArrayToNArray.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/MatlabNArrayToNArray.cpp	(revision 12004)
@@ -13,5 +13,5 @@
 #include "../../include/include.h"
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 
Index: sm/branches/trunk-jpl-damage/src/c/toolkits/matlab/MatlabVectorToVector.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/MatlabVectorToVector.cpp	(revision 12003)
+++ 	(revision )
@@ -1,36 +1,0 @@
-/* \file MatlabVectorToVector.cpp
- * \brief: convert a sparse or dense matlab vector to a vector:
- */
-
-
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-
-#ifdef _SERIAL_
-
-/*Matlab includes: */
-#include "mex.h"
-#include "../../objects/objects.h"
-
-Vector* MatlabVectorToVector(const mxArray* mxvector){
-
-	Vector* vector=NULL;
-
-	#ifdef _HAVE_PETSC_
-	/*allocate vector object: */
-	vector=new Vector();
-	
-	/*Call Matlab to Petsc API: */
-	MatlabVectorToPetscVector(&vector->vector,&vector->M,mxvector);
-
-	#else
-		_error_("not supported yet!");
-	#endif
-
-	return vector;
-}
-#endif
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/matlabincludes.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/matlabincludes.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/matlab/matlabincludes.h	(revision 12004)
@@ -6,5 +6,5 @@
 #define _MATLAB_INCLUDES_H_
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include <mex.h>
 class Matrix;
@@ -14,6 +14,4 @@
 int MatlabNArrayToNArray(bool** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix);
 int MatlabNArrayToNArray(char** pmatrix,int* pmatrix_numel,int* pmatrix_ndims,int** pmatrix_size,const mxArray* mxmatrix);
-Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix);
-Vector* MatlabVectorToVector(const mxArray* mxvector);
 #endif
 
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscMatrixType.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscMatrixType.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/ISSMToPetscMatrixType.cpp	(revision 12004)
@@ -0,0 +1,35 @@
+/* \file ISSMToPetscMatrixType.cpp
+ * \brief: convert MatrixType from ISSM to Petsc
+ */
+
+
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*Petsc includes: */
+#include "petscmat.h"
+#include "petscvec.h"
+#include "petscksp.h"
+
+/*ISSM includes: */
+#include "../../toolkitsenums.h"
+#include "../../../shared/shared.h"
+
+
+MatType ISSMToPetscMatrixType(MatrixType type){
+
+	switch(type){
+		case DENSE_SEQUENTIAL:  
+			return MATSEQDENSE;
+			break;
+		case SPARSE_SEQUENTIAL:  
+			return MATSEQAIJ;
+			break;
+		default: 
+			_error_("unknown matrix type !");
+			break;
+	}
+}
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatInvert.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatInvert.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatInvert.cpp	(revision 12004)
@@ -56,5 +56,5 @@
 	MatAssemblyEnd(inv,MAT_FINAL_ASSEMBLY);
 
-	#ifdef _SERIAL_
+	#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 		MatConvert(inv, MATSEQAIJ,MAT_REUSE_MATRIX,&inv);
 	#else
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatPartition.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatPartition.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatPartition.cpp	(revision 12004)
@@ -48,8 +48,19 @@
 			d_nz=0;
 			o_nz=0;
+			#ifdef _HAVE_PETSCDEV_
+			MatCreateAIJ(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,d_nz,PETSC_NULL,o_nz,PETSC_NULL,&outmatrix);
+			#else
 			MatCreateMPIAIJ(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,d_nz,PETSC_NULL,o_nz,PETSC_NULL,&outmatrix);
+			#endif
 		}
 		else if (strcmp(type,"mpidense")==0){
+			#ifdef _HAVE_PETSCDEV_
+			MatCreateDense(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,PETSC_NULL,&outmatrix);
+			#else
 			MatCreateMPIDense(MPI_COMM_WORLD,PETSC_DETERMINE,PETSC_DETERMINE, 0,0,PETSC_NULL,&outmatrix);
+			#endif
+		}
+		else{
+			_error_("MatType %s not supported yet",type);
 		}
 		/*Assemble*/
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatlabMatrixToPetscMatrix.cpp	(revision 12004)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
@@ -116,6 +116,6 @@
 	/*Assign output pointer: */
 	*pmatrix=matrix;
-	*pmatrix_rows=rows;
-	*pmatrix_cols=cols;
+	if(pmatrix_rows) *pmatrix_rows=rows;
+	if(pmatrix_cols) *pmatrix_cols=cols;
 
 	return 1;
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatlabVectorToPetscVector.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatlabVectorToPetscVector.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/MatlabVectorToPetscVector.cpp	(revision 12004)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
@@ -94,5 +94,4 @@
 	VecAssemblyEnd(vector);
 
-
 	/*Assign output pointer: */
 	*pvector=vector;
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/NewMat.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/NewMat.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/NewMat.cpp	(revision 12004)
@@ -39,5 +39,9 @@
 	o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
 
+	#ifdef _HAVE_PETSCDEV_
+	MatCreateAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix); 
+	#else
 	MatCreateMPIAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix); 
+	#endif
 
 	return outmatrix;
@@ -63,5 +67,9 @@
 	o_nz=(int)((double)nnz/(double)M/2.0); //number of non zeros per row/2
 
+	#ifdef _HAVE_PETSCDEV_
+	MatCreateAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix); 
+	#else
 	MatCreateMPIAIJ(MPI_COMM_WORLD,m,n,M,N,d_nz,NULL,o_nz,NULL,&outmatrix); 
+	#endif
 
 	return outmatrix;
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscMatrixToMatlabMatrix.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscMatrixToMatlabMatrix.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscMatrixToMatlabMatrix.cpp	(revision 12004)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
@@ -25,5 +25,5 @@
 
 
-int PetscMatrixToMatlabMatrix(mxArray** pdataref,Mat matrix){
+int PetscMatrixToMatlabMatrix(mxArray** pdataref,Mat tmatrix){
 
 	int i,j,k;
@@ -31,5 +31,4 @@
 	/*output: */
 	mxArray* dataref=NULL;
-	mxArray* tdataref=NULL;
 	int    rows,cols;
 
@@ -50,5 +49,12 @@
 	int*    idxm=NULL;
 	int*    idxn=NULL;
+	Mat     matrix=NULL;
 
+	
+	/*First off, we need to transpose the matrix using the Petsc API. We tried using the transpose operation from 
+	 * Matlab, but this ends up creating issues with lost pointers and references: */
+	MatTranspose(tmatrix,MAT_INITIAL_MATRIX,&matrix);
+
+	/*Some needed information: */
 	MatGetType(matrix,&type);
 	MatGetSize(matrix,&rows,&cols);
@@ -128,19 +134,17 @@
 
 		dataref = mxCreateDoubleMatrix(0,0,mxREAL);
-		mxSetM(dataref,rows);
-		mxSetN(dataref,cols);
+		mxSetM(dataref,cols);
+		mxSetN(dataref,rows);
 		mxSetPr(dataref,(double*)matrix_ptr);	
 	}
 
-
-	/*Transpose matrcol_indes: */
-	mexCallMATLAB(1,&tdataref,1,&dataref, "transpose");
-
+	/*Free ressources:*/
+	MatFree(&matrix);
 
 	/*Assign output pointers: */
-	*pdataref=tdataref;
+	*pdataref=dataref;
 
 	return 1;
 }
 
-#endif  //#ifdef _SERIAL_
+#endif  
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscOptionsInsertMultipleString.cpp	(revision 12004)
@@ -90,4 +90,8 @@
 	}
 
+#ifdef _HAVE_PETSCDEV_
+	PetscTokenDestroy(&token);
+#else
 	PetscTokenDestroy(token);
+#endif
 }
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscVectorToMatlabVector.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscVectorToMatlabVector.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/PetscVectorToMatlabVector.cpp	(revision 12004)
@@ -11,5 +11,5 @@
 
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 
 /*Petsc includes: */
@@ -27,9 +27,8 @@
 int PetscVectorToMatlabVector(mxArray** pdataref,Vec vector){
 
-
-	int i;
-	int rows;
-	int* idxm=NULL;
-	double* values=NULL;
+	int     i;
+	int     rows;
+	int    *idxm   = NULL;
+	double *values = NULL;
 
 	/*output: */
@@ -37,12 +36,16 @@
 
 	/*Get size of vector: */
-	VecGetSize(vector,&rows);
+	if(vector){
+		VecGetSize(vector,&rows);
+		if(rows){
+			idxm=(int*)xmalloc(rows*sizeof(int));
+			values=(double*)xmalloc(rows*sizeof(double));
+			for(i=0;i<rows;i++)idxm[i]=i;
 
-	if(rows){
-		idxm=(int*)xmalloc(rows*sizeof(int));
-		values=(double*)xmalloc(rows*sizeof(double));
-		for(i=0;i<rows;i++)idxm[i]=i;
-		 
-		VecGetValues(vector,rows,idxm,values);
+			VecGetValues(vector,rows,idxm,values);
+		}
+	}
+	else{
+		rows=0;
 	}
 
@@ -61,5 +64,3 @@
 }
 
-
-#endif  //#ifdef _SERIAL_
-
+#endif  //#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/SerialToVec.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/SerialToVec.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/SerialToVec.cpp	(revision 12004)
@@ -13,9 +13,4 @@
 #include "petscvec.h"
 #include "petscksp.h"
-
-/*Matlab includes: */
-#ifdef _SERIAL_
-#include "mex.h"
-#endif
 
 #include "../../../shared/shared.h"
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/petscpatches.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/petscpatches.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/petsc/patches/petscpatches.h	(revision 12004)
@@ -16,5 +16,5 @@
 class Parameters;
 
-#ifdef _SERIAL_
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
 #include "mex.h"
 int MatlabMatrixToPetscMatrix(Mat* matrix,int* prows,int* pcols, const mxArray* mxmatrix);
@@ -49,4 +49,5 @@
 InsertMode ISSMToPetscInsertMode(InsMode mode);
 NormType ISSMToPetscNormMode(NormMode mode);
+MatType ISSMToPetscMatrixType(MatrixType type);
 
 #endif
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/python/pythonincludes.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/python/pythonincludes.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/python/pythonincludes.h	(revision 12004)
@@ -0,0 +1,24 @@
+/* \file pythonincludes.h
+ * \brief all includes for PYTHON layer
+ */
+
+#ifndef _PYTHON_INCLUDES_H_
+#define _PYTHON_INCLUDES_H_
+
+
+#include "Python.h"
+#include "arrayobject.h"
+
+
+
+#ifdef _HAVE_BOOST_
+using namespace std;
+#include <boost/python/def.hpp>
+#include <boost/python.hpp>
+#include <boost/python/module.hpp>
+using namespace boost::python;
+typedef boost::python::numeric::array pyArray;
+#endif
+
+
+#endif
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/toolkits.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/toolkits.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/toolkits.h	(revision 12004)
@@ -12,14 +12,23 @@
 #endif
 
+#if defined(_HAVE_PYTHON_) && defined(_SERIAL_)
+#include "./python/pythonincludes.h"
+#endif
+
 #ifdef _HAVE_PETSC_
 #include "./petsc/petscincludes.h"
 #endif
 
+#if defined(_HAVE_MATLAB_) && defined(_SERIAL_)
+#include "./matlab/matlabincludes.h"
+#endif
+
+
 #include "./mpi/mpiincludes.h"
 #include "./metis/metisincludes.h"
 #include "./triangle/triangleincludes.h"
-#include "./matlab/matlabincludes.h"
 #include "./double/double.h"
 #include "./toolkitsenums.h"
+#include "./issm/issmtoolkit.h"
 
 #endif
Index: /issm/branches/trunk-jpl-damage/src/c/toolkits/toolkitsenums.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/c/toolkits/toolkitsenums.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/c/toolkits/toolkitsenums.h	(revision 12004)
@@ -14,4 +14,5 @@
 typedef enum {INS_VAL, ADD_VAL} InsMode;
 typedef enum {NORM_INF,NORM_TWO} NormMode;
+typedef enum {DENSE_SEQUENTIAL,SPARSE_SEQUENTIAL} MatrixType;
 
 #endif
Index: /issm/branches/trunk-jpl-damage/src/m/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/Makefile.am	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/Makefile.am	(revision 12004)
@@ -1,1 +1,45 @@
-SUBDIRS = classes enum kml model planet qmu shared solutions solvers utils
+bin_SCRIPTS=./classes/*.m \
+				./classes/model/*.m \
+				./classes/clusters/*.m \
+				./enum/*.m \
+				./kml/*.m \
+				./model/*.m \
+				./model/plot/*.m \
+				./model/mesh/*.m \
+				./model/display/*.m \
+				./model/parameterization/*.m \
+				./model/partition/*.m \
+				./model/solvers/*.m \
+				./planet/*.m \
+				./qmu/*.m \
+				./shared/*.m \
+				./solutions/*.m \
+				./solvers/*.m \
+				./utils/*.m \
+				./utils/Analysis/*.m \
+				./utils/Array/*.m \
+				./utils/BC/*.m \
+				./utils/Basins/*.m \
+				./utils/Cluster/*.m \
+				./utils/DataProcessing/*.m \
+				./utils/Ecco3/*.m \
+				./utils/Exp/*.m \
+				./utils/Exp/manipulation/*.m \
+				./utils/Exp/readwrite/*.m \
+				./utils/Geometry/*.m \
+				./utils/ImageProcessing/*.m \
+				./utils/Interp/*.m \
+				./utils/Kml/*.m \
+				./utils/LatLong/*.m \
+				./utils/Math/*.m \
+				./utils/Meca/*.m \
+				./utils/Mesh/*.m \
+				./utils/Miscellaneous/*.m \
+				./utils/Model/*.m \
+				./utils/Numerics/*.m \
+				./utils/OS/*.m \
+				./utils/Plot/*.m \
+				./utils/Shell/*.m \
+				./utils/String/*.m \
+				./utils/consistency/*.m \
+				./utils/qmu/*.m 
Index: sm/branches/trunk-jpl-damage/src/m/classes/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,2 +1,0 @@
-SUBDIRS = @pairoptions @modellist model clusters
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/classes/autodiff.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/autodiff.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/autodiff.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/balancethickness.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/balancethickness.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/balancethickness.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/basalforcings.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/basalforcings.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/basalforcings.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: sm/branches/trunk-jpl-damage/src/m/classes/clusters/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/castor.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/castor.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/castor.m	(revision 12004)
@@ -21,14 +21,5 @@
 	 methods
 		 function cluster=castor(varargin) % {{{1
-			 options=pairoptions(varargin{:});
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('castor')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster castor']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/cosmos.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/cosmos.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/cosmos.m	(revision 12004)
@@ -21,14 +21,5 @@
 	 methods
 		 function cluster=cosmos(varargin) % {{{1
-			 options=pairoptions(varargin{:});
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('cosmos')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster cosmos']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/gemini.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/gemini.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/gemini.m	(revision 12004)
@@ -21,14 +21,5 @@
     methods
 		 function cluster=gemini(varargin) % {{{1
-			 options=pairoptions(varargin{:});
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('gemini')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster gemini']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/generic.m	(revision 12004)
@@ -35,13 +35,5 @@
 
 			 %OK get other fields
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('generic')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster generic']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/greenplanet.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/greenplanet.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/greenplanet.m	(revision 12004)
@@ -30,14 +30,5 @@
 
 			 %use provided options to change fields
-			 options=pairoptions(varargin{:});
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('greenplanet')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster greenplanet']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/none.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/none.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/none.m	(revision 12004)
@@ -12,14 +12,5 @@
     methods
 		 function cluster=none(varargin) % {{{1
-			 options=pairoptions(varargin{:});
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('none')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster none']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/pfe.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/pfe.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/pfe.m	(revision 12004)
@@ -35,14 +35,5 @@
 
 			 %use provided options to change fields
-			 options=pairoptions(varargin{:});
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('pfe')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster pfe']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/clusters/pollux.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/clusters/pollux.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/clusters/pollux.m	(revision 12004)
@@ -21,14 +21,5 @@
 	 methods
 		 function cluster=pollux(varargin) % {{{1
-			 options=pairoptions(varargin{:});
-			 for i=1:size(options.list,1),
-				 fieldname=options.list{i,1};
-				 fieldvalue=options.list{i,2};
-				 if ismember(fieldname,properties('pollux')),
-					 cluster.(fieldname)=fieldvalue;
-				 else
-					 disp(['''' fieldname ''' is not a property of cluster pollux']);
-				 end
-			 end
+			 cluster=AssignObjectFields(pairoptions(varargin{:}),cluster);
 		 end
 		 %}}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/constants.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/constants.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/constants.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/debug.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/debug.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/debug.m	(revision 12004)
@@ -6,6 +6,7 @@
 classdef debug
 	properties (SetAccess=public) 
-		valgrind=false;
-		gprof   = false;
+		valgrind = false;
+		gprof    = false;
+		petsc_profiling = false;
 	end
 	methods
@@ -14,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -33,5 +27,9 @@
 			fielddisplay(obj,'valgrind','use Valgrind to debug (0 or 1)');
 			fielddisplay(obj,'gprof','use gnu-profiler to find out where the time is spent');
+			fielddisplay(obj,'petsc_profiling','enables PETSc profiling (memory, flops, time)');
 
+		end % }}}
+		function marshall(obj,fid) % {{{
+			WriteData(fid,'object',obj,'fieldname','petsc_profiling','format','Boolean');
 		end % }}}
 	end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/diagnostic.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/diagnostic.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/diagnostic.m	(revision 12004)
@@ -30,11 +30,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -117,5 +110,5 @@
 				pos=find(md.mask.vertexongroundedice & md.mesh.vertexonbed);
 				if any(~isnan(md.diagnostic.referential(pos,:))),
-					checkmessage(['model ' md.miscellaneous.name ' not consistent. No referential should be specified for basal vertices of grounded ice']);
+					checkmessage(['no referential should be specified for basal vertices of grounded ice']);
 				end
 			end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/flaim.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/flaim.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/flaim.m	(revision 12004)
@@ -25,11 +25,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/flowequation.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/flowequation.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/flowequation.m	(revision 12004)
@@ -20,11 +20,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/friction.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/friction.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/friction.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/geometry.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/geometry.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/geometry.m	(revision 12004)
@@ -17,11 +17,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -39,4 +32,7 @@
 				checkmessage(['equality thickness=surface-bed violated']);
 			end 
+			if solution==TransientSolutionEnum & md.transient.isgroundingline,
+				checkfield(md,'geometry.bathymetry','NaN',1,'size',[md.mesh.numberofvertices 1]);
+			end
 		end % }}}
 		function disp(obj) % {{{
Index: /issm/branches/trunk-jpl-damage/src/m/classes/groundingline.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/groundingline.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/groundingline.m	(revision 12004)
@@ -14,11 +14,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/hydrology.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/hydrology.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/hydrology.m	(revision 12004)
@@ -19,11 +19,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/initialization.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/initialization.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/initialization.m	(revision 12004)
@@ -20,11 +20,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -53,5 +46,5 @@
 				%Triangle with zero velocity
 				if any(sum(abs(md.initialization.vx(md.mesh.elements)),2)==0 & sum(abs(md.initialization.vy(md.mesh.elements)),2)==0)
-					checkmessage('model not consistent: at least one triangle has all its vertices with a zero velocity');
+					checkmessage('at least one triangle has all its vertices with a zero velocity');
 				end
 			end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/inversion.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/inversion.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/inversion.m	(revision 12004)
@@ -32,11 +32,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/mask.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/mask.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/mask.m	(revision 12004)
@@ -18,11 +18,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/materials.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/materials.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/materials.m	(revision 12004)
@@ -26,11 +26,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/mesh.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/mesh.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/mesh.m	(revision 12004)
@@ -51,11 +51,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/miscellaneous.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/miscellaneous.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/miscellaneous.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: sm/branches/trunk-jpl-damage/src/m/classes/model/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/model/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/classes/model/model.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/model/model.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/model/model.m	(revision 12004)
@@ -73,17 +73,4 @@
 			 end
 		 end% }}}
-		 function temp = template() % {{{
-
-			 %Get default fields
-			 md=model(0);
-			 modelprops=properties('model');
-
-			 %build output
-			 temp=struct();
-			 for i=1:length(modelprops),
-				 temp.(modelprops{i})=md.(modelprops{i});
-			 end
-
-		 end% }}}
 	 end
 	 methods
@@ -93,24 +80,4 @@
 				 case 0
 					 md=setdefaultparameters(md);
-				 case 1
-					 in=varargin{1};
-					 if (isa(in,'model'))
-						 %If single argument of class model, we have a copy constructor. 
-						 md = in;
-					 elseif (isa(in,'numeric') & in==0)
-						 %requesting template
-						 %FIXME: for now recursive call
-						 md2=model;
-						 modelprops=properties('model');
-						 for i=1:length(modelprops);
-							 fieldname=modelprops{i};
-							 if md.(fieldname).marshall & isobject(md2.(fieldname)) & isempty(md.(fieldname).preprocess),
-								 eval(['md.' fieldname '=' fieldname '(0);']);
-							 end
-						 end
-					 else
-						 error('model constructor error message: unknown constructor for ''model'' class object');
-					 end 
-
 				 otherwise
 					 error('model constructor error message: 0 of 1 argument only in input.');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/modellist.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/modellist.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/modellist.m	(revision 12004)
@@ -0,0 +1,181 @@
+%MODELLIST class definition
+%
+%   Usage:
+%      modellist=modellist({md1 md2 md3});
+
+classdef modellist
+	properties (SetAccess=public) 
+		models  = cell(0,1);
+		cluster = none();
+	end
+	methods
+		function obj = modellist(varargin) % {{{
+
+			%initialize list
+			if nargin==0,
+				%Do nothing,
+			elseif nargin==1,
+				if ~isa(varargin{1},'cell'),
+					error('not supported yet');
+				end
+
+				celllist=varargin{1};
+
+				%check on size of cell list: 
+				if (size(celllist,2)~=1),
+					error('modellist constructor error message: list of models should be a cell list of column size 1');
+				end
+
+				%check that only models are in the celllist: 
+				for i=1:size(celllist,1),
+					if ~isa(celllist{i},'model')
+						error(['modellist constructor error message: element ' num2str(i) ' of cell list is not a model!']);
+					end
+				end
+
+				obj.models  = celllist;
+				obj.cluster = obj.models{1}.cluster;
+			end
+		end % }}}
+		function val = get(obj, propName)% {{{
+		%GET - gets model propertie from a specified object ans returns the value
+		% 
+		%   Usage:
+		%      val = get(a, propName)
+
+			switch propName
+				case 'numberofelements'
+					val = obj.numberofelements;
+				case 'numberofnodes'
+					val = obj.numberofnodes;
+				case 'elements' 
+					val = obj.elements;
+				case 'x' 
+					val = obj.x;
+				case 'y' 
+					val = obj.y;
+				case 'z' 
+					val = obj.z;
+				otherwise
+					error(['get error message: ' propName,' is not a valid model property'])
+			end
+		end % }}}
+		function obj = loadmultipleresultsfromcluster(obj) % {{{
+			%LOADMULTIPLERESULTSFROMCLUSTER - load multiple results of solution sequences from cluster
+			%
+			%   Usage:
+			%      obj=loadresultsfromcluster(obj);
+
+			nummodels=length(obj.models);
+
+			%Get cluster settings
+			cluster=obj.cluster;
+			name=obj.name;
+			cluster_rc_location=which('cluster.rc');
+			[codepath,executionpath]=ClusterParameters(cluster,cluster_rc_location);
+
+			%Remote tar: 
+			disp('tarring results');
+			issmssh(cluster,['"cd ' executionpath '/' name ' && rm -rf file_list.txt ModelResults.tar.gz && find -iname ''*-*vs*.outbin'' > file_list.txt && tar zcvf ModelResults.tar.gz --files-from file_list.txt  && rm -rf file_list.txt "']);
+
+			%copy results from cluster to present directory
+			scpin(cluster, [executionpath '/' name], {'ModelResults.tar.gz'});
+
+			%untar:
+			!tar -zxvf ModelResults.tar.gz
+
+			%ok, go through list and load results from disk: 
+			for i=1:nummodels,
+				%load  results for this model
+				obj.models{i}=loadresultsfromdisk(obj.models{i},[name '-' num2str(i) 'vs' num2str(nummodels) '.outbin']);
+
+				delete([name '-' num2str(i) 'vs' num2str(nummodels) '.outbin']);
+			end
+
+			%erase files 
+			delete('ModelResults.tar.gz');
+		end % }}}
+		function obj = solve(obj,varargin)% {{{
+			%SOLVE - apply solution sequence for  a list of models. Used in batch mode.
+			%
+			%   Usage:
+			%      obj=solve(obj,varargin)
+			%      where varargin is a lit of paired arguments. 
+			%      arguments can be: 'analysis_type': 'diagnostic','thermal','prognostic','transient'
+			%
+			%   Examples:
+			%      obj=solve(obj,'analysis_type','diagnostic');
+
+			%recover options
+			options=pairoptions(varargin{:});
+
+			%add default options
+			options=process_solve_options(options);
+
+			%length of list
+			nummodels=length(obj.models);
+
+			%name of queue: to make it unique, add a time stamp
+			name=[obj.name '-' datestr(now,1) '-' datestr(now,'HH-MM-SS') ];
+
+			%name of cluster will be first name of list
+			cluster=obj.cluster;
+
+			%Figure out parameters for this particular cluster
+			cluster_rc_location=which('cluster.rc');
+			[codepath,executionpath]=ClusterParameters(cluster,cluster_rc_location);
+
+			%solve in batch mode: 
+			for i=1:nummodels,
+
+				%model
+				mdex=obj.models{i};
+
+				%recover some fields
+				mdex.analysis_type=options.analysis_type;
+
+				mdex.name=[name '-' num2str(i) 'vs' num2str(nummodels)];
+				mdex.time=obj.time;
+				mdex.queue=obj.queue;
+				mdex.cluster=obj.cluster;
+				if ~isnan(obj.np),
+					mdex.np=obj.np;
+				end
+
+				%call solve in batch mode:
+				if strcmpi(cluster,oshostname),
+					mdex=solve(mdex,varargin{:});
+				else
+					mdex=solve(mdex,varargin{:},'batch','yes','directory',name);
+				end
+
+				%feed back
+				obj.models{i}=mdex;
+			end
+
+			%locally, we are done.
+			if strcmpi(cluster,oshostname),
+				return
+			end
+
+
+			%now, tar all the files and then erase them.
+			eval(['!find -iname ''' name '-*'' > file_list.txt']);
+			!tar zcvf ModelList.tar.gz --files-from file_list.txt
+			!rm -rf *.bin *.queue file_list.txt
+
+			%still have to build a launching script.
+			BuildMultipleQueueingScript(cluster,name,executionpath,codepath);
+
+			%launch jobs on remote cluster
+			LaunchMultipleQueueJob(cluster,name,executionpath);
+
+			%erase files: 
+			delete([name '.queue']);
+			delete('ModelList.tar.gz');
+
+			%save name: 
+			obj.name=name;
+		end % }}}
+	end
+end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/pairoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/pairoptions.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/pairoptions.m	(revision 12004)
@@ -0,0 +1,226 @@
+%PAIROPTIONS class definition
+%
+%   Usage:
+%      pairoptions=pairoptions();
+%      pairoptions=pairoptions('module',true,'solver',false);
+
+classdef pairoptions
+	properties (SetAccess = private,GetAccess = private) 
+		functionname = '';
+		list         = cell(0,2);
+	end
+	methods
+		function obj = pairoptions(varargin) % {{{
+
+			%get calling function name
+			a=dbstack;
+			if length(a)>1,
+				obj.functionname=a(2).file(1:end-2);
+			else
+				obj.functionname='';
+			end
+
+			%initialize list
+			if nargin==0,
+				%Do nothing,
+			else
+				obj=buildlist(obj,varargin{:});
+			end
+		end % }}}
+		function obj = buildlist(obj,varargin) % {{{
+		%BUILDLIST - build list of obj from input
+
+			%check length of input
+			if mod((nargin-1),2),
+				error('error: an even number of options is required') 
+			end
+			numoptions = (nargin-1)/2;
+
+			%Allocate memory
+			obj.list=cell(numoptions,2);
+
+			%go through varargin and build list of obj
+			for i=1:numoptions,
+				if ischar(varargin{2*i-1}),
+					obj.list{i,1}=varargin{2*i-1};
+					obj.list{i,2}=varargin{2*i};
+				else
+					%option is not a string, ignore it
+					disp(['WARNING: option number ' num2str(i) ' is not a string, it will be ignored']);
+					obj.list(i,:)=[];
+					continue
+				end
+			end
+		end % }}}
+		function obj = addfield(obj,field,value) % {{{
+			if ischar(field),
+				obj.list{end+1,1} = field;
+				obj.list{end,2}   = value;
+			end
+		end % }}}
+		function obj = addfielddefault(obj,field,value) % {{{
+		%ADDFIELDDEFAULT - add a field to an options list if it does not exist
+			if ischar(field),
+				if ~exist(obj,field),
+					obj.list{end+1,1} = field;
+					obj.list{end,2}   = value;
+				end
+			end
+		end % }}}
+		function obj2 = AssignObjectFields(options,obj2) % {{{
+		%ASSIGNOBJECTFIELDS - assign object fields from options
+			listproperties=properties(obj2);
+			for i=1:size(options.list,1),
+				fieldname=options.list{i,1};
+				fieldvalue=options.list{i,2};
+				if ismember(fieldname,listproperties),
+					obj2.(fieldname)=fieldvalue;
+				else
+					disp(['WARNING: ''' fieldname ''' is not a property of ''' class(obj2) '''']);
+				end
+			end
+		end % }}}
+		function obj = changefieldvalue(obj,field,newvalue) % {{{
+		%CHANGEOPTIONVALUE - change the value of an option in an option list
+
+			%track occurance of field
+			lines=find(strcmpi(obj.list(:,1),field));
+
+			%replace value
+			if isempty(lines),
+				%add new field if not found
+				obj=addfield(obj,field,newvalue);
+			else
+				for i=1:length(lines),
+					obj.list{lines(i),2}=newvalue;
+				end
+			end
+		end % }}}
+		function obj = deleteduplicates(obj,warn) % {{{
+		%DELETEDUPLICATES - delete duplicates in an option list
+
+			%track the first occurance of each option
+			[dummy lines]=unique(obj.list(:,1),'first');
+			clear dummy
+
+			%warn user if requested
+			if warn,
+				numoptions=size(obj.list,1);
+				for i=1:numoptions,
+					if ~ismember(i,lines),
+						disp(['WARNING: option ' obj.list{i,1} ' appeared more than once. Only its first occurence will be kept'])
+					end
+				end
+			end
+
+			%remove duplicates from the options list
+			obj.list=obj.list(lines,:);
+		end % }}}
+		function disp(obj) % {{{
+			disp(sprintf('   functionname: %s',obj.functionname));
+			if ~isempty(obj.list),
+				disp(sprintf('   list: (%ix%i)\n',size(obj.list,1),size(obj.list,2)));
+				for i=1:size(obj.list,1),
+					if ischar(obj.list{i,2}),
+						disp(sprintf('     field: %-10s value: ''%s''',obj.list{i,1},obj.list{i,2}));
+					elseif isnumeric(obj.list{i,2}) & length(obj.list{i,2})==1,
+						disp(sprintf('     field: %-10s value: %g',obj.list{i,1},obj.list{i,2}));
+					elseif isnumeric(obj.list{i,2}) & length(obj.list{i,2})==2,
+						disp(sprintf('     field: %-10s value: [%g %g]',obj.list{i,1},obj.list{i,2}));
+					else
+						disp(sprintf('     field: %-10s value: (%ix%i)',obj.list{i,1},size(obj.list{i,2},1),size(obj.list{i,2},2)));
+					end
+				end
+			else
+				disp(sprintf('   list: empty'));
+			end
+		end % }}}
+		function bool = exist(obj,field) % {{{
+		%EXIST - check if the option exist
+
+			%some argument checking: 
+			if ((nargin~=2) | (nargout~=1)),
+				error('exist error message: bad usage');
+			end
+			if ~ischar(field),
+				error('exist error message: field should be a string');
+			end
+
+			%Recover option
+			bool=any(strcmpi(field,obj.list(:,1)));
+		end % }}}
+		function num = fieldoccurences(obj,field), % {{{
+		%FIELDOCCURENCES - get number of occurence of a field
+
+			%check input 
+			if ~ischar(field),
+				error('fieldoccurences error message: field should be a string');
+			end
+
+			%get number of occurence
+			num=sum(strcmpi(field,obj.list(:,1)));
+		end % }}}
+		function value = getfieldvalue(obj,field,varargin), % {{{
+		%GETOPTION - get the value of an option
+		%
+		%   Usage:
+		%      value=getfieldvalue(obj,field,varargin)
+		%
+		%   Find an option value from a field. A default option
+		%   can be given in input if the field does not exist
+		%
+		%   Examples:
+		%      value=getfieldvalue(options,'caxis');
+		%      value=getfieldvalue(options,'caxis',[0 2]);
+
+			%some argument checking: 
+			if nargin~=2 & nargin~=3,
+				help getfieldvalue
+				error('getfieldvalue error message: bad usage');
+			end
+
+			if ~ischar(field),
+				error('getfieldvalue error message: field should be a string');
+			end
+
+			%Recover option
+			for i=1:size(obj.list,1),
+				if strcmpi(obj.list{i,1},field)
+					value=obj.list{i,2};
+					return
+				end
+			end
+
+			%The option has not been found, output default if provided
+			if nargin==3,
+				value=varargin{1};
+			else
+				error(['error message: field ' field ' has not been provided by user (and no default value has been specified)'])
+			end
+		end % }}}
+		function obj = removefield(obj,field,warn)% {{{
+		%REMOVEFIELD - delete a field in an option list
+		%
+		%   Usage:
+		%      obj=removefield(obj,field,warn)
+		%
+		%   if warn==1 display an info message to wan user that
+		%   some of his options have been removed.
+
+			%check is field exist
+			if exist(obj,field),
+
+				%find where the field is located
+				lines=find(~strcmpi(obj.list(:,1),field));
+
+				%remove duplicates from the options list
+				obj.list=obj.list(lines,:);
+
+				%warn user if requested
+				if warn
+					disp(['removefield info: option ' field ' has been removed from the list of options.'])
+				end
+			end
+		end % }}}
+	end
+end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/plotoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/plotoptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/plotoptions.m	(revision 12004)
@@ -48,6 +48,19 @@
 			 end
 
-			 %first: build a pairoptions out of varargin:
+			 %go through varargin and build list (like pairoptions)
 			 rawoptions=pairoptions(varargin{:});
+			 numoptions = (nargin-1)/2;
+			 rawlist=cell(numoptions,2);
+			 for i=1:numoptions,
+				 if ischar(varargin{2*i-1}),
+					 rawlist{i,1}=varargin{2*i-1};
+					 rawlist{i,2}=varargin{2*i};
+				 else
+					 %option is not a string, ignore it
+					 disp(['WARNING: option number ' num2str(i) ' is not a string, it will be ignored']);
+					 rawlist(i,:)=[];
+					 continue
+				 end
+			 end
 
 			 %get figure number
@@ -72,17 +85,17 @@
 
 			 %process plot options
-			 for i=1:size(rawoptions.list,1),
+			 for i=1:size(rawlist,1),
 
 				 %If alloptions flag has is on, apply to all plots
-				 if (allflag & ~strcmpi(rawoptions.list{i,1},'data') & ~ismember('#',rawoptions.list{i,1})),
+				 if (allflag & ~strcmpi(rawlist{i,1},'data') & ~ismember('#',rawlist{i,1})),
 					 for j=1:numberofplots,
-						 opt.list{j}=addfield(opt.list{j},rawoptions.list{i,1},rawoptions.list{i,2});
+						 opt.list{j}=addfield(opt.list{j},rawlist{i,1},rawlist{i,2});
 					 end
 
 					 %option contains '#'
-				 elseif ismember('#',rawoptions.list{i,1}),
+				 elseif ismember('#',rawlist{i,1}),
 
 					 %get suplot(s) associated
-					 string=strsplit(rawoptions.list{i,1},'#');
+					 string=strsplit(rawlist{i,1},'#');
 					 plotnums=string{end};
 					 field=string{1};
@@ -102,5 +115,5 @@
 						 elseif strcmpi(plotnum,'all');
 							 for j=1:numberofplots,
-								 opt.list{j}=addfield(opt.list{j},field,rawoptions.list{i,2});
+								 opt.list{j}=addfield(opt.list{j},field,rawlist{i,2});
 							 end
 
@@ -113,5 +126,5 @@
 							 end
 							 for j=nums(1):nums(2),
-								 opt.list{j}=addfield(opt.list{j},field,rawoptions.list{i,2});
+								 opt.list{j}=addfield(opt.list{j},field,rawlist{i,2});
 							 end
 
@@ -122,5 +135,5 @@
 								 error(['opt error message: ' field ' cannot be assigned (' plotnum ' exceed maximum number of plot)']);
 							 end
-							 opt.list{str2num(plotnum)}=addfield(opt.list{str2num(plotnum)},field,rawoptions.list{i,2});
+							 opt.list{str2num(plotnum)}=addfield(opt.list{str2num(plotnum)},field,rawlist{i,2});
 						 end
 					 end
@@ -132,6 +145,6 @@
 					 j=1;
 					 while (j<=numberofplots),
-						 if ~exist(opt.list{j},rawoptions.list{i,1});
-							 opt.list{j}=addfield(opt.list{j},rawoptions.list{i,1},rawoptions.list{i,2});
+						 if ~exist(opt.list{j},rawlist{i,1});
+							 opt.list{j}=addfield(opt.list{j},rawlist{i,1},rawlist{i,2});
 							 break
 						 else
@@ -140,5 +153,5 @@
 					 end
 					 if j>numberofplots,
-						 disp(['plot info message: too many ''' rawoptions.list{i,1} ''' options']);
+						 disp(['plot info message: too many ''' rawlist{i,1} ''' options']);
 					 end
 				 end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/private.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/private.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/private.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/prognostic.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/prognostic.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/prognostic.m	(revision 12004)
@@ -18,11 +18,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/qmu.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/qmu.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/qmu.m	(revision 12004)
@@ -28,11 +28,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -48,27 +41,27 @@
 
 			if md.qmu.params.evaluation_concurrency~=1,
-				checkmessage(['model not consistent: concurrency should be set to 1 when running dakota in library mode']);
+				checkmessage(['concurrency should be set to 1 when running dakota in library mode']);
 			end
 			if ~isempty(md.qmu.partition),
 				if numel(md.qmu.partition)~=md.mesh.numberofvertices,
-					checkmessage(['model not consistent: user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']);
+					checkmessage(['user supplied partition for qmu analysis should have size md.mesh.numberofvertices x 1 ']);
 				end
 				if find(md.qmu.partition)>=md.mesh.numberofvertices,
-					checkmessage(['model not consistent: user supplied partition should be indexed from 0 (c-convention)']);
+					checkmessage(['user supplied partition should be indexed from 0 (c-convention)']);
 				end
 				if min(md.qmu.partition)~=0,
-					checkmessage(['model not consistent: partition vector not indexed from 0 on']);
+					checkmessage(['partition vector not indexed from 0 on']);
 				end
 				if max(md.qmu.partition)>=md.mesh.numberofvertices,
-					checkmessage(['model not consistent: partition vector cannot have maximum index larger than number of nodes']);
+					checkmessage(['partition vector cannot have maximum index larger than number of nodes']);
 				end
 				if ~isempty(find(md.qmu.partition<0)),
-					checkmessage(['model not consistent: partition vector cannot have values less than 0']);
+					checkmessage(['partition vector cannot have values less than 0']);
 				end
 				if ~isempty(find(md.qmu.partition>=md.qmu.numberofpartitions)),
-					checkmessage(['model not consistent: partition vector cannot have values more than md.qmu.numberofpartitions-1']);
+					checkmessage(['partition vector cannot have values more than md.qmu.numberofpartitions-1']);
 				end
 				if max(md.qmu.partition)>=md.qmu.numberofpartitions,
-					checkmessage(['model not consistent: for qmu analysis, partitioning vector cannot go over npart, number of partition areas']);
+					checkmessage(['for qmu analysis, partitioning vector cannot go over npart, number of partition areas']);
 				end
 			end
@@ -76,5 +69,5 @@
 			if ~strcmpi(md.cluster.name,'none'),
 				if md.settings.waitonlock==0,
-					checkmessage(['model is not correctly configured: waitonlock should be activated when running qmu in parallel mode!']);
+					checkmessage(['waitonlock should be activated when running qmu in parallel mode!']);
 				end
 			end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/radaroverlay.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/radaroverlay.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/radaroverlay.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/rifts.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/rifts.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/rifts.m	(revision 12004)
@@ -14,11 +14,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -36,5 +29,5 @@
 			if numrifts,
 				if ~(md.mesh.dimension==2),
-					checkmessage(['model not consistent: models with rifts are only supported in 2d for now!']);
+					checkmessage(['models with rifts are only supported in 2d for now!']);
 				end
 				if ~isstruct(obj.riftstruct),
Index: /issm/branches/trunk-jpl-damage/src/m/classes/settings.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/settings.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/settings.m	(revision 12004)
@@ -17,11 +17,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/solver.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/solver.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/solver.m	(revision 12004)
@@ -4,7 +4,8 @@
 %      obj=solver();
 
-classdef solver
+classdef solver < dynamicprops
     properties (SetAccess=public) 
-		 options=cell(0,0);
+		 NoneAnalysis = struct();
+		 %The other properties are dynamic
 	 end
 	 methods
@@ -13,25 +14,8 @@
 				 case 0
 					 obj=setdefaultparameters(obj);
-				 case 1
-					 in=varargin{1};
-					 if (isa(in,'numeric') & in==0),
-						 % requesting templates do nothing
-					 else
-						 error('constructor not supported');
-					 end 
 				 otherwise
 					 error('constructor not supported');
 				 end
 			 end % }}}
-		 function obj = setdefaultparameters(obj) % {{{
-
-			 %MUMPS is the default solver
-			 if ismumps,
-				 obj.options={'NoneAnalysis',mumpsoptions};
-			 else
-				 obj.options={'NoneAnalysis',iluasmoptions};
-			 end
-
-		 end % }}}
 		 function obj = addoptions(obj,analysis,solveroptions) % {{{1
 
@@ -39,35 +23,46 @@
 			 analysis=EnumToString(analysis);
 
-			 %first, find out if analysis has already been supplied
-			 found=false;
-			 for i=1:size(obj.options,1),
-				 inanalysis=obj.options{i,1};
-				 if strcmp(inanalysis,analysis),
-					 found=true;
-					 obj.options{i,1} = analysis;
-					 obj.options{i,2} = solveroptions;
-					 break;
-				 end
+			 %Create dynamic property if property does not exist yet
+			 if ~ismember(analysis,properties(obj)),
+				 obj.addprop(analysis);
 			 end
 
-			 if ~found,
-				 obj.options{end+1,1}= analysis;
-				 obj.options{end,2}  = solveroptions;
-			 end
+			 %Add solver options to analysis
+			 obj.(analysis) = solveroptions;
 		 end
 		 %}}}
+		 function obj = setdefaultparameters(obj) % {{{
+
+			 %MUMPS is the default solver
+			 if ismumps,
+				 obj.NoneAnalysis=mumpsoptions;
+			 else
+				 obj.NoneAnalysis=iluasmoptions;
+			 end
+
+		 end % }}}
+		 function disp(obj) % {{{
+			 analyses=properties(obj);
+			 disp(sprintf('List of solver options per analysis:\n'));
+			 for i=1:numel(analyses),
+				 analysis=analyses{i};
+				 disp([analysis ':']);
+				 disp(obj.(analysis));
+			 end
+		 end % }}}
 		 function checkconsistency(obj,md,solution,analyses) % {{{
-			 for i=1:size(obj.options,1),
-				 if ~ischar(obj.options{i,1}),
-					 checkmessage('solver is not well formatted: Analyses are not strings');
+			 analyses=properties(obj);
+			 for i=1:numel(analyses),
+				 if isempty(fieldnames(obj.(analyses{i})))
+					 checkmessage(['md.solver.' analyses{i} ' is empty']);
 				 end
 			 end
 		 end % }}}
 		 function PetscFile(solver,filename) % {{{
-			 %PETSCFILE - build petsc file
-			 %
-			 %   Build a Petsc compatible options file, from the solver model field  + return options string
-			 %
-			 %   Usage:     PetscFile(solver,filename);
+		 %PETSCFILE - build petsc file
+		 %
+		 %   Build a Petsc compatible options file, from the solver model field  + return options string
+		 %
+		 %   Usage:     PetscFile(solver,filename);
 
 			 %open file for writing
@@ -81,7 +76,8 @@
 
 			 %start writing options
-			 for i=1:size(solver.options,1),
-				 analysis=solver.options{i,1};
-				 options=solver.options{i,2};
+			 analyses=properties(solver);
+			 for i=1:numel(analyses),
+				 analysis=analyses{i};
+				 options=solver.(analysis);
 
 				 %first write analysis:
@@ -89,22 +85,21 @@
 
 				 %now, write options
-				 for j=1:size(options,2),
-					 option=options{j};
-					 if isempty(option),
-						 %do nothing
-					 elseif length(option)==1,
+				 optionslist=fieldnames(options);
+				 for j=1:numel(optionslist),
+					 optionname=optionslist{j};
+					 optionvalue=options.(optionname);
+
+					 if isempty(optionvalue),
 						 %this option has only one argument
-						 fprintf(fid,'-%s\n',option{1});
-					 elseif length(option)==2,
+						 fprintf(fid,'-%s\n',optionname);
+					 else
 						 %option with value. value can be string or scalar
-						 if isscalar(option{2}),
-							 fprintf(fid,'-%s %g\n',option{1},option{2});
-						 elseif ischar(option{2}),
-							 fprintf(fid,'-%s %s\n',option{1},option{2});
+						 if isscalar(optionvalue),
+							 fprintf(fid,'-%s %g\n',optionname,optionvalue);
+						 elseif ischar(optionvalue),
+							 fprintf(fid,'-%s %s\n',optionname,optionvalue);
 						 else
-							 error(['PetscFile error: option #' num2str(j) ' is not well formatted']);
+							 error(['PetscFile error: option ' optionname ' is not well formatted']);
 						 end
-					 else 
-						 error(['PetscFile error: option #' num2str(j) ' is not well formatted']);
 					 end
 				 end
@@ -113,37 +108,4 @@
 			 fclose(fid);
 		 end %}}}
-		 function disp(obj) % {{{1
-			disp(sprintf('   solver parameters:'));
-
-			for i=1:size(obj.options,1),
-				analysis=obj.options{i,1};
-				ioptions=obj.options{i,2};
-
-				string='';
-				for i=1:length(ioptions),
-					option=ioptions{i};
-					if isempty(option),
-						%do nothing
-					elseif length(option)==1,
-						%this option has only one argument
-						string=[string ' -' option{1}];
-					elseif length(option)==2,
-						%option with value. value can be string or scalar
-						if isscalar(option{2}),
-							string=[string ' -' option{1} ' ' num2str(option{2})];
-						elseif ischar(option{2}),
-							string=[string ' -' option{1} ' ' option{2}];
-						else
-							error(['PetscString error: option #' num2str(i) ' is not well formatted']);
-						end
-					else 
-						error(['PetscString error: option #' num2str(i) ' is not well formatted']);
-					end
-				end
-
-				disp(sprintf('   %s -> ''%s''',analysis,string));
-			end
-		 end
-		 %}}}
 	 end
  end
Index: /issm/branches/trunk-jpl-damage/src/m/classes/steadystate.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/steadystate.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/steadystate.m	(revision 12004)
@@ -15,11 +15,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -39,9 +32,9 @@
 
 			if md.timestepping.time_step~=0,
-				checkmessage(['model not consistent: for a steadystate computation, timestepping.time_step must be zero.']);
+				checkmessage(['for a steadystate computation, timestepping.time_step must be zero.']);
 			end
 
 			if isnan(md.diagnostic.reltol),
-				checkmessage(['model not consistent: for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']);
+				checkmessage(['for a steadystate computation, diagnostic.reltol (relative convergence criterion) must be defined!']);
 			end
 		end % }}}
Index: /issm/branches/trunk-jpl-damage/src/m/classes/surfaceforcings.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/surfaceforcings.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/surfaceforcings.m	(revision 12004)
@@ -14,11 +14,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/thermal.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/thermal.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/thermal.m	(revision 12004)
@@ -19,11 +19,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/timestepping.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/timestepping.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/timestepping.m	(revision 12004)
@@ -6,6 +6,7 @@
 classdef timestepping
 	properties (SetAccess=public) 
+		start_time      = 0;
+		final_time      = 0;
 		time_step       = 0;
-		final_time      = 0;
 		time_adapt      = 0;
 		cfl_coefficient = 0;
@@ -16,11 +17,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
@@ -41,12 +35,19 @@
 		function checkconsistency(obj,md,solution,analyses) % {{{
 
+			checkfield(md,'timestepping.start_time','numel',1,'NaN',1);
+			checkfield(md,'timestepping.final_time','numel',1,'NaN',1);
+			checkfield(md,'timestepping.time_step','numel',1,'>=',0,'NaN',1);
 			checkfield(md,'timestepping.time_adapt','numel',1,'values',[0 1]);
 			checkfield(md,'timestepping.cfl_coefficient','numel',1,'>',0,'<=',1);
+			if obj.final_time-obj.start_time<0,
+				checkmessage('timestepping.final_time should be larger than timestepping.start_time');
+			end 
 		end % }}}
 		function disp(obj) % {{{
 			disp(sprintf('   timestepping parameters:'));
 
+			fielddisplay(obj,'start_time','simulation starting time [yrs]');
+			fielddisplay(obj,'final_time','final time to stop the simulation [yrs]');
 			fielddisplay(obj,'time_step','length of time steps [yrs]');
-			fielddisplay(obj,'final_time','final time to stop the simulation [yrs]');
 			fielddisplay(obj,'time_adapt','use cfl condition to define time step ? (0 or 1) ');
 			fielddisplay(obj,'cfl_coefficient','coefficient applied to cfl condition');
@@ -54,6 +55,7 @@
 		end % }}}
 		function marshall(obj,fid) % {{{
+			WriteData(fid,'object',obj,'fieldname','start_time','format','Double');
+			WriteData(fid,'object',obj,'fieldname','final_time','format','Double');
 			WriteData(fid,'object',obj,'fieldname','time_step','format','Double');
-			WriteData(fid,'object',obj,'fieldname','final_time','format','Double');
 			WriteData(fid,'object',obj,'fieldname','time_adapt','format','Boolean');
 			WriteData(fid,'object',obj,'fieldname','cfl_coefficient','format','Double');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/transient.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/transient.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/transient.m	(revision 12004)
@@ -17,11 +17,4 @@
 				case 0
 					obj=setdefaultparameters(obj);
-				case 1
-					in=varargin{1};
-					if (isa(in,'numeric') & in==0),
-						% requesting templates do nothing
-					else
-						error('constructor not supported');
-					end 
 				otherwise
 					error('constructor not supported');
Index: /issm/branches/trunk-jpl-damage/src/m/classes/verbose.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/classes/verbose.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/classes/verbose.m	(revision 12004)
@@ -37,34 +37,34 @@
 		function verbose=verbose(varargin) % {{{1
 
-			if nargin==1,
+			switch(nargin),
+				case 0,
+					%Don't do anything
+				case 1,
+					binary=varargin{1};
+					if ischar(binary),
+						if strcmpi(binary,'all'),
+							binary=2^11-1; %all ones
+							verbose=BinaryToVerbose(verbose,binary);
+							verbose.solver=false; %Do not use by default
+						else
+							binary=bin2dec(binary);
+							verbose=BinaryToVerbose(verbose,binary);
+						end
+					end 
+				otherwise,
+					%Use options to initialize object
+					verbose=AssignObjectFields(pairoptions(varargin{:}),verbose);
 
-				binary=varargin{1};
-				if ischar(binary),
-					if strcmpi(binary,'all'),
-						binary=2^11-1; %all ones
-						verbose=BinaryToVerbose(verbose,binary);
-						verbose.solver=false; %Do not use by default
-					else
-						binary=bin2dec(binary);
-						verbose=BinaryToVerbose(verbose,binary);
-					end
-				end 
-			else
-
-				options=pairoptions(varargin{:});
-				for i=1:size(options.list,1),
-					fieldname=options.list{i,1};
-					fieldvalue=options.list{i,2};
-					if ismember(fieldname,properties('verbose')),
-						if islogical(fieldvalue) | isnumeric(fieldvalue),
+					%Cast to logicals
+					listproperties=properties('verbose');
+					for i=1:numel(listproperties),
+						fieldname=listproperties{i};
+						fieldvalue=verbose.(fieldname);
+						if (islogical(fieldvalue) | isnumeric(fieldvalue)) & numel(fieldvalue)==1,
 							verbose.(fieldname)=logical(fieldvalue);
 						else
 							error('verbose supported field values are logicals only (true or false)');
 						end
-					else
-						disp(['''' fieldname ''' is not a property of verbose verbose']);
 					end
-				end
-
 			end
 		end
Index: /issm/branches/trunk-jpl-damage/src/m/enum/ContourEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/ContourEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/ContourEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=ContourEnum()
+%CONTOURENUM - Enum of Contour
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=ContourEnum()
+
+macro=StringToEnum('Contour');
Index: /issm/branches/trunk-jpl-damage/src/m/enum/DebugPetscProfilingEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/DebugPetscProfilingEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/DebugPetscProfilingEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=DebugPetscProfilingEnum()
+%DEBUGPETSCPROFILINGENUM - Enum of DebugPetscProfiling
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=DebugPetscProfilingEnum()
+
+macro=StringToEnum('DebugPetscProfiling');
Index: sm/branches/trunk-jpl-damage/src/m/enum/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingCurrentFlopsEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingCurrentFlopsEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingCurrentFlopsEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=PetscProfilingCurrentFlopsEnum()
+%PETSCPROFILINGCURRENTFLOPSENUM - Enum of PetscProfilingCurrentFlops
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=PetscProfilingCurrentFlopsEnum()
+
+macro=StringToEnum('PetscProfilingCurrentFlops');
Index: /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingCurrentMemEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingCurrentMemEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingCurrentMemEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=PetscProfilingCurrentMemEnum()
+%PETSCPROFILINGCURRENTMEMENUM - Enum of PetscProfilingCurrentMem
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=PetscProfilingCurrentMemEnum()
+
+macro=StringToEnum('PetscProfilingCurrentMem');
Index: /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingSolutionTimeEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingSolutionTimeEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/PetscProfilingSolutionTimeEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=PetscProfilingSolutionTimeEnum()
+%PETSCPROFILINGSOLUTIONTIMEENUM - Enum of PetscProfilingSolutionTime
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=PetscProfilingSolutionTimeEnum()
+
+macro=StringToEnum('PetscProfilingSolutionTime');
Index: /issm/branches/trunk-jpl-damage/src/m/enum/SaveResultsEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/SaveResultsEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/SaveResultsEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=SaveResultsEnum()
+%SAVERESULTSENUM - Enum of SaveResults
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=SaveResultsEnum()
+
+macro=StringToEnum('SaveResults');
Index: /issm/branches/trunk-jpl-damage/src/m/enum/StepEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/StepEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/StepEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=StepEnum()
+%STEPENUM - Enum of Step
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=StepEnum()
+
+macro=StringToEnum('Step');
Index: /issm/branches/trunk-jpl-damage/src/m/enum/TimesteppingStartTimeEnum.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/enum/TimesteppingStartTimeEnum.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/enum/TimesteppingStartTimeEnum.m	(revision 12004)
@@ -0,0 +1,11 @@
+function macro=TimesteppingStartTimeEnum()
+%TIMESTEPPINGSTARTTIMEENUM - Enum of TimesteppingStartTime
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/EnumDefinitions/Synchronize.sh
+%            Please read src/c/EnumDefinitions/README for more information
+%
+%   Usage:
+%      macro=TimesteppingStartTimeEnum()
+
+macro=StringToEnum('TimesteppingStartTime');
Index: sm/branches/trunk-jpl-damage/src/m/kml/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/kml/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/model/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,2 +1,0 @@
-SUBDIRS = plot mesh display parameterization partition solvers
-bin_SCRIPTS=*.m  
Index: /issm/branches/trunk-jpl-damage/src/m/model/SectionValues.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/SectionValues.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/SectionValues.m	(revision 12004)
@@ -12,5 +12,5 @@
 if ischar(infile),
 	%read infile:
-	contempt=expread(infile,1);
+	contempt=expread(infile);
 	nods=contempt.nods;
 	x=contempt.x;
Index: /issm/branches/trunk-jpl-damage/src/m/model/collapse.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/collapse.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/collapse.m	(revision 12004)
@@ -101,4 +101,8 @@
 md.mask.vertexonwater=project2d(md,md.mask.vertexonwater,1);
 
+%lat long
+md.mesh.lat=project2d(md,md.mesh.lat,1);
+md.mesh.long=project2d(md,md.mesh.long,1);
+
 %Initialize with the 2d mesh
 md.mesh.x=md.mesh.x2d;
Index: sm/branches/trunk-jpl-damage/src/m/model/display/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/display/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/model/extrude.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/extrude.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/extrude.m	(revision 12004)
@@ -125,4 +125,8 @@
 %Ok, now deal with the other fields from the 2d mesh:
 
+%lat long
+md.mesh.lat=project3d(md,'vector',md.mesh.lat,'type','node');
+md.mesh.long=project3d(md,'vector',md.mesh.long,'type','node');
+
 %drag coefficient is limited to nodes that are on the bedrock.
 md.friction.coefficient=project3d(md,'vector',md.friction.coefficient,'type','node','layer',1);
Index: /issm/branches/trunk-jpl-damage/src/m/model/marshall.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/marshall.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/marshall.m	(revision 12004)
@@ -22,5 +22,5 @@
 
 	%Some properties do not need to be marshalled
-	if ismember(field,{'results' 'debug' 'radaroverlay' 'solver' 'cluster'  'flaim' 'private'}),
+	if ismember(field,{'results' 'radaroverlay' 'solver' 'cluster'  'flaim' 'private'}),
 		continue;
 	end
Index: sm/branches/trunk-jpl-damage/src/m/model/mesh/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/mesh/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/model/mesh/triangle.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/mesh/triangle.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/mesh/triangle.m	(revision 12004)
@@ -39,7 +39,7 @@
 %Mesh using TriMesh
 if strcmp(riftname,''),
-	[md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers]=TriMesh(domainname,area,'yes');
+	[md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.segments,md.mesh.segmentmarkers]=TriMesh(domainname,area,true);
 else
-	[elements,x,y,segments,segmentmarkers]=TriMesh(domainname,riftname,area,'yes');
+	[elements,x,y,segments,segmentmarkers]=TriMeshRifts(domainname,riftname,area,'yes');
 
 	%check that all the created nodes belong to at least one element
Index: sm/branches/trunk-jpl-damage/src/m/model/parameterization/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/parameterization/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/model/partition/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/partition/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/model/petscversion.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/petscversion.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/petscversion.m	(revision 12004)
@@ -5,4 +5,6 @@
 %       PETSC_VERSION=petscversion();
 
+%default
+PETSC_VERSION=3;
 
 configfile=[issmtier() '/config.h'];
Index: sm/branches/trunk-jpl-damage/src/m/model/plot/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/plot/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_contour.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_contour.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_contour.m	(revision 12004)
@@ -9,4 +9,5 @@
 %process data and model
 [x y z index is2d isplanet]=processmesh(md,[],options);
+options=removefield(options,'log',0);
 [data datatype]=processdata(md,datain,options);
 
Index: /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_overlay.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_overlay.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_overlay.m	(revision 12004)
@@ -80,7 +80,5 @@
 	%hue (H)
 	h_data=(data_grid-data_min)/(data_max-data_min+eps);
-	if radaronly,
-		h_data(:)=0;
-	end
+	if radaronly, h_data(:)=0; end
 	%saturation (S)
 	s_data=max(min((0.1+h_data).^(1/transparency),1),0);
@@ -89,7 +87,5 @@
 	h_data=1-(data_grid-data_min)/(data_max-data_min+eps)*0.7;
 	%h_data=(data_grid-data_min)/(data_max-data_min)*2/3;
-	if radaronly,
-		h_data(:)=0;
-	end
+	if radaronly, h_data(:)=0; end
 	%saturation (S)
 	s_data=max(min((0.1+h_data).^(1/transparency),1),0);
@@ -113,4 +109,7 @@
 v_data=radar/max(radar(:)); %use radar power as intensity
 
+%Change background from black to white
+%pos=find(v_data==0);v_data(pos)=1;
+
 %Transform HSV to RGB
 image_hsv=zeros(size(data_grid,1),size(data_grid,2),3);
@@ -130,5 +129,6 @@
 	hold on
 	A=elements(:,1); B=elements(:,2); C=elements(:,3); 
-	patch('Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none','EdgeColor',getfieldvalue(options,'edgecolor'));
+	patch('Faces',[A B C],'Vertices', [x y z],'FaceVertexCData',zeros(size(x)),'FaceColor','none',...
+		'EdgeColor',getfieldvalue(options,'edgecolor'),'LineWidth',getfieldvalue(options,'linewidth',1));
 end
 
Index: /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_section.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_section.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/plot/plot_section.m	(revision 12004)
@@ -111,8 +111,7 @@
 
 			%plot section value
-			hold on;
-			subplot(nlines,ncols,index1)
-			%subplot(1,3,[2 3])
+			if(i==1), subplot(nlines,ncols,index1); end
 			plot(s,data_s,'color',color(i,:),'LineWidth',getfieldvalue(options,'linewidth',1))
+			hold on
 
 
Index: /issm/branches/trunk-jpl-damage/src/m/model/plot/plotmodel.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/plot/plotmodel.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/plot/plotmodel.m	(revision 12004)
@@ -48,4 +48,5 @@
 		for i=1:numberofplots,
 			plot_manager(getfieldvalue(options.list{i},'model',md),options.list{i},subplotwidth,nlines,ncols,i);
+			%cbfreeze;
 		end
 	catch me,
Index: /issm/branches/trunk-jpl-damage/src/m/model/slope.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/slope.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/slope.m	(revision 12004)
@@ -27,6 +27,6 @@
 
 if md.mesh.dimension==3,
-	sx=project3d(md,sx,'element');
-	sy=project3d(md,sy,'element');
+	sx=project3d(md,'vector',sx,'type','element');
+	sy=project3d(md,'vector',sy,'type','element');
 	s=sqrt(sx.^2+sy.^2);
 end
Index: /issm/branches/trunk-jpl-damage/src/m/model/solveparallel.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solveparallel.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solveparallel.m	(revision 12004)
@@ -11,4 +11,10 @@
 	md=loadresultsfromcluster(md);
 else
+
+	%In parallel mode, we need to make sure we have PETSC support, otherwise, we run with only one cpu: 
+	if ~ispetsc,
+		disp('PETSC support not included, running on 1 cpu only!');
+		cluster.np=1;
+	end
 
 	%First, build a runtime name that is unique, that we will use to create 
Index: sm/branches/trunk-jpl-damage/src/m/model/solvers/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/asmoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/asmoptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/asmoptions.m	(revision 12004)
@@ -1,3 +1,3 @@
-function options=asmoptions(varargin)
+function asm=asmoptions(varargin)
 %ASMOPTIONS - return Additive Shwartz Method petsc options
 %
@@ -6,26 +6,13 @@
 			 
 %retrieve options provided in varargin
-arguments=pairoptions(varargin{:});
+options=pairoptions(varargin{:});
+asm=struct();
 
 %default asm options
-options={{'mat_type','aij'},{'ksp_type','gmres'},{'pc_type','asm'},{'sub_pc_type','lu'},{'pc_asm_overlap',3},{'ksp_max_it',100},{'ksp_rtol',1e-30'}};
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
+asm.mat_type=getfieldvalue(options,'mat_type','aij');
+asm.ksp_type=getfieldvalue(options,'ksp_type','gmres');
+asm.pc_type=getfieldvalue(options,'pc_type','asm');
+asm.sub_pc_type=getfieldvalue(options,'sub_pc_type','lu');
+asm.pc_asm_overlap=getfieldvalue(options,'pc_asm_overlap',3);
+asm.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
+asm.ksp_rtol=getfieldvalue(options,'ksp_rtol',1e-30);
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/iluasmoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/iluasmoptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/iluasmoptions.m	(revision 12004)
@@ -1,4 +1,4 @@
-function options=iluasmoptions(varargin)
-%ASMOPTIONS - return Additive Shwartz Method with ILU preconditioner petsc options
+function iluasm=iluasmoptions(varargin)
+%ILUASMOPTIONS - 
 %
 %   Usage:
@@ -6,26 +6,13 @@
 			 
 %retrieve options provided in varargin
-arguments=pairoptions(varargin{:});
+options=pairoptions(varargin{:});
+iluasm=struct();
 
 %default iluasm options
-options={{'mat_type','aij'},{'ksp_type','gmres'},{'pc_type','asm'},{'sub_pc_type','ilu'},{'pc_asm_overlap',5},{'ksp_max_it',100},{'ksp_rtol',1e-15'}};
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
+iluasm.mat_type=getfieldvalue(options,'mat_type''','aij');
+iluasm.ksp_type=getfieldvalue(options,'ksp_type''','gmres');
+iluasm.pc_type=getfieldvalue(options,'pc_type''','asm');
+iluasm.sub_pc_type=getfieldvalue(options,'sub_pc_type''','ilu');
+iluasm.pc_asm_overlap=getfieldvalue(options,'pc_asm_overlap',5);
+iluasm.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
+iluasm.ksp_rtol=getfieldvalue(options,'ksp_rtol',1e-15);
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/jacobiasmoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/jacobiasmoptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/jacobiasmoptions.m	(revision 12004)
@@ -1,3 +1,3 @@
-function options=jacobiasmoptions(varargin)
+function jacobiasm=jacobiasmoptions(varargin)
 %ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
 %
@@ -6,26 +6,13 @@
 			 
 %retrieve options provided in varargin
-arguments=pairoptions(varargin{:});
+options=pairoptions(varargin{:});
+jacobiasm=struct();
 
 %default jacobiasm options
-options={{'mat_type','aij'},{'ksp_type','gmres'},{'pc_type','asm'},{'sub_pc_type','jacobi'},{'pc_asm_overlap',3},{'ksp_max_it',100},{'ksp_rtol',1e-15'}};
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
+jacobiasm.mat_type=getfieldvalue(options,'mat_type','aij');
+jacobiasm.ksp_type=getfieldvalue(options,'ksp_type','gmres');
+jacobiasm.pc_type=getfieldvalue(options,'pc_type','asm');
+jacobiasm.sub_pc_type=getfieldvalue(options,'sub_pc_type','jacobi');
+jacobiasm.pc_asm_overlap=getfieldvalue(options,'pc_asm_overlap',3);
+jacobiasm.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
+jacobiasm.ksp_rtol=getfieldvalue(options,'ksp_rtol',1e-15);
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/jacobicgoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/jacobicgoptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/jacobicgoptions.m	(revision 12004)
@@ -1,3 +1,3 @@
-function options=jacobiasmoptions(varargin)
+function jacobicg=jacobiacgoptions(varargin)
 %ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
 %
@@ -6,26 +6,10 @@
 			 
 %retrieve options provided in varargin
-arguments=pairoptions(varargin{:});
+options=pairoptions(varargin{:});
+jacobicg=struct();
 
 %default jacobiasm options
-options={{'mat_type','aij'},{'ksp_type','cg'},{'ksp_max_it',100},{'ksp_rtol',1e-15'}};
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
+jacobicg.mat_type=getfieldvalue(options,'mat_type','aij');
+jacobicg.ksp_type=getfieldvalue(options,'ksp_type','cg');
+jacobicg.ksp_max_it=getfieldvalue(options,'ksp_max_it',100);
+jacobicg.ksp_rtol=getfieldvalue(options,'ksp_rtol',1e-15);
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/matlaboptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/matlaboptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/matlaboptions.m	(revision 12004)
@@ -1,3 +1,3 @@
-function options=matlaboptions(varargin)
+function maltab=matlaboptions(varargin)
 %MATLABOPTIONS - return Matlab petsc options
 %
@@ -6,26 +6,7 @@
 			 
 %retrieve options provided in varargin
-arguments=pairoptions(varargin{:});
+options=pairoptions(varargin{:});
+maltab=struct();
 
 %default matlab options
-options={{'ksp_type','matlab'}};
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
+maltab.ksp_type='matlab';
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/mumpsoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/mumpsoptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/mumpsoptions.m	(revision 12004)
@@ -1,3 +1,3 @@
-function options=mumpsoptions(varargin)
+function mumps=mumpsoptions(varargin)
 %MUMPSOPTIONS - return MUMPS direct solver  petsc options
 %
@@ -6,33 +6,22 @@
 
 %retrieve options provided in varargin
-arguments=pairoptions(varargin{:});
+options=pairoptions(varargin{:});
+mumps=struct();
 
 %default mumps options
 PETSC_VERSION=petscversion();
 if PETSC_VERSION==2,
-	options={{'mat_type','aijmumps'},{'ksp_type','preonly'},{'pc_type','lu'},{'mat_mumps_icntl_14',120},{'pc_factor_shift_positive_definite','true'}};
+	mumps.mat_type=getfieldvalue(options,'mat_type','aijmumps');
+	mumps.ksp_type=getfieldvalue(options,'ksp_type','preonly');
+	mumps.pc_type=getfieldvalue(options,'pc_type','lu');
+	mumps.mat_mumps_icntl_14=getfieldvalue(options,'mat_mumps_icntl_14',120);
+	mumps.pc_factor_shift_positive_definite=getfieldvalue(options,'pc_factor_shift_positive_definite','true');
 end
 if PETSC_VERSION==3,
-	options={{'mat_type','mpiaij'},{'ksp_type','preonly'},{'pc_type','lu'},{'pc_factor_mat_solver_package','mumps'},{'mat_mumps_icntl_14',120},{'pc_factor_shift_positive_definite','true'}};
-
+	mumps.mat_type=getfieldvalue(options,'mat_type','mpiaij');
+	mumps.ksp_type=getfieldvalue(options,'ksp_type','preonly');
+	mumps.pc_type=getfieldvalue(options,'pc_type','lu');
+	mumps.pc_factor_mat_solver_package=getfieldvalue(options,'pc_factor_mat_solver_package','mumps');
+	mumps.mat_mumps_icntl_14=getfieldvalue(options,'mat_mumps_icntl_14',120);
+	mumps.pc_factor_shift_positive_definite=getfieldvalue(options,'pc_factor_shift_positive_definite','true');
 end
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/soroptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/soroptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/soroptions.m	(revision 12004)
@@ -1,3 +1,3 @@
-function options=soroptions(varargin)
+function sor=soroptions(varargin)
 %SOROPTIONS - return Relaxation Solver petsc options
 %
@@ -6,26 +6,11 @@
 			 
 %retrieve options provided in varargin
-arguments=pairoptions(varargin{:});
+options=pairoptions(varargin{:});
+sor=struct();
 
 %default sor options
-options={{'mat_type','aij'},{'ksp_type','cg'},{'pc_type','sor'},{'pc_sor_omega',1.1},{'pc_sor_its',2}};
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
+sor.mat_type=getfieldvalue(options,'mat_type','aij');
+sor.ksp_type=getfieldvalue(options,'ksp_type','cg');
+sor.pc_type=getfieldvalue(options,'pc_type','sor');
+sor.pc_sor_omega=getfieldvalue(options,'pc_sor_omega',1.1);
+sor.pc_sor_its=getfieldvalue(options,'pc_sor_its',2);
Index: /issm/branches/trunk-jpl-damage/src/m/model/solvers/stokesoptions.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/model/solvers/stokesoptions.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/model/solvers/stokesoptions.m	(revision 12004)
@@ -1,3 +1,3 @@
-function options=stokesoptions(varargin)
+function stokes=stokesoptions(varargin)
 %STOKESOPTIONS - return STOKES multi-physics solver petsc options
 %
@@ -7,4 +7,5 @@
 %retrieve options provided in varargin
 arguments=pairoptions(varargin{:});
+stokes=struct();
 
 %default stokes options
@@ -14,26 +15,14 @@
 end
 if PETSC_VERSION==3,
-	options={{'mat_type','mpiaij'},{'ksp_max_it',1000},{'ksp_type','gmres'},{'pc_type','fieldsplit'},{'pc_field_split_type','schur'},...
-	{'fieldsplit_0_pc_type','hypre'},{'fieldsplit_0_ksp_type','gmres'},{'fieldsplit_0_pc_hypre_type','boomerang'},...
-	{'fieldsplit_1_pc_type','jacobi'},{'fieldsplit_1_ksp_type','preonly'},{'issm_option_solver','stokes'}};
+	stokes.mat_type=getfieldvalue(options,'mat_type','mpiaij');
+	stokes.ksp_max_it=getfieldvalue(options,'ksp_max_it',1000);
+	stokes.ksp_type=getfieldvalue(options,'ksp_type','gmres');
+	stokes.pc_type=getfieldvalue(options,'pc_type','fieldsplit');
+	stokes.pc_field_split_type=getfieldvalue(options,'pc_field_split_type','schur');
+	stokes.fieldsplit_0_pc_type=getfieldvalue(options,'fieldsplit_0_pc_type','hypre');
+	stokes.fieldsplit_0_ksp_type=getfieldvalue(options,'fieldsplit_0_ksp_type','gmres');
+	stokes.fieldsplit_0_pc_hypre_type=getfieldvalue(options,'fieldsplit_0_pc_hypre_type','boomerang');
+	stokes.fieldsplit_1_pc_type=getfieldvalue(options,'fieldsplit_1_pc_type','jacobi');
+	stokes.fieldsplit_1_ksp_type=getfieldvalue(options,'fieldsplit_1_ksp_type','preonly');
+	stokes.issm_option_solver=getfieldvalue(options,'issm_option_solver','stokes');
 end
-
-%now, go through our arguments, and write over default options.
-for i=1:size(arguments.list,1),
-	arg1=arguments.list{i,1};
-	arg2=arguments.list{i,2};
-	found=0;
-	for j=1:size(options,2),
-		joption=options{j};
-		if strcmpi(joption{1},arg1),
-			joption{2}=arg2;
-			options{j}=joption;
-			found=1;
-			break;
-		end
-	end
-	if ~found,
-		%this option did not exist, add it: 
-		options{end+1}={arg1,arg2};
-	end
-end
Index: sm/branches/trunk-jpl-damage/src/m/planet/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/planet/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/qmu/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/qmu/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/shared/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/shared/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/AnalysisConfiguration.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/AnalysisConfiguration.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/AnalysisConfiguration.m	(revision 12004)
@@ -5,5 +5,7 @@
 %      [analyses, numanalyses]=AnalysisConfiguration(solutiontype);
 
-
+if ~isnumeric(solutiontype)
+	solutiontype=StringToEnum(solutiontype);
+end
 
 switch solutiontype,
Index: sm/branches/trunk-jpl-damage/src/m/solutions/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/adjointbalancethickness_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/adjointbalancethickness_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/adjointbalancethickness_core.m	(revision 12004)
@@ -6,6 +6,5 @@
 
 	%recover parameters common to all solutions
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 
 	%set analysis type to compute velocity:
@@ -24,5 +23,5 @@
 	%Save results
 	femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,AdjointEnum);
-	if(solution_type==AdjointSolutionEnum & ~control_analysis)
+	if(save_results),
 		issmprintf(VerboseSolution,'   saving results');
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,AdjointEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/adjointdiagnostic_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/adjointdiagnostic_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/adjointdiagnostic_core.m	(revision 12004)
@@ -7,7 +7,5 @@
 	%recover parameters common to all solutions
 	isstokes=femmodel.parameters.FlowequationIsstokes;
-	dim=femmodel.parameters.MeshDimension;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 	conserve_loads=true;
 
@@ -26,5 +24,5 @@
 
 	%save results
-	if(solution_type==AdjointSolutionEnum & ~control_analysis)
+	if(save_results),
 		issmprintf(VerboseSolution,'   saving results');
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,AdjointxEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/balancethickness_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/balancethickness_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/balancethickness_core.m	(revision 12004)
@@ -6,7 +6,5 @@
 
 	%recover parameters common to all solutions
-	dim=femmodel.parameters.MeshDimension;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 
 	%Activate formulation
@@ -16,5 +14,5 @@
 	femmodel=solver_linear(femmodel);
 
-	if (solution_type==BalancethicknessSolutionEnum & ~control_analysis),
+	if (save_results),
 		issmprintf(VerboseSolution,'   saving results');
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,ThicknessEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/bedslope_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/bedslope_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/bedslope_core.m	(revision 12004)
@@ -7,7 +7,5 @@
 
 	%Recover some parameters:
-	dim=femmodel.parameters.MeshDimension;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 
 	issmprintf(VerboseSolution,'   computing bed slope');
@@ -19,5 +17,5 @@
 	femmodel=solver_linear(femmodel);
 	
-	if (solution_type==BedSlopeSolutionEnum & ~control_analysis),
+	if (save_results),
 		issmprintf(VerboseSolution,'   saving results');
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,BedSlopeXEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/control_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/control_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/control_core.m	(revision 12004)
@@ -17,6 +17,6 @@
 	tol_cm=femmodel.parameters.InversionCostFunctionThreshold;
 	gradient_only=femmodel.parameters.InversionGradientOnly;
-	dim=femmodel.parameters.MeshDimension;
 	isstokes=femmodel.parameters.FlowequationIsstokes;
+	femmodel.parameters.SaveResults=false;
 
 	%Initialise options with maxiter
@@ -59,5 +59,5 @@
 
 		issmprintf(VerboseControl,'   optimizing along gradient direction');
-		[search_scalar J(n)]=ControlOptimization('objectivefunctionC',0,1,options,femmodel,n,femmodel.parameters);
+		[search_scalar J(n)]=ControlOptimization('objectivefunction',0,1,options,femmodel,n,femmodel.parameters);
 
 		issmprintf(VerboseControl,'   updating parameter using optimized search scalar');
@@ -75,5 +75,5 @@
 	%generate output
 	issmprintf(VerboseControl,'   preparing final velocity solution');
-	femmodel.parameters.InversionIscontrol=0;
+	femmodel.parameters.SaveResults=true;
 	eval(['femmodel=' solutioncore '(femmodel);']);
 
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/diagnostic_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/diagnostic_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/diagnostic_core.m	(revision 12004)
@@ -11,11 +11,11 @@
 
 	%recover parameters common to all solutions
-	dim=femmodel.parameters.MeshDimension;
 	ishutter=femmodel.parameters.FlowequationIshutter;
 	ismacayealpattyn=femmodel.parameters.FlowequationIsmacayealpattyn;
 	isstokes=femmodel.parameters.FlowequationIsstokes;
 	isnewton=femmodel.parameters.DiagnosticIsnewton;
+	dim=femmodel.parameters.MeshDimension;
 	dakota_analysis=femmodel.parameters.QmuIsdakota;
-	control_analysis=femmodel.parameters.InversionIscontrol;
+	save_results=femmodel.parameters.SaveResults;
 	solution_type=femmodel.parameters.SolutionType;
 
@@ -75,5 +75,5 @@
 	end
 
-	if (solution_type==DiagnosticSolutionEnum & ~control_analysis)
+	if (save_results),
 		issmprintf(VerboseSolution,'\n%s',['   saving results']);
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VxEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/enthalpy_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/enthalpy_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/enthalpy_core.m	(revision 12004)
@@ -6,30 +6,15 @@
 
 	%recover parameters common to all solutions
-	ndt=femmodel.parameters.TimesteppingFinalTime;
-	dt=femmodel.parameters.TimesteppingTimeStep;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 
-	%Compute number of timesteps
-	if (dt==0 | ndt==0),
-		dt=0;
-		nsteps=1;
-	else
-		nsteps=floor(ndt/dt);
-	end
+	issmprintf(VerboseSolution,'\n%s',['   computing enthalpy']);
+	femmodel=SetCurrentConfiguration(femmodel,EnthalpyAnalysisEnum);
+	femmodel=solver_nonlinear(femmodel,true);
 
-	%Loop through time
-	for i=1:nsteps,
-		issmprintf(VerboseSolution,'\n%s%i/%i\n','time step: ',i,nsteps);
-		time=(i+1)*dt;
-
-		femmodel=enthalpy_core_step(femmodel,i,time); 
-
-		if (solution_type==EnthalpySolutionEnum & ~control_analysis),
-			issmprintf(VerboseSolution,'\n%s',['   saving results']);
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,EnthalpyEnum,i,time);
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,TemperatureEnum,i,time);
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,WaterfractionEnum,i,time);
-		end
+	if (save_results),
+		issmprintf(VerboseSolution,'\n%s',['   saving results']);
+		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,EnthalpyEnum);
+		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,TemperatureEnum);
+		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,WaterfractionEnum);
 	end
 
Index: sm/branches/trunk-jpl-damage/src/m/solutions/enthalpy_core_step.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/enthalpy_core_step.m	(revision 12003)
+++ 	(revision )
@@ -1,14 +1,0 @@
-function femmodel=enthalpy_core_step(femmodel,step,time)
-%ENTHALPY_CORE_STEP - core of the enthalpy solution for one step 
-%
-%   Usage:
-%      femmodel=enthalpy_core_step(femmodel,step,time)
-
-	%some parameters
-	modify_loads=true;
-
-	issmprintf(VerboseSolution,'\n%s',['   computing enthalpy']);
-	femmodel=SetCurrentConfiguration(femmodel,EnthalpyAnalysisEnum);
-	femmodel=solver_nonlinear(femmodel,modify_loads);
-
-end %end function
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/objectivefunction.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/objectivefunction.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/objectivefunction.m	(revision 12004)
@@ -0,0 +1,39 @@
+function J =objectivefunction(search_scalar,femmodel);
+%OBJECTIVEFUNCTION - objective function that return a parameter for a certain function
+%
+%   Usage:
+%      J =objectivefunction(search_scalar,femmodel);
+
+conserve_loads=true;
+J=0;
+
+%recover some parameters
+analysis_type = femmodel.parameters.AnalysisType;
+solution_type = femmodel.parameters.SolutionType;
+isstokes      = femmodel.parameters.FlowequationIsstokes;
+
+%set current configuration
+if (solution_type==DiagnosticSolutionEnum | solution_type==SteadystateSolutionEnum)
+	femmodel=SetCurrentConfiguration(femmodel,DiagnosticHorizAnalysisEnum);
+elseif (solution_type==BalancethicknessSolutionEnum)
+	femmodel=SetCurrentConfiguration(femmodel,BalancethicknessAnalysisEnum);
+else
+	error('solution not implemented yet');
+end
+
+%Use search scalar to shoot parameter in the gradient direction:
+[femmodel.elements,femmodel.nodes,femmmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters]=InputControlUpdate(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,search_scalar,0);
+
+%Run diagnostic with updated inputs:
+if (solution_type==DiagnosticSolutionEnum)
+	femmodel=solver_nonlinear(femmodel,conserve_loads);  %true means we conserve loads at each diagnostic run
+elseif (solution_type==SteadystateSolutionEnum)
+	femmodel=diagnostic_core(femmodel);  %We need a 3D velocity!! (vz is required for the next thermal run)
+elseif (solution_type==BalancethicknessSolutionEnum)
+	femmodel=solver_linear(femmodel);
+else
+	error('solution not implemented yet');
+end
+
+%Compute misfit for this velocity field
+J=CostFunction(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials, femmodel.parameters);
Index: sm/branches/trunk-jpl-damage/src/m/solutions/objectivefunctionC.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/objectivefunctionC.m	(revision 12003)
+++ 	(revision )
@@ -1,36 +1,0 @@
-function J =objectivefunctionC(search_scalar,femmodel);
-%OBJECTIVEFUNCTIONC - objective function that return a parameter for a certain function
-
-conserve_loads=true;
-J=0;
-
-%recover some parameters
-analysis_type = femmodel.parameters.AnalysisType;
-solution_type = femmodel.parameters.SolutionType;
-isstokes      = femmodel.parameters.FlowequationIsstokes;
-
-%set current configuration
-if (solution_type==DiagnosticSolutionEnum | solution_type==SteadystateSolutionEnum)
-	femmodel=SetCurrentConfiguration(femmodel,DiagnosticHorizAnalysisEnum);
-elseif (solution_type==BalancethicknessSolutionEnum)
-	femmodel=SetCurrentConfiguration(femmodel,BalancethicknessAnalysisEnum);
-else
-	error('solution not implemented yet');
-end
-
-%Use search scalar to shoot parameter in the gradient direction:
-[femmodel.elements,femmodel.nodes,femmmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters]=InputControlUpdate(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,search_scalar,0);
-
-%Run diagnostic with updated inputs:
-if (solution_type==DiagnosticSolutionEnum)
-	femmodel=solver_nonlinear(femmodel,conserve_loads);  %true means we conserve loads at each diagnostic run
-elseif (solution_type==SteadystateSolutionEnum)
-	femmodel=diagnostic_core(femmodel);  %We need a 3D velocity!! (vz is required for the next thermal run)
-elseif (solution_type==BalancethicknessSolutionEnum)
-	femmodel=solver_linear(femmodel);
-else
-	error('solution not implemented yet');
-end
-
-%Compute misfit for this velocity field
-J=CostFunction(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials, femmodel.parameters);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/prognostic_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/prognostic_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/prognostic_core.m	(revision 12004)
@@ -6,6 +6,5 @@
 
 	%recover parameters common to all solutions
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 
 	%Activate formulation
@@ -15,5 +14,5 @@
 	femmodel=solver_linear(femmodel);
 	
-	if (solution_type==PrognosticSolutionEnum & ~control_analysis)
+	if (save_results),
 		issmprintf(VerboseSolution,'\n%s',['   saving results']);
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,ThicknessEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/steadystate_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/steadystate_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/steadystate_core.m	(revision 12004)
@@ -7,8 +7,7 @@
 
 	%recover parameters common to all solutions
-	dim=femmodel.parameters.MeshDimension;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 	isenthalpy=femmodel.parameters.ThermalIsenthalpy;
+	femmodel.parameters.SaveResults=false;
 
 	%Initialize counter
@@ -43,5 +42,5 @@
 	end
 
-	if (solution_type==SteadystateSolutionEnum & ~control_analysis),
+	if (save_results),
 		issmprintf(VerboseSolution,'\n%s',['   saving results']);
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VxEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/surfaceslope_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/surfaceslope_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/surfaceslope_core.m	(revision 12004)
@@ -7,7 +7,5 @@
 
 	%Recover some parameters:
-	dim=femmodel.parameters.MeshDimension;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 
 	%Call on core computations: 
@@ -18,5 +16,5 @@
 	femmodel=solver_linear(femmodel);
 	
-	if (solution_type==SurfaceSlopeSolutionEnum),
+	if (save_results),
 		issmprintf(VerboseSolution,'\n%s',['   saving results']);
 		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,SurfaceSlopeXEnum);
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/thermal_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/thermal_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/thermal_core.m	(revision 12004)
@@ -7,30 +7,18 @@
 
 	%recover parameters common to all solutions
-	ndt=femmodel.parameters.TimesteppingFinalTime;
-	dt=femmodel.parameters.TimesteppingTimeStep;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	save_results=femmodel.parameters.SaveResults;
 
-	%Compute number of timesteps
-	if (dt==0 | ndt==0),
-		dt=0;
-		nsteps=1;
-	else
-		nsteps=floor(ndt/dt);
-	end
+	issmprintf(VerboseSolution,'\n%s',['   computing temperature']);
+	femmodel=SetCurrentConfiguration(femmodel,ThermalAnalysisEnum);
+	femmodel=solver_thermal_nonlinear(femmodel);
 
-	%Loop through time
-	for i=1:nsteps,
-		issmprintf(VerboseSolution,'\n%s%i/%i\n','time step: ',i,nsteps);
-		time=(i+1)*dt;
+	issmprintf(VerboseSolution,'\n%s',['   computing melting']);
+	femmodel=SetCurrentConfiguration(femmodel,MeltingAnalysisEnum);
+	femmodel=solver_linear(femmodel);
 
-		issmprintf(VerboseSolution,'\n%s',['   computing temperature']);
-		femmodel=thermal_core_step(femmodel,i,time); 
-
-		if (solution_type==ThermalSolutionEnum & ~control_analysis),
-			issmprintf(VerboseSolution,'\n%s',['   saving results']);
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,TemperatureEnum,i,time);
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,BasalforcingsMeltingRateEnum,i,time);
-		end
+	if (save_results),
+		issmprintf(VerboseSolution,'\n%s',['   saving results']);
+		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,TemperatureEnum);
+		femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,BasalforcingsMeltingRateEnum);
 	end
 
Index: sm/branches/trunk-jpl-damage/src/m/solutions/thermal_core_step.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/thermal_core_step.m	(revision 12003)
+++ 	(revision )
@@ -1,15 +1,0 @@
-function femmodel=thermal_core_step(femmodel,step,time)
-%THERMAL_CORE_STEP - core of the thermal solution for one step 
-%
-%   Usage:
-%      femmodel=thermal_core_step(femmodel,step,time)
-
-	issmprintf(VerboseSolution,'\n%s',['   computing temperature']);
-	femmodel=SetCurrentConfiguration(femmodel,ThermalAnalysisEnum);
-	femmodel=solver_thermal_nonlinear(femmodel);
-
-	issmprintf(VerboseSolution,'\n%s',['   computing melting']);
-	femmodel=SetCurrentConfiguration(femmodel,MeltingAnalysisEnum);
-	femmodel=solver_linear(femmodel);
-	
-end %end function
Index: /issm/branches/trunk-jpl-damage/src/m/solutions/transient_core.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solutions/transient_core.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/solutions/transient_core.m	(revision 12004)
@@ -6,10 +6,9 @@
 
 	%recover parameters common to all solutions
-	dim=femmodel.parameters.MeshDimension;
-	ndt=femmodel.parameters.TimesteppingFinalTime;
+	starttime=femmodel.parameters.TimesteppingStartTime;
+	finaltime=femmodel.parameters.TimesteppingFinalTime;
 	dt=femmodel.parameters.TimesteppingTimeStep;
 	yts=femmodel.parameters.ConstantsYts;
-	control_analysis=femmodel.parameters.InversionIscontrol;
-	solution_type=femmodel.parameters.SolutionType;
+	dim=femmodel.parameters.MeshDimension; 
 	output_frequency=femmodel.parameters.SettingsOutputFrequency;
 	time_adapt=femmodel.parameters.TimesteppingTimeAdapt;
@@ -23,5 +22,5 @@
 
 	%Initialize
-	time=0;
+	time=starttime;
 	step=0;
 
@@ -42,10 +41,10 @@
 
 	%Loop through time
-	while (time < ndt - (yts*eps)),
+	while (time < finaltime+eps),
 
 		%Increment
 		if(time_adapt),
 			dt=TimeAdapt(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters);
-			if(time+dt>ndt), dt=ndt-time; end
+			if(time+dt>finaltime), dt=finaltime-time; end
 			femmodel.parameters.TimesteppingTimeStep=dt;
 		end
@@ -53,13 +52,20 @@
 		time=time+dt;
 		femmodel.parameters.Time=time;
+		femmodel.parameters.Step=step;
 
-		issmprintf(VerboseSolution,'\n%s%g%s%i%s%g\n','time [yr] ',time/yts,' iteration number: ',step,'/',floor(ndt/dt));
+		issmprintf(VerboseSolution,'\n%s%g%s%i%s%g\n','time [yr] ',time/yts,' iteration number: ',step,'/',floor((finaltime-starttime)/dt));
+		if(mod(step,output_frequency)==0 | time==ndt),
+			save_results=true;
+		else
+			save_results=false;
+		end
+		femmodel.parameters.SaveResults=save_results;
 
 		if (isthermal & dim==3)
 			issmprintf(VerboseSolution,'\n%s',['   computing temperature']);
 			if (isenthalpy==0),
-				femmodel=thermal_core_step(femmodel); 
+				femmodel=thermal_core(femmodel); 
 			else
-				femmodel=enthalpy_core_step(femmodel); 
+				femmodel=enthalpy_core(femmodel); 
 			end
 		end
@@ -84,18 +90,8 @@
 		end
 
-		if (solution_type==TransientSolutionEnum & ~control_analysis & (mod(step,output_frequency)==0 | time==ndt)),
-			issmprintf(VerboseSolution,'\n%s',['   saving results']);
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VxEnum,step,time);
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VyEnum,step,time);
-			if (dim==3), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VzEnum,step,time); end
-			if (isdiagnostic), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,VelEnum,step,time); end
-			if (isdiagnostic), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,PressureEnum,step,time); end
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,ThicknessEnum,step,time);
+		if (save_results),
+			issmprintf(VerboseSolution,'\n%s',['   saving transient results']);
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,SurfaceEnum,step,time);
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,BedEnum,step,time);
-			if (dim==3 & isthermal), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,TemperatureEnum,step,time);end
-			if (dim==3 & isenthalpy), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,WaterfractionEnum,step,time);end
-			if (dim==3 & isenthalpy), femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,EnthalpyEnum,step,time);end
-			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,BasalforcingsMeltingRateEnum,step,time);
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,SurfaceforcingsMassBalanceEnum,step,time);
 			femmodel.elements=InputToResult(femmodel.elements,femmodel.nodes,femmodel.vertices,femmodel.loads,femmodel.materials,femmodel.parameters,MaskElementonfloatingiceEnum,step,time);
Index: sm/branches/trunk-jpl-damage/src/m/solvers/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/solvers/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Analysis/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Analysis/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Array/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Array/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/BC/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/BC/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Basins/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Basins/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Cluster/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Cluster/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/DataProcessing/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/DataProcessing/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Ecco3/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Ecco3/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/utils/Exp/clicktoflowline.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/clicktoflowline.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/utils/Exp/clicktoflowline.m	(revision 12004)
@@ -1,16 +1,24 @@
 function clicktoflowline(index,x,y,u,v,filename)
-%CLICKTOFLOWLINE create a flowline contour file (named 'filename') by clicking on a velocity field once.
+%CLICKTOFLOWLINE - create a flowline ARGUS file
 %
-% Usage: clicktoflowline(index,x,y,u,v,x0,y0,filename)
+%   create a flowline contour file (named 'filename') by clicking
+%   on a velocity field once (velocity must be plotted first)
 %
-% Ex: clicktoflowline(md.mesh.elements,md.mesh.x,md.mesh.y,md.inversion.vx_obs,md.inversion.vy_obs,'flowline1.exp')
+%   Usage: 
+%      clicktoflowline(index,x,y,u,v,x0,y0,filename)
+%
+%   Example: 
+%      clicktoflowline(md.mesh.elements,md.mesh.x,md.mesh.y,md.inversion.vx_obs,md.inversion.vy_obs,'flowline.exp')
 
-
+%Get click position
 [x0,y0]=ginput(1);
 
+%Get flowline
 line=flowlines(index,x,y,u,v,x0,y0,200);
 
+%plot
 hold on
 plot(line.x,line.y,'r-');
 
+%Write argus file
 expwrite(line,filename);
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/expconcatenate.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/expconcatenate.m	(revision 12003)
+++ 	(revision )
@@ -1,56 +1,0 @@
-function expconcatenate(newfile,oldfile)
-%EXPCONCATENATE - modify several profiles to concatenate them
-% 
-%   this routine reads the profiles of oldfile and enables the user to concatenate
-%   the profiles by clicking on the tips he/she wants to link
-%
-%   Usage:
-%      expconcatenate(newfile,oldfile)
-%
-%   See also EXPMASTER, EXPDOC
- 
-%Some checks
-if nargin~=2 | nargout
-	error('expconcatenate usage: expconcatenate(newfile,oldfile)')
-elseif ~exist(oldfile)
-	error(['expconcatenate error message: the file ' oldfile  'does not exist'])
-elseif exist(newfile),
-	choice=input(['A file ' newfile ' already exists, do you want to modify it? (y/n)'],'s');
-	if ~strcmpi(choice,'y'),
-		error('no modification done ... exiting');
-	end
-end
-
-%Get exp oldfile
-[path root ext ver]=fileparts(oldfile);
-A=expread(oldfile,1);
-numprofiles=size(A,2);
-
-%Figure out how nany plots have been done so far 
-g=get(gca,'children'); 
-prevplot=length(g);
-
-%plot existing profile
-hold on
-numpoints=0;
-closed=zeros(numprofiles,1);
-for i=1:numprofiles
-	plot(A(i).x,A(i).y,'-r','MarkerSize',10);
-
-	%update numpoints
-	numpoints=numpoints+size(A(i).x,1);
-
-	%figure out if the profile is closed or not
-	if (A(i).x(1)==A(i).x(end) & A(i).y(1)==A(i).y(end))
-		closed(i)=1;
-	end
-end
-
-%call merge profile routine
-[A,numprofiles,numpoints,closed]=mergeprofiles(A,numprofiles,numpoints,closed,prevplot,root,options);
-
-hold off
-
-%write contour using expwrite
-title('New file written, exiting','FontSize',14);
-expwrite(A,newfile);
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/expcut.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/expcut.m	(revision 12003)
+++ 	(revision )
@@ -1,56 +1,0 @@
-function expcut(newfile,oldfile)
-%EXPCUT - cut a part of a profile
-%
-%   this routine reads the profiles of oldfile and enables the user to cut
-%   the profiles by clicking on the tips he/she wants to link
-%
-%   Usage:
-%      expcut(newfile,oldfile)
-%
-%   See also EXPMASTER, EXPDOC
- 
-%Some checks
-if nargin~=2 | nargout
-	error('expcut usage: expcut(newfile,oldfile)')
-elseif ~exist(oldfile)
-	error(['expcut error message: the file ' oldfile  'does not exist'])
-elseif exist(newfile),
-	choice=input(['A file ' newfile ' already exists, do you want to modify it? (y/n)'],'s');
-	if ~strcmpi(choice,'y'),
-		error('no modification done ... exiting');
-	end
-end
-
-%Get exp oldfile
-[path root ext ver]=fileparts(oldfile);
-A=expread(oldfile,1);
-numprofiles=size(A,2);
-
-%Figure out how nany plots have been done so far 
-g=get(gca,'children'); 
-prevplot=length(g);
-
-%plot existing profile
-hold on
-numpoints=0;
-closed=zeros(numprofiles,1);
-for i=1:numprofiles
-	plot(A(i).x,A(i).y,'-r','MarkerSize',10);
-
-	%update numpoints
-	numpoints=numpoints+size(A(i).x,1);
-
-	%figure out if the profile is closed or not
-	if (A(i).x(1)==A(i).x(end) & A(i).y(1)==A(i).y(end))
-		closed(i)=1;
-	end
-end
-
-%call merge profile routine
-[A,numprofiles,numpoints,closed]=cutarea(A,numprofiles,numpoints,closed,prevplot,root,options);
-
-hold off
-
-%write contour using expwrite
-title('New file written, exiting','FontSize',14);
-expwrite(A,newfile);
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/expselect.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/expselect.m	(revision 12003)
+++ 	(revision )
@@ -1,61 +1,0 @@
-function expselect(newfile,oldfile)
-%EXPSELECT - allow to select some profiles
-%
-%   this routine reads the profiles of oldfile
-%   and enables the user to select the profiles 
-%   that he/she wants to keep in newfile
-%
-%   Usage:
-%      expselect(newfile,oldfile)
-%
-%   See also EXPMASTER, EXPDOC
- 
-%Some checks
-if nargin~=2 | nargout
-	error('expselect usage: expselect(newfile,oldfile)')
-elseif ~exist(oldfile)
-	error(['expselect error message: the file ' oldfile  'does not exist'])
-elseif exist(newfile),
-	choice=input(['A file ' newfile ' already exists, do you want to modify it? (y/n)'],'s');
-	if ~strcmpi(choice,'y'),
-		error('no modification done ... exiting');
-	end
-end
-
-%Get exp oldfile
-[path root ext ver]=fileparts(oldfile);
-A=expread(oldfile,1);
-numprofiles=size(A,2);
-
-%Figure out how nany plots have been done so far 
-g=get(gca,'children'); 
-prevplot=length(g);
-
-%plot existing profile
-hold on
-numpoints=0;
-closed=zeros(numprofiles,1);
-for i=1:numprofiles
-	plot(A(i).x,A(i).y,'-r','MarkerSize',10);
-
-	%update numpoints
-	numpoints=numpoints+size(A(i).x,1);
-
-	%figure out if the profile is closed or not
-	if (A(i).x(1)==A(i).x(end) & A(i).y(1)==A(i).y(end))
-		closed(i)=1;
-	end
-end
-
-%call merge profile routine
-[A,numprofiles,numpoints,closed]=removeprofile(A,numprofiles,numpoints,closed,prevplot,root,options);
-
-hold off
-
-%write contour using expwrite
-title('New file written, exiting','FontSize',14);
-if isempty(A)
-	disp('Profile empty, no file written')
-else
-	expwrite(A,newfile);
-end
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/manipulation/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/manipulation/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/expread.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/expread.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/expread.m	(revision 12004)
@@ -1,3 +1,3 @@
-function Struct=expread(filename,whole);
+function Struct=expread(filename);
 %EXPREAD - read a file exp and build a Structure
 %
@@ -10,9 +10,9 @@
 %
 %   Usage:
-%      Struct=expread(filename,whole)
+%      Struct=expread(filename)
 %  
 %   Example:
 %      Struct=expread('domainoutline.exp')
-%      Struct=expread('domainoutline.exp',1)
+%      Struct=expread('domainoutline.exp')
 %
 %   See also EXPDOC, EXPWRITEASVERTICES
@@ -21,7 +21,4 @@
 if ~exist(filename),
 	error(['expread error message: file ' filename ' not found!']);
-end
-if nargin<2,
-	whole=1;
 end
 
@@ -76,14 +73,7 @@
 	   (Struct(count).y(end) == Struct(count).y(1))
 		Struct(count).closed=true;
-		%skip last coordinate if whole=0,
-		if whole==0
-			Struct(count).nods=Struct(count).nods-1;
-			Struct(count).x   =Struct(count).x(1:end-1,1);
-			Struct(count).y   =Struct(count).y(1:end-1,1);
-		end
 	else
 		Struct(count).closed=false;
 	end
-
 end
 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/newline.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/newline.m	(revision 12003)
+++ 	(revision )
@@ -1,8 +1,0 @@
-function new_line(fid)
-%NEW_LINE - add a new line in a a file
-%
-%   Used by exp generators and readers. 
-%   DO NOT USE
-
-A='';
-fprintf(fid,'\n',A);
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/read_file.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/read_file.m	(revision 12003)
+++ 	(revision )
@@ -1,42 +1,0 @@
-function struct=read_file(name,whole);
-%READ_FILE - ???
-%
-%   Usage:
-%      struct=read_file(name,whole)
-
-fid=fopen(name,'r');
-i=0;
-while (~feof(fid)),
-   i=i+1;
-   A=readline(fid,2);
-A=readline(fid,2);
-A=readline(fid,4);
-[A,bytecount]=fscanf(fid,'%i %f',[1 2]);
-if whole==1,
-   struct(i).nods=A(1);
-else
-   struct(i).nods=A(1)-1;
-end
-A=readline(fid,5);
-
-struct(i).x=zeros(struct(i).nods,1);
-struct(i).y=zeros(struct(i).nods,1);
-
-for n=1:struct(i).nods,
-   [A,bytecount]=fscanf(fid,'%f %f',[1 2]);
-   struct(i).x(n)=A(1);
-   struct(i).y(n)=A(2);
-end
-if whole==0,
-   fscanf(fid,'%f %f',[1 2]);
-end
-
-end
-fclose(fid);
-
-
-
-
-
-
-
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/readfile.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/readfile.m	(revision 12003)
+++ 	(revision )
@@ -1,14 +1,0 @@
-function string=readfile(filename)
-%READFILE - ???
-%
-%   Usage:
-%      string=readfile(filename)
-
-string='';
-fid=fopen(filename);
-while(1),
-	tline=fgets(fid);
-	if ~ischar(tline), break, end
-	string=[string  tline];
-end
-fclose(fid);
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/writefile.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/readwrite/writefile.m	(revision 12003)
+++ 	(revision )
@@ -1,14 +1,0 @@
-function writefile(filename,string)
-%WRITEFILE - write a file from a string
-%
-%   useful to recovert an exp file from md.domainoutline
-%
-%   Usage:
-%      writefile(filename,string)
-%
-%   Example:
-%      writefile('DomainOutline.exp',md.domainoutline)
-
-fid = fopen(filename,'wt');
-fprintf(fid,string);
-fclose(fid);
Index: sm/branches/trunk-jpl-damage/src/m/utils/Exp/zinput.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Exp/zinput.m	(revision 12003)
+++ 	(revision )
@@ -1,211 +1,0 @@
-function  [out_regs] = zinput(arg1)
-% ZINPUT - Graphical input from mouse with zoom
-%   
-%   [OUT_REGS] = ZINPUT(N) gets N points or regions from the
-%   current axes and returns the X- and Y-ranges in a length Nx4
-%   matrix OUT_REGS. 
-%   The cursor can be positioned using a mouse. Data points are entered by
-%   pressing the right mouse button, the region of the current axis
-%   are selected with the middle button, left button is for
-%   zooming,  single cklick zooms in, click-and drag zooms to
-%   region (and doubble-click should zoom out - feature pending).
-%   Any key on the keyboard except carriage return zooms out to the
-%   orignal axis except carriage return, which terminates the input
-%   before N points are entered.
-%   
-%   [OUT_REGS] = ZINPUT gathers an unlimited number of points until the
-%   return key is pressed.
-%   
-%   Usage:
-%      [out_regs] = zinput(arg1)
-%
-%   See also GINPUT
-
-% Copyright Bjorn Gustavsson 20050314
-
-ax0 = axis;
-out_regs = [];
-c = computer;
-if ~strcmp(c(1:2),'PC') 
-  tp = get(0,'TerminalProtocol');
-else
-  tp = 'micro';
-end
-
-if ~strcmp(tp,'none') & ~strcmp(tp,'x') & ~strcmp(tp,'micro') & 0,
-  % I dont know about this so better make short-cut and blindly try
-  % what works for X in all environments - sorry about that.
-else
-  
-  fig = gcf;
-  figure(gcf);
-  
-  if nargin == 0
-    how_many = inf;
-    b = [];
-  else
-    how_many = arg1;
-    b = [];
-    if  isstr(how_many) ...
-          | size(how_many,1) ~= 1 | size(how_many,2) ~= 1 ...
-          | ~(fix(how_many) == how_many) ...
-          | how_many < 0
-      error('Requires a positive integer.');
-    end
-    if how_many == 0
-      ptr_fig = 0;
-      while(ptr_fig ~= fig)
-        ptr_fig = get(0,'PointerWindow');
-      end
-      scrn_pt = get(0,'PointerLocation');
-      loc = get(fig,'Position');
-      pt = [scrn_pt(1) - loc(1), scrn_pt(2) - loc(2)];
-      out1 = pt(1); y = pt(2);
-    elseif how_many < 0
-      error('Argument must be a positive integer.');
-    end
-  end
-  
-  % Remove figure button functions
-  state = uisuspend(fig);
-  pointer = get(gcf,'pointer');
-  set(gcf,'pointer','fullcrosshair');
-  
-  fig_units = get(fig,'units');
-  char = 0;
-  while  size(out_regs,1) < how_many
-    % Use no-side effect WAITFORBUTTONPRESS
-    waserr = 0;
-    try
-      keydown = wfbp;
-    catch
-      waserr = 1;
-    end
-    if(waserr == 1)
-      if(ishandle(fig))
-        set(fig,'units',fig_units);
-        uirestore(state);
-        error('Interrupted');
-      else
-        error('Interrupted by figure deletion');
-      end
-    end
-    
-    ptr_fig = get(0,'CurrentFigure');
-    if(ptr_fig == fig)
-      if keydown
-        axis(ax0);
-        char = get(fig, 'CurrentCharacter');
-      else
-        char = get(fig, 'CurrentCharacter');
-        button = abs(get(fig, 'CurrentCharacter'));
-        
-        pnt = get(gcf,'currentpoint');
-        xy1 = get(gca,'currentpoint');
-        rbbox([pnt 0 0],pnt)
-        xy2 = get(gca,'currentpoint');
-        selection_type = get(gcf,'selectiontype');
-        
-        if all(xy1==xy2)
-          ax1 = axis;
-          
-          dx = abs(ax1(2)-ax1(1));
-          dy = abs(ax1(4)-ax1(3));
-          
-          xmin = max(ax1(1),xy1(1)-dx/4);
-          xmax = min(ax1(2),xy1(1)+dx/4);
-          ymin = max(ax1(3),xy1(1,2)-dy/4);
-          ymax = min(ax1(4),xy1(1,2)+dy/4);
-          zoom2ax = [xmin xmax ymin ymax];
-        else
-          %%% zoom to selected rectangle
-          zoom2ax = [sort([xy1(1,1) xy2(1,1)]) sort([xy1(1,2) xy2(1,2)])];
-        end
-        
-        switch selection_type
-         case 'normal'
-          axis(zoom2ax)
-          reg = [];
-         case 'alt'
-          reg = axis;
-          axis(ax0)
-         case 'extend'
-          reg = xy1(1,[1 1 2 2]);
-          axis(ax0)
-         otherwise %%% open (doubleclick in linux)
-          axis(ax0);
-          reg = [];
-        end
-      end
-      pt = get(gca, 'CurrentPoint');
-      
-      if (char == 'r')
-        rmi = size(out_regs,1);
-        if rmi > 0
-          out_regs(rmi,:) = [];
-        end
-        set(fig, 'CurrentCharacter','q')
-        char = 'q';
-        reg = [];
-      end
-      if(char == 13) % & how_many ~= 0)
-                     % if the return key was pressed, char will == 13,
-                     % and that's our signal to break out of here whether
-                     % or not we have collected all the requested data
-                     % points.  
-                     % If this was an early breakout, don't include
-                     % the <Return> key info in the return arrays.
-                     % We will no longer count it if it's the last input.
-        break;
-      end
-      
-      if ~isempty(reg)
-        out_regs = [out_regs;reg];
-      end
-    end
-    %[size(out_regs,1), how_many, size(out_regs,1) < how_many]
-  end
-  
-  uirestore(state);
-  set(gcf,'pointer','arrow');
-  set(fig,'units',fig_units);
-  set(fig, 'CurrentCharacter','q');
-  
-end
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-function key = wfbp
-%WFBP   Replacement for WAITFORBUTTONPRESS that has no side effects.
-
-fig = gcf;
-current_char = [];
-
-% Now wait for that buttonpress, and check for error conditions
-waserr = 0;
-try
-  h=findall(fig,'type','uimenu','accel','C');   % Disabling ^C for edit menu so the only ^C is for
-  set(h,'accel','');                            % interrupting the function.
-  keydown = waitforbuttonpress;
-  current_char = double(get(fig,'CurrentCharacter')); % Capturing the character.
-  if~isempty(current_char) & (keydown == 1)           % If the character was generated by the 
-    if(current_char == 3)                       % current keypress AND is ^C, set 'waserr'to 1
-      waserr = 1;                             % so that it errors out. 
-    end
-  end
-  
-  set(h,'accel','C');                                 % Set back the accelerator for edit menu.
-catch
-  waserr = 1;
-end
-drawnow;
-if(waserr == 1)
-  set(h,'accel','C');                                % Set back the accelerator if it errored out.
-  error('Interrupted');
-end
-
-selection_type = get(gcf,'selectiontype');
-if strcmp(selection_type,'open')
-  axis(ax0)
-end
-if nargout>0, key = keydown; end
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Index: sm/branches/trunk-jpl-damage/src/m/utils/Geometry/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Geometry/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/ImageProcessing/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/ImageProcessing/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Interp/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Interp/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Kml/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Kml/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/LatLong/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/LatLong/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,2 +1,0 @@
-SUBDIRS = Analysis Array BC Basins Cluster DataProcessing Ecco3 Exp Geometry ImageProcessing Interp Kml LatLong Math Meca Mesh Miscellaneous Model Numerics OS Plot Shell String consistency qmu
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Math/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Math/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Meca/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Meca/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Mesh/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Mesh/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Miscellaneous/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Miscellaneous/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Model/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Model/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Numerics/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Numerics/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/utils/Numerics/cfl_step.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Numerics/cfl_step.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/m/utils/Numerics/cfl_step.m	(revision 12004)
@@ -2,5 +2,5 @@
 %CFL_STEP - return the maximum time step for the model in years
 %
-%   Dt < c / ( u/Dx +v/Dy )
+%   Dt < 0.5 / ( u/Dx +v/Dy )
 %
 %   Usage:
@@ -8,5 +8,5 @@
 %
 %   Example:
-%      dt=cfl_step(md,md.results.diagnostic.vx,md.results.diagnostic.vy);
+%      dt=cfl_step(md,md,md.results.DiagnosticSolution.Vx,md.results.DiagnosticSolution.Vy)
 
 %Check length of velocities 
Index: sm/branches/trunk-jpl-damage/src/m/utils/OS/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/OS/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/m/utils/OS/ispetsc.m
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/OS/ispetsc.m	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/m/utils/OS/ispetsc.m	(revision 12004)
@@ -0,0 +1,33 @@
+function flag=ispetsc()
+%ISPETSC - figure out if PETSC package was compiled with ISSM
+%
+%   Usage:
+%       flag=ispetsc();
+
+
+configfile=[issmtier() '/bin/config.h']; %should find it in the install target
+if ~exist(configfile,'file'),
+	error(['File ' configfile ' not found. ISSM has not been configured yet!']);
+end
+
+%go through the file, and recover the line we want
+flag=2;
+fid=fopen(configfile,'r');
+if(fid==-1), error(['could not open file: ' configfile]); end
+
+while(true),
+	tline=fgets(fid);
+	if ~ischar(tline), break, end
+	if strncmp(tline,'/* #undef _HAVE_PETSC_ */',25),
+		flag=0;
+		break;
+	end
+	if  strncmp(tline,'#define _HAVE_PETSC_',20),
+		flag=1;
+		break;
+	end
+end
+fclose(fid);
+if flag==2,
+	error('could not determine whether PETSC was or was not compiled');
+end
Index: sm/branches/trunk-jpl-damage/src/m/utils/Plot/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Plot/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/Shell/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/Shell/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/String/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/String/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/consistency/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/consistency/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: sm/branches/trunk-jpl-damage/src/m/utils/qmu/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/m/utils/qmu/Makefile.am	(revision 12003)
+++ 	(revision )
@@ -1,1 +1,0 @@
-bin_SCRIPTS=*.m 
Index: /issm/branches/trunk-jpl-damage/src/mex/AddExternalResult/AddExternalResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/AddExternalResult/AddExternalResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/AddExternalResult/AddExternalResult.cpp	(revision 12004)
@@ -19,7 +19,7 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&results,RESULTS);
-	FetchMatlabData(&type,TYPE);
-	FetchMatlabData(&value,&nraws,&ncols,VALUE);
+	FetchData(&results,RESULTS);
+	FetchData(&type,TYPE);
+	FetchData(&value,&nraws,&ncols,VALUE);
 
 	/*results might be NILL, allocate: */
@@ -38,5 +38,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(RESULTSOUT,results);
+	WriteData(RESULTSOUT,results);
 	
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/AddExternalResult/AddExternalResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/AddExternalResult/AddExternalResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/AddExternalResult/AddExternalResult.h	(revision 12004)
@@ -9,4 +9,5 @@
 void AddExternalResultUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/AverageFilter/AverageFilter.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/AverageFilter/AverageFilter.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/AverageFilter/AverageFilter.cpp	(revision 12004)
@@ -37,6 +37,6 @@
 
 	/*Fetch data: */
-	FetchMatlabData(&imagein,&imagein_rows,&imagein_cols,IMAGEIN);
-	FetchMatlabData(&smooth,SMOOTH);
+	FetchData(&imagein,&imagein_rows,&imagein_cols,IMAGEIN);
+	FetchData(&smooth,SMOOTH);
 	
 	/*Run core hole filler routine: */
@@ -44,5 +44,5 @@
 
 	/* output: */
-	WriteMatlabData(IMAGEOUT,imageout,imagein_rows,imagein_cols);
+	WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/AverageFilter/AverageFilter.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/AverageFilter/AverageFilter.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/AverageFilter/AverageFilter.h	(revision 12004)
@@ -11,4 +11,5 @@
 void AverageFilterUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/BamgConvertMesh/BamgConvertMesh.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/BamgConvertMesh/BamgConvertMesh.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/BamgConvertMesh/BamgConvertMesh.cpp	(revision 12004)
@@ -38,7 +38,7 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs\n");
-	FetchMatlabData(&index,&nels,&index_rows,INDEXHANDLE);
-	FetchMatlabData(&x,&nods,&x_cols,XHANDLE);
-	FetchMatlabData(&y,&y_rows,&y_cols,YHANDLE);
+	FetchData(&index,&nels,&index_rows,INDEXHANDLE);
+	FetchData(&x,&nods,&x_cols,XHANDLE);
+	FetchData(&y,&y_rows,&y_cols,YHANDLE);
 
 	/*Check inputs*/
Index: /issm/branches/trunk-jpl-damage/src/mex/BamgConvertMesh/BamgConvertMesh.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/BamgConvertMesh/BamgConvertMesh.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/BamgConvertMesh/BamgConvertMesh.h	(revision 12004)
@@ -9,4 +9,5 @@
 void BamgConvertMeshUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/BamgMesher/BamgMesher.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/BamgMesher/BamgMesher.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/BamgMesher/BamgMesher.h	(revision 12004)
@@ -9,4 +9,5 @@
 void BamgMesherUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/BamgTriangulate/BamgTriangulate.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/BamgTriangulate/BamgTriangulate.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/BamgTriangulate/BamgTriangulate.cpp	(revision 12004)
@@ -28,6 +28,6 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs\n");
-	FetchMatlabData(&x,&nods,&x_cols,XHANDLE);
-	FetchMatlabData(&y,&y_rows,&y_cols,YHANDLE);
+	FetchData(&x,&nods,&x_cols,XHANDLE);
+	FetchData(&y,&y_rows,&y_cols,YHANDLE);
 
 	/*Check inputs*/
@@ -41,5 +41,5 @@
 
 	/*Write output*/
-	WriteMatlabData(INDEX,index,nels,3);
+	WriteData(INDEX,index,nels,3);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/BamgTriangulate/BamgTriangulate.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/BamgTriangulate/BamgTriangulate.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/BamgTriangulate/BamgTriangulate.h	(revision 12004)
@@ -9,4 +9,5 @@
 void BamgTriangulateUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Chaco/Chaco.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Chaco/Chaco.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Chaco/Chaco.cpp	(revision 12004)
@@ -74,17 +74,17 @@
 
 	/*Fetch rest of data: */
-	FetchMatlabData(&vwgts,&nterms,VWGTS_IN); 
+	FetchData(&vwgts,&nterms,VWGTS_IN); 
 
-	FetchMatlabData(&x,&nterms,X_IN); 
-	FetchMatlabData(&y,&nterms,Y_IN); 
-	FetchMatlabData(&z,&nterms,Z_IN); 
+	FetchData(&x,&nterms,X_IN); 
+	FetchData(&y,&nterms,Y_IN); 
+	FetchData(&z,&nterms,Z_IN); 
 	
-	FetchMatlabData(&in_options,&nterms,OPTNS_IN); 
+	FetchData(&in_options,&nterms,OPTNS_IN); 
 	for (i=0;i<(nterms<10?nterms:10);i++) options[i]=in_options[i]; //copy in_options into default options
 	
-	FetchMatlabData(&npart,NPARTS_IN); 
+	FetchData(&npart,NPARTS_IN); 
 	nparts=(int*)xmalloc(sizeof(int)); nparts[0]=npart; //weird Chacox interface ain't it?
 
-	FetchMatlabData(&goal,&nterms,GOAL_IN); 
+	FetchData(&goal,&nterms,GOAL_IN); 
 	
 	/*Some debugging print: {{{*/
@@ -120,5 +120,5 @@
 	doubleassignment=(double*)xmalloc(nvtxs*sizeof(double));
 	for (i=0;i<nvtxs;i++) doubleassignment[i]=(double)assignment[i];
-	WriteMatlabData(ASSGN_OUT,doubleassignment,nvtxs);
+	WriteData(ASSGN_OUT,doubleassignment,nvtxs);
 
 	/*Free ressources:*/
Index: /issm/branches/trunk-jpl-damage/src/mex/Chaco/Chaco.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Chaco/Chaco.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Chaco/Chaco.h	(revision 12004)
@@ -13,4 +13,5 @@
 #include <time.h>      /*  clock,time,difftime  */
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ComputeBasalStress/ComputeBasalStress.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ComputeBasalStress/ComputeBasalStress.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ComputeBasalStress/ComputeBasalStress.cpp	(revision 12004)
@@ -26,10 +26,10 @@
         
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -42,5 +42,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(SIGMA,sigma_g);
+	WriteData(SIGMA,sigma_g);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ComputeBasalStress/ComputeBasalStress.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ComputeBasalStress/ComputeBasalStress.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ComputeBasalStress/ComputeBasalStress.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ComputeBasalStressUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ConfigureObjects/ConfigureObjects.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ConfigureObjects/ConfigureObjects.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ConfigureObjects/ConfigureObjects.cpp	(revision 12004)
@@ -24,10 +24,10 @@
 	
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*!Configure objects:*/
@@ -35,8 +35,8 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(LOADS,loads);
-	WriteMatlabData(NODESOUT,nodes);
-	WriteMatlabData(PARAMETERSOUT,parameters);
+	WriteData(ELEMENTS,elements);
+	WriteData(LOADS,loads);
+	WriteData(NODESOUT,nodes);
+	WriteData(PARAMETERSOUT,parameters);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ConfigureObjects/ConfigureObjects.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ConfigureObjects/ConfigureObjects.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ConfigureObjects/ConfigureObjects.h	(revision 12004)
@@ -11,4 +11,5 @@
 void ConfigureObjectsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ConstraintsState/ConstraintsState.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ConstraintsState/ConstraintsState.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ConstraintsState/ConstraintsState.cpp	(revision 12004)
@@ -26,10 +26,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -42,7 +42,7 @@
 
 	/*write output datasets: */
-	WriteMatlabData(LOADS,loads);
-	WriteMatlabData(CONVERGED,converged);
-	WriteMatlabData(NUMUNSTABLECONSTRAINTS,num_unstable_constraints);
+	WriteData(LOADS,loads);
+	WriteData(CONVERGED,converged);
+	WriteData(NUMUNSTABLECONSTRAINTS,num_unstable_constraints);
 	
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ConstraintsState/ConstraintsState.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ConstraintsState/ConstraintsState.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ConstraintsState/ConstraintsState.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ConstraintsStateUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ContourToMesh/ContourToMesh.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ContourToMesh/ContourToMesh.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ContourToMesh/ContourToMesh.cpp	(revision 12004)
@@ -58,8 +58,8 @@
 
 	/*Fetch inputs: */
-	FetchMatlabData(&index,&nel,NULL,INDEXHANDLE);
-	FetchMatlabData(&x,&nods,NULL,XHANDLE);
-	FetchMatlabData(&y,NULL,NULL,YHANDLE);
-	FetchMatlabData(&edgevalue,EDGEVALUEHANDLE);
+	FetchData(&index,&nel,NULL,INDEXHANDLE);
+	FetchData(&x,&nods,NULL,XHANDLE);
+	FetchData(&y,NULL,NULL,YHANDLE);
+	FetchData(&edgevalue,EDGEVALUEHANDLE);
 
 	//Fetch contours
@@ -78,5 +78,5 @@
 
 	/*Fetch  interptype: */
-	FetchMatlabData(&interptype,INTERPTYPEHANDLE);
+	FetchData(&interptype,INTERPTYPEHANDLE);
 
 	/* Debugging of contours :{{{1*/
@@ -96,12 +96,12 @@
 	/* output: */
 	if (strcmp(interptype,"node")==0){
-		WriteMatlabData(PLHS0,in_nod);
+		WriteData(PLHS0,in_nod);
 	}
 	else if (strcmp(interptype,"element")==0){
-		WriteMatlabData(PLHS0,in_elem);
+		WriteData(PLHS0,in_elem);
 	}
 	else if (strcmp(interptype,"element and node")==0){
-		WriteMatlabData(PLHS0,in_nod);
-		WriteMatlabData(PLHS1,in_elem);
+		WriteData(PLHS0,in_nod);
+		WriteData(PLHS1,in_elem);
 	}
 	else _error_(" wrong interpolation type");
Index: /issm/branches/trunk-jpl-damage/src/mex/ContourToMesh/ContourToMesh.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ContourToMesh/ContourToMesh.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ContourToMesh/ContourToMesh.h	(revision 12004)
@@ -11,4 +11,5 @@
 void ContourToMeshUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ContourToNodes/ContourToNodes.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ContourToNodes/ContourToNodes.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ContourToNodes/ContourToNodes.cpp	(revision 12004)
@@ -52,7 +52,7 @@
 	
 	/*Fetch inputs: */
-	FetchMatlabData(&x,&nods,NULL,XHANDLE);
-	FetchMatlabData(&y,NULL,NULL,YHANDLE);
-	FetchMatlabData(&edgevalue,EDGEVALUEHANDLE);
+	FetchData(&x,&nods,NULL,XHANDLE);
+	FetchData(&y,NULL,NULL,YHANDLE);
+	FetchData(&edgevalue,EDGEVALUEHANDLE);
 
 	//Fetch contours
@@ -95,5 +95,5 @@
 
 	/* output: */
-	WriteMatlabData(FLAGS,flags);
+	WriteData(FLAGS,flags);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ContourToNodes/ContourToNodes.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ContourToNodes/ContourToNodes.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ContourToNodes/ContourToNodes.h	(revision 12004)
@@ -11,4 +11,5 @@
 void ContourToNodesUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlInputGetGradient/ControlInputGetGradient.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlInputGetGradient/ControlInputGetGradient.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlInputGetGradient/ControlInputGetGradient.cpp	(revision 12004)
@@ -25,10 +25,10 @@
 	
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -42,5 +42,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(GRADIENT,gradient);
+	WriteData(GRADIENT,gradient);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlInputGetGradient/ControlInputGetGradient.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlInputGetGradient/ControlInputGetGradient.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlInputGetGradient/ControlInputGetGradient.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ControlInputGetGradientUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlInputScaleGradient/ControlInputScaleGradient.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlInputScaleGradient/ControlInputScaleGradient.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlInputScaleGradient/ControlInputScaleGradient.cpp	(revision 12004)
@@ -24,12 +24,12 @@
 
 /*Input datasets: */
-FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-FetchMatlabData((DataSet**)&nodes,NODESIN);
-FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-FetchMatlabData((DataSet**)&loads,LOADSIN);
-FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-FetchMatlabData(&parameters,PARAMETERSIN);
-FetchMatlabData(&norm_list,NULL,NULL,NORMLIST);
-FetchMatlabData(&step,STEP);
+FetchData((DataSet**)&elements,ELEMENTSIN);
+FetchData((DataSet**)&nodes,NODESIN);
+FetchData((DataSet**)&vertices,VERTICESIN);
+FetchData((DataSet**)&loads,LOADSIN);
+FetchData((DataSet**)&materials,MATERIALSIN);
+FetchData(&parameters,PARAMETERSIN);
+FetchData(&norm_list,NULL,NULL,NORMLIST);
+FetchData(&step,STEP);
 
 /*configure: */
@@ -42,10 +42,10 @@
 
 /*write output datasets: */
-WriteMatlabData(ELEMENTS,elements);
-WriteMatlabData(NODES,nodes);
-WriteMatlabData(VERTICES,vertices);
-WriteMatlabData(LOADS,loads);
-WriteMatlabData(MATERIALS,materials);
-WriteMatlabData(PARAMETERS,parameters);
+WriteData(ELEMENTS,elements);
+WriteData(NODES,nodes);
+WriteData(VERTICES,vertices);
+WriteData(LOADS,loads);
+WriteData(MATERIALS,materials);
+WriteData(PARAMETERS,parameters);
 
 /*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlInputScaleGradient/ControlInputScaleGradient.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlInputScaleGradient/ControlInputScaleGradient.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlInputScaleGradient/ControlInputScaleGradient.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ControlInputScaleGradientUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlInputSetGradient/ControlInputSetGradient.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlInputSetGradient/ControlInputSetGradient.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlInputSetGradient/ControlInputSetGradient.cpp	(revision 12004)
@@ -23,11 +23,11 @@
 
 /*Input datasets: */
-FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-FetchMatlabData((DataSet**)&nodes,NODESIN);
-FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-FetchMatlabData((DataSet**)&loads,LOADSIN);
-FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-FetchMatlabData(&parameters,PARAMETERSIN);
-FetchMatlabData(&gradient,NULL,GRADIENT);
+FetchData((DataSet**)&elements,ELEMENTSIN);
+FetchData((DataSet**)&nodes,NODESIN);
+FetchData((DataSet**)&vertices,VERTICESIN);
+FetchData((DataSet**)&loads,LOADSIN);
+FetchData((DataSet**)&materials,MATERIALSIN);
+FetchData(&parameters,PARAMETERSIN);
+FetchData(&gradient,NULL,GRADIENT);
 
 /*configure: */
@@ -40,10 +40,10 @@
 
 /*write output datasets: */
-WriteMatlabData(ELEMENTS,elements);
-WriteMatlabData(NODES,nodes);
-WriteMatlabData(VERTICES,vertices);
-WriteMatlabData(LOADS,loads);
-WriteMatlabData(MATERIALS,materials);
-WriteMatlabData(PARAMETERS,parameters);
+WriteData(ELEMENTS,elements);
+WriteData(NODES,nodes);
+WriteData(VERTICES,vertices);
+WriteData(LOADS,loads);
+WriteData(MATERIALS,materials);
+WriteData(PARAMETERS,parameters);
 
 /*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlInputSetGradient/ControlInputSetGradient.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlInputSetGradient/ControlInputSetGradient.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlInputSetGradient/ControlInputSetGradient.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ControlInputSetGradientUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlOptimization/ControlOptimization.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlOptimization/ControlOptimization.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlOptimization/ControlOptimization.cpp	(revision 12004)
@@ -29,12 +29,12 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&function_name,FUNCTIONNAME);
-	FetchMatlabData(&xmin,XMIN);
-	FetchMatlabData(&xmax,XMAX);
+	FetchData(&function_name,FUNCTIONNAME);
+	FetchData(&xmin,XMIN);
+	FetchData(&xmax,XMAX);
 
 	/*Parameters: */
-	FetchMatlabData(&maxiter,NULL,NULL,mxGetField(OPTIONS,0,"MaxIter"));
-	FetchMatlabData(&threshold,NULL,NULL,mxGetField(PARAMETERS,0,"InversionStepThreshold"));
-	FetchMatlabData(&n_value,STEP);
+	FetchData(&maxiter,NULL,NULL,mxGetField(OPTIONS,0,"MaxIter"));
+	FetchData(&threshold,NULL,NULL,mxGetField(PARAMETERS,0,"InversionStepThreshold"));
+	FetchData(&n_value,STEP);
 
 	optargs.function_name=function_name;
@@ -49,6 +49,6 @@
 
 	/*write output : */
-	WriteMatlabData(SEARCHSCALAR,search_scalar);
-	WriteMatlabData(MISFIT,J);
+	WriteData(SEARCHSCALAR,search_scalar);
+	WriteData(MISFIT,J);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ControlOptimization/ControlOptimization.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ControlOptimization/ControlOptimization.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ControlOptimization/ControlOptimization.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ControlOptimizationUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/CostFunction/CostFunction.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/CostFunction/CostFunction.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/CostFunction/CostFunction.cpp	(revision 12004)
@@ -25,10 +25,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -41,5 +41,5 @@
 
 	/*write output : */
-	WriteMatlabData(COST,J);
+	WriteData(COST,J);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/CostFunction/CostFunction.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/CostFunction/CostFunction.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/CostFunction/CostFunction.h	(revision 12004)
@@ -9,4 +9,5 @@
 void CostFunctionUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/CreateJacobianMatrix/CreateJacobianMatrix.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/CreateJacobianMatrix/CreateJacobianMatrix.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/CreateJacobianMatrix/CreateJacobianMatrix.cpp	(revision 12004)
@@ -26,11 +26,11 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
-	FetchMatlabData(&kmax,KMAX);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
+	FetchData(&kmax,KMAX);
 
 	/*configure: */
@@ -44,5 +44,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(JFF,Jff);
+	WriteData(JFF,Jff);
 	
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/CreateJacobianMatrix/CreateJacobianMatrix.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/CreateJacobianMatrix/CreateJacobianMatrix.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/CreateJacobianMatrix/CreateJacobianMatrix.h	(revision 12004)
@@ -9,4 +9,5 @@
 void CreateJacobianMatrixUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/CreateNodalConstraints/CreateNodalConstraints.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/CreateNodalConstraints/CreateNodalConstraints.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/CreateNodalConstraints/CreateNodalConstraints.cpp	(revision 12004)
@@ -21,6 +21,6 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData(&analysis_type,ANALYSISTYPE);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData(&analysis_type,ANALYSISTYPE);
 
 	/*!Reduce vector: */
@@ -28,5 +28,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(YS,ys);
+	WriteData(YS,ys);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/CreateNodalConstraints/CreateNodalConstraints.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/CreateNodalConstraints/CreateNodalConstraints.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/CreateNodalConstraints/CreateNodalConstraints.h	(revision 12004)
@@ -9,4 +9,5 @@
 void CreateNodalConstraintsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Dakota/Dakota.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Dakota/Dakota.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Dakota/Dakota.h	(revision 12004)
@@ -11,4 +11,5 @@
 void DakotaUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/DakotaResponses/DakotaResponses.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/DakotaResponses/DakotaResponses.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/DakotaResponses/DakotaResponses.cpp	(revision 12004)
@@ -31,10 +31,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-	FetchMatlabData(&parameters,PARAMETERSIN);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALSIN);
+	FetchData(&parameters,PARAMETERSIN);
 
 	/*number of responses: */
@@ -64,5 +64,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(RESPONSES,responses,numresponses);
+	WriteData(RESPONSES,responses,numresponses);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/DakotaResponses/DakotaResponses.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/DakotaResponses/DakotaResponses.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/DakotaResponses/DakotaResponses.h	(revision 12004)
@@ -9,4 +9,5 @@
 void DakotaResponsesUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Echo/Echo.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Echo/Echo.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Echo/Echo.cpp	(revision 12004)
@@ -17,5 +17,5 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&dataset,DATASET);
+	FetchData(&dataset,DATASET);
 
 	/*Echo dataset: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Echo/Echo.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Echo/Echo.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Echo/Echo.h	(revision 12004)
@@ -9,4 +9,5 @@
 void EchoUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ElementConnectivity/ElementConnectivity.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ElementConnectivity/ElementConnectivity.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ElementConnectivity/ElementConnectivity.cpp	(revision 12004)
@@ -23,6 +23,6 @@
         
 	/*Input datasets: */
-	FetchMatlabData(&elements,&nel,NULL,ELEMENTS);
-	FetchMatlabData(&nodeconnectivity,&nods,&width,NODECONNECTIVITY);
+	FetchData(&elements,&nel,NULL,ELEMENTS);
+	FetchData(&nodeconnectivity,&nods,&width,NODECONNECTIVITY);
 
 	/*!Generate internal degree of freedom numbers: */
@@ -30,5 +30,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3);
+	WriteData(ELEMENTCONNECTIVITY,elementconnectivity,nel,3);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ElementConnectivity/ElementConnectivity.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ElementConnectivity/ElementConnectivity.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ElementConnectivity/ElementConnectivity.h	(revision 12004)
@@ -11,4 +11,5 @@
 void ElementConnectivityUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/EnumToString/EnumToString.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/EnumToString/EnumToString.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/EnumToString/EnumToString.cpp	(revision 12004)
@@ -16,5 +16,5 @@
 
 	/*Fetch inputs: */
-	FetchMatlabData(&enum_in,ENUMIN);
+	FetchData(&enum_in,ENUMIN);
 
 	/*Run core function: */
@@ -22,5 +22,5 @@
 
 	/* output: */
-	WriteMatlabData(NAME,name);
+	WriteData(NAME,name);
 }
 
Index: /issm/branches/trunk-jpl-damage/src/mex/EnumToString/EnumToString.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/EnumToString/EnumToString.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/EnumToString/EnumToString.h	(revision 12004)
@@ -9,4 +9,5 @@
 void EnumToStringUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Exp2Kml/Exp2Kml.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Exp2Kml/Exp2Kml.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Exp2Kml/Exp2Kml.cpp	(revision 12004)
@@ -35,9 +35,9 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&filexp,EXP_IN);
+	FetchData(&filexp,EXP_IN);
 	if (verbose) printf("  filexp=\"%s\"\n",filexp);
-	FetchMatlabData(&filkml,KML_IN);
+	FetchData(&filkml,KML_IN);
 	if (verbose) printf("  filkml=\"%s\"\n",filkml);
-	FetchMatlabData(&sgn,SGN_IN);
+	FetchData(&sgn,SGN_IN);
 	if (verbose) printf("  sgn=%d\n",sgn);
 
@@ -76,5 +76,5 @@
 
 	/*Write data: */
-	WriteMatlabData(RET_OUT,iret);
+	WriteData(RET_OUT,iret);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/Exp2Kml/Exp2Kml.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Exp2Kml/Exp2Kml.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Exp2Kml/Exp2Kml.h	(revision 12004)
@@ -9,4 +9,5 @@
 void Exp2KmlUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/GetSolutionFromInputs/GetSolutionFromInputs.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/GetSolutionFromInputs/GetSolutionFromInputs.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/GetSolutionFromInputs/GetSolutionFromInputs.cpp	(revision 12004)
@@ -25,10 +25,10 @@
 	
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -41,5 +41,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(UG,ug);
+	WriteData(UG,ug);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/GetSolutionFromInputs/GetSolutionFromInputs.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/GetSolutionFromInputs/GetSolutionFromInputs.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/GetSolutionFromInputs/GetSolutionFromInputs.h	(revision 12004)
@@ -9,4 +9,5 @@
 void GetSolutionFromInputsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/GetVectorFromInputs/GetVectorFromInputs.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/GetVectorFromInputs/GetVectorFromInputs.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/GetVectorFromInputs/GetVectorFromInputs.cpp	(revision 12004)
@@ -27,12 +27,12 @@
 	
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
-	FetchMatlabData(&name_enum,NAMEENUM);
-	FetchMatlabData(&type_enum,TYPEENUM);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
+	FetchData(&name_enum,NAMEENUM);
+	FetchData(&type_enum,TYPEENUM);
 
 	/*configure: */
@@ -45,5 +45,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(UG,ug);
+	WriteData(UG,ug);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/GetVectorFromInputs/GetVectorFromInputs.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/GetVectorFromInputs/GetVectorFromInputs.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/GetVectorFromInputs/GetVectorFromInputs.h	(revision 12004)
@@ -9,4 +9,5 @@
 void GetVectorFromInputsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Gradj/Gradj.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Gradj/Gradj.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Gradj/Gradj.cpp	(revision 12004)
@@ -27,10 +27,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 	parameters->FindParam(&num_controls,InversionNumControlParametersEnum); 
 
@@ -44,6 +44,6 @@
 
 	/*write output : */
-	WriteMatlabData(NORMLIST,norm_list,num_controls,1);
-	WriteMatlabData(GRADG,gradient);
+	WriteData(NORMLIST,norm_list,num_controls,1);
+	WriteData(GRADG,gradient);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Gradj/Gradj.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Gradj/Gradj.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Gradj/Gradj.h	(revision 12004)
@@ -9,4 +9,5 @@
 void GradjUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/GroundinglineMigration/GroundinglineMigration.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/GroundinglineMigration/GroundinglineMigration.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/GroundinglineMigration/GroundinglineMigration.cpp	(revision 12004)
@@ -22,10 +22,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-	FetchMatlabData(&parameters,PARAMETERSIN);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALSIN);
+	FetchData(&parameters,PARAMETERSIN);
 
 	/*configure: */
@@ -38,10 +38,10 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(NODES,nodes);
-	WriteMatlabData(VERTICES,vertices);
-	WriteMatlabData(LOADS,loads);
-	WriteMatlabData(MATERIALS,materials);
-	WriteMatlabData(PARAMETERS,parameters);
+	WriteData(ELEMENTS,elements);
+	WriteData(NODES,nodes);
+	WriteData(VERTICES,vertices);
+	WriteData(LOADS,loads);
+	WriteData(MATERIALS,materials);
+	WriteData(PARAMETERS,parameters);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/GroundinglineMigration/GroundinglineMigration.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/GroundinglineMigration/GroundinglineMigration.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/GroundinglineMigration/GroundinglineMigration.h	(revision 12004)
@@ -9,4 +9,5 @@
 void GroundinglineMigrationUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/HoleFiller/HoleFiller.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/HoleFiller/HoleFiller.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/HoleFiller/HoleFiller.cpp	(revision 12004)
@@ -38,6 +38,6 @@
 
 	/*Fetch data: */
-	FetchMatlabData(&imagein,&imagein_rows,&imagein_cols,IMAGEIN);
-	FetchMatlabData(&smooth_flag,SMOOTH);
+	FetchData(&imagein,&imagein_rows,&imagein_cols,IMAGEIN);
+	FetchData(&smooth_flag,SMOOTH);
 	
 	/*Get smooth flag setup: */
@@ -51,5 +51,5 @@
 
 	/* output: */
-	WriteMatlabData(IMAGEOUT,imageout,imagein_rows,imagein_cols);
+	WriteData(IMAGEOUT,imageout,imagein_rows,imagein_cols);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/HoleFiller/HoleFiller.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/HoleFiller/HoleFiller.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/HoleFiller/HoleFiller.h	(revision 12004)
@@ -11,4 +11,5 @@
 void HoleFillerUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputControlUpdate/InputControlUpdate.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputControlUpdate/InputControlUpdate.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputControlUpdate/InputControlUpdate.cpp	(revision 12004)
@@ -24,12 +24,12 @@
 
 /*Input datasets: */
-FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-FetchMatlabData((DataSet**)&nodes,NODESIN);
-FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-FetchMatlabData((DataSet**)&loads,LOADSIN);
-FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-FetchMatlabData(&parameters,PARAMETERSIN);
-FetchMatlabData(&scalar,SCALAR);
-FetchMatlabData(&update,UPDATE);
+FetchData((DataSet**)&elements,ELEMENTSIN);
+FetchData((DataSet**)&nodes,NODESIN);
+FetchData((DataSet**)&vertices,VERTICESIN);
+FetchData((DataSet**)&loads,LOADSIN);
+FetchData((DataSet**)&materials,MATERIALSIN);
+FetchData(&parameters,PARAMETERSIN);
+FetchData(&scalar,SCALAR);
+FetchData(&update,UPDATE);
 
 /*configure: */
@@ -42,10 +42,10 @@
 
 /*write output datasets: */
-WriteMatlabData(ELEMENTS,elements);
-WriteMatlabData(NODES,nodes);
-WriteMatlabData(VERTICES,vertices);
-WriteMatlabData(LOADS,loads);
-WriteMatlabData(MATERIALS,materials);
-WriteMatlabData(PARAMETERS,parameters);
+WriteData(ELEMENTS,elements);
+WriteData(NODES,nodes);
+WriteData(VERTICES,vertices);
+WriteData(LOADS,loads);
+WriteData(MATERIALS,materials);
+WriteData(PARAMETERS,parameters);
 
 /*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputControlUpdate/InputControlUpdate.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputControlUpdate/InputControlUpdate.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputControlUpdate/InputControlUpdate.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputControlUpdateUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputConvergence/InputConvergence.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputConvergence/InputConvergence.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputConvergence/InputConvergence.cpp	(revision 12004)
@@ -35,17 +35,17 @@
 	CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&InputConvergenceUsage);
 
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
-	FetchMatlabData(&double_fields,&numfields,FIELDENUMS);
+	FetchData(&double_fields,&numfields,FIELDENUMS);
 	field_enums=(int*)xmalloc(numfields*sizeof(int));
 	for(i=0;i<numfields;i++)field_enums[i]=(int)double_fields[i];
 
-	FetchMatlabData(&double_criterion,&numcriterions,CRITERIONENUMS);
-	FetchMatlabData(&criterion_values,&numcriterions,CRITERIONVALUES);
+	FetchData(&double_criterion,&numcriterions,CRITERIONENUMS);
+	FetchData(&criterion_values,&numcriterions,CRITERIONVALUES);
 	criterion_enums=(int*)xmalloc(numcriterions*sizeof(int));
 	for(i=0;i<numcriterions;i++)criterion_enums[i]=(int)double_criterion[i];
@@ -60,5 +60,5 @@
 
 	/*Write output data: */
-	WriteMatlabData(CONVERGED,converged);
+	WriteData(CONVERGED,converged);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputConvergence/InputConvergence.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputConvergence/InputConvergence.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputConvergence/InputConvergence.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputConvergenceUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputDuplicate/InputDuplicate.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputDuplicate/InputDuplicate.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputDuplicate/InputDuplicate.cpp	(revision 12004)
@@ -23,13 +23,13 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 	
-	FetchMatlabData(&original_enum,ORIGINALENUM);
-	FetchMatlabData(&new_enum,NEWENUM);
+	FetchData(&original_enum,ORIGINALENUM);
+	FetchData(&new_enum,NEWENUM);
 
 	/*!Call core code: */
@@ -37,5 +37,5 @@
 
 	/*write output : */
-	WriteMatlabData(ELEMENTSOUT,elements);
+	WriteData(ELEMENTSOUT,elements);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputDuplicate/InputDuplicate.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputDuplicate/InputDuplicate.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputDuplicate/InputDuplicate.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputDuplicateUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputScale/InputScale.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputScale/InputScale.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputScale/InputScale.cpp	(revision 12004)
@@ -24,13 +24,13 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 	
-	FetchMatlabData(&enum_type,ENUMTYPE);
-	FetchMatlabData(&scale_factor,SCALEFACTOR);
+	FetchData(&enum_type,ENUMTYPE);
+	FetchData(&scale_factor,SCALEFACTOR);
 
 	/*configure: */
@@ -43,5 +43,5 @@
 
 	/*write output : */
-	WriteMatlabData(ELEMENTSOUT,elements);
+	WriteData(ELEMENTSOUT,elements);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputScale/InputScale.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputScale/InputScale.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputScale/InputScale.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputScaleUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputToResult/InputToResult.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputToResult/InputToResult.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputToResult/InputToResult.cpp	(revision 12004)
@@ -28,12 +28,12 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 	
-	FetchMatlabData(&enum_type,ENUMTYPE);
+	FetchData(&enum_type,ENUMTYPE);
 
 	/*configure: */
@@ -42,19 +42,9 @@
 	loads->     Configure(elements, loads, nodes,vertices, materials,parameters);
 
-	if(nrhs==9){
-		FetchMatlabData(&step,STEP);
-		FetchMatlabData(&time,TIME);
-
-		/*!Call core code: */
-		InputToResultx( elements, nodes, vertices, loads, materials,parameters,enum_type, step,time);
-	}
-	else{
-
-		/*!Call core code: */
-		InputToResultx( elements, nodes, vertices, loads, materials,parameters,enum_type);
-	}
+	/*Call core code: */
+	InputToResultx( elements, nodes, vertices, loads, materials,parameters,enum_type);
 
 	/*write output : */
-	WriteMatlabData(ELEMENTSOUT,elements);
+	WriteData(ELEMENTSOUT,elements);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputToResult/InputToResult.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputToResult/InputToResult.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputToResult/InputToResult.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputToResultUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromConstant/InputUpdateFromConstant.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromConstant/InputUpdateFromConstant.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromConstant/InputUpdateFromConstant.cpp	(revision 12004)
@@ -24,12 +24,12 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-	FetchMatlabData(&parameters,PARAMETERSIN);
-	FetchMatlabData(&constant,CONSTANT);
-	FetchMatlabData(&name,NAME);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALSIN);
+	FetchData(&parameters,PARAMETERSIN);
+	FetchData(&constant,CONSTANT);
+	FetchData(&name,NAME);
 
 	/*configure: */
@@ -42,6 +42,6 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(LOADS,loads);
+	WriteData(ELEMENTS,elements);
+	WriteData(LOADS,loads);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromConstant/InputUpdateFromConstant.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromConstant/InputUpdateFromConstant.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromConstant/InputUpdateFromConstant.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputUpdateFromConstantUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.cpp	(revision 12004)
@@ -30,12 +30,12 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-	FetchMatlabData(&parameters,PARAMETERSIN);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALSIN);
+	FetchData(&parameters,PARAMETERSIN);
 	/*dakota input: */
-	FetchMatlabData(&variables,&numvariables,VARIABLES);
+	FetchData(&variables,&numvariables,VARIABLES);
 
 	variables_descriptors=(char**)xmalloc(numvariables*sizeof(char*));
@@ -60,7 +60,7 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(LOADS,loads);
-	WriteMatlabData(MATERIALS,materials);
+	WriteData(ELEMENTS,elements);
+	WriteData(LOADS,loads);
+	WriteData(MATERIALS,materials);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromDakota/InputUpdateFromDakota.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputUpdateFromDakotaUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromSolution/InputUpdateFromSolution.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromSolution/InputUpdateFromSolution.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromSolution/InputUpdateFromSolution.cpp	(revision 12004)
@@ -23,11 +23,11 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-	FetchMatlabData(&parameters,PARAMETERSIN);
-	FetchMatlabData(&solution,SOLUTION);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALSIN);
+	FetchData(&parameters,PARAMETERSIN);
+	FetchData(&solution,SOLUTION);
 
 	/*configure: */
@@ -40,6 +40,6 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(MATERIALS,materials);
+	WriteData(ELEMENTS,elements);
+	WriteData(MATERIALS,materials);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromSolution/InputUpdateFromSolution.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromSolution/InputUpdateFromSolution.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromSolution/InputUpdateFromSolution.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InputUpdateFromSolutionUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromVector/InputUpdateFromVector.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromVector/InputUpdateFromVector.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromVector/InputUpdateFromVector.cpp	(revision 12004)
@@ -26,13 +26,13 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-	FetchMatlabData(&parameters,PARAMETERSIN);
-	FetchMatlabData(&vector,&dummy,VECTOR);
-	FetchMatlabData(&name,NAME);
-	FetchMatlabData(&type,TYPE);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALSIN);
+	FetchData(&parameters,PARAMETERSIN);
+	FetchData(&vector,&dummy,VECTOR);
+	FetchData(&name,NAME);
+	FetchData(&type,TYPE);
 
 	/*Check that type is one of Constant, Vertex or Element: */
@@ -50,10 +50,10 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(NODES,nodes);
-	WriteMatlabData(VERTICES,vertices);
-	WriteMatlabData(LOADS,loads);
-	WriteMatlabData(MATERIALS,materials);
-	WriteMatlabData(PARAMETERS,parameters);
+	WriteData(ELEMENTS,elements);
+	WriteData(NODES,nodes);
+	WriteData(VERTICES,vertices);
+	WriteData(LOADS,loads);
+	WriteData(MATERIALS,materials);
+	WriteData(PARAMETERS,parameters);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromVector/InputUpdateFromVector.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromVector/InputUpdateFromVector.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InputUpdateFromVector/InputUpdateFromVector.h	(revision 12004)
@@ -11,4 +11,5 @@
 void InputUpdateFromVectorUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InternalFront/InternalFront.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InternalFront/InternalFront.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InternalFront/InternalFront.cpp	(revision 12004)
@@ -25,11 +25,11 @@
 
 	/*Fetch required fields*/
-	FetchMatlabData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements"));
+	FetchData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements"));
 	if(numberofelements<=0) _error_("No elements found in the model");
-	FetchMatlabData(&elements,&M,&N,mxGetAssignedField(MODEL,0,"elements"));
+	FetchData(&elements,&M,&N,mxGetAssignedField(MODEL,0,"elements"));
 	if(M!=numberofelements || N!=3) _error_("Field 'elements' should be of size [md.numberofelements 3]");
-	FetchMatlabData(&elementonwater,&M,&N,mxGetAssignedField(MODEL,0,"elementonwater"));
+	FetchData(&elementonwater,&M,&N,mxGetAssignedField(MODEL,0,"elementonwater"));
 	if(M!=numberofelements || N!=1) _error_("Field 'elementonwater' should be of size [md.numberofelements 1]");
-	FetchMatlabData(&elementconnectivity,&M,&N,mxGetAssignedField(MODEL,0,"elementconnectivity"));
+	FetchData(&elementconnectivity,&M,&N,mxGetAssignedField(MODEL,0,"elementconnectivity"));
 	if(M!=numberofelements || N!=3) _error_("Field 'elementconnectivity' should be of size [md.numberofelements 3]");
 
@@ -87,5 +87,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(FRONT,front2,numberofsegments,4);
+	WriteData(FRONT,front2,numberofsegments,4);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InternalFront/InternalFront.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InternalFront/InternalFront.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InternalFront/InternalFront.h	(revision 12004)
@@ -11,4 +11,5 @@
 void InternalFrontUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/shared/shared.h"
 #include "../../c/io/io.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 12004)
@@ -50,14 +50,14 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&x,&x_rows,NULL,XHANDLE);
-	FetchMatlabData(&y,&y_rows,NULL,YHANDLE);
-	FetchMatlabData(&data,&data_rows,&data_cols,DATAHANDLE);
-	FetchMatlabData(&x_mesh,&x_mesh_rows,NULL,XMESHHANDLE);
-	FetchMatlabData(&y_mesh,&y_mesh_rows,NULL,YMESHHANDLE);
-	FetchMatlabData(&default_value,DEFAULTHANDLE);
+	FetchData(&x,&x_rows,NULL,XHANDLE);
+	FetchData(&y,&y_rows,NULL,YHANDLE);
+	FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
+	FetchData(&x_mesh,&x_mesh_rows,NULL,XMESHHANDLE);
+	FetchData(&y_mesh,&y_mesh_rows,NULL,YMESHHANDLE);
+	FetchData(&default_value,DEFAULTHANDLE);
 
 	/* Run core computations: */
 	if(nrhs==7){
-		FetchMatlabData(&interpolationenum,INTERPENUM);
+		FetchData(&interpolationenum,INTERPENUM);
 		InterpFromGridToMeshx(&data_mesh, x, x_rows,  y, y_rows, data, data_rows,data_cols, x_mesh, y_mesh, x_mesh_rows,default_value,interpolationenum);
 	}
@@ -67,5 +67,5 @@
 
 	/*Write data: */
-	WriteMatlabData(DATAMESH,data_mesh);
+	WriteData(DATAMESH,data_mesh);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromGridToMesh/InterpFromGridToMesh.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InterpFromGridToMeshUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMesh2d/InterpFromMesh2d.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 12004)
@@ -77,14 +77,14 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&index_data,&index_data_rows,&dummy,INDEXHANDLE);
-	FetchMatlabData(&x_data,&x_data_rows,NULL,XHANDLE);
-	FetchMatlabData(&y_data,&y_data_rows,NULL,YHANDLE);
-	FetchMatlabData(&data,&data_rows,&data_cols,DATAHANDLE);
-	FetchMatlabData(&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE);
-	FetchMatlabData(&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE);
+	FetchData(&index_data,&index_data_rows,&dummy,INDEXHANDLE);
+	FetchData(&x_data,&x_data_rows,NULL,XHANDLE);
+	FetchData(&y_data,&y_data_rows,NULL,YHANDLE);
+	FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
+	FetchData(&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE);
+	FetchData(&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE);
 
 	if(nrhs>=7){
 		/*default values: */
-		FetchMatlabData(&default_values,&num_default_values,DEFAULTHANDLE);
+		FetchData(&default_values,&num_default_values,DEFAULTHANDLE);
 	}
 	else{
@@ -146,5 +146,5 @@
 
 	/*Write data: */
-	WriteMatlabData(DATAPRIME,data_prime);
+	WriteData(DATAPRIME,data_prime);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMesh2d/InterpFromMesh2d.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMesh2d/InterpFromMesh2d.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMesh2d/InterpFromMesh2d.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InterpFromMesh2dUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp	(revision 12004)
@@ -35,15 +35,15 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&index,&nel,NULL,INDEX);
-	FetchMatlabData(&x,&nods,NULL,X);
-	FetchMatlabData(&y,NULL,NULL,Y);
-	FetchMatlabData(&meshdata,&meshdata_length,NULL,MESHDATA);
-	FetchMatlabData(&xmin,XMIN);
-	FetchMatlabData(&ymax,YMAX);
-	FetchMatlabData(&xposting,XPOSTING);
-	FetchMatlabData(&yposting,YPOSTING);
-	FetchMatlabData(&nlines,NLINES);
-	FetchMatlabData(&ncols,NCOLS);
-	FetchMatlabData(&default_value,DEFAULTVALUE);
+	FetchData(&index,&nel,NULL,INDEX);
+	FetchData(&x,&nods,NULL,X);
+	FetchData(&y,NULL,NULL,Y);
+	FetchData(&meshdata,&meshdata_length,NULL,MESHDATA);
+	FetchData(&xmin,XMIN);
+	FetchData(&ymax,YMAX);
+	FetchData(&xposting,XPOSTING);
+	FetchData(&yposting,YPOSTING);
+	FetchData(&nlines,NLINES);
+	FetchData(&ncols,NCOLS);
+	FetchData(&default_value,DEFAULTVALUE);
 
 	/*Call core of computation: */
@@ -51,7 +51,7 @@
 
 	/*Write results: */
-	WriteMatlabData(XM,x_m,ncols);
-	WriteMatlabData(YM,y_m,nlines);
-	WriteMatlabData(GRIDDATA,griddata,nlines,ncols);
+	WriteData(XM,x_m,ncols);
+	WriteData(YM,y_m,nlines);
+	WriteData(GRIDDATA,griddata,nlines,ncols);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.h	(revision 12004)
@@ -11,4 +11,5 @@
 void InterpFromMeshToGridUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.cpp	(revision 12004)
@@ -61,10 +61,10 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs\n");
-	FetchMatlabData(&index,&nels_data,&index_cols,INDEXHANDLE);
-	FetchMatlabData(&x_data,&x_data_rows,NULL,XHANDLE);
-	FetchMatlabData(&y_data,&y_data_rows,NULL,YHANDLE);
-	FetchMatlabData(&data,&data_rows,&data_cols,DATAHANDLE);
-	FetchMatlabData(&x_interp,&x_interp_rows,NULL,XINTERPHANDLE);
-	FetchMatlabData(&y_interp,&y_interp_rows,NULL,YINTERPHANDLE);
+	FetchData(&index,&nels_data,&index_cols,INDEXHANDLE);
+	FetchData(&x_data,&x_data_rows,NULL,XHANDLE);
+	FetchData(&y_data,&y_data_rows,NULL,YHANDLE);
+	FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
+	FetchData(&x_interp,&x_interp_rows,NULL,XINTERPHANDLE);
+	FetchData(&y_interp,&y_interp_rows,NULL,YINTERPHANDLE);
 
 	if(nrhs==8){
@@ -74,5 +74,5 @@
 
 		/*default values: */
-		FetchMatlabData(&default_values,&num_default_values,DEFAULTHANDLE);
+		FetchData(&default_values,&num_default_values,DEFAULTHANDLE);
 
 		/*contours: */
@@ -129,5 +129,5 @@
 
 	/*Write data: */
-	WriteMatlabData(DATAINTERP,data_interp,nods_interp,data_cols);
+	WriteData(DATAINTERP,data_interp,nods_interp,data_cols);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh2d/InterpFromMeshToMesh2d.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InterpFromMeshToMesh2dUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 12004)
@@ -64,13 +64,13 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&index_data,&index_data_rows,NULL,INDEXHANDLE);
-	FetchMatlabData(&x_data,&x_data_rows,NULL,XHANDLE);
-	FetchMatlabData(&y_data,&y_data_rows,NULL,YHANDLE);
-	FetchMatlabData(&z_data,&z_data_rows,NULL,ZHANDLE);
-	FetchMatlabData(&data,&data_rows,&data_cols,DATAHANDLE);
-	FetchMatlabData(&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE);
-	FetchMatlabData(&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE);
-	FetchMatlabData(&z_prime,&z_prime_rows,NULL,ZPRIMEHANDLE);
-	FetchMatlabData(&default_value,DEFAULTHANDLE);
+	FetchData(&index_data,&index_data_rows,NULL,INDEXHANDLE);
+	FetchData(&x_data,&x_data_rows,NULL,XHANDLE);
+	FetchData(&y_data,&y_data_rows,NULL,YHANDLE);
+	FetchData(&z_data,&z_data_rows,NULL,ZHANDLE);
+	FetchData(&data,&data_rows,&data_cols,DATAHANDLE);
+	FetchData(&x_prime,&x_prime_rows,NULL,XPRIMEHANDLE);
+	FetchData(&y_prime,&y_prime_rows,NULL,YPRIMEHANDLE);
+	FetchData(&z_prime,&z_prime_rows,NULL,ZPRIMEHANDLE);
+	FetchData(&default_value,DEFAULTHANDLE);
 
 	/*some checks*/
@@ -90,5 +90,5 @@
 
 	/*Write data: */
-	WriteMatlabData(DATAPRIME,data_prime);
+	WriteData(DATAPRIME,data_prime);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.h	(revision 12004)
@@ -9,4 +9,5 @@
 void InterpFromMeshToMesh3dUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/KMLFileRead/KMLFileRead.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/KMLFileRead/KMLFileRead.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/KMLFileRead/KMLFileRead.cpp	(revision 12004)
@@ -67,5 +67,5 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&filnam,FILENAME);
+	FetchData(&filnam,FILENAME);
 	if (verbose) printf("  filnam =\"%s\"\n",filnam);
 
@@ -115,5 +115,5 @@
 
 	/*Write data: */
-	WriteMatlabData(ERRORFLAG,ierror);
+	WriteData(ERRORFLAG,ierror);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/KMLFileRead/KMLFileRead.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/KMLFileRead/KMLFileRead.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/KMLFileRead/KMLFileRead.h	(revision 12004)
@@ -9,4 +9,5 @@
 void KMLFileReadUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/KMLMeshWrite/KMLMeshWrite.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/KMLMeshWrite/KMLMeshWrite.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/KMLMeshWrite/KMLMeshWrite.cpp	(revision 12004)
@@ -62,5 +62,5 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&name,NAME);
+	FetchData(&name,NAME);
 	if (verbose) printf("  name   =\"%s\"\n",name);
 
@@ -84,25 +84,25 @@
 	}
 	else
-		FetchMatlabData(&notes,NOTES);
+		FetchData(&notes,NOTES);
 	if (verbose) printf("  notes  =\"%s\"\n",notes);
 
-	FetchMatlabData(&elem,&melem,&nelem,ELEMHANDLE);
+	FetchData(&elem,&melem,&nelem,ELEMHANDLE);
 	if (verbose) printf("  elem   =size [%d x %d]\n",melem,nelem);
-	FetchMatlabData(&nodecon,&mncon,&nncon,NODECONHANDLE);
+	FetchData(&nodecon,&mncon,&nncon,NODECONHANDLE);
 	if (verbose) printf("  nodecon=size [%d x %d]\n",mncon,nncon);
-	FetchMatlabData(&lat,&mlat,&nlat,LATHANDLE);
+	FetchData(&lat,&mlat,&nlat,LATHANDLE);
 	llat=mlat*nlat;
 	if (verbose) printf("  lat    =length [%d]\n",llat);
-	FetchMatlabData(&lng,&mlng,&nlng,LNGHANDLE);
+	FetchData(&lng,&mlng,&nlng,LNGHANDLE);
 	llng=mlng*nlng;
 	if (verbose) printf("  lng    =length [%d]\n",llng);
-	FetchMatlabData(&part,&mprt,&nprt,PARTHANDLE);
+	FetchData(&part,&mprt,&nprt,PARTHANDLE);
 	lprt=mprt*nprt;
 	if (verbose) printf("  part   =length [%d]\n",lprt);
-	FetchMatlabData(&data,&mdata,&ndata,DATAHANDLE);
+	FetchData(&data,&mdata,&ndata,DATAHANDLE);
 	if (verbose) printf("  data   =size [%d x %d]\n",mdata,ndata);
-	FetchMatlabData(&cmap,&mcmap,&ncmap,CMAPHANDLE);
+	FetchData(&cmap,&mcmap,&ncmap,CMAPHANDLE);
 	if (verbose) printf("  cmap   =size [%d x %d]\n",mcmap,ncmap);
-	FetchMatlabData(&filnam,FILENAME);
+	FetchData(&filnam,FILENAME);
 	if (verbose) printf("  filnam =\"%s\"\n",filnam);
 
@@ -160,5 +160,5 @@
 
 	/*Write data: */
-	WriteMatlabData(ERRORFLAG,ierror);
+	WriteData(ERRORFLAG,ierror);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/KMLMeshWrite/KMLMeshWrite.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/KMLMeshWrite/KMLMeshWrite.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/KMLMeshWrite/KMLMeshWrite.h	(revision 12004)
@@ -9,4 +9,5 @@
 void KMLMeshWriteUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/KMLOverlay/KMLOverlay.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/KMLOverlay/KMLOverlay.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/KMLOverlay/KMLOverlay.cpp	(revision 12004)
@@ -41,5 +41,5 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&filkml,FILENAME);
+	FetchData(&filkml,FILENAME);
 	if (verbose) printf("  filkml=\"%s\"\n",filkml);
 
@@ -109,5 +109,5 @@
 
 	/*Write data: */
-	WriteMatlabData(ERRORFLAG,ierror);
+	WriteData(ERRORFLAG,ierror);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/KMLOverlay/KMLOverlay.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/KMLOverlay/KMLOverlay.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/KMLOverlay/KMLOverlay.h	(revision 12004)
@@ -9,4 +9,5 @@
 void KMLOverlayUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Kml2Exp/Kml2Exp.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Kml2Exp/Kml2Exp.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Kml2Exp/Kml2Exp.cpp	(revision 12004)
@@ -33,9 +33,9 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&filkml,KML_IN);
+	FetchData(&filkml,KML_IN);
 	if (verbose) printf("  filkml=\"%s\"\n",filkml);
-	FetchMatlabData(&filexp,EXP_IN);
+	FetchData(&filexp,EXP_IN);
 	if (verbose) printf("  filexp=\"%s\"\n",filexp);
-	FetchMatlabData(&sgn,SGN_IN);
+	FetchData(&sgn,SGN_IN);
 	if (verbose) printf("  sgn=%d\n",sgn);
 
@@ -69,5 +69,5 @@
 
 	/*Write data: */
-	WriteMatlabData(RET_OUT,iret);
+	WriteData(RET_OUT,iret);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/Kml2Exp/Kml2Exp.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Kml2Exp/Kml2Exp.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Kml2Exp/Kml2Exp.h	(revision 12004)
@@ -9,4 +9,5 @@
 void Kml2ExpUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Ll2xy/Ll2xy.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Ll2xy/Ll2xy.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Ll2xy/Ll2xy.cpp	(revision 12004)
@@ -35,15 +35,15 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&lat,&nlat,LAT_IN);
+	FetchData(&lat,&nlat,LAT_IN);
 	if (verbose)
 		if   (nlat == 1) printf("  lat=%g\n",lat[0]);
 		else             printf("  lat=[%d values]\n",nlat);
 //	for (i=0; i<nlat; i++) printf("  lat[%d]=%g\n",i,lat[i]);
-	FetchMatlabData(&lon,&nlon,LON_IN);
+	FetchData(&lon,&nlon,LON_IN);
 	if (verbose)
 		if   (nlon == 1) printf("  lon=%g\n",lon[0]);
 		else             printf("  lon=[%d values]\n",nlon);
 //	for (i=0; i<nlon; i++) printf("  lon[%d]=%g\n",i,lon[i]);
-	FetchMatlabData(&sgn,SGN_IN);
+	FetchData(&sgn,SGN_IN);
 	if (verbose) printf("  sgn=%d\n",sgn);
 
@@ -84,6 +84,6 @@
 
 	/*Write data: */
-	WriteMatlabData(X_OUT,x,ncoord);
-	WriteMatlabData(Y_OUT,y,ncoord);
+	WriteData(X_OUT,x,ncoord);
+	WriteData(Y_OUT,y,ncoord);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/Ll2xy/Ll2xy.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Ll2xy/Ll2xy.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Ll2xy/Ll2xy.h	(revision 12004)
@@ -9,4 +9,5 @@
 void Ll2xyUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Makefile.am
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Makefile.am	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Makefile.am	(revision 12004)
@@ -1,9 +1,10 @@
-INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ 
-EXEEXT=$(MEXEXT)
-
+INCLUDES = @MATLABINCL@ @PETSCINCL@ @MPIINCL@ @METISINCL@ @TRIANGLEINCL@ @CHACOINCL@ @SCOTCHINCL@ @SHAPELIBINCL@ @BOOSTINCL@ @PYTHONINCL@ @PYTHON_NUMPYINCL@
+EXEEXT=$(WRAPPEREXT)
 #Bin programs {{{1
+
 if NOSERIAL
 bin_PROGRAMS = 
 else
+if MATLAB
 bin_PROGRAMS = AverageFilter\
 				AddExternalResult\
@@ -79,4 +80,5 @@
 				TriaSearch\
 				TriMesh\
+				TriMeshRifts\
 				TriMeshNoDensity\
 				TriMeshProcessRifts\
@@ -88,5 +90,8 @@
 				UpdateDynamicConstraints\
 				VerticesDof
-
+endif
+if PYTHON
+bin_PROGRAMS = TriMesh
+endif
 endif 
 #}}}
@@ -96,33 +101,37 @@
 else
 if DAKOTA
+if MATLAB
 bin_PROGRAMS += DakotaResponses\
 				Dakota\
 				InputUpdateFromDakota
-else
-bin_PROGRAMS += 
-endif
 endif 
+endif 
+endif
 #}}}
 #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) $(SHAPELIBLIB) $(MEXLIB)
-
-AM_LDFLAGS = $(MEXLINK)
-
-#Matlab
-AM_CXXFLAGS=  -DMATLAB  -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread 
+LDADD = ../c/libISSM.a $(TRIANGLELIB) $(PETSCLIB) $(FLIBS) $(PLAPACKLIB) $(MUMPSLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(SHAPELIBLIB) $(GSLLIB)
+
+#Initialize
+AM_CXXFLAGS = -D_SERIAL_
+
+if MATLAB
+AM_LDFLAGS   = $(MEXLINK)
+AM_CXXFLAGS +=  -DMATLAB  -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread 
+LDADD       += $(MEXLIB) 
+
+endif
+
+if PYTHON
+AM_LDFLAGS  = $(PYTHONLINK)
+AM_CXXFLAGS+=  -DNPY_NO_DEPRECATED_API 
+LDADD      += $(BOOSTLIB) $(PYTHONLIB)
+endif
+
 
 #Triangle library
-AM_CXXFLAGS+=  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER
-
-
-#64 vs 32 bits
-if LARGEARRAYS
-AM_CXXFLAGS += -D__GCC4BUILD__ -D_SERIAL_ 
-else
-AM_CXXFLAGS += -DMX_COMPAT_32 -D_SERIAL_
-endif
-
+AM_CXXFLAGS +=  -DTRILIBRARY -DANSI_DECLARATORS -DNO_TIMER
+
+#Optimization flags:
 AM_CXXFLAGS += $(CXXOPTFLAGS) 
-
 #}}}
 #Bin sources {{{1
@@ -343,4 +352,7 @@
 TriMesh_SOURCES = TriMesh/TriMesh.cpp\
 			  TriMesh/TriMesh.h
+
+TriMeshRifts_SOURCES = TriMeshRifts/TriMeshRifts.cpp\
+			  TriMeshRifts/TriMeshRifts.h
 
 TriMeshNoDensity_SOURCES = TriMeshNoDensity/TriMeshNoDensity.cpp\
Index: /issm/branches/trunk-jpl-damage/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.cpp	(revision 12004)
@@ -27,8 +27,8 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&uf,UF);
-	FetchMatlabData(&ys,YS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData(&uf,UF);
+	FetchData(&ys,YS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData(&parameters,PARAMETERS);
 
 	/*!Reduce vector: */
@@ -37,10 +37,10 @@
 	}
 	else{
-		FetchMatlabData(&flag_ys0,YSFLAG);
+		FetchData(&flag_ys0,YSFLAG);
 		Mergesolutionfromftogx(&ug, uf,ys,nodes,parameters,flag_ys0);
 	}
 
 	/*write output datasets: */
-	WriteMatlabData(UG,ug);
+	WriteData(UG,ug);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Mergesolutionfromftog/Mergesolutionfromftog.h	(revision 12004)
@@ -11,4 +11,5 @@
 void MergesolutionfromftogUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/MeshPartition/MeshPartition.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/MeshPartition/MeshPartition.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/MeshPartition/MeshPartition.cpp	(revision 12004)
@@ -56,16 +56,16 @@
 
 	/*Fetch data: */
-	FetchMatlabData(&dim,mxGetAssignedField(MODEL,0,"dimension"));
-	FetchMatlabData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements"));
-	FetchMatlabData(&numberofvertices,mxGetAssignedField(MODEL,0,"numberofvertices"));
-	FetchMatlabData(&elements,NULL,&elements_width,mxGetAssignedField(MODEL,0,"elements"));
+	FetchData(&dim,mxGetAssignedField(MODEL,0,"dimension"));
+	FetchData(&numberofelements,mxGetAssignedField(MODEL,0,"numberofelements"));
+	FetchData(&numberofvertices,mxGetAssignedField(MODEL,0,"numberofvertices"));
+	FetchData(&elements,NULL,&elements_width,mxGetAssignedField(MODEL,0,"elements"));
 
 	if (dim==3){
-		FetchMatlabData(&numberofelements2d,mxGetAssignedField(MODEL,0,"numberofelements2d"));
-		FetchMatlabData(&numberofvertices2d,mxGetAssignedField(MODEL,0,"numberofvertices2d"));
-		FetchMatlabData(&elements2d,NULL,NULL,mxGetAssignedField(MODEL,0,"elements2d"));
+		FetchData(&numberofelements2d,mxGetAssignedField(MODEL,0,"numberofelements2d"));
+		FetchData(&numberofvertices2d,mxGetAssignedField(MODEL,0,"numberofvertices2d"));
+		FetchData(&elements2d,NULL,NULL,mxGetAssignedField(MODEL,0,"elements2d"));
 	}
-	FetchMatlabData(&numberoflayers,mxGetAssignedField(MODEL,0,"numberoflayers"));
-	FetchMatlabData(&numareas,NUMAREAS);
+	FetchData(&numberoflayers,mxGetAssignedField(MODEL,0,"numberoflayers"));
+	FetchData(&numareas,NUMAREAS);
 
 	/*Run partitioning algorithm based on a "clever" use of the Metis partitioner: */
@@ -85,6 +85,6 @@
 
 	/*Write data:*/
-	WriteMatlabData(ELEMENTPARTITIONING,element_partitioning,numberofelements);
-	WriteMatlabData(NODEPARTITIONING,node_partitioning,numberofvertices);
+	WriteData(ELEMENTPARTITIONING,element_partitioning,numberofelements);
+	WriteData(NODEPARTITIONING,node_partitioning,numberofvertices);
 	
 	/*Free ressources:*/
Index: /issm/branches/trunk-jpl-damage/src/mex/MeshPartition/MeshPartition.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/MeshPartition/MeshPartition.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/MeshPartition/MeshPartition.h	(revision 12004)
@@ -11,4 +11,5 @@
 void MeshPartitionUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/MeshProfileIntersection/MeshProfileIntersection.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/MeshProfileIntersection/MeshProfileIntersection.cpp	(revision 12004)
@@ -53,5 +53,5 @@
 	/*Fetch inputs: */
 	//index
-	FetchMatlabData(&double_index,&nel,&dummy,INDEX);
+	FetchData(&double_index,&nel,&dummy,INDEX);
 	if(dummy!=3 && dummy!=6)_error_(" element triangulation should be of 3 or 6 column width!");
 	index=(int*)xmalloc(nel*3*sizeof(int));
@@ -62,6 +62,6 @@
 	}
 	//x and y
-	FetchMatlabData(&x,&nods,X);
-	FetchMatlabData(&y,&dummy,Y);
+	FetchData(&x,&nods,X);
+	FetchData(&y,&dummy,Y);
 
 	//contours
@@ -94,5 +94,5 @@
 
 	/* output: */
-	WriteMatlabData(SEGMENTS,segments,numsegs,5);
+	WriteData(SEGMENTS,segments,numsegs,5);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/MeshProfileIntersection/MeshProfileIntersection.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/MeshProfileIntersection/MeshProfileIntersection.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/MeshProfileIntersection/MeshProfileIntersection.h	(revision 12004)
@@ -11,4 +11,5 @@
 void MeshProfileIntersectionUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ModelProcessor/ModelProcessor.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ModelProcessor/ModelProcessor.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ModelProcessor/ModelProcessor.cpp	(revision 12004)
@@ -34,10 +34,10 @@
 	
 	/*open file input for reading: */
-	FetchMatlabData(&inputfilename,INPUTFILE);
+	FetchData(&inputfilename,INPUTFILE);
 	IOMODEL= pfopen(inputfilename ,"rb");
 
 	/*retrieve solution type and analyses: */
-	FetchMatlabData(&solution_type,SOLUTIONTYPE);
-	FetchMatlabData(&double_analyses,&numanalyses,ANALYSES);
+	FetchData(&solution_type,SOLUTIONTYPE);
+	FetchData(&double_analyses,&numanalyses,ANALYSES);
 	analyses=(int*)xmalloc(numanalyses*sizeof(int));
 	for(i=0;i<numanalyses;i++)analyses[i]=(int)double_analyses[i];
@@ -47,11 +47,11 @@
 
 	/*Write output data: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(NODES,nodes);
-	WriteMatlabData(VERTICES,vertices);
-	WriteMatlabData(CONSTRAINTS,constraints);
-	WriteMatlabData(LOADS,loads);
-	WriteMatlabData(MATERIALS,materials);
-	WriteMatlabData(PARAMETERS,parameters);
+	WriteData(ELEMENTS,elements);
+	WriteData(NODES,nodes);
+	WriteData(VERTICES,vertices);
+	WriteData(CONSTRAINTS,constraints);
+	WriteData(LOADS,loads);
+	WriteData(MATERIALS,materials);
+	WriteData(PARAMETERS,parameters);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ModelProcessor/ModelProcessor.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ModelProcessor/ModelProcessor.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ModelProcessor/ModelProcessor.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ModelProcessorUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/NodeConnectivity/NodeConnectivity.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/NodeConnectivity/NodeConnectivity.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/NodeConnectivity/NodeConnectivity.cpp	(revision 12004)
@@ -22,6 +22,6 @@
         
 	/*Input datasets: */
-	FetchMatlabData(&elements,&nel,NULL,ELEMENTS);
-	FetchMatlabData(&nods,NUMNODES);
+	FetchData(&elements,&nel,NULL,ELEMENTS);
+	FetchData(&nods,NUMNODES);
 
 	/*!Generate internal degree of freedom numbers: */
@@ -29,5 +29,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(CONNECTIVITY,connectivity,nods,width);
+	WriteData(CONNECTIVITY,connectivity,nods,width);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/NodeConnectivity/NodeConnectivity.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/NodeConnectivity/NodeConnectivity.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/NodeConnectivity/NodeConnectivity.h	(revision 12004)
@@ -11,4 +11,5 @@
 void NodeConnectivityUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/NodesDof/NodesDof.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/NodesDof/NodesDof.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/NodesDof/NodesDof.cpp	(revision 12004)
@@ -19,6 +19,6 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData(&parameters,PARAMETERS);
 
 	/*find analysis_type: */
@@ -29,5 +29,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(NODES,nodes);
+	WriteData(NODES,nodes);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/NodesDof/NodesDof.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/NodesDof/NodesDof.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/NodesDof/NodesDof.h	(revision 12004)
@@ -11,4 +11,5 @@
 void NodesDofUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Orth/Orth.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Orth/Orth.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Orth/Orth.cpp	(revision 12004)
@@ -21,6 +21,6 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&gradj,GRADJ);
-	FetchMatlabData(&oldgradj,OLDGRADJ);
+	FetchData(&gradj,GRADJ);
+	FetchData(&oldgradj,OLDGRADJ);
 
 	/*!Reduce load from g to f size: */
@@ -28,5 +28,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(NEWGRADJ,newgradj);
+	WriteData(NEWGRADJ,newgradj);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Orth/Orth.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Orth/Orth.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Orth/Orth.h	(revision 12004)
@@ -11,4 +11,5 @@
 void OrthUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/OutputResults/OutputResults.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/OutputResults/OutputResults.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/OutputResults/OutputResults.cpp	(revision 12004)
@@ -26,11 +26,11 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
-	FetchMatlabData((DataSet**)&results,RESULTS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&results,RESULTS);
 
 	/*results might be NULL, allocate: */
@@ -43,5 +43,5 @@
 
 	/*Call "x" code layer: */
-	OutputResultsx(&dataref, elements,nodes,vertices,loads,materials,parameters,&results);
+	OutputResultsx(&dataref, elements,nodes,vertices,loads,materials,parameters,results);
 
 	/*write output datasets: */
Index: /issm/branches/trunk-jpl-damage/src/mex/OutputResults/OutputResults.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/OutputResults/OutputResults.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/OutputResults/OutputResults.h	(revision 12004)
@@ -9,4 +9,5 @@
 void OutputResultsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/OutputRifts/OutputRifts.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/OutputRifts/OutputRifts.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/OutputRifts/OutputRifts.cpp	(revision 12004)
@@ -24,6 +24,6 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData(&numrifts,mxGetField(PARAMETERS,0,"numrifts"));
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData(&numrifts,mxGetField(PARAMETERS,0,"numrifts"));
 
 	/*!Call core code: */
@@ -31,5 +31,5 @@
 
 	/*write output : */
-	WriteMatlabData(RIFTPROPERTIES,riftproperties);
+	WriteData(RIFTPROPERTIES,riftproperties);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/OutputRifts/OutputRifts.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/OutputRifts/OutputRifts.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/OutputRifts/OutputRifts.h	(revision 12004)
@@ -11,4 +11,5 @@
 void OutputRiftsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ParameterOutput/ParameterOutput.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ParameterOutput/ParameterOutput.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ParameterOutput/ParameterOutput.cpp	(revision 12004)
@@ -27,13 +27,13 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&results,RESULTS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&results,RESULTS);
 	
 	/*parameters: */
-	FetchMatlabData(&analysis_type,ANALYSIS);
-	FetchMatlabData(&sub_analysis_type,SUBANALYSIS);
+	FetchData(&analysis_type,ANALYSIS);
+	FetchData(&sub_analysis_type,SUBANALYSIS);
 
 	/*!Generate internal degree of freedom numbers: */
@@ -41,5 +41,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(RESULTS,results,0,0,"DataSet",NULL); 
+	WriteData(RESULTS,results,0,0,"DataSet",NULL); 
 	
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ParameterOutput/ParameterOutput.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ParameterOutput/ParameterOutput.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ParameterOutput/ParameterOutput.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ParameterOutputUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ParsePetscOptions/ParsePetscOptions.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ParsePetscOptions/ParsePetscOptions.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ParsePetscOptions/ParsePetscOptions.cpp	(revision 12004)
@@ -19,6 +19,6 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&parameters,PARAMETERS);
-	FetchMatlabData(&petscoptionsfilename,PETSCOPTIONSFILENAME); 
+	FetchData(&parameters,PARAMETERS);
+	FetchData(&petscoptionsfilename,PETSCOPTIONSFILENAME); 
 
 	petscoptionsfid=fopen(petscoptionsfilename,"r");
@@ -28,5 +28,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(PARAMETERSOUT,parameters);
+	WriteData(PARAMETERSOUT,parameters);
 	
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ParsePetscOptions/ParsePetscOptions.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ParsePetscOptions/ParsePetscOptions.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ParsePetscOptions/ParsePetscOptions.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ParsePetscOptionsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 12004)
@@ -26,8 +26,8 @@
 
 	/*Fetch inputs: */
-	FetchMatlabData(&x,&nods,NULL,XHANDLE);  
-	FetchMatlabData(&y,NULL,NULL,YHANDLE);
-	FetchMatlabData(&mindistance,MINDISTANCE);
-	FetchMatlabData(&multithread,MULTITHREAD);
+	FetchData(&x,&nods,NULL,XHANDLE);  
+	FetchData(&y,NULL,NULL,YHANDLE);
+	FetchData(&mindistance,MINDISTANCE);
+	FetchData(&multithread,MULTITHREAD);
 
 	/*Run core routine: */
@@ -35,5 +35,5 @@
 
 	/* output: */
-	WriteMatlabData(FLAGS,flags);
+	WriteData(FLAGS,flags);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/PointCloudFindNeighbors/PointCloudFindNeighbors.h	(revision 12004)
@@ -11,4 +11,5 @@
 void PointCloudFindNeighborsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ProcessParams/ProcessParams.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ProcessParams/ProcessParams.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ProcessParams/ProcessParams.cpp	(revision 12004)
@@ -17,8 +17,8 @@
 	
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&parameters,PARAMETERS);
+	FetchData((DataSet**)&parameters,PARAMETERS);
 
 	/*write output datasets: */
-	WriteMatlabData(PARAMETERSOUT,parameters);
+	WriteData(PARAMETERSOUT,parameters);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ProcessParams/ProcessParams.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ProcessParams/ProcessParams.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ProcessParams/ProcessParams.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ProcessParamsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.cpp	(revision 12004)
@@ -22,8 +22,8 @@
         
 	/*Input datasets: */
-	FetchMatlabData(&connectivity,&nel,&dummy,CONNECTIVITY);
-	FetchMatlabData(&pool,&dummy,POOL);
-	FetchMatlabData(&index,INDEX);
-	FetchMatlabData(&flags,&dummy,FLAGS);
+	FetchData(&connectivity,&nel,&dummy,CONNECTIVITY);
+	FetchData(&pool,&dummy,POOL);
+	FetchData(&index,INDEX);
+	FetchData(&flags,&dummy,FLAGS);
 
 	/*!Generate internal degree of freedom numbers: */
@@ -31,5 +31,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(POOLOUT,pool,nel);
+	WriteData(POOLOUT,pool,nel);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/PropagateFlagsFromConnectivity/PropagateFlagsFromConnectivity.h	(revision 12004)
@@ -11,4 +11,5 @@
 void PropagateFlagsFromConnectivityUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Reduceload/Reduceload.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Reduceload/Reduceload.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Reduceload/Reduceload.cpp	(revision 12004)
@@ -23,11 +23,11 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&pf,PF);
-	FetchMatlabData(&Kfs,KFS);
-	FetchMatlabData(&ys,YS);
+	FetchData(&pf,PF);
+	FetchData(&Kfs,KFS);
+	FetchData(&ys,YS);
 
 	/*!Reduce load from g to f size: */
 	if(nrhs==4){
-		FetchMatlabData(&flag_ys0,YSFLAG);
+		FetchData(&flag_ys0,YSFLAG);
 		Reduceloadx(pf, Kfs, ys,flag_ys0);
 	}
@@ -37,5 +37,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(PFOUT,pf);
+	WriteData(PFOUT,pf);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Reduceload/Reduceload.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Reduceload/Reduceload.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Reduceload/Reduceload.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ReduceloadUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtof/Reducevectorgtof.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtof/Reducevectorgtof.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtof/Reducevectorgtof.cpp	(revision 12004)
@@ -22,7 +22,7 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&ug,UG);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData(&ug,UG);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData(&parameters,PARAMETERS);
 
 	/*!Reduce vector: */
@@ -30,5 +30,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(UF,uf);
+	WriteData(UF,uf);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtof/Reducevectorgtof.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtof/Reducevectorgtof.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtof/Reducevectorgtof.h	(revision 12004)
@@ -11,4 +11,5 @@
 void ReducevectorgtofUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtos/Reducevectorgtos.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtos/Reducevectorgtos.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtos/Reducevectorgtos.cpp	(revision 12004)
@@ -22,7 +22,7 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&yg,YG);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData(&yg,YG);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData(&parameters,PARAMETERS);
 
 	/*!Reduce vector: */
@@ -30,5 +30,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(YS,ys);
+	WriteData(YS,ys);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtos/Reducevectorgtos.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtos/Reducevectorgtos.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Reducevectorgtos/Reducevectorgtos.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ReducevectorgtosUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.cpp	(revision 12004)
@@ -26,10 +26,10 @@
         
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -42,5 +42,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(NODESOUT,nodes);
+	WriteData(NODESOUT,nodes);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/ResetCoordinateSystem/ResetCoordinateSystem.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ResetCoordinateSystemUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Response/Response.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Response/Response.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Response/Response.cpp	(revision 12004)
@@ -28,13 +28,13 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
-	FetchMatlabData(&response,RESPONSE);
-	FetchMatlabData(&process_units,PROCESSUNITS);
-	FetchMatlabData(&weight_index,WEIGHTINDEX);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
+	FetchData(&response,RESPONSE);
+	FetchData(&process_units,PROCESSUNITS);
+	FetchData(&weight_index,WEIGHTINDEX);
 
 	/*configure: */
@@ -47,5 +47,5 @@
 
 	/*write output : */
-	WriteMatlabData(OUTPUT,resp);
+	WriteData(OUTPUT,resp);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/Response/Response.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Response/Response.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Response/Response.h	(revision 12004)
@@ -9,4 +9,5 @@
 void ResponseUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Scotch/Scotch.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Scotch/Scotch.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Scotch/Scotch.h	(revision 12004)
@@ -13,4 +13,5 @@
 #include <time.h>      /*  clock,time,difftime  */
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Shp2Kml/Shp2Kml.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Shp2Kml/Shp2Kml.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Shp2Kml/Shp2Kml.cpp	(revision 12004)
@@ -44,9 +44,9 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&filshp,SHP_IN);
+	FetchData(&filshp,SHP_IN);
 	if (verbose) printf("  filshp=\"%s\"\n",filshp);
-	FetchMatlabData(&filkml,KML_IN);
+	FetchData(&filkml,KML_IN);
 	if (verbose) printf("  filkml=\"%s\"\n",filkml);
-	FetchMatlabData(&sgn,SGN_IN);
+	FetchData(&sgn,SGN_IN);
 	if (verbose) printf("  sgn=%d\n",sgn);
 
@@ -80,5 +80,5 @@
 
 	/*Write data: */
-	WriteMatlabData(RET_OUT,iret);
+	WriteData(RET_OUT,iret);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/Shp2Kml/Shp2Kml.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Shp2Kml/Shp2Kml.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Shp2Kml/Shp2Kml.h	(revision 12004)
@@ -9,4 +9,5 @@
 void Shp2KmlUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Solver/Solver.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Solver/Solver.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Solver/Solver.cpp	(revision 12004)
@@ -29,5 +29,5 @@
 	
 	/*parameters: */
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*In serial mode, we have not set any petsc options, do it now: */
@@ -40,8 +40,8 @@
 	
 		/*Input datasets: */
-		FetchMatlabData(&Kff,KFF);
-		FetchMatlabData(&pf,PF);
-		FetchMatlabData(&uf0,UF0);
-		FetchMatlabData(&df,DF);
+		FetchData(&Kff,KFF);
+		FetchData(&pf,PF);
+		FetchData(&uf0,UF0);
+		FetchData(&df,DF);
 
 		/*Core module: */
@@ -49,5 +49,5 @@
 
 		/*Write output*/
-		WriteMatlabData(UF,uf);
+		WriteData(UF,uf);
 	}
 	else{
Index: /issm/branches/trunk-jpl-damage/src/mex/Solver/Solver.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Solver/Solver.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Solver/Solver.h	(revision 12004)
@@ -11,4 +11,5 @@
 void SolverUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/SparseToVector/SparseToVector.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/SparseToVector/SparseToVector.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/SparseToVector/SparseToVector.h	(revision 12004)
@@ -13,4 +13,5 @@
 #include <time.h>      /*  clock,time,difftime  */
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/SpcNodes/SpcNodes.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/SpcNodes/SpcNodes.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/SpcNodes/SpcNodes.cpp	(revision 12004)
@@ -21,8 +21,8 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&constraints,CONSTRAINTS);
-	FetchMatlabData(&parameters,PARAMETERS);
-	FetchMatlabData(&analysis_type,ANALYSISTYPE);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&constraints,CONSTRAINTS);
+	FetchData(&parameters,PARAMETERS);
+	FetchData(&analysis_type,ANALYSISTYPE);
 	
 	/*!Generate internal degree of freedom numbers: */
@@ -30,5 +30,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(NODES,nodes);
+	WriteData(NODES,nodes);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/SpcNodes/SpcNodes.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/SpcNodes/SpcNodes.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/SpcNodes/SpcNodes.h	(revision 12004)
@@ -11,4 +11,5 @@
 void SpcNodesUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/StringToEnum/StringToEnum.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/StringToEnum/StringToEnum.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/StringToEnum/StringToEnum.cpp	(revision 12004)
@@ -16,5 +16,5 @@
 
 	/*Fetch inputs: */
-	FetchMatlabData(&name,NAME);
+	FetchData(&name,NAME);
 
 	/*Run core function: */
@@ -22,5 +22,5 @@
 
 	/* output: */
-	WriteMatlabData(ENUMOUT,enum_out);
+	WriteData(ENUMOUT,enum_out);
 }
 
Index: /issm/branches/trunk-jpl-damage/src/mex/StringToEnum/StringToEnum.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/StringToEnum/StringToEnum.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/StringToEnum/StringToEnum.h	(revision 12004)
@@ -9,4 +9,5 @@
 void StringToEnumUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/SurfaceArea/SurfaceArea.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/SurfaceArea/SurfaceArea.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/SurfaceArea/SurfaceArea.cpp	(revision 12004)
@@ -22,10 +22,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -38,5 +38,5 @@
 
 	/*write output : */
-	WriteMatlabData(ELEMENTSOUT,elements);
+	WriteData(ELEMENTSOUT,elements);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/SurfaceArea/SurfaceArea.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/SurfaceArea/SurfaceArea.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/SurfaceArea/SurfaceArea.h	(revision 12004)
@@ -9,4 +9,5 @@
 void SurfaceAreaUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/SystemMatrices/SystemMatrices.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/SystemMatrices/SystemMatrices.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/SystemMatrices/SystemMatrices.cpp	(revision 12004)
@@ -34,10 +34,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTS);
-	FetchMatlabData((DataSet**)&nodes,NODES);
-	FetchMatlabData((DataSet**)&vertices,VERTICES);
-	FetchMatlabData((DataSet**)&loads,LOADS);
-	FetchMatlabData((DataSet**)&materials,MATERIALS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&elements,ELEMENTS);
+	FetchData((DataSet**)&nodes,NODES);
+	FetchData((DataSet**)&vertices,VERTICES);
+	FetchData((DataSet**)&loads,LOADS);
+	FetchData((DataSet**)&materials,MATERIALS);
+	FetchData(&parameters,PARAMETERS);
 
 	/*configure: */
@@ -49,8 +49,8 @@
 	/*!Generate internal degree of freedom numbers: */
 	if(nrhs==10){
-		FetchMatlabData(&kflag,KFLAG);
-		FetchMatlabData(&pflag,PFLAG);
-		FetchMatlabData(&penalty_kflag,PENALTYKFLAG);
-		FetchMatlabData(&penalty_pflag,PENALTYPFLAG);
+		FetchData(&kflag,KFLAG);
+		FetchData(&pflag,PFLAG);
+		FetchData(&penalty_kflag,PENALTYKFLAG);
+		FetchData(&penalty_pflag,PENALTYPFLAG);
 		SystemMatricesx(&Kff,&Kfs,&pf,&df,&kmax,elements,nodes,vertices,loads,materials,parameters,kflag,pflag,penalty_kflag,penalty_pflag);
 	}
@@ -59,9 +59,9 @@
 
 	/*write output datasets: */
-	WriteMatlabData(KFF,Kff);
-	WriteMatlabData(KFS,Kfs);
-	WriteMatlabData(PF,pf);
-	WriteMatlabData(DF,df);
-	WriteMatlabData(KMAX,kmax);
+	WriteData(KFF,Kff);
+	WriteData(KFS,Kfs);
+	WriteData(PF,pf);
+	WriteData(DF,df);
+	WriteData(KMAX,kmax);
 	
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/SystemMatrices/SystemMatrices.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/SystemMatrices/SystemMatrices.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/SystemMatrices/SystemMatrices.h	(revision 12004)
@@ -9,4 +9,5 @@
 void SystemMatricesUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/TimeAdapt/TimeAdapt.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TimeAdapt/TimeAdapt.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TimeAdapt/TimeAdapt.cpp	(revision 12004)
@@ -25,10 +25,10 @@
 
 /*Input datasets: */
-FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-FetchMatlabData((DataSet**)&nodes,NODESIN);
-FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-FetchMatlabData((DataSet**)&loads,LOADSIN);
-FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-FetchMatlabData(&parameters,PARAMETERSIN);
+FetchData((DataSet**)&elements,ELEMENTSIN);
+FetchData((DataSet**)&nodes,NODESIN);
+FetchData((DataSet**)&vertices,VERTICESIN);
+FetchData((DataSet**)&loads,LOADSIN);
+FetchData((DataSet**)&materials,MATERIALSIN);
+FetchData(&parameters,PARAMETERSIN);
 
 /*configure: */
@@ -41,5 +41,5 @@
 
 /*write output datasets: */
-WriteMatlabData(DT,dt);
+WriteData(DT,dt);
 
 /*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/TimeAdapt/TimeAdapt.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TimeAdapt/TimeAdapt.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TimeAdapt/TimeAdapt.h	(revision 12004)
@@ -9,4 +9,5 @@
 void TimeAdaptUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/TriMesh/TriMesh.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriMesh/TriMesh.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriMesh/TriMesh.cpp	(revision 12004)
@@ -1,323 +1,75 @@
 /*
- * TriMesh: out of a domain outline file ( Argus format ), 
- * use the Triangle package to create a triangular mesh 
- *
+ * TriMesh: mesh a domain using an .exp file
  */
 
 #include "./TriMesh.h"
 
+WRAPPER(TriMesh){
+	
+	/* input: */
+	char*  domainname=NULL;
+	double area;
+	bool   order;
 
-void mexFunction(	int nlhs, mxArray* plhs[],
-					int nrhs, const mxArray* prhs[] )
-{
+	/*intermediary: */
+	DataSet* domain=NULL;
+
+	/* output: */
+	Matrix* index=NULL;
+	Vector* x=NULL;
+	Vector* y=NULL;
+	Matrix* segments=NULL;
+	Vector* segmentmarkerlist=NULL;
+
+	/*Boot module: */
+	MODULEBOOT();
+
+	/*checks on arguments on the matlab side: */
+	CHECKARGUMENTS(NLHS,NRHS,&TriMeshUsage);
+	
+	/*Fetch data needed for meshing: */
+	FetchData(&domainname,DOMAINOUTLINE);
+	FetchData(&area,AREA);
+	FetchData(&order,ORDER);
 
 
-	/*Matlab arrays: */
-	mxArray* pmxa_array=NULL;
-	int i,j;
-	int counter,counter2,backcounter;
-	int prhs_counter;
+	/*Read domain outline: */
+	domain=DomainOutlineRead(domainname,false);
+
+	/*call x core: */
+	TriMeshx(&index,&x,&y,&segments,&segmentmarkerlist,domain,area,order);
 	
-	/* returned quantities: */
+	
+	/*write outputs: */
+	WriteData(INDEX,index);
+	WriteData(X,x);
+	WriteData(Y,y);
+	WriteData(SEGMENTS,segments);
+	WriteData(SEGMENTMARKERLIST,segmentmarkerlist);
 
-	double* index=NULL;
-	double* x=NULL;
-	double* y=NULL;
-	double* segments=NULL;
-	double*    segmentmarkerlist=NULL;
+	/*free ressources: */
+	delete domain;
+	xdelete(&index);
+	xdelete(&x);
+	xdelete(&y);
+	xdelete(&segments);
+	xdelete(&segmentmarkerlist);
 
-	/* input: */
-	char*  domainname=NULL;
-	char*  riftname=NULL;
-	double area;
-	char*  order=NULL;
-	
-	/*Domain outline variables: */
-	int      nprof;
-	int*     profnvertices=NULL;
-	double** pprofx=NULL;
-	double** pprofy=NULL;
-	double*  xprof=NULL;
-	double*  yprof=NULL;
-	int      numberofpoints;
+	/*end module: */
+	MODULEEND();
 
-	/*Rift outline variables: */
-	int      numrifts;
-	int*     riftsnumvertices=NULL;
-	double** riftsverticesx=NULL;
-	double** riftsverticesy=NULL;
-
-	/* Triangle structures: */
-	struct triangulateio in,out;
-	char   options[256];
-
-	/* verify correct usage: */
-	if (nlhs==0 && nrhs==0) {
-		/* special case: */
-		TriMeshUsage();
-		return;
-	}
-
-	if (!(  (nlhs==5) ||(nrhs==2) || (nrhs==3)  || (nrhs==4) )){
-		mexPrintf("   %s format error.\n", __FUNCT__);
-		TriMeshUsage();
-		printf("   ");
-		mexErrMsgTxt(" ");
-	}
-
-	/*Fetch data needed by Triangle: */
-
-	prhs_counter=0;
-	/*First recover the domain outline file name: */
-	if (!mxIsChar(prhs[prhs_counter])){
-		mexPrintf("%s%s\n",__FUNCT__," error message; first argument should be the domain outline file name!");
-		mexErrMsgTxt(" ");
-	}
-	domainname = (char *) mxMalloc((mxGetN(prhs[prhs_counter])+1)*sizeof(char));
-	mxGetString(prhs[prhs_counter],domainname,mxGetN(prhs[prhs_counter])+1);
-
-	/*Look for optional rifts file name: */
-	prhs_counter++;
-	if (mxIsChar(prhs[prhs_counter])){
-		riftname = (char *) mxMalloc((mxGetN(prhs[prhs_counter])+1)*sizeof(char));
-		mxGetString(prhs[prhs_counter],riftname,mxGetN(prhs[prhs_counter])+1);
-		prhs_counter++;
-	}
-
-	/*Recover the mesh density desired:*/
-	area=mxGetScalar(prhs[prhs_counter]);
-
-	/*Optionaly, recover desired order: */
-	prhs_counter++;
-	if (mxIsChar(prhs[prhs_counter])){
-		order = (char *) mxMalloc((mxGetN(prhs[prhs_counter])+1)*sizeof(char));
-		mxGetString(prhs[prhs_counter],order,mxGetN(prhs[prhs_counter])+1);
-	}
-	
-	/*Start reading the domain outline file: */
-	if(!DomainOutlineRead(&nprof,&profnvertices,&pprofx,&pprofy,NULL,domainname,false)){
-		printf("%s%s%s\n",__FUNCT__," error message reading domain outline ",domainname);
-		mexErrMsgTxt(" ");
-	}
-
-	/*Read rifts file if present: */
-	if(riftname){
-		if(!DomainOutlineRead(&numrifts,&riftsnumvertices,&riftsverticesx,&riftsverticesy,NULL,riftname,false)){
-			printf("%s%s%s\n",__FUNCT__," error message reading rifts outline ",riftname);
-			mexErrMsgTxt(" ");
-		}
-	}
-
-	/*Create initial triangulation to call triangulate():*/
-	numberofpoints=0;
-	for (i=0;i<nprof;i++){
-		numberofpoints+=profnvertices[i];
-	}
-	if (riftname){
-		for (i=0;i<numrifts;i++){
-			numberofpoints+=riftsnumvertices[i];
-		}
-	}
-	in.numberofpoints=numberofpoints;
-
-	in.numberofpointattributes=1;
-	in.pointlist = (REAL *) mxMalloc(in.numberofpoints * 2 * sizeof(REAL));
-
-	counter=0;
-	for (i=0;i<nprof;i++){
-		xprof=pprofx[i];
-		yprof=pprofy[i];
-		for (j=0;j<profnvertices[i];j++){
-			in.pointlist[2*counter+0]=xprof[j];
-			in.pointlist[2*counter+1]=yprof[j];
-			counter++;
-		}
-	}
-	if(riftname){
-		for (i=0;i<numrifts;i++){
-			xprof=riftsverticesx[i];
-			yprof=riftsverticesy[i];
-			for (j=0;j<riftsnumvertices[i];j++){
-				in.pointlist[2*counter+0]=xprof[j];
-				in.pointlist[2*counter+1]=yprof[j];
-				counter++;
-			}
-		}
-	}
-	
-	in.pointattributelist = (REAL *) mxMalloc(in.numberofpoints *
-										  in.numberofpointattributes *
-										  sizeof(REAL));
-	for (i=0;i<in.numberofpoints;i++){
-		in.pointattributelist[i] = 0.0;
-	}
-	in.pointmarkerlist = (int *) mxMalloc(in.numberofpoints * sizeof(int));
-	for(i=0;i<in.numberofpoints;i++){
-		in.pointmarkerlist[i] = 0;
-	}
-
-	/*Build segments: */
-	/*Figure out number of segments: holes and closed outlines have as many segments as vertices, 
-	 *for rifts, we have one less segment as we have vertices*/
-	in.numberofsegments=0;
-	for (i=0;i<nprof;i++){
-		in.numberofsegments+=profnvertices[i];
-	}
-	if (riftname){
-		for (i=0;i<numrifts;i++){
-			in.numberofsegments+=riftsnumvertices[i]-1;
-		}
-	}
-	
-	in.segmentlist = (int *) mxMalloc(in.numberofsegments * 2 * sizeof(int));
-	in.segmentmarkerlist = (int *) mxCalloc(in.numberofsegments,sizeof(int));
-	counter=0;
-	backcounter=0;
-	for (i=0;i<nprof;i++){
-		for (j=0;j<(profnvertices[i]-1);j++){
-			in.segmentlist[2*counter+0]=counter;
-			in.segmentlist[2*counter+1]=counter+1;
-			in.segmentmarkerlist[counter]=0;
-			counter++;
-		}
-		/*Close this profile: */
-		 in.segmentlist[2*counter+0]=counter;
-		 in.segmentlist[2*counter+1]=backcounter;
-		 in.segmentmarkerlist[counter]=0;
-		 counter++;
-		 backcounter=counter;
-	}
-	counter2=counter;
-	if(riftname){
-		for (i=0;i<numrifts;i++){
-			for (j=0;j<(riftsnumvertices[i]-1);j++){
-				in.segmentlist[2*counter2+0]=counter;
-				in.segmentlist[2*counter2+1]=counter+1;
-				in.segmentmarkerlist[counter2]=2+i;
-				counter2++;
-				counter++;
-			}
-			counter++;
-		}
-	}
-
-	
-	/*Build regions: */
-	in.numberofregions = 0;
-
-	/*Build holes: */
-	in.numberofholes = nprof-1; /*everything is a hole, but for the first profile.*/
-	in.holelist = (REAL *) mxMalloc(in.numberofholes * 2 * sizeof(REAL));
-	for (i=0;i<nprof-1;i++){
-		/*We are looking for a vertex that lies inside the hole: */
-		GridInsideHole(&in.holelist[2*i+0],&in.holelist[2*i+1],profnvertices[i+1],pprofx[i+1],pprofy[i+1]);
-	}
-
-	/* Make necessary initializations so that Triangle can return a */
-	/*   triangulation in `out': */
-
-	out.pointlist = (REAL *) NULL;            
-	out.pointattributelist = (REAL *) NULL;
-	out.pointmarkerlist = (int *) NULL; 
-	out.trianglelist = (int *) NULL;          
-	out.triangleattributelist = (REAL *) NULL;
-	out.neighborlist = (int *) NULL;         
-	out.segmentlist = (int *) NULL;
-	out.segmentmarkerlist = (int *) NULL;
-	out.edgelist = (int *) NULL;             
-	out.edgemarkerlist = (int *) NULL;   
-
-	/* Triangulate the points:.  Switches are chosen to read and write a  */
-	/*   PSLG (p), preserve the convex hull (c), number everything from  */
-	/*   zero (z), assign a regional attribute to each element (A), and  */
-	/*   produce an edge list (e), a Voronoi diagram (v), and a triangle */
-	/*   neighbor list (n).                                              */
-
-	sprintf(options,"%s%lf","pQzDq30ia",area); /*replace V by Q to quiet down the logging*/
-  
-	triangulate(options, &in, &out, NULL);
-	/*report(&out, 0, 1, 1, 1, 1, 0);*/
-
-	/*Allocate index, x and y: */
-	index=(double*)mxMalloc(3*out.numberoftriangles*sizeof(double));
-	x=(double*)mxMalloc(out.numberofpoints*sizeof(double));
-	y=(double*)mxMalloc(out.numberofpoints*sizeof(double));
-	segments=(double*)mxMalloc(3*out.numberofsegments*sizeof(double));
-	segmentmarkerlist=(double*)mxMalloc(out.numberofsegments*sizeof(double));
-
-	for (i = 0; i < out.numberoftriangles; i++) {
-		for (j = 0; j < out.numberofcorners; j++) {
-			*(index+3*i+j)=(double)out.trianglelist[i * out.numberofcorners + j]+1;
-		}
-	}
-	for (i = 0; i < out.numberofpoints; i++) {
-		x[i]=out.pointlist[i * 2 + 0];
-		y[i]=out.pointlist[i * 2 + 1];
-	}
-	
-	for (i = 0; i < out.numberofsegments; i++) {
-		segments[3*i+0]=(double)out.segmentlist[i*2+0]+1;
-		segments[3*i+1]=(double)out.segmentlist[i*2+1]+1;
-		segmentmarkerlist[i]=(double)out.segmentmarkerlist[i];
-	}
-
-	/*Associate elements with segments: */
-	AssociateSegmentToElement(&segments,out.numberofsegments,index,out.numberoftriangles);
-
-	/*Order segments so that their normals point outside the domain: */
-	if(!strcmp(order,"yes")){
-		OrderSegments(&segments,out.numberofsegments, index,out.numberoftriangles);
-	}
-
-	/*Output : */
-	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
-	mxSetM(pmxa_array,3);
-	mxSetN(pmxa_array,out.numberoftriangles);
-	mxSetPr(pmxa_array,index);
-	mexCallMATLAB( 1, &plhs[0], 1, &pmxa_array, "transpose");
-
-	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
-	mxSetM(pmxa_array,1);
-	mxSetN(pmxa_array,out.numberofpoints);
-	mxSetPr(pmxa_array,x);
-	mexCallMATLAB( 1, &plhs[1], 1, &pmxa_array, "transpose");
-
-	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
-	mxSetM(pmxa_array,1);
-	mxSetN(pmxa_array,out.numberofpoints);
-	mxSetPr(pmxa_array,y);
-	mexCallMATLAB( 1, &plhs[2], 1, &pmxa_array, "transpose");
-
-	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
-	mxSetM(pmxa_array,3);
-	mxSetN(pmxa_array,out.numberofsegments);
-	mxSetPr(pmxa_array,segments);
-	mexCallMATLAB( 1, &plhs[3], 1, &pmxa_array, "transpose");
-
-	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
-	mxSetM(pmxa_array,1);
-	mxSetN(pmxa_array,out.numberofsegments);
-	mxSetPr(pmxa_array,segmentmarkerlist);
-	mexCallMATLAB( 1, &plhs[4], 1, &pmxa_array, "transpose");
-	
-	return;
 }
 
-void TriMeshUsage(void)
+void TriMeshUsage(void) //{{{1
 {
 	printf("\n");
-	printf("   usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,riftsoutlinename,area,ordered) \n");
+	printf("   usage: [index,x,y,segments,segmentmarkers]=TriMesh(domainoutlinefilename,area,ordered) \n");
 	printf("      where: index,x,y defines a triangulation, segments is an array made \n");
-	printf("      of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment \n");
-	printf("      (if rifts are present, markers >=2 flag them ), outlinefilename an Argus domain outline file.\n");
-	printf("      riftsoutlinename is an Argus domain file, defining rifts (ie: open profiles), \n");
-	printf("      area is the maximum area desired for any element of the resulting mesh. \n");
-	printf("      and ordered is a string ('yes' or 'no') that determines whether segments are output in the \n");
+	printf("      of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment, \n");
+	printf("      outlinefilename an Argus domain outline file, \n");
+	printf("      area is the maximum area desired for any element of the resulting mesh, \n");
+	printf("      and ordered is a bool that determines whether segments are output in the \n");
 	printf("      order they are made by Triangle (ie none), or ordered counter clockwise around the domain outline.\n");
-	printf("      riftsoutlinename and ordered are optional arguments.\n");
 	printf("\n");
 }
-
-
-
-
+//}}}
Index: /issm/branches/trunk-jpl-damage/src/mex/TriMesh/TriMesh.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriMesh/TriMesh.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriMesh/TriMesh.h	(revision 12004)
@@ -1,21 +1,69 @@
-/*!\file:  TriMesh.h
- * \brief header prototype
- */ 
+/*
+	TriMesh.h
+*/
 
-#ifndef _TRIMESH_H_
-#define _TRIMESH_H_
+#ifndef _TRIMESH_H
+#define _TRIMESH_H
 
-#include "mex.h"
-#include "triangle.h"
-#include "string.h"
 
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+/*Very important definition in case we are compiling a python module!: needs to come before header files inclusion*/
+#ifdef _HAVE_PYTHON_
+#define PY_ARRAY_UNIQUE_SYMBOL PythonIOSymbol
+#endif
+
+#include "../../c/include/globals.h"
+#include "../../c/toolkits/toolkits.h"
+#include "../../c/include/include.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
 #include "../../c/shared/shared.h"
+#include "../../c/io/io.h"
+#include "../../c/EnumDefinitions/EnumDefinitions.h"
 
+#ifdef _HAVE_MATLAB_
+/* serial input macros: */
+#define DOMAINOUTLINE     (mxArray *)prhs[0]
+#define AREA        (mxArray *)prhs[1]
+#define ORDER     (mxArray *)prhs[2]
+
+/* serial output macros: */
+#define INDEX  (mxArray**)&plhs[0]
+#define X  (mxArray**)&plhs[1]
+#define Y   (mxArray**)&plhs[2]
+#define SEGMENTS   (mxArray**)&plhs[3]
+#define SEGMENTMARKERLIST (mxArray**)&plhs[4]
+
+#endif
+#ifdef _HAVE_PYTHON_
+/* serial input macros: */
+#define DOMAINOUTLINE     PyTuple_GetItem(args,0)
+#define AREA        PyTuple_GetItem(args,1)
+#define ORDER     PyTuple_GetItem(args,2)
+
+/* serial output macros: */
+#define INDEX  output,0
+#define X  output,1
+#define Y   output,2
+#define SEGMENTS   output,3
+#define SEGMENTMARKERLIST output,4
+#endif
+
+/* local prototypes: */
 void TriMeshUsage(void);
 
 #undef __FUNCT__ 
-#define __FUNCT__ "TriMesh"
+#define __FUNCT__  "TriMesh"
 
-#endif
+/* serial arg counts: */
+#undef NLHS
+#define NLHS  5
+#undef NRHS
+#define NRHS  3
+
+#endif  /* _TRIMESH_H */
Index: /issm/branches/trunk-jpl-damage/src/mex/TriMeshNoDensity/TriMeshNoDensity.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriMeshNoDensity/TriMeshNoDensity.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriMeshNoDensity/TriMeshNoDensity.h	(revision 12004)
@@ -10,4 +10,5 @@
 #include "string.h"
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/TriMeshProcessRifts/TriMeshProcessRifts.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriMeshProcessRifts/TriMeshProcessRifts.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriMeshProcessRifts/TriMeshProcessRifts.h	(revision 12004)
@@ -10,4 +10,5 @@
 #include "string.h"
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/TriMeshRefine/TriMeshRefine.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriMeshRefine/TriMeshRefine.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriMeshRefine/TriMeshRefine.h	(revision 12004)
@@ -10,4 +10,5 @@
 #include "string.h"
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/TriMeshRifts/TriMeshRifts.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriMeshRifts/TriMeshRifts.cpp	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriMeshRifts/TriMeshRifts.cpp	(revision 12004)
@@ -0,0 +1,322 @@
+/*
+ * TriMeshRifts: out of a domain outline file ( Argus format ), 
+ * use the Triangle package to create a triangular mesh 
+ *
+ */
+
+#include "./TriMeshRifts.h"
+
+void mexFunction(	int nlhs, mxArray* plhs[],
+					int nrhs, const mxArray* prhs[] )
+{
+
+
+	/*Matlab arrays: */
+	mxArray* pmxa_array=NULL;
+	int i,j;
+	int counter,counter2,backcounter;
+	int prhs_counter;
+	
+	/* returned quantities: */
+
+	double* index=NULL;
+	double* x=NULL;
+	double* y=NULL;
+	double* segments=NULL;
+	double*    segmentmarkerlist=NULL;
+
+	/* input: */
+	char*  domainname=NULL;
+	char*  riftname=NULL;
+	double area;
+	char*  order=NULL;
+	
+	/*Domain outline variables: */
+	int      nprof;
+	int*     profnvertices=NULL;
+	double** pprofx=NULL;
+	double** pprofy=NULL;
+	double*  xprof=NULL;
+	double*  yprof=NULL;
+	int      numberofpoints;
+
+	/*Rift outline variables: */
+	int      numrifts;
+	int*     riftsnumvertices=NULL;
+	double** riftsverticesx=NULL;
+	double** riftsverticesy=NULL;
+
+	/* Triangle structures: */
+	struct triangulateio in,out;
+	char   options[256];
+
+	/* verify correct usage: */
+	if (nlhs==0 && nrhs==0) {
+		/* special case: */
+		TriMeshRiftsUsage();
+		return;
+	}
+
+	if (!(  (nlhs==5) ||(nrhs==2) || (nrhs==3)  || (nrhs==4) )){
+		mexPrintf("   %s format error.\n", __FUNCT__);
+		TriMeshRiftsUsage();
+		printf("   ");
+		mexErrMsgTxt(" ");
+	}
+
+	/*Fetch data needed by Triangle: */
+
+	prhs_counter=0;
+	/*First recover the domain outline file name: */
+	if (!mxIsChar(prhs[prhs_counter])){
+		mexPrintf("%s%s\n",__FUNCT__," error message; first argument should be the domain outline file name!");
+		mexErrMsgTxt(" ");
+	}
+	domainname = (char *) mxMalloc((mxGetN(prhs[prhs_counter])+1)*sizeof(char));
+	mxGetString(prhs[prhs_counter],domainname,mxGetN(prhs[prhs_counter])+1);
+
+	/*Look for optional rifts file name: */
+	prhs_counter++;
+	if (mxIsChar(prhs[prhs_counter])){
+		riftname = (char *) mxMalloc((mxGetN(prhs[prhs_counter])+1)*sizeof(char));
+		mxGetString(prhs[prhs_counter],riftname,mxGetN(prhs[prhs_counter])+1);
+		prhs_counter++;
+	}
+
+	/*Recover the mesh density desired:*/
+	area=mxGetScalar(prhs[prhs_counter]);
+
+	/*Optionaly, recover desired order: */
+	prhs_counter++;
+	if (mxIsChar(prhs[prhs_counter])){
+		order = (char *) mxMalloc((mxGetN(prhs[prhs_counter])+1)*sizeof(char));
+		mxGetString(prhs[prhs_counter],order,mxGetN(prhs[prhs_counter])+1);
+	}
+	
+	/*Start reading the domain outline file: */
+	if(!DomainOutlineRead(&nprof,&profnvertices,&pprofx,&pprofy,NULL,domainname,false)){
+		printf("%s%s%s\n",__FUNCT__," error message reading domain outline ",domainname);
+		mexErrMsgTxt(" ");
+	}
+
+	/*Read rifts file if present: */
+	if(riftname){
+		if(!DomainOutlineRead(&numrifts,&riftsnumvertices,&riftsverticesx,&riftsverticesy,NULL,riftname,false)){
+			printf("%s%s%s\n",__FUNCT__," error message reading rifts outline ",riftname);
+			mexErrMsgTxt(" ");
+		}
+	}
+
+	/*Create initial triangulation to call triangulate():*/
+	numberofpoints=0;
+	for (i=0;i<nprof;i++){
+		numberofpoints+=profnvertices[i];
+	}
+	if (riftname){
+		for (i=0;i<numrifts;i++){
+			numberofpoints+=riftsnumvertices[i];
+		}
+	}
+	in.numberofpoints=numberofpoints;
+
+	in.numberofpointattributes=1;
+	in.pointlist = (REAL *) mxMalloc(in.numberofpoints * 2 * sizeof(REAL));
+
+	counter=0;
+	for (i=0;i<nprof;i++){
+		xprof=pprofx[i];
+		yprof=pprofy[i];
+		for (j=0;j<profnvertices[i];j++){
+			in.pointlist[2*counter+0]=xprof[j];
+			in.pointlist[2*counter+1]=yprof[j];
+			counter++;
+		}
+	}
+	if(riftname){
+		for (i=0;i<numrifts;i++){
+			xprof=riftsverticesx[i];
+			yprof=riftsverticesy[i];
+			for (j=0;j<riftsnumvertices[i];j++){
+				in.pointlist[2*counter+0]=xprof[j];
+				in.pointlist[2*counter+1]=yprof[j];
+				counter++;
+			}
+		}
+	}
+	
+	in.pointattributelist = (REAL *) mxMalloc(in.numberofpoints *
+										  in.numberofpointattributes *
+										  sizeof(REAL));
+	for (i=0;i<in.numberofpoints;i++){
+		in.pointattributelist[i] = 0.0;
+	}
+	in.pointmarkerlist = (int *) mxMalloc(in.numberofpoints * sizeof(int));
+	for(i=0;i<in.numberofpoints;i++){
+		in.pointmarkerlist[i] = 0;
+	}
+
+	/*Build segments: */
+	/*Figure out number of segments: holes and closed outlines have as many segments as vertices, 
+	 *for rifts, we have one less segment as we have vertices*/
+	in.numberofsegments=0;
+	for (i=0;i<nprof;i++){
+		in.numberofsegments+=profnvertices[i];
+	}
+	if (riftname){
+		for (i=0;i<numrifts;i++){
+			in.numberofsegments+=riftsnumvertices[i]-1;
+		}
+	}
+	
+	in.segmentlist = (int *) mxMalloc(in.numberofsegments * 2 * sizeof(int));
+	in.segmentmarkerlist = (int *) mxCalloc(in.numberofsegments,sizeof(int));
+	counter=0;
+	backcounter=0;
+	for (i=0;i<nprof;i++){
+		for (j=0;j<(profnvertices[i]-1);j++){
+			in.segmentlist[2*counter+0]=counter;
+			in.segmentlist[2*counter+1]=counter+1;
+			in.segmentmarkerlist[counter]=0;
+			counter++;
+		}
+		/*Close this profile: */
+		 in.segmentlist[2*counter+0]=counter;
+		 in.segmentlist[2*counter+1]=backcounter;
+		 in.segmentmarkerlist[counter]=0;
+		 counter++;
+		 backcounter=counter;
+	}
+	counter2=counter;
+	if(riftname){
+		for (i=0;i<numrifts;i++){
+			for (j=0;j<(riftsnumvertices[i]-1);j++){
+				in.segmentlist[2*counter2+0]=counter;
+				in.segmentlist[2*counter2+1]=counter+1;
+				in.segmentmarkerlist[counter2]=2+i;
+				counter2++;
+				counter++;
+			}
+			counter++;
+		}
+	}
+
+	
+	/*Build regions: */
+	in.numberofregions = 0;
+
+	/*Build holes: */
+	in.numberofholes = nprof-1; /*everything is a hole, but for the first profile.*/
+	in.holelist = (REAL *) mxMalloc(in.numberofholes * 2 * sizeof(REAL));
+	for (i=0;i<nprof-1;i++){
+		/*We are looking for a vertex that lies inside the hole: */
+		GridInsideHole(&in.holelist[2*i+0],&in.holelist[2*i+1],profnvertices[i+1],pprofx[i+1],pprofy[i+1]);
+	}
+
+	/* Make necessary initializations so that Triangle can return a */
+	/*   triangulation in `out': */
+
+	out.pointlist = (REAL *) NULL;            
+	out.pointattributelist = (REAL *) NULL;
+	out.pointmarkerlist = (int *) NULL; 
+	out.trianglelist = (int *) NULL;          
+	out.triangleattributelist = (REAL *) NULL;
+	out.neighborlist = (int *) NULL;         
+	out.segmentlist = (int *) NULL;
+	out.segmentmarkerlist = (int *) NULL;
+	out.edgelist = (int *) NULL;             
+	out.edgemarkerlist = (int *) NULL;   
+
+	/* Triangulate the points:.  Switches are chosen to read and write a  */
+	/*   PSLG (p), preserve the convex hull (c), number everything from  */
+	/*   zero (z), assign a regional attribute to each element (A), and  */
+	/*   produce an edge list (e), a Voronoi diagram (v), and a triangle */
+	/*   neighbor list (n).                                              */
+
+	sprintf(options,"%s%lf","pQzDq30ia",area); /*replace V by Q to quiet down the logging*/
+  
+	triangulate(options, &in, &out, NULL);
+	/*report(&out, 0, 1, 1, 1, 1, 0);*/
+
+	/*Allocate index, x and y: */
+	index=(double*)mxMalloc(3*out.numberoftriangles*sizeof(double));
+	x=(double*)mxMalloc(out.numberofpoints*sizeof(double));
+	y=(double*)mxMalloc(out.numberofpoints*sizeof(double));
+	segments=(double*)mxMalloc(3*out.numberofsegments*sizeof(double));
+	segmentmarkerlist=(double*)mxMalloc(out.numberofsegments*sizeof(double));
+
+	for (i = 0; i < out.numberoftriangles; i++) {
+		for (j = 0; j < out.numberofcorners; j++) {
+			*(index+3*i+j)=(double)out.trianglelist[i * out.numberofcorners + j]+1;
+		}
+	}
+	for (i = 0; i < out.numberofpoints; i++) {
+		x[i]=out.pointlist[i * 2 + 0];
+		y[i]=out.pointlist[i * 2 + 1];
+	}
+	
+	for (i = 0; i < out.numberofsegments; i++) {
+		segments[3*i+0]=(double)out.segmentlist[i*2+0]+1;
+		segments[3*i+1]=(double)out.segmentlist[i*2+1]+1;
+		segmentmarkerlist[i]=(double)out.segmentmarkerlist[i];
+	}
+
+	/*Associate elements with segments: */
+	AssociateSegmentToElement(&segments,out.numberofsegments,index,out.numberoftriangles);
+
+	/*Order segments so that their normals point outside the domain: */
+	if(!strcmp(order,"yes")){
+		OrderSegments(&segments,out.numberofsegments, index,out.numberoftriangles);
+	}
+
+	/*Output : */
+	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
+	mxSetM(pmxa_array,3);
+	mxSetN(pmxa_array,out.numberoftriangles);
+	mxSetPr(pmxa_array,index);
+	mexCallMATLAB( 1, &plhs[0], 1, &pmxa_array, "transpose");
+
+	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
+	mxSetM(pmxa_array,1);
+	mxSetN(pmxa_array,out.numberofpoints);
+	mxSetPr(pmxa_array,x);
+	mexCallMATLAB( 1, &plhs[1], 1, &pmxa_array, "transpose");
+
+	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
+	mxSetM(pmxa_array,1);
+	mxSetN(pmxa_array,out.numberofpoints);
+	mxSetPr(pmxa_array,y);
+	mexCallMATLAB( 1, &plhs[2], 1, &pmxa_array, "transpose");
+
+	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
+	mxSetM(pmxa_array,3);
+	mxSetN(pmxa_array,out.numberofsegments);
+	mxSetPr(pmxa_array,segments);
+	mexCallMATLAB( 1, &plhs[3], 1, &pmxa_array, "transpose");
+
+	pmxa_array= mxCreateDoubleMatrix(0,0,mxREAL);
+	mxSetM(pmxa_array,1);
+	mxSetN(pmxa_array,out.numberofsegments);
+	mxSetPr(pmxa_array,segmentmarkerlist);
+	mexCallMATLAB( 1, &plhs[4], 1, &pmxa_array, "transpose");
+	
+	return;
+}
+
+void TriMeshRiftsUsage(void)
+{
+	printf("\n");
+	printf("   usage: [index,x,y,segments,segmentmarkers]=TriMeshRifts(domainoutlinefilename,riftsoutlinename,area,ordered) \n");
+	printf("      where: index,x,y defines a triangulation, segments is an array made \n");
+	printf("      of exterior segments to the mesh domain outline, segmentmarkers is an array flagging each segment \n");
+	printf("      (if rifts are present, markers >=2 flag them ), outlinefilename an Argus domain outline file.\n");
+	printf("      riftsoutlinename is an Argus domain file, defining rifts (ie: open profiles), \n");
+	printf("      area is the maximum area desired for any element of the resulting mesh. \n");
+	printf("      and ordered is a string ('yes' or 'no') that determines whether segments are output in the \n");
+	printf("      order they are made by Triangle (ie none), or ordered counter clockwise around the domain outline.\n");
+	printf("      riftsoutlinename and ordered are optional arguments.\n");
+	printf("\n");
+}
+
+
+
+
Index: /issm/branches/trunk-jpl-damage/src/mex/TriMeshRifts/TriMeshRifts.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriMeshRifts/TriMeshRifts.h	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriMeshRifts/TriMeshRifts.h	(revision 12004)
@@ -0,0 +1,22 @@
+/*!\file:  TriMeshRifts.h
+ * \brief header prototype
+ */ 
+
+#ifndef _TRIMESHRIFTS_H_
+#define _TRIMESHRIFTS_H_
+
+#include "mex.h"
+#include "triangle.h"
+#include "string.h"
+
+#include "../../c/include/globals.h"
+#include "../../c/modules/modules.h"
+#include "../../c/Container/Container.h"
+#include "../../c/shared/shared.h"
+
+void TriMeshRiftsUsage(void);
+
+#undef __FUNCT__ 
+#define __FUNCT__ "TriMeshRifts"
+
+#endif
Index: /issm/branches/trunk-jpl-damage/src/mex/TriaSearch/TriaSearch.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriaSearch/TriaSearch.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriaSearch/TriaSearch.cpp	(revision 12004)
@@ -31,9 +31,9 @@
 
 	/*Input datasets: */
-	FetchMatlabData(&index,&nel,&dummy,INDEXHANDLE);
-	FetchMatlabData(&x,&nods,XHANDLE);
-	FetchMatlabData(&y,&nods,YHANDLE);
-	FetchMatlabData(&x0,&numberofnodes,X0HANDLE);
-	FetchMatlabData(&y0,&numberofnodes,Y0HANDLE);
+	FetchData(&index,&nel,&dummy,INDEXHANDLE);
+	FetchData(&x,&nods,XHANDLE);
+	FetchData(&y,&nods,YHANDLE);
+	FetchData(&x0,&numberofnodes,X0HANDLE);
+	FetchData(&y0,&numberofnodes,Y0HANDLE);
 
 	/* Echo: {{{1*/
@@ -48,5 +48,5 @@
 
 	/*Write data: */
-	WriteMatlabData(TRIA,tria,numberofnodes);
+	WriteData(TRIA,tria,numberofnodes);
 
 	/*end module: */
Index: /issm/branches/trunk-jpl-damage/src/mex/TriaSearch/TriaSearch.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/TriaSearch/TriaSearch.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/TriaSearch/TriaSearch.h	(revision 12004)
@@ -8,4 +8,5 @@
 void TriaSearchUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/UpdateConstraints/UpdateConstraints.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/UpdateConstraints/UpdateConstraints.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/UpdateConstraints/UpdateConstraints.cpp	(revision 12004)
@@ -20,7 +20,7 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&constraints,CONSTRAINTS);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&constraints,CONSTRAINTS);
+	FetchData(&parameters,PARAMETERS);
 	
 	/*!Generate internal degree of freedom numbers: */
@@ -28,5 +28,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(NODES,nodes);
+	WriteData(NODES,nodes);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/UpdateConstraints/UpdateConstraints.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/UpdateConstraints/UpdateConstraints.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/UpdateConstraints/UpdateConstraints.h	(revision 12004)
@@ -11,4 +11,5 @@
 void UpdateConstraintsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.cpp	(revision 12004)
@@ -20,8 +20,8 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&constraints,CONSTRAINTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((Parameters**)&parameters,PARAMETERS);
-	FetchMatlabData(&yg,YG);
+	FetchData((DataSet**)&constraints,CONSTRAINTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((Parameters**)&parameters,PARAMETERS);
+	FetchData(&yg,YG);
 	
 	/*!Generate internal degree of freedom numbers: */
@@ -29,5 +29,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(CONSTRAINTSOUT,constraints);
+	WriteData(CONSTRAINTSOUT,constraints);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/UpdateDynamicConstraints/UpdateDynamicConstraints.h	(revision 12004)
@@ -9,4 +9,5 @@
 void UpdateDynamicConstraintsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/UpdateVertexPositions/UpdateVertexPositions.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/UpdateVertexPositions/UpdateVertexPositions.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/UpdateVertexPositions/UpdateVertexPositions.cpp	(revision 12004)
@@ -22,10 +22,10 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&elements,ELEMENTSIN);
-	FetchMatlabData((DataSet**)&nodes,NODESIN);
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData((DataSet**)&loads,LOADSIN);
-	FetchMatlabData((DataSet**)&materials,MATERIALSIN);
-	FetchMatlabData(&parameters,PARAMETERSIN);
+	FetchData((DataSet**)&elements,ELEMENTSIN);
+	FetchData((DataSet**)&nodes,NODESIN);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData((DataSet**)&loads,LOADSIN);
+	FetchData((DataSet**)&materials,MATERIALSIN);
+	FetchData(&parameters,PARAMETERSIN);
 
 	/*configure: */
@@ -38,10 +38,10 @@
 
 	/*write output datasets: */
-	WriteMatlabData(ELEMENTS,elements);
-	WriteMatlabData(NODES,nodes);
-	WriteMatlabData(VERTICES,vertices);
-	WriteMatlabData(LOADS,loads);
-	WriteMatlabData(MATERIALS,materials);
-	WriteMatlabData(PARAMETERS,parameters);
+	WriteData(ELEMENTS,elements);
+	WriteData(NODES,nodes);
+	WriteData(VERTICES,vertices);
+	WriteData(LOADS,loads);
+	WriteData(MATERIALS,materials);
+	WriteData(PARAMETERS,parameters);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/UpdateVertexPositions/UpdateVertexPositions.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/UpdateVertexPositions/UpdateVertexPositions.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/UpdateVertexPositions/UpdateVertexPositions.h	(revision 12004)
@@ -9,4 +9,5 @@
 void UpdateVertexPositionsUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/VerticesDof/VerticesDof.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/VerticesDof/VerticesDof.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/VerticesDof/VerticesDof.cpp	(revision 12004)
@@ -18,6 +18,6 @@
 
 	/*Input datasets: */
-	FetchMatlabData((DataSet**)&vertices,VERTICESIN);
-	FetchMatlabData(&parameters,PARAMETERS);
+	FetchData((DataSet**)&vertices,VERTICESIN);
+	FetchData(&parameters,PARAMETERS);
 
 	/*!Generate internal degree of freedom numbers: */
@@ -25,5 +25,5 @@
 
 	/*write output datasets: */
-	WriteMatlabData(VERTICES,vertices);
+	WriteData(VERTICES,vertices);
 
 	/*Free ressources: */
Index: /issm/branches/trunk-jpl-damage/src/mex/VerticesDof/VerticesDof.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/VerticesDof/VerticesDof.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/VerticesDof/VerticesDof.h	(revision 12004)
@@ -9,4 +9,5 @@
 void VerticesDofUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/mex/Xy2ll/Xy2ll.cpp
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Xy2ll/Xy2ll.cpp	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Xy2ll/Xy2ll.cpp	(revision 12004)
@@ -35,15 +35,15 @@
 	/*Input datasets: */
 	if (verbose) printf("Fetching inputs:\n");
-	FetchMatlabData(&x,&nx,X_IN);
+	FetchData(&x,&nx,X_IN);
 	if (verbose)
 		if   (nx == 1) printf("  x=%g\n",x[0]);
 		else           printf("  x=[%d values]\n",nx);
 //	for (i=0; i<nx; i++) printf("  x[%d]=%g\n",i,x[i]);
-	FetchMatlabData(&y,&ny,Y_IN);
+	FetchData(&y,&ny,Y_IN);
 	if (verbose)
 		if   (ny == 1) printf("  y=%g\n",y[0]);
 		else           printf("  y=[%d values]\n",ny);
 //	for (i=0; i<ny; i++) printf("  y[%d]=%g\n",i,y[i]);
-	FetchMatlabData(&sgn,SGN_IN);
+	FetchData(&sgn,SGN_IN);
 	if (verbose) printf("  sgn=%d\n",sgn);
 
@@ -84,6 +84,6 @@
 
 	/*Write data: */
-	WriteMatlabData(LAT_OUT,lat,ncoord);
-	WriteMatlabData(LON_OUT,lon,ncoord);
+	WriteData(LAT_OUT,lat,ncoord);
+	WriteData(LON_OUT,lon,ncoord);
 
 	/*Clean-up*/
Index: /issm/branches/trunk-jpl-damage/src/mex/Xy2ll/Xy2ll.h
===================================================================
--- /issm/branches/trunk-jpl-damage/src/mex/Xy2ll/Xy2ll.h	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/mex/Xy2ll/Xy2ll.h	(revision 12004)
@@ -9,4 +9,5 @@
 void Xy2llUsage(void);
 
+#include "../../c/include/globals.h"
 #include "../../c/modules/modules.h"
 #include "../../c/Container/Container.h"
Index: /issm/branches/trunk-jpl-damage/src/py/README
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/README	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/py/README	(revision 12004)
@@ -5,5 +5,5 @@
 # launch python
 
->>> md=mode();
+>>> md=model();
 >>> md
 >>> md.mesh
Index: /issm/branches/trunk-jpl-damage/src/py/classes/autodiff.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/autodiff.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/autodiff.py	(revision 12004)
@@ -0,0 +1,19 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class autodiff:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.isautodiff = False
+		self.forward    = True
+		self.reverse    = False
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   automatic differentiation parameters:'
+		string="%s\n%s"%(string,fielddisplay(obj,'isautodiff','indicates if the automatic differentiation is activated'))
+		string="%s\n%s"%(string,fielddisplay(obj,'forward','forward differentiation'))
+		string="%s\n%s"%(string,fielddisplay(obj,'reverse','backward differentiation'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/balancethickness.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/balancethickness.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/balancethickness.py	(revision 12004)
@@ -0,0 +1,20 @@
+#module imports
+from fielddisplay import fielddisplay
+class balancethickness:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.spcthickness = float('NaN')
+		self.thickening_rate           = float('NaN')
+		self.stabilization           = 0
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		
+		string='   balance thickness solution parameters:' 
+		
+		string="%s\n\n%s"%(string,fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'thickening_rate','ice thickening rate used in the mass conservation (dh/dt)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'stabilization','0: None, 1: SU, 2: MacAyeal''s artificial diffusivity, 3:DG'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/basalforcings.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/basalforcings.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/basalforcings.py	(revision 12004)
@@ -0,0 +1,20 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class basalforcings:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.melting_rate             = float('NaN')
+		self.melting_rate_correction  = float('NaN')
+		self.geothermalflux           = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   basal forcings parameters:"
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,"melting_rate","basal melting rate (positive if melting)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"melting_rate_correction","additional melting applied when the grounding line retreats"))
+		string="%s\n%s"%(string,fielddisplay(obj,"geothermalflux","geothermal heat flux [W/m^2]"))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/clusters/generic.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/clusters/generic.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/clusters/generic.py	(revision 12004)
@@ -0,0 +1,217 @@
+#GENERIC cluster class definition
+#
+#   Usage:
+#      cluster=generic('name','astrid',);
+#      cluster=generic('name','astrid','np',3);
+#      cluster=generic('name',oshostname(),'np',3,'login','username');
+
+
+class generic:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.name=''
+		self.login=''
+		self.np=1
+		self.port=0
+		self.interactive=1
+		self.codepath=issmtier() + '/bin'
+		self.executionpath=issmtier() + '/execution'
+		self.valgrind=issmtier() + '/externalpackages/valgrind/install/bin/valgrind'
+		self.valgrindlib=issmtier() + '/externalpackages/valgrind/install/lib/libmpidebug.so'
+		self.valgrindsup=issmtier() + '/externalpackages/valgrind/issm.supp'
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		
+		string="class 'generic' object:"
+		string="%s\n\n%s"%(string,"%s%s"%('    name: ',obj.name))
+		string="%s\n%s"%(string,"%s%i"%('    np: ',obj.np))
+		string="%s\n%s"%(string,"%s%i"%('    port: ',obj.port))
+		string="%s\n%s"%(string,"%s%s"%('    codepath: ',obj.codepath))
+		string="%s\n%s"%(string,"%s%s"%('    executionpath: ',obj.executionpath))
+		string="%s\n%s"%(string,"%s%s"%('    valgrind: ',obj.valgrind))
+		string="%s\n%s"%(string,"%s%s"%('    valgrindlib: ',obj.valgrindlib))
+		string="%s\n%s"%(string,"%s%s"%('    valgrindsup: ',obj.valgrindsup))
+		return string
+		#}}}
+		
+
+#old matlab
+#		function cluster=generic(varargin) % {{{1
+#
+#			 %use provided options to change fields
+#			 options=pairoptions(varargin{:});
+#
+#			 %get name
+#			 if ~exist(options,'name'), error('option ''name'' has not been provided'); end
+#			 cluster.name=getfieldvalue(options,'name');
+#
+#			 %initialize cluster using user settings if provided
+#			 if (exist([cluster.name '_settings'])==2), eval([cluster.name '_settings']); end
+#
+#			 %OK get other fields
+#			 for i=1:size(options.list,1),
+#				 fieldname=options.list{i,1};
+#				 fieldvalue=options.list{i,2};
+#				 if ismember(fieldname,properties('generic')),
+#					 cluster.(fieldname)=fieldvalue;
+#				 else
+#					 disp(['''' fieldname ''' is not a property of cluster generic']);
+#				 end
+#			 end
+#		 end
+#		 %}}}
+#		 function checkconsistency(cluster,md,solution,analyses) % {{{1
+#			 if cluster.np<1
+#				 checkmessage(['number of processors should be at least 1']);
+#			 end
+#			 if isnan(cluster.np),
+#				 checkessage('number of processors should not be NaN!');
+#			 end
+#		 end
+#		 %}}}
+#		 function BuildQueueScript(cluster,md) % {{{1
+#		 
+#			 %retrieve parameters
+#			 modelname=md.miscellaneous.name;
+#			 solution=md.private.solution;
+#			 isvalgrind=md.debug.valgrind;
+#			 isgprof=md.debug.gprof;
+#
+#			 %open file for writing: 
+#			 if ~ispc,
+#				 fid=fopen([modelname '.queue'],'w');
+#			 else
+#				 fid=fopen([modelname '.bat'],'w');
+#			 end
+#
+#			 %write instructions for launching a job on the cluster
+#			 if ~ispc,
+#				 fprintf(fid,'#!/bin/sh\n');
+#			 else
+#				 fprintf(fid,'@echo off\n');
+#			 end
+#			 
+#			 if ~isvalgrind,
+#				 if cluster.interactive
+#					 if ~ispc,
+#						 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
+#					 else
+#						 fprintf(fid,'"%s/issm.exe" %s "%s" %s ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname);
+#					 end
+#				 else
+#					 if ~ispc,
+#						 fprintf(fid,'mpiexec -np %i %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',cluster.np,cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
+#					 else
+#						 fprintf(fid,'"%s/issm.exe" %s "%s" %s 2> %s.errlog >%s.outlog ',cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
+#					 end
+#				 end
+#			 else
+#				 if ~ispc,
+#					 %Add --gen-suppressions=all to get suppression lines
+#					 fprintf(fid,'LD_PRELOAD=%s \\\n',cluster.valgrindlib);
+#					 fprintf(fid,'mpiexec -np %i %s --leak-check=full --suppressions=%s %s/issm.exe %s %s %s 2> %s.errlog >%s.outlog ',...
+#					 cluster.np,cluster.valgrind,cluster.valgrindsup, cluster.codepath,EnumToString(solution),cluster.executionpath,modelname,modelname,modelname);
+#				 else
+#					 error('valgrind not supported on windows platforms');
+#				 end
+#			 end
+#
+#			 if isgprof,
+#				 if ~ispc,
+#					 fprintf(fid,'\n gprof %s/issm.exe gmon.out > %s.performance',cluster.codepath,modelname);
+#				 else
+#					 error('gprof not supported on windows platforms');
+#				 end
+#
+#			 end
+#
+#			 if ~md.settings.io_gather,
+#				 if ~ispc,
+#					 %concatenate the output files:
+#					 fprintf(fid,'\ncat %s.outbin.* > %s.outbin',modelname,modelname);
+#				 else
+#					 error('iogather not supported on windows platforms');
+#				 end
+#
+#			 end
+#			 
+#			 %close file: 
+#			 fclose(fid);
+#
+#			 %in interactive mode, create a run file, and errlog and outlog file
+#			 if cluster.interactive,
+#				 fid=fopen([modelname '.errlog'],'w'); fclose(fid);
+#				 fid=fopen([modelname '.outlog'],'w'); fclose(fid);
+#			 end
+#
+#
+#		 end
+#		 %}}}
+#		 function LaunchQueueJob(cluster,md,options)% {{{1
+#			 
+#			 if ~ispc,
+#					 %lauch command, to be executed via ssh
+#					 launchcommand=['cd ' cluster.executionpath ' && rm -rf ./' md.private.runtimename ' && mkdir ' md.private.runtimename ...
+#					 ' && cd ' md.private.runtimename ' && mv ../' md.private.runtimename '.tar.gz ./ && tar -zxf ' md.private.runtimename '.tar.gz  && source  ' md.miscellaneous.name '.queue '];
+#
+#					 if ~strcmpi(options.batch,'yes'),
+#
+#						 %compress the files into one zip.
+#						 compressstring=['tar -zcf ' md.private.runtimename '.tar.gz ' md.miscellaneous.name '.bin ' md.miscellaneous.name '.queue '  md.miscellaneous.name '.petsc '];
+#						 if md.qmu.isdakota,
+#							 compressstring=[compressstring md.miscellaneous.name '.qmu.in'];
+#					end
+#					if cluster.interactive,
+#						compressstring=[compressstring ' ' md.miscellaneous.name '.errlog ' md.miscellaneous.name '.outlog '];
+#					end
+#					system(compressstring);
+#
+#					disp('uploading input file and queueing script');
+#					issmscpout(cluster.name,cluster.executionpath,cluster.login,cluster.port,{[md.private.runtimename '.tar.gz']});
+#
+#					disp('launching solution sequence on remote cluster');
+#					issmssh(cluster.name,cluster.login,cluster.port,launchcommand);
+#				else
+#					disp('batch mode requested: not launching job interactively');
+#					disp('launch solution sequence on remote cluster by hand');
+#				end
+#			else
+#				%launch right here, do not compress or archive.
+#				system([md.miscellaneous.name '.bat']);
+#			end
+#
+#		end %}}}
+#		 function Download(cluster,md)% {{{1
+#
+#			if ~ispc,
+#				%some check
+#				if isempty(md.private.runtimename),
+#					error('supply runtime name for results to be loaded!');
+#				end
+#
+#				%Figure out the  directory where all the files are in: 
+#				directory=[cluster.executionpath '/' md.private.runtimename '/'];
+#
+#				%What packages are we picking up from remote cluster
+#				packages={[md.miscellaneous.name '.outlog'],[md.miscellaneous.name '.errlog']};
+#				if md.qmu.isdakota,
+#					packages{end+1}=[md.miscellaneous.name '.qmu.err'];
+#					packages{end+1}=[md.miscellaneous.name '.qmu.out'];
+#					if isfield(md.qmu.params,'tabular_graphics_data'),
+#						if md.qmu.params.tabular_graphics_data==true,
+#							packages{end+1}='dakota_tabular.dat'; 
+#						end
+#					end
+#				else
+#					packages{end+1}=[md.miscellaneous.name '.outbin'];
+#				end
+#
+#				%copy files from cluster to present directory
+#				issmscpin(cluster.name, cluster.login, cluster.port, directory, packages);
+#			else
+#				%do nothing!
+#			end
+#		end %}}}
+#
Index: /issm/branches/trunk-jpl-damage/src/py/classes/clusters/none.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/clusters/none.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/clusters/none.py	(revision 12004)
@@ -0,0 +1,24 @@
+#NONE cluster class definition
+#
+#   Usage:
+#      cluster=none();
+#      cluster=none('np',3);
+#      cluster=none('np',3,'login','username');
+
+class none:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.name='none'
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		
+		string="class 'none' object:"
+		string="%s\n\n%s"%(string,"%s%s"%('    name: ',obj.name))
+		return string
+		#}}}
+	def checkconsistency(cluster,md,solution,analyses):
+		pass
+	def BuildQueueScript(cluster,md):
+			 raise RuntimeError('none.BuildQueueScript error message: serial cluster cannot build queue script')
Index: /issm/branches/trunk-jpl-damage/src/py/classes/constants.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/constants.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/constants.py	(revision 12004)
@@ -0,0 +1,21 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class constants:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.g                    = 0
+		self.yts                  = 0
+		self.referencetemperature = 0
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   constants parameters:"
+		string="%s\n\n%s"%(string,fielddisplay(obj,"g","gravitational acceleration"))
+		string="%s\n%s"%(string,fielddisplay(obj,"yts","number of seconds in a year"))
+		string="%s\n%s"%(string,fielddisplay(obj,"referencetemperature","reference temperature used in the enthalpy model"))
+
+
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/debug.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/debug.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/debug.py	(revision 12004)
@@ -0,0 +1,18 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class debug:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.valgrind=False
+		self.gprof   = False
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   debug parameters:"
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,"valgrind","use Valgrind to debug (0 or 1)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"gprof","use gnu-profiler to find out where the time is spent"))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/diagnostic.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/diagnostic.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/diagnostic.py	(revision 12004)
@@ -0,0 +1,63 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class diagnostic:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.spcvx                    = float('NaN')
+		self.spcvy                    = float('NaN')
+		self.spcvz                    = float('NaN')
+		self.restol                   = 0
+		self.reltol                   = 0
+		self.abstol                   = 0
+		self.isnewton                 = 0
+		self.stokesreconditioning     = 0
+		self.viscosity_overshoot      = 0
+		self.icefront                 = float('NaN')
+		self.maxiter                  = 0
+		self.shelf_dampening          = 0
+		self.vertex_pairing           = float('NaN')
+		self.penalty_factor           = float('NaN')
+		self.rift_penalty_lock        = float('NaN')
+		self.rift_penalty_threshold   = 0
+		self.referential              = float('NaN')
+		self.requested_outputs        = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		
+		
+		string='\n   Diagnostic solution parameters:'
+		string="%s\n\n%s"%(string,'      Convergence criteria:')
+			
+		string="%s\n%s"%(string,fielddisplay(obj,'restol','mechanical equilibrium residual convergence criterion'))
+		string="%s\n%s"%(string,fielddisplay(obj,'reltol','velocity relative convergence criterion, NaN -> not applied'))
+		string="%s\n%s"%(string,fielddisplay(obj,'abstol','velocity absolute convergence criterion, NaN -> not applied'))
+		string="%s\n%s"%(string,fielddisplay(obj,'isnewton','Apply Newton''s method instead of a Picard fixed point method'))
+		string="%s\n%s"%(string,fielddisplay(obj,'maxiter','maximum number of nonlinear iterations'))
+		string="%s\n%s"%(string,fielddisplay(obj,'viscosity_overshoot','over-shooting constant new=new+C*(new-old)'))
+
+		string="%s\n%s"%(string,'      boundary conditions:')
+
+		string="%s\n%s"%(string,fielddisplay(obj,'spcvx','x-axis velocity constraint (NaN means no constraint)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'spcvy','y-axis velocity constraint (NaN means no constraint)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'spcvz','z-axis velocity constraint (NaN means no constraint)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'icefront','segments on ice front list (last column 0-> Air, 1-> Water, 2->Ice'))
+
+		string="%s\n%s"%(string,'      Rift options:')
+		string="%s\n%s"%(string,fielddisplay(obj,'rift_penalty_threshold','threshold for instability of mechanical constraints'))
+		string="%s\n%s"%(string,fielddisplay(obj,'rift_penalty_lock','number of iterations before rift penalties are locked'))
+
+		string="%s\n%s"%(string,'      Penalty options:')
+		string="%s\n%s"%(string,fielddisplay(obj,'penalty_factor','offset used by penalties: penalty = Kmax*10^offset'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vertex_pairing','pairs of vertices that are penalized'))
+
+		string="%s\n%s"%(string,'      Other:')
+		string="%s\n%s"%(string,fielddisplay(obj,'shelf_dampening','use dampening for floating ice ? Only for Stokes model'))
+		string="%s\n%s"%(string,fielddisplay(obj,'stokesreconditioning','multiplier for incompressibility equation. Only for Stokes model'))
+		string="%s\n%s"%(string,fielddisplay(obj,'referential','local referential'))
+		string="%s\n%s"%(string,fielddisplay(obj,'requested_outputs','additional outputs requested'))
+
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/flaim.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/flaim.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/flaim.py	(revision 12004)
@@ -0,0 +1,50 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class flaim:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.targets            = ''
+		self.tracks             = ''
+		self.flightreqs         = {}
+		self.criterion          = float('NaN')
+		self.gridsatequator     = 200000
+		self.usevalueordering   = True
+		self.split_antimeridian = True
+		self.solution           = ''
+		self.quality            = 0
+		self.path_optimize      = False
+		self.opt_ndir           = 1
+		self.opt_dist           = 25
+		self.opt_niter          = 30000
+		#}}}
+	def __repr__(obj):
+		# {{{ Displa
+		string='   FLAIM - Flight Line Adaptation using Ice sheet Modeling:'
+
+		string="%s\n\n%s"%(string,'      Input:')
+		string="%s\n%s"%(string,fielddisplay(obj,'targets'            ,'name of kml output targets file '))
+		string="%s\n%s"%(string,fielddisplay(obj,'tracks'             ,'name of kml input tracks file '))
+		string="%s\n%s"%(string,fielddisplay(obj,'flightreqs'         ,'structure of kml flight requirements (not used yet)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'criterion'          ,'element or nodal criterion for flight path evaluation (metric)'))
+
+		string="%s\n\n%s"%(string,'      Arguments:')
+		string="%s\n%s"%(string,fielddisplay(obj,'gridsatequator'     ,'number of grids at equator (determines resolution)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'usevalueordering'   ,'flag to consider target values for flight path evaluation'))
+		string="%s\n%s"%(string,fielddisplay(obj,'split_antimeridian' ,'flag to split polygons on the antimeridian'))
+		
+		string="%s\n\n%s"%(string,'      Optimization:')
+		string="%s\n%s"%(string,fielddisplay(obj,'path_optimize'     ,'optimize? (default false)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'opt_ndir'     ,['number of directions to test when moving a point.  If this value = 1, a random direction is tested.',\
+										  'A value > 1 results in directions equally spaced from [0, 2*PI] being tested.',\
+										  'For example, 4 would result in directions [0, PI/2, PI, 3PI/2].']))
+		string="%s\n%s"%(string,fielddisplay(obj,'opt_dist'     ,'specifies the distance in km (default 25) to move a randomly selected path point on each iteration'))
+		string="%s\n%s"%(string,fielddisplay(obj,'opt_niter'     ,['number of iterations (default 30,000) to run for flightplan optimization',\
+										   'i.e. the number of times to randomly select a point and move it.']))
+
+		string="%s\n\n%s"%(string,'      Output:')
+		string="%s\n%s"%(string,fielddisplay(obj,'solution'           ,'name of kml solution file'))
+		string="%s\n%s"%(string,fielddisplay(obj,'quality'            ,'quality of kml solution'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/flowequation.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/flowequation.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/flowequation.py	(revision 12004)
@@ -0,0 +1,31 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class flowequation:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		
+		self.ismacayealpattyn     = 0;
+		self.ishutter             = 0;
+		self.isstokes             = 0;
+		self.vertex_equation      = float('NaN')
+		self.element_equation     = float('NaN')
+		self.bordermacayeal       = float('NaN')
+		self.borderpattyn         = float('NaN')
+		self.borderstokes         = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   flow equation parameters:'
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,'ismacayealpattyn','is the macayeal or pattyn approximation used ?'))
+		string="%s\n%s"%(string,fielddisplay(obj,'ishutter','is the shallow ice approximation used ?'))
+		string="%s\n%s"%(string,fielddisplay(obj,'isstokes','are the Full-Stokes equations used ?'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vertex_equation','flow equation for each vertex'))
+		string="%s\n%s"%(string,fielddisplay(obj,'element_equation','flow equation for each element'))
+		string="%s\n%s"%(string,fielddisplay(obj,'bordermacayeal','vertices on MacAyeal''s border (for tiling)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'borderpattyn','vertices on Pattyn''s border (for tiling)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'borderstokes','vertices on Stokes'' border (for tiling)'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/friction.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/friction.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/friction.py	(revision 12004)
@@ -0,0 +1,19 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class friction:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.coefficient = float('NaN')
+		self.p           = float('NaN')
+		self.q           = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p"
+		string="%s\n\n%s"%(string,fielddisplay(obj,"coefficient","friction coefficient [SI]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"p","p exponent"))
+		string="%s\n%s"%(string,fielddisplay(obj,"q","q exponent"))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/geometry.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/geometry.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/geometry.py	(revision 12004)
@@ -0,0 +1,25 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class geometry:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.surface           = float('NaN')
+		self.thickness         = float('NaN')
+		self.bed               = float('NaN')
+		self.bathymetry        = float('NaN')
+		self.hydrostatic_ratio = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+
+		string="   geometry parameters:"
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,'surface','surface elevation'))
+		string="%s\n%s"%(string,fielddisplay(obj,'thickness','ice thickness'))
+		string="%s\n%s"%(string,fielddisplay(obj,'bed','bed elevation'))
+		string="%s\n%s"%(string,fielddisplay(obj,'bathymetry','bathymetry elevation'))
+		string="%s\n%s"%(string,fielddisplay(obj,'hydrostatic_ratio','coefficient for ice shelves'' thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/groundingline.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/groundingline.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/groundingline.py	(revision 12004)
@@ -0,0 +1,18 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class groundingline:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.migration=''
+		self.melting_rate=float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   grounding line solution parameters:'
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,'migration','type of grounding line migration: ''SoftMigration'',''AgressiveMigration'' or ''None'''))
+		string="%s\n%s"%(string,fielddisplay(obj,'melting_rate','melting rate applied when previously grounded parts start floating'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/hydrology.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/hydrology.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/hydrology.py	(revision 12004)
@@ -0,0 +1,29 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class hydrology:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.spcwatercolumn = float('NaN')
+		self.n              = 0
+		self.CR             = 0
+		self.p              = 0
+		self.q              = 0
+		self.kn             = 0
+		self.stabilization  = 0
+	
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		
+		string='   hydrology solution parameters:'
+		string="%s\n\n%s"%(string,fielddisplay(obj,'spcwatercolumn','water thickness constraints (NaN means no constraint)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'n','Manning roughness coefficient'))
+		string="%s\n%s"%(string,fielddisplay(obj,'CR','tortuosity parameter'))
+		string="%s\n%s"%(string,fielddisplay(obj,'p','dimensionless exponent in Manning velocity formula'))
+		string="%s\n%s"%(string,fielddisplay(obj,'q','dimensionless exponent in Manning velocity formula'))
+		string="%s\n%s"%(string,fielddisplay(obj,'kn','parameter in effective pressure formula'))
+		string="%s\n%s"%(string,fielddisplay(obj,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/initialization.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/initialization.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/initialization.py	(revision 12004)
@@ -0,0 +1,32 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class initialization:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		
+		self.vx            = float('NaN')
+		self.vy            = float('NaN')
+		self.vz            = float('NaN')
+		self.vel           = float('NaN')
+		self.pressure      = float('NaN')
+		self.temperature   = float('NaN')
+		self.watercolumn   = float('NaN')
+		self.waterfraction = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   initial field values:'
+
+		string="%s\n%s"%(string,fielddisplay(obj,'vx','x component of velocity'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vy','y component of velocity'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vz','z component of velocity'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vel','velocity norm'))
+		string="%s\n%s"%(string,fielddisplay(obj,'pressure','pressure field'))
+		string="%s\n%s"%(string,fielddisplay(obj,'temperature','temperature in Kelvins'))
+		string="%s\n%s"%(string,fielddisplay(obj,'watercolumn','thickness of subglacial water'))
+		string="%s\n%s"%(string,fielddisplay(obj,'waterfraction','fraction of water in the ice'))
+
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/inversion.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/inversion.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/inversion.py	(revision 12004)
@@ -0,0 +1,59 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class inversion:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.iscontrol                   = 0
+		self.tao                         = 0
+		self.incomplete_adjoint          = 0
+		self.control_parameters          = float('NaN')
+		self.nsteps                      = 0
+		self.maxiter_per_step            = float('NaN')
+		self.cost_functions              = float('NaN')
+		self.cost_functions_coefficients = float('NaN')
+		self.gradient_scaling            = float('NaN')
+		self.cost_function_threshold     = 0
+		self.min_parameters              = float('NaN')
+		self.max_parameters              = float('NaN')
+		self.step_threshold              = float('NaN')
+		self.gradient_only               = 0
+		self.vx_obs                      = float('NaN')
+		self.vy_obs                      = float('NaN')
+		self.vz_obs                      = float('NaN')
+		self.vel_obs                     = float('NaN')
+		self.thickness_obs               = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='\n   Inversion parameters:'
+		string="%s\n%s"%(string,fielddisplay(obj,'iscontrol','is inversion activated?'))
+		string="%s\n%s"%(string,fielddisplay(obj,'incomplete_adjoint','do we assume linear viscosity?'))
+		string="%s\n%s"%(string,fielddisplay(obj,'control_parameters','parameter where inverse control is carried out; ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}'))
+		string="%s\n%s"%(string,fielddisplay(obj,'nsteps','number of optimization searches'))
+		string="%s\n%s"%(string,fielddisplay(obj,'cost_functions','indicate the type of response for each optimization step'))
+		string="%s\n%s"%(string,fielddisplay(obj,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter'))
+		string="%s\n%s"%(string,fielddisplay(obj,'cost_function_threshold','misfit convergence criterion. Default is 1%, NaN if not applied'))
+		string="%s\n%s"%(string,fielddisplay(obj,'maxiter_per_step','maximum iterations during each optimization step'))
+		string="%s\n%s"%(string,fielddisplay(obj,'gradient_scaling','scaling factor on gradient direction during optimization, for each optimization step'))
+		string="%s\n%s"%(string,fielddisplay(obj,'step_threshold','decrease threshold for misfit, default is 30%'))
+		string="%s\n%s"%(string,fielddisplay(obj,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex'))
+		string="%s\n%s"%(string,fielddisplay(obj,'max_parameters','absolute maximum acceptable value of the inversed parameter on each vertex'))
+		string="%s\n%s"%(string,fielddisplay(obj,'gradient_only','stop control method solution at gradient'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vx_obs','observed velocity x component [m/a]'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vy_obs','observed velocity y component [m/a]'))
+		string="%s\n%s"%(string,fielddisplay(obj,'vel_obs','observed velocity magnitude [m/a]'))
+		string="%s\n%s"%(string,fielddisplay(obj,'thickness_obs','observed thickness [m]'))
+		string="%s\n%s"%(string,'Available cost functions:')
+		string="%s\n%s"%(string,'   101: SurfaceAbsVelMisfit')
+		string="%s\n%s"%(string,'   102: SurfaceRelVelMisfit')
+		string="%s\n%s"%(string,'   103: SurfaceLogVelMisfit')
+		string="%s\n%s"%(string,'   104: SurfaceLogVxVyMisfit')
+		string="%s\n%s"%(string,'   105: SurfaceAverageVelMisfit')
+		string="%s\n%s"%(string,'   201: ThicknessAbsMisfit')
+		string="%s\n%s"%(string,'   501: DragCoefficientAbsGradient')
+		string="%s\n%s"%(string,'   502: RheologyBbarAbsGradient')
+		string="%s\n%s"%(string,'   503: ThicknessAbsGradient')
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/mask.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/mask.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/mask.py	(revision 12004)
@@ -0,0 +1,26 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class mask:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.elementonfloatingice = float('NaN')
+		self.elementongroundedice = float('NaN')
+		self.elementonwater       = float('NaN')
+		self.vertexonfloatingice  = float('NaN')
+		self.vertexongroundedice  = float('NaN')
+		self.vertexonwater        = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+
+		string="";
+		string="%s\n%s"%(string,fielddisplay(obj,"elementonfloatingice","element on floating ice flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"vertexonfloatingice","vertex on floating ice flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"elementongroundedice","element on grounded ice  list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"vertexongroundedice","vertex on grounded ice flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"elementonwater","element on water flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"vertexonwater","vertex on water flags list"))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/materials.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/materials.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/materials.py	(revision 12004)
@@ -0,0 +1,41 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class materials:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.rho_ice                    = 0;
+		self.rho_water                  = 0;
+		self.mu_water                   = 0;
+		self.heatcapacity               = 0;
+		self.latentheat                 = 0;
+		self.thermalconductivity        = 0;
+		self.meltingpoint               = 0;
+		self.beta                       = 0;
+		self.mixed_layer_capacity       = 0;
+		self.thermal_exchange_velocity  = 0;
+		self.rheology_B   = float('NaN')
+		self.rheology_n   = float('NaN')
+		self.rheology_law = "";
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   Materials:"
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,"rho_ice","ice density [kg/m^3]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"rho_water","water density [kg/m^3]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"mu_water","water viscosity [N s/m^2]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"heatcapacity","heat capacity [J/kg/K]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"thermalconductivity","ice thermal conductivity [W/m/K]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"meltingpoint","melting point of ice at 1atm in K"))
+		string="%s\n%s"%(string,fielddisplay(obj,"latentheat","latent heat of fusion [J/m^3]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"beta","rate of change of melting point with pressure [K/Pa]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"mixed_layer_capacity","mixed layer capacity [W/kg/K]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"thermal_exchange_velocity","thermal exchange velocity [m/s]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"rheology_B","flow law parameter [Pa/s^(1/n)]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"rheology_n","Glen""s flow law exponent"))
+		string="%s\n%s"%(string,fielddisplay(obj,"rheology_law","law for the temperature dependance of the rheology: ""None"", ""Paterson"" or ""Arrhenius"""))
+
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/mesh.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/mesh.py	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/mesh.py	(revision 12004)
@@ -1,9 +1,108 @@
+#module imports
+from fielddisplay import fielddisplay
+
 class mesh:
-	"""Python mesh class"""
-	x = []
-	y = []
-	elements = []
-	def __repr__(self):
-		return """x: X coordinates
-		        y: Y coordinates
-				  elements: indexing """
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.x                           = float('NaN');
+		self.y                           = float('NaN');
+		self.z                           = float('NaN');
+		self.elements                    = float('NaN');
+		self.dimension                   = 0;
+		self.numberoflayers              = 0;
+		self.numberofelements            = 0;
+		self.numberofvertices            = 0;
+		self.numberofedges               = 0;
+		
+		self.lat                         = float('NaN');
+		self.long                        = float('NaN');
+		self.hemisphere                  = float('NaN');
+
+		self.elementonbed                = float('NaN');
+		self.elementonsurface            = float('NaN');
+		self.vertexonbed                 = float('NaN');
+		self.vertexonsurface             = float('NaN');
+		self.lowerelements               = float('NaN');
+		self.lowervertex                 = float('NaN');
+		self.upperelements               = float('NaN');
+		self.uppervertex                 = float('NaN');
+		self.vertexonboundary            = float('NaN');
+
+		self.edges                       = float('NaN');
+		self.segments                    = float('NaN');
+		self.segmentmarkers              = float('NaN');
+		self.vertexconnectivity          = float('NaN');
+		self.elementconnectivity         = float('NaN');
+		self.average_vertex_connectivity = 0;
+
+		self.x2d                         = float('NaN');
+		self.y2d                         = float('NaN');
+		self.elements2d                  = float('NaN');
+		self.numberofvertices2d          = 0;
+		self.numberofelements2d          = 0;
+
+		self.extractedvertices           = float('NaN');
+		self.extractedelements           = float('NaN');
+
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+
+		if obj.dimension==3:
+			string="\n%s"%("      Elements and vertices of the original 2d mesh:")
+			
+			string="%s\n%s"%(string,fielddisplay(obj,"numberofelements2d","number of elements"))
+			string="%s\n%s"%(string,fielddisplay(obj,"numberofvertices2d","number of vertices"))
+			string="%s\n%s"%(string,fielddisplay(obj,"elements2d","index into (x,y,z), coordinates of the vertices"))
+			string="%s\n%s"%(string,fielddisplay(obj,"x2d","vertices x coordinate"))
+			string="%s\n%s"%(string,fielddisplay(obj,"y2d","vertices y coordinate"))
+
+			string="%s\n%s" %(string,"Elements and vertices of the extruded 3d mesh:")
+		else:
+			string="\n%s"%("      Elements and vertices:")
+
+		string="%s\n%s"%(string,fielddisplay(obj,"numberofelements","number of elements"))
+		
+
+
+
+		string="%s\n%s"%(string,fielddisplay(obj,"numberofvertices","number of vertices"))
+		string="%s\n%s"%(string,fielddisplay(obj,"elements","index into (x,y,z), coordinates of the vertices"))
+		string="%s\n%s"%(string,fielddisplay(obj,"x","vertices x coordinate"))
+		string="%s\n%s"%(string,fielddisplay(obj,"y","vertices y coordinate"))
+		string="%s\n%s"%(string,fielddisplay(obj,"z","vertices z coordinate"))
+		string="%s\n%s"%(string,fielddisplay(obj,"edges","edges of the 2d mesh (vertex1 vertex2 element1 element2)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"numberofedges","number of edges of the 2d mesh"))
+
+		string="%s%s"%(string,"\n      Properties:")
+		
+		string="%s\n%s"%(string,fielddisplay(obj,"dimension","mesh dimension (2d or 3d)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"numberoflayers","number of extrusion layers"))
+		string="%s\n%s"%(string,fielddisplay(obj,"vertexonbed","lower vertices flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"elementonbed","lower elements flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"vertexonsurface","upper vertices flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"elementonsurface","upper elements flags list"))
+		string="%s\n%s"%(string,fielddisplay(obj,"uppervertex","upper vertex list (NaN for vertex on the upper surface)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"upperelements","upper element list (NaN for element on the upper layer)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"lowervertex","lower vertex list (NaN for vertex on the lower surface)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"lowerelements","lower element list (NaN for element on the lower layer"))
+		string="%s\n%s"%(string,fielddisplay(obj,"vertexonboundary","vertices on the boundary of the domain flag list"))
+		
+		string="%s\n%s"%(string,fielddisplay(obj,"segments","edges on domain boundary (vertex1 vertex2 element)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"segmentmarkers","number associated to each segment"))
+		string="%s\n%s"%(string,fielddisplay(obj,"vertexconnectivity","list of vertices connected to vertex_i"))
+		string="%s\n%s"%(string,fielddisplay(obj,"elementconnectivity","list of vertices connected to element_i"))
+		string="%s\n%s"%(string,fielddisplay(obj,"average_vertex_connectivity","average number of vertices connected to one vertex"))
+
+		string="%s%s"%(string,"\n      Extracted model:")
+
+		string="%s\n%s"%(string,fielddisplay(obj,"extractedvertices","vertices extracted from the model"))
+		string="%s\n%s"%(string,fielddisplay(obj,"extractedelements","elements extracted from the model"))
+
+		string="%s%s"%(string,"\n      Projection:")
+		string="%s\n%s"%(string,fielddisplay(obj,"lat","vertices latitude"))
+		string="%s\n%s"%(string,fielddisplay(obj,"long","vertices longitude"))
+		string="%s\n%s"%(string,fielddisplay(obj,"hemisphere","Indicate hemisphere ""n"" or ""s"" "))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/miscellaneous.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/miscellaneous.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/miscellaneous.py	(revision 12004)
@@ -0,0 +1,20 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class miscellaneous:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.notes = ''
+		self.name  = ''
+		self.dummy = {}
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   miscellaneous parameters:'
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,'notes','notes in a cell of strings'))
+		string="%s\n%s"%(string,fielddisplay(obj,'name','model name'))
+		string="%s\n%s"%(string,fielddisplay(obj,'dummy','empty field to store some data'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/model.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/model.py	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/model.py	(revision 12004)
@@ -1,9 +1,115 @@
-from mesh import *
+#module imports {{{
+from mesh import mesh
+from mask import mask
+from geometry import geometry
+from constants import constants
+from surfaceforcings import surfaceforcings
+from basalforcings import basalforcings
+from materials import materials
+from friction import friction
+from flowequation import flowequation
+from timestepping import timestepping
+from initialization import initialization
+from rifts import rifts
+from debug import debug
+from verbose import verbose
+from settings import settings
+from solver import solver
+from none import none
+from balancethickness import balancethickness
+from diagnostic import diagnostic
+from groundingline import groundingline
+from hydrology import hydrology
+from prognostic import prognostic
+from thermal import thermal
+from steadystate import steadystate
+from transient import transient
+from autodiff import autodiff
+from flaim import flaim
+from inversion import inversion
+from qmu import qmu
+from radaroverlay import radaroverlay
+from miscellaneous import miscellaneous
+from private import private
+#}}}
+class model:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.mesh             = mesh()
+		self.mask             = mask()
+		self.geometry         = geometry()
+		self.constants        = constants()
+		self.surfaceforcings  = surfaceforcings()
+		self.basalforcings    = basalforcings()
+		self.materials        = materials()
+		self.friction         = friction()
+		self.flowequation     = flowequation()
+		self.timestepping     = timestepping()
+		self.initialization   = initialization()
+		self.rifts            = rifts()
 
-class model:
-	"""Python model class"""
-	mesh=mesh()
-	def __init__(self):
-		print 'new model created'
-	def __repr__(self):
-		return "   mesh: mesh properties"
+		self.debug            = debug()
+		self.verbose          = verbose()
+		self.settings         = settings()
+		self.solver           = solver()
+		self.cluster          = none()
+
+		self.balancethickness = balancethickness()
+		self.diagnostic       = diagnostic()
+		self.groundingline    = groundingline()
+		self.hydrology        = hydrology()
+		self.prognostic       = prognostic()
+		self.thermal          = thermal()
+		self.steadystate      = steadystate()
+		self.transient        = transient()
+
+		self.autodiff         = autodiff()
+		self.flaim            = flaim()
+		self.inversion        = inversion()
+		self.qmu              = qmu()
+
+		self.results          = [];
+		self.radaroverlay     = radaroverlay()
+		self.miscellaneous    = miscellaneous()
+		self.private          = private()
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+
+		#print "Here %s the number: %d" % ("is", 37)
+		string="%19s: %-22s -- %s" % ("mesh","[%s,%s]" % ("1x1",obj.mesh.__class__.__name__),"mesh properties")
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("mask","[%s,%s]" % ("1x1",obj.mask.__class__.__name__),"defines grounded and floating elements"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("geometry","[%s,%s]" % ("1x1",obj.geometry.__class__.__name__),"surface elevation, bedrock topography, ice thickness,..."))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("constants","[%s,%s]" % ("1x1",obj.constants.__class__.__name__),"physical constants"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("surfaceforcings","[%s,%s]" % ("1x1",obj.surfaceforcings.__class__.__name__),"surface forcings"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("basalforcings","[%s,%s]" % ("1x1",obj.basalforcings.__class__.__name__),"bed forcings"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("materials","[%s,%s]" % ("1x1",obj.materials.__class__.__name__),"material properties"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("friction","[%s,%s]" % ("1x1",obj.friction.__class__.__name__),"basal friction/drag properties"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("flowequation","[%s,%s]" % ("1x1",obj.flowequation.__class__.__name__),"flow equations"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("timestepping","[%s,%s]" % ("1x1",obj.timestepping.__class__.__name__),"time stepping for transient models"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("initialization","[%s,%s]" % ("1x1",obj.initialization.__class__.__name__),"initial guess/state"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("rifts","[%s,%s]" % ("1x1",obj.rifts.__class__.__name__),"rifts properties'"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("debug","[%s,%s]" % ("1x1",obj.debug.__class__.__name__),"debugging tools (valgrind, gprof"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("verbose","[%s,%s]" % ("1x1",obj.verbose.__class__.__name__),"verbosity level in solve"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("settings","[%s,%s]" % ("1x1",obj.settings.__class__.__name__),"settings properties"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("solver","[%s,%s]" % ("1x1",obj.solver.__class__.__name__),"PETSc options for each solution'"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("cluster","[%s,%s]" % ("1x1",obj.cluster.__class__.__name__),"cluster parameters (number of cpus...)"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("balancethickness","[%s,%s]" % ("1x1",obj.balancethickness.__class__.__name__),"parameters for balancethickness solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("diagnostic","[%s,%s]" % ("1x1",obj.diagnostic.__class__.__name__),"parameters for diagnostic solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("groundingline","[%s,%s]" % ("1x1",obj.groundingline.__class__.__name__),"parameters for groundingline solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("hydrology","[%s,%s]" % ("1x1",obj.hydrology.__class__.__name__),"parameters for hydrology solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("prognostic","[%s,%s]" % ("1x1",obj.prognostic.__class__.__name__),"parameters for prognostic solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("thermal","[%s,%s]" % ("1x1",obj.thermal.__class__.__name__),"parameters for thermal solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("steadystate","[%s,%s]" % ("1x1",obj.steadystate.__class__.__name__),"parameters for steadystate solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("transient","[%s,%s]" % ("1x1",obj.transient.__class__.__name__),"parameters for transient solution"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("autodiff","[%s,%s]" % ("1x1",obj.autodiff.__class__.__name__),"automatic differentiation parameters"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("flaim","[%s,%s]" % ("1x1",obj.flaim.__class__.__name__),"flaim parameters"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("inversion","[%s,%s]" % ("1x1",obj.inversion.__class__.__name__),"parameters for inverse methods"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("qmu","[%s,%s]" % ("1x1",obj.qmu.__class__.__name__),"dakota properties"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("results","[%s,%s]" % ("1x1",obj.results.__class__.__name__),"model results'"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("radaroverlay","[%s,%s]" % ("1x1",obj.radaroverlay.__class__.__name__),"radar image for plot overlay"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("miscellaneous","[%s,%s]" % ("1x1",obj.miscellaneous.__class__.__name__),"miscellaneous fields"))
+		string="%s\n%s" % (string,"%19s: %-22s -- %s" % ("miscellaneous","[%s,%s]" % ("1x1",obj.miscellaneous.__class__.__name__),"miscellaneous fields"))
+		return string;
+		 #}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/pairoptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/pairoptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/pairoptions.py	(revision 12004)
@@ -0,0 +1,38 @@
+class pairoptions:
+	#properties
+	def __init__(self,*args):
+		# {{{ Properties
+		if len(args)%2==1:
+			raise RuntimeError('pairoption error message: an even number of options is required')
+
+		#create a pairoption object
+		if len(args)==0:
+			self.list=[]
+		else:
+			self.list=[]
+			for i in range(int(round(len(args)/2))):
+				if isinstance(args[2*i],str):
+					self.list.append([args[2*i],args[2*i+1]])
+				else:
+					#option is not a string, ignore it
+					print("%s%i%s"%('buildlist info: option number ',i,' is not a string, it will be ignored'))
+					continue
+
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		if not obj.list:
+			string='   list: empty'
+		else:
+			string="   list: (%i)"%(len(obj.list))
+			for i in range(len(obj.list)):
+				if isinstance(obj.list[i][1],str):
+					string2="     field: %-10s value: '%s'"%(obj.list[i][0],obj.list[i][1])
+				elif isinstance(obj.list[i][1],float):
+					string2="     field: %-10s value: %g"%(obj.list[i][0],obj.list[i][1])
+				elif isinstance(obj.list[i][1],int):
+					string2="     field: %-10s value: %i"%(obj.list[i][0],obj.list[i][1])
+				else:
+					string2="     field: %-10s value: (%i)"%(len(obj.list[i][1]))
+				string="%s\n%s"%(string,string2)
+		return string
Index: /issm/branches/trunk-jpl-damage/src/py/classes/private.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/private.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/private.py	(revision 12004)
@@ -0,0 +1,19 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class private:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.runtimename = ''
+		self.bamg        = {}
+		self.solution    = '';
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   private parameters: do not change'
+		string="%s\n%s"%(string,fielddisplay(obj,'runtimename','name of the run launched'))
+		string="%s\n%s"%(string,fielddisplay(obj,'bamg','structure with mesh properties construced if bamg is used to mesh the domain'))
+		string="%s\n%s"%(string,fielddisplay(obj,'solution','type of solution launched'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/prognostic.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/prognostic.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/prognostic.py	(revision 12004)
@@ -0,0 +1,24 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class prognostic:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.spcthickness           = float('NaN')
+		self.min_thickness          = 0
+		self.hydrostatic_adjustment = 0
+		self.stabilization          = 0
+		self.vertex_pairing         = float('NaN')
+		self.penalty_factor         = 0
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   Prognostic solution parameters:'
+		string="%s\n\n%s"%(string,fielddisplay(obj,'spcthickness','thickness constraints (NaN means no constraint)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'min_thickness','minimum ice thickness allowed'))
+		string="%s\n%s"%(string,fielddisplay(obj,'hydrostatic_adjustment','adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute'' '))
+		string="%s\n%s"%(string,fielddisplay(obj,'stabilization','0->no, 1->artificial_diffusivity, 2->streamline upwinding, 3->discontinuous Galerkin'))
+
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/qmu.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/qmu.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/qmu.py	(revision 12004)
@@ -0,0 +1,29 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class qmu:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.isdakota                    = 0
+		self.variables                   = {}
+		self.responses                   = {}
+		self.method                      = {}
+		self.params                      = {}
+		self.results                     = {}
+		self.partition                   = float('NaN')
+		self.numberofpartitions          = 0
+		self.numberofresponses           = 0
+		self.variabledescriptors         = []
+		self.responsedescriptors         = []
+		self.mass_flux_profile_directory = float('NaN')
+		self.mass_flux_profiles          = float('NaN')
+		self.mass_flux_segments          = []
+		self.adjacency                   = float('NaN')
+		self.vertex_weight               = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   qmu parameters: not implemented yet!"
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/radaroverlay.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/radaroverlay.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/radaroverlay.py	(revision 12004)
@@ -0,0 +1,19 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class radaroverlay:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.pwr = float('NaN')
+		self.x   = float('NaN')
+		self.y   = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   radaroverlay parameters:'
+		string="%s\n\n%s"%(string,fielddisplay(obj,'pwr','radar power image (matrix)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'x','corresponding x coordinates'))
+		string="%s\n%s"%(string,fielddisplay(obj,'y','corresponding y coordinates'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/rifts.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/rifts.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/rifts.py	(revision 12004)
@@ -0,0 +1,18 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class rifts:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.riftstruct     = float('NaN')
+		self.riftproperties = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   rifts parameters:'
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,'riftstruct','structure containing all rift information (vertices coordinates, segments, type of melange, ...)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'riftproperties',''))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/settings.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/settings.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/settings.py	(revision 12004)
@@ -0,0 +1,24 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class settings:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.io_gather           = 0;
+		self.lowmem              = 0;
+		self.results_as_patches  = 0;
+		self.output_frequency    = 0;
+		self.waitonlock          = 0;
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   general settings parameters:"
+
+		string="%s\n%s"%(string,fielddisplay(obj,"io_gather","I/O gathering strategy for result outputs (default 1)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"lowmem","is the memory limited ? (0 or 1)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"results_as_patches","provide results as patches for each element (0 or 1)"))
+		string="%s\n%s"%(string,fielddisplay(obj,"output_frequency","frequency at which results are saved in all solutions with multiple time_steps"))
+		string="%s\n%s"%(string,fielddisplay(obj,"waitonlock","maximum number of minutes to wait for batch results, or return 0"))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/solver.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/solver.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/solver.py	(revision 12004)
@@ -0,0 +1,49 @@
+#module imports {{{
+import fielddisplay 
+import ismumps
+from  mumpsoptions import *
+from  iluasmoptions import *
+#}}}
+class solver:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		if ismumps:
+			self.options=[["NoneAnalysis",mumpsoptions()]]
+		else:
+			self.options=[["NoneAnalysis",iluasmoptions()]]
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		
+		string2="   solver parameters:"
+		for i in range(len(obj.options)):
+			option=obj.options[i]
+			analysis=option[0]
+			ioptions=option[1]
+
+			string=""
+			for i in range(len(ioptions)):
+				option=ioptions[i]
+				if not option:
+					#do nothing
+					pass
+				elif len(option)==1:
+					#this option has only one argument
+					string="%s%s%s"%(string," -",option[0])
+				elif len(option)==2:
+					#option with value. value can be string or scalar
+					if isinstance(option[1],float):
+						string="%s%s%s%s%s"%(string," -",option[0]," ","%g"%(option[1]))
+					elif isinstance(option[1],str):
+						string="%s%s%s%s%s"%(string," -",option[0]," ",option[1])
+					elif isinstance(option[1],int):
+						string="%s%s%s%s%s"%(string," -",option[0]," ","%i"%(option[1]))
+					else:
+						raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
+				else:
+					raise RuntimeError("%s%s%s"%("PetscString error: option #","%i"%(i)," is not well formatted"))
+
+			string2="%s\n%s"%(string2,"   %s -> '%s'"%(analysis,string))
+		return string2
+	#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/steadystate.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/steadystate.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/steadystate.py	(revision 12004)
@@ -0,0 +1,19 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class steadystate:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.reltol            = 0
+		self.maxiter           = 0
+		self.requested_outputs = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   steadystate solution parameters:'
+		string="%s\n%s"%(string,fielddisplay(obj,'reltol','relative tolerance criterion'))
+		string="%s\n%s"%(string,fielddisplay(obj,'maxiter','maximum number of iterations'))
+		string="%s\n%s"%(string,fielddisplay(obj,'requested_outputs','additional requested outputs'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/surfaceforcings.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/surfaceforcings.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/surfaceforcings.py	(revision 12004)
@@ -0,0 +1,19 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class surfaceforcings:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.precipitation = float('NaN')
+		self.mass_balance  = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   surface forcings parameters:"
+
+		string="%s\n\n%s"%(string,fielddisplay(obj,'precipitation','surface precipitation [m/yr water eq]'))
+		string="%s\n%s"%(string,fielddisplay(obj,'mass_balance','surface mass balance [m/yr ice eq]'))
+
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/thermal.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/thermal.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/thermal.py	(revision 12004)
@@ -0,0 +1,26 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class thermal:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.spctemperature    = float('NaN')
+		self.penalty_threshold = 0
+		self.stabilization     = 0
+		self.maxiter           = 0
+		self.penalty_lock      = 0
+		self.penalty_factor    = 0
+		self.isenthalpy        = 0
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   Thermal solution parameters:'
+		string="%s\n\n%s"%(string,fielddisplay(obj,'spctemperature','temperature constraints (NaN means no constraint)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'stabilization','0->no, 1->artificial_diffusivity, 2->SUPG'))
+		string="%s\n%s"%(string,fielddisplay(obj,'maxiter','maximum number of non linear iterations'))
+		string="%s\n%s"%(string,fielddisplay(obj,'penalty_lock','stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'penalty_threshold','threshold to declare convergence of thermal solution (default is 0)'))
+		string="%s\n%s"%(string,fielddisplay(obj,'isenthalpy','use an enthalpy formulation to include temperate ice (default is 0)'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/timestepping.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/timestepping.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/timestepping.py	(revision 12004)
@@ -0,0 +1,21 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class timestepping:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.time_step       = 0;
+		self.final_time      = 0;
+		self.time_adapt      = 0;
+		self.cfl_coefficient = 0;
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="   timestepping parameters:"
+		string="%s\n\n%s"%(string,fielddisplay(obj,"time_step","length of time steps [yrs]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"final_time","final time to stop the simulation [yrs]"))
+		string="%s\n%s"%(string,fielddisplay(obj,"time_adapt","use cfl condition to define time step ? (0 or 1) "))
+		string="%s\n%s"%(string,fielddisplay(obj,"cfl_coefficient","coefficient applied to cfl condition"))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/transient.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/transient.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/transient.py	(revision 12004)
@@ -0,0 +1,23 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class transient:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.isprognostic      = 0
+		self.isdiagnostic      = 0
+		self.isthermal         = 0
+		self.isgroundingline   = 0
+		self.requested_outputs = float('NaN')
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string='   transient solution parameters:'
+		string="%s\n%s"%(string,fielddisplay(obj,'isprognostic','indicates if a prognostic solution is used in the transient'))
+		string="%s\n%s"%(string,fielddisplay(obj,'isthermal','indicates if a thermal solution is used in the transient'))
+		string="%s\n%s"%(string,fielddisplay(obj,'isdiagnostic','indicates if a diagnostic solution is used in the transient'))
+		string="%s\n%s"%(string,fielddisplay(obj,'isgroundingline','indicates if a groundingline migration is used in the transient'))
+		string="%s\n%s"%(string,fielddisplay(obj,'requested_outputs','list of additional outputs requested'))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/classes/verbose.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/classes/verbose.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/classes/verbose.py	(revision 12004)
@@ -0,0 +1,27 @@
+#module imports
+from fielddisplay import fielddisplay
+
+class verbose:
+	#properties
+	def __init__(self):
+		# {{{ Properties
+		self.mprocessor  = False
+		self.module      = False
+		self.solution    = False
+		self.solver      = False
+		self.convergence = False
+		self.control     = False
+		self.qmu         = False
+		#}}}
+	def __repr__(obj):
+		# {{{ Display
+		string="%s%s%s\n\n"%("class '",obj.__class__.__name__,"'=")
+		string="%s%s\n"%(string,"   %15s : %s"%("mprocessor",obj.mprocessor))
+		string="%s%s\n"%(string,"   %15s : %s"%("module",obj.module))
+		string="%s%s\n"%(string,"   %15s : %s"%("solution",obj.solution))
+		string="%s%s\n"%(string,"   %15s : %s"%("solver",obj.solver))
+		string="%s%s\n"%(string,"   %15s : %s"%("convergence",obj.convergence))
+		string="%s%s\n"%(string,"   %15s : %s"%("control",obj.control))
+		string="%s%s\n"%(string,"   %15s : %s"%("qmu",obj.qmu))
+		return string
+		#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/model/display/fielddisplay.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/display/fielddisplay.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/display/fielddisplay.py	(revision 12004)
@@ -0,0 +1,102 @@
+#Module import 
+from math import isnan
+
+
+def fielddisplay(md,name,comment):
+#FIELDDISPLAY - display model field
+#
+#   Usage:
+#      fielddisplay(md,name,comment)
+
+	#get field
+	field=getattr(md,name)
+
+	#disp corresponding line as a function of field type (offset set as 9 spaces)
+	return parsedisplay("         ",name,field,comment);
+
+#parsedisplay{{{ 
+def  parsedisplay(offset,name,field,comment):
+
+	#string
+	if isinstance(field,str):
+		if len(field)>30:
+			string=displayunit(offset,name,"not displayed",comment)
+		else:
+			string=displayunit(offset,name,field,comment)
+
+	#numeric
+	elif isinstance(field, int):
+		string=displayunit(offset,name,"%i" % (field),comment) 
+
+	elif isinstance(field, complex):
+		raise RuntimeError("fielddisplay cannot handle complex numbers")
+
+	elif isinstance(field, float):
+		string=displayunit(offset,name,"%g"%(field),comment)
+
+	#logical
+	elif isinstance(field,bool):
+		if field:
+			string=displayunit(offset,name,"true",comment)
+		else:
+			string=displayunit(offset,name,"false",comment)
+	
+	elif isinstance(field,dict):
+		if not field:
+			string=displayunit(offset,name,'N/A',comment)
+		else:
+			string=displayunit(offset,name,'(dictionary)',comment)
+			for key in field.keys():
+				string="%s\n%s"%(string,parsedisplay(offset + '   ',key,field[key],''))
+
+	elif isinstance(field,list):
+		if not field:
+			string=displayunit(offset,name,'N/A',comment),
+		else:
+			string=displayunit(offset,name,'(structure)',comment)
+			for i in range(len(field)):
+				string="%s\n%s"%(string,displayunit(offset + '   ',name,field[i],comment))
+	#cell
+	#elif  iscell(field):
+	#	cell_display(offset,name,field,comment),
+
+	else:
+		string=displayunit(offset,name,"not displayed",comment)
+		
+	return string
+
+#}}}
+#displayunit {{{
+def  displayunit(offset,name,characterization,comment):
+
+	#take care of name
+	if len(name)>23:
+		name="%s..." % (name[:19])
+	
+	#take care of characterization
+	if characterization=="":
+		characterization="N/A"
+	
+	if characterization=="nan":
+		characterization="N/A"
+	
+	if len(characterization)>15:
+		characterization="%s%s" % (characterization[:11],"...")
+	
+	#print
+	if not comment:
+		string="%s%-23s: %-15s" % (offset,name,characterization)
+	else:
+		if isinstance(comment,str):
+			string="%s%-23s: %-15s -- %s" % (offset,name,characterization,comment)
+		elif isinstance(comment,list):
+			print(comment)
+			string="%s%-23s: %-15s -- %s" % (offset,name,characterization,comment[0])
+			for i in range(1,len(comment)):
+				string2="%s%-23s  %-15s    %s" %(offset,"","",comment[i])
+				string="%s\n%s"%(string,string2)
+		else:
+			raise RuntimeError("fielddisplay error message: format for comment not supportet yet")
+
+	return string
+#}}}
Index: /issm/branches/trunk-jpl-damage/src/py/model/display/fielddisplay.rest
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/display/fielddisplay.rest	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/display/fielddisplay.rest	(revision 12004)
@@ -0,0 +1,154 @@
+def fielddisplay(md,name,comment):
+#FIELDDISPLAY - display model field
+#
+#   Usage:
+#      fielddisplay(md,offset,name,comment)
+
+	#get field
+	field=getattr(md,name)
+
+	#disp corresponding line as a function of field type (offset set as 9 spaces)
+	#parsedisplay('         ',name,field,comment);
+
+	return 
+
+function parsedisplay(offset,name,field,comment); %{{{
+
+	%string
+	if ischar(field),
+
+		if length(field)>30;
+			displayunit(offset,name,'not displayed',comment),
+		else
+			displayunit(offset,name,['''' field ''''],comment),
+		end
+
+	%numeric
+	elseif isnumeric(field)
+
+		%get size
+		fieldsize=size(field);
+
+		%double
+		if max(fieldsize)==1,
+			displayunit(offset,name,num2str(field),comment),
+		%matrix
+		else
+			displayunit(offset,name,['(' num2str(fieldsize(1)) 'x' num2str(fieldsize(2)) ')'],comment),
+		end
+
+	%logical
+	elseif islogical(field)
+
+		%get size
+		fieldsize=size(field);
+
+		%single value
+		if max(fieldsize)==1,
+			if (field)
+				displayunit(offset,name,'true',comment),
+			else
+				displayunit(offset,name,'false',comment),
+			end
+		%matrix
+		else
+			displayunit(offset,name,['(' num2str(fieldsize(1)) 'x' num2str(fieldsize(2)) ')'],comment),
+		end
+
+		%structure
+	elseif isstruct(field),
+		if ~isempty(fields(field))
+			displayunit(offset,name,'(structure)',comment),
+			struct_display(field,[offset '   ']),
+		else
+			displayunit(offset,name,'N/A',comment),
+		end
+
+	%cell
+	elseif iscell(field),
+		cell_display(offset,name,field,comment),
+
+	else
+		displayunit(offset,name,'not displayed',comment),
+
+	end
+end%}}}
+
+function struct_display(structure,offset) % {{{
+
+	structure_fields=fields(structure);
+
+	for i=1:length(structure_fields),
+
+		%get current field
+		field=structure.(structure_fields{i});
+
+		%recursive call if necessary
+		if isstruct(field),
+			displayunit(offset,structure_fields{i},'(structure)',''),
+			struct_display(field,[offset '   ']);
+
+		%display value
+		else
+			parsedisplay(offset,structure_fields{i},field,'');
+		end
+	end
+end% }}}
+function cell_display(offset,name,field,comment) % {{{
+
+	%initialization
+	string='{';
+
+	%go through the cell and fill string
+	if length(field)<5;
+		for i=1:length(field),
+			if ischar(field{i}),
+				string=[string ''''  field{i} ''','];
+			elseif (isnumeric(field{i}) & length(field{i})==1)
+				string=[string num2str(field{i}) ',' ];
+			else
+				string='{';
+				break
+			end
+		end
+	end
+	if strcmp(string,'{'),
+		string=['(' num2str(size(field,1)) 'x' num2str(size(field,2)) ')'];
+	else
+		string=[string(1:end-1) '}'];
+	end
+
+	%call displayunit
+	displayunit(offset,name,string,comment);
+end% }}}
+function displayunit(offset,name,characterization,comment),% {{{
+
+	%take care of name
+	if length(name)>23,
+		name=[name(1:20) '...'];
+	end
+
+	%take care of characterization
+	if (strcmp(characterization,['''' '''']) | strcmp(characterization,'NaN')),
+		characterization='N/A';
+	end
+	if length(characterization)>15,
+		characterization=[characterization(1:12) '...'];
+	end
+
+	%print
+	if isempty(comment)
+		disp(sprintf('%s%-23s: %-15s',offset,name,characterization));
+	else
+		if ischar(comment),
+			disp(sprintf('%s%-23s: %-15s -- %s',offset,name,characterization,comment));
+		elseif iscell(comment),
+			disp(sprintf('%s%-23s: %-15s -- %s',offset,name,characterization,comment{1}));
+			for i=2:length(comment),
+				disp(sprintf('%s%-23s  %-15s    %s',offset,'','',comment{i}));
+			end
+		else
+			error('fielddisplay error message: format for comment not supportet yet');
+		end
+	end
+end% }}}
Index: /issm/branches/trunk-jpl-damage/src/py/model/petscversion.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/petscversion.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/petscversion.py	(revision 12004)
@@ -0,0 +1,39 @@
+#PETSCVERSION - recover petsc version number, inside config.h file
+#
+#   Usage:
+#       PETSC_VERSION=petscversion();
+
+#Module imports {{{
+import os
+import sys
+from issmtier import *
+#}}}
+
+def petscversion():
+
+	#default
+	PETSC_VERSION=3;
+	
+	configfile=issmtier() + "/bin/config.h" #should find it in the install target
+	
+	if not os.path.isfile(configfile):
+		raise RuntimeError("%s%s%s"%("File ",configfile," not found. ISSM has not been configured yet!"))
+
+	#go through the file, and recover the line we want
+	fid=open(configfile,'r');
+
+	tline=fid.readline()
+	while tline:
+
+		if tline=='': 
+			break
+		
+		if tline[0:21]=="#define _PETSC_MAJOR_":
+			PETSC_VERSION=int(tline[22])
+			break
+		
+		tline=fid.readline()
+	
+	fid.close();
+
+	return PETSC_VERSION
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/asmoptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/asmoptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/asmoptions.py	(revision 12004)
@@ -0,0 +1,31 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def asmoptions(*args):
+	#ASMOPTIONS - return ASM petsc options
+	#
+	#   Usage:
+	#      options=asmoptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+	
+	options=[['mat_type','aij'],['ksp_type','gmres'],['pc_type','asm'],['sub_pc_type','lu'],['pc_asm_overlap',3],['ksp_max_it',100],['ksp_rtol',1e-30]];
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/iluasmoptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/iluasmoptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/iluasmoptions.py	(revision 12004)
@@ -0,0 +1,31 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def iluasmoptions(*args):
+	#ILUASMOPTIONS - return MUMPS direct solver  petsc options
+	#
+	#   Usage:
+	#      options=iluasmoptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+	
+	options=[['mat_type','aij'],['ksp_type','gmres'],['pc_type','asm'],['sub_pc_type','ilu'],['pc_asm_overlap',5],['ksp_max_it',100],['ksp_rtol',1e-15]];
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/jacobiasmoptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/jacobiasmoptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/jacobiasmoptions.py	(revision 12004)
@@ -0,0 +1,31 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def jacobiasmoptions(*args):
+	#ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
+	#
+	#   Usage:
+	#      options=jacobiasmoptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+	
+	options=[['mat_type','aij'],['ksp_type','gmres'],['pc_type','asm'],['sub_pc_type','jacobi'],['pc_asm_overlap',3],['ksp_max_it',100],['ksp_rtol',1e-15]];
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/jacobicgoptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/jacobicgoptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/jacobicgoptions.py	(revision 12004)
@@ -0,0 +1,31 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def jacobicgoptions(*args):
+	#ASMOPTIONS - return Additive Shwartz Method with Jacobi preconditioner petsc options
+	#
+	#   Usage:
+	#      options=jacobicgoptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+	
+	options=[['mat_type','aij'],['ksp_type','cg'],['ksp_max_it',100],['ksp_rtol',1e-15]];
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/matlaboptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/matlaboptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/matlaboptions.py	(revision 12004)
@@ -0,0 +1,31 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def matlaboptions(*args):
+	#MATLABOPTIONS - return Matlab petsc options
+	#
+	#   Usage:
+	#      options=matlaboptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+	
+	options=[['ksp_type','matlab']];
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/mumpsoptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/mumpsoptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/mumpsoptions.py	(revision 12004)
@@ -0,0 +1,38 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def mumpsoptions(*args):
+	#MUMPSOPTIONS - return MUMPS direct solver  petsc options
+	#
+	#   Usage:
+	#      options=mumpsoptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+
+
+	#default mumps options
+	PETSC_VERSION=petscversion()
+
+	if PETSC_VERSION==2:
+		options=[['mat_type','aijmumps'],['ksp_type','preonly'],['pc_type','lu'],['mat_mumps_icntl_14',120],['pc_factor_shift_positive_definite','true']]
+	if PETSC_VERSION==3:
+		options=[['mat_type','mpiaij'],['ksp_type','preonly'],['pc_type','lu'],['pc_factor_mat_solver_package','mumps'],['mat_mumps_icntl_14',120],['pc_factor_shift_positive_definite','true']]
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/soroptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/soroptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/soroptions.py	(revision 12004)
@@ -0,0 +1,31 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def soroptions(*args):
+	#SOROPTIONS - return Relaxation Solver petsc options
+	#
+	#   Usage:
+	#      options=soroptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+	
+	options=[['mat_type','aij'],['ksp_type','cg'],['pc_type','sor'],['pc_sor_omega',1.1],['pc_sor_its',2]];
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/model/solvers/stokesoptions.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/model/solvers/stokesoptions.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/model/solvers/stokesoptions.py	(revision 12004)
@@ -0,0 +1,40 @@
+#module imports {{{
+from pairoptions import *
+from petscversion  import *
+#}}}
+def stokesoptions(*args):
+	#STOKESOPTIONS - return STOKES multi-physics solver petsc options
+	#
+	#   Usage:
+	#      options=stokesoptions;
+	
+	#retrieve options provided in varargin
+	arguments=pairoptions(*args) 
+
+
+	#default stokes options
+	PETSC_VERSION=petscversion()
+
+	if PETSC_VERSION==2:
+		raise RuntimeError('stokesoptions error message: multi-physics options not supported in Petsc 2')
+	if PETSC_VERSION==3:
+		options=[['mat_type','mpiaij'],['ksp_max_it',1000],['ksp_type','gmres'],['pc_type','fieldsplit'],['pc_field_split_type','schur'],\
+	['fieldsplit_0_pc_type','hypre'],['fieldsplit_0_ksp_type','gmres'],['fieldsplit_0_pc_hypre_type','boomerang'],\
+	['fieldsplit_1_pc_type','jacobi'],['fieldsplit_1_ksp_type','preonly'],['issm_option_solver','stokes']]
+
+	#now, go through our arguments, and write over default options.
+	for i in range(len(arguments.list)):
+		arg1=arguments.list[i][0]
+		arg2=arguments.list[i][1]
+		found=0;
+		for j in range(len(options)):
+			joption=options[j][0]
+			if joption==arg1:
+				joption[1]=arg2;
+				options[j]=joption;
+				found=1;
+				break
+		if not found:
+			#this option did not exist, add it: 
+			options.append([arg1,arg2])
+	return options
Index: /issm/branches/trunk-jpl-damage/src/py/utils/OS/ismumps.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/utils/OS/ismumps.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/utils/OS/ismumps.py	(revision 12004)
@@ -0,0 +1,41 @@
+#ISMUMPS - figure out if MUMPS package was compiled with ISSM
+#
+#   Usage:
+#       flag=ismumps();
+
+#Module imports {{{
+import os
+import sys
+from issmtier import *
+#}}}
+
+def ismumps():
+
+	configfile=issmtier() + "/bin/config.h" #should find it in the install target
+	
+	if not os.path.isfile(configfile):
+		raise RuntimeError("%s%s%s"%("File ",configfile," not found. ISSM has not been configured yet!"))
+	
+	#%go through the file, and recover the line we want
+	flag=2;
+	fid=open(configfile,'r');
+
+	tline=fid.readline()
+	while tline:
+		
+		if tline=='': 
+			break
+		if tline[0:25]=="/* #undef _HAVE_MUMPS_ */":
+			flag=0;
+			break
+		if tline[0:20]=="#define _HAVE_MUMPS_":
+			flag=1
+			break
+		tline=fid.readline()
+
+	fid.close();
+
+	if flag==2:
+		raise RuntimeError('could not determine whether MUMPS was or was not compiled')
+
+	return flag
Index: /issm/branches/trunk-jpl-damage/src/py/utils/Shell/issmtier.py
===================================================================
--- /issm/branches/trunk-jpl-damage/src/py/utils/Shell/issmtier.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/src/py/utils/Shell/issmtier.py	(revision 12004)
@@ -0,0 +1,24 @@
+
+#ISSMTIER - Get ISSM_TIER environment variable contents.
+#
+#   Usage:
+#      ISSM_TIER=issmtier()
+
+
+#Module imports
+import os
+
+def issmtier():
+
+	if os.name =="posix":
+		ISSM_TIER =os.getenv('ISSM_TIER')
+	else:
+		ISSM_TIER =os.getenv('ISSM_TIER_WIN')
+
+	if(ISSM_TIER[-1]=="/") or (ISSM_TIER[-1]=="\\"):
+		ISSM_TIER = ISSM_TIER[:-2]; #shave off the last '/'
+
+	if ISSM_TIER == "":
+		raise RuntimeError("issmdir error message: ''ISSM_TIER'' environment variable is empty! You should define ISSM_TIER in your .cshrc or .bashrc!")
+		
+	return ISSM_TIER
Index: /issm/branches/trunk-jpl-damage/startup.m
===================================================================
--- /issm/branches/trunk-jpl-damage/startup.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/startup.m	(revision 12004)
@@ -16,7 +16,8 @@
 else
 	ISSM_TIER=getenv('ISSM_TIER_WIN');
+	%ISSM_TIER='';
 end
 if (isempty(ISSM_TIER)),
-	error('issmdir error message: ''ISSM_TIER'' environment variable is empty! You should define ISSM_TIER in your .cshrc or .bashrc!');
+	error('''ISSM_TIER'' environment variable is empty! You should define ISSM_TIER in your .cshrc or .bashrc!');
 end
 
@@ -32,6 +33,7 @@
 addpath(recursivepath([ISSM_TIER '/externalpackages/canos']));
 addpath(recursivepath([ISSM_TIER '/externalpackages/kml']));
-addpath(recursivepath([ISSM_TIER '/externalpackages/googleearthtoolbox/']));
 addpath(recursivepath([ISSM_TIER '/externalpackages/export_fig']));
+addpath(recursivepath([ISSM_TIER '/externalpackages/googleearthtoolbox']));
+addpath(recursivepath([ISSM_TIER '/externalpackages/cm_and_cb_utilities']));
 
 clear ISSM_TIER;
Index: /issm/branches/trunk-jpl-damage/startup.py
===================================================================
--- /issm/branches/trunk-jpl-damage/startup.py	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/startup.py	(revision 12004)
@@ -10,4 +10,10 @@
 import os,sys
 
+ 
+#First check we are running python 3 at least 
+if sys.version_info[0] < 3:
+	print("ISSM can only work in Python 3. Exiting python")
+	sys.exit(1)
+
 #Recover ISSM_TIER, ISSM_DIR  and USERNAME
 ISSM_TIER=os.getenv('ISSM_TIER')
@@ -20,10 +26,60 @@
 #the variable ISSM_TIER in this file, in case it is not correctly setup. 
 
-#ISSM path
-sys.path.append(ISSM_TIER+'/src/py')
-sys.path.append(ISSM_TIER+'/src/py/classes')
-sys.path.append(ISSM_TIER+'/src/py/modules/TriMesh')
-sys.path.append(ISSM_TIER+'/src/py/modules/hello')
+#ISSM path. Go through src/py and load everything we find  that looks like a python file
+for root,dirs,files in os.walk(ISSM_TIER+ '/src/py'):
+	for file in files:
+		if file.find(".py") != -1:
+			if file.find(".pyc") == -1:
+				#add to path 
+				sys.path.append(root)
+				file=os.path.splitext(file)[0]
+				#__import__(file)
+				
+sys.path.append(ISSM_TIER + '/src/mex')
+
+#Deal with scipy import: 
+import scipy 
+import numpy
+import nose
+
+#Import modules that are absolutely needed in ISSM {{{
 from model import *
+from mesh import *
+from mask import *
+from geometry import *
+from constants import *
+from surfaceforcings import *
+from basalforcings import *
+from materials import *
+from friction import *
+from flowequation import *
+from fielddisplay import *
+from timestepping import *
+from initialization import *
+from rifts import *
+from debug import *
+from settings import *
+from solver import *
+from issmtier  import * 
+from ismumps  import * 
+from pairoptions  import * 
+from petscversion  import * 
+from asmoptions import *           
+from iluasmoptions import *        
+from jacobiasmoptions import *     
+from jacobicgoptions import *      
+from matlaboptions import *        
+from mumpsoptions import *         
+from soroptions import *           
+from stokesoptions import *
+from generic import *
+from none import *
+from none import *
+from hydrology import *
+from miscellaneous import *
+from private import *
+from TriMesh import *
 
-print "\n  To get started with ISSM, type issmdoc at the command prompt.\n\n"
+#}}}
+
+print("\n  To get started with ISSM, type issmdoc at the command prompt.\n\n")
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test101.py
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test101.py	(revision 12004)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test101.py	(revision 12004)
@@ -0,0 +1,6 @@
+from model import *
+from TriMesh import *
+
+md=model()
+[a,b,c,d,e]=TriMesh('../Exp/Square.exp',15000.0**2.0,True)
+print(a,b,c,d,e)
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test117.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test117.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test117.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'macayeal','all');
 md.cluster=none;
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,5 +15,5 @@
 field_tolerances={1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test118.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test118.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test118.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'macayeal','all');
 md.cluster=generic('name',oshostname(),'np',3);
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,5 +15,5 @@
 field_tolerances={1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test140.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test140.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test140.m	(revision 12004)
@@ -7,10 +7,9 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.initialization.waterfraction=zeros(md.mesh.numberofvertices,1);
-%md=solve(md,ThermalSolutionEnum);
 md=solve(md,EnthalpySolutionEnum);
 
 %Fields and tolerances to track changes
 field_names     ={'Enthalpy','Waterfraction','Temperature'};
-field_tolerances={1e-13,1e-13,1e-13};
+field_tolerances={1e-13,1e-10,1e-13};
 field_values={...
 	(md.results.EnthalpySolution.Enthalpy),...
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test141.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test141.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test141.m	(revision 12004)
@@ -6,5 +6,10 @@
 md.initialization.waterfraction=zeros(md.mesh.numberofvertices,1);
 md.cluster=none;
-md=solve(md,EnthalpySolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md.thermal.isenthalpy=1;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -14,12 +19,12 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.EnthalpySolution(1).Enthalpy),...
-	(md.results.EnthalpySolution(1).Waterfraction),...
-	(md.results.EnthalpySolution(1).Temperature),...
-	(md.results.EnthalpySolution(2).Enthalpy),...
-	(md.results.EnthalpySolution(2).Waterfraction),...
-	(md.results.EnthalpySolution(2).Temperature),...
-	(md.results.EnthalpySolution(3).Enthalpy),...
-	(md.results.EnthalpySolution(3).Waterfraction),...
-	(md.results.EnthalpySolution(3).Temperature),...
+	(md.results.TransientSolution(1).Enthalpy),...
+	(md.results.TransientSolution(1).Waterfraction),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(2).Enthalpy),...
+	(md.results.TransientSolution(2).Waterfraction),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(3).Enthalpy),...
+	(md.results.TransientSolution(3).Waterfraction),...
+	(md.results.TransientSolution(3).Temperature),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test142.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test142.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test142.m	(revision 12004)
@@ -6,6 +6,10 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.initialization.waterfraction=zeros(md.mesh.numberofvertices,1);
-%md=solve(md,ThermalSolutionEnum);
-md=solve(md,EnthalpySolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md.thermal.isenthalpy=1;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -15,12 +19,12 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-10,1e-13};
 field_values={...
-	(md.results.EnthalpySolution(1).Enthalpy),...
-	(md.results.EnthalpySolution(1).Waterfraction),...
-	(md.results.EnthalpySolution(1).Temperature),...
-	(md.results.EnthalpySolution(2).Enthalpy),...
-	(md.results.EnthalpySolution(2).Waterfraction),...
-	(md.results.EnthalpySolution(2).Temperature),...
-	(md.results.EnthalpySolution(3).Enthalpy),...
-	(md.results.EnthalpySolution(3).Waterfraction),...
-	(md.results.EnthalpySolution(3).Temperature),...
+	(md.results.TransientSolution(1).Enthalpy),...
+	(md.results.TransientSolution(1).Waterfraction),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(2).Enthalpy),...
+	(md.results.TransientSolution(2).Waterfraction),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(3).Enthalpy),...
+	(md.results.TransientSolution(3).Waterfraction),...
+	(md.results.TransientSolution(3).Temperature),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test213.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test213.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test213.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'macayeal','all');
 md.cluster=none;
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,9 +15,9 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(2).Temperature),...
-	(md.results.ThermalSolution(2).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(3).Temperature),...
-	(md.results.ThermalSolution(3).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(2).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(3).Temperature),...
+	(md.results.TransientSolution(3).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test214.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test214.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test214.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'macayeal','all');
 md.cluster=generic('name',oshostname(),'np',3);
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,9 +15,9 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(2).Temperature),...
-	(md.results.ThermalSolution(2).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(3).Temperature),...
-	(md.results.ThermalSolution(3).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(2).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(3).Temperature),...
+	(md.results.TransientSolution(3).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test263.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test263.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test263.m	(revision 12004)
@@ -8,5 +8,9 @@
 md.timestepping.time_step=1;
 md.timestepping.final_time=4;
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -14,11 +18,11 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(2).Temperature),...
-	(md.results.ThermalSolution(2).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(3).Temperature),...
-	(md.results.ThermalSolution(3).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(4).Temperature),...
-	(md.results.ThermalSolution(4).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(2).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(3).Temperature),...
+	(md.results.TransientSolution(3).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(4).Temperature),...
+	(md.results.TransientSolution(4).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test264.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test264.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test264.m	(revision 12004)
@@ -8,5 +8,9 @@
 md.timestepping.time_step=1;
 md.timestepping.final_time=4;
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -14,11 +18,11 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(2).Temperature),...
-	(md.results.ThermalSolution(2).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(3).Temperature),...
-	(md.results.ThermalSolution(3).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(4).Temperature),...
-	(md.results.ThermalSolution(4).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(2).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(3).Temperature),...
+	(md.results.TransientSolution(3).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(4).Temperature),...
+	(md.results.TransientSolution(4).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test325.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test325.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test325.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'macayeal','all');
 md.cluster=none;
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,5 +15,5 @@
 field_tolerances={1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test326.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test326.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test326.m	(revision 12004)
@@ -5,5 +5,10 @@
 md=setflowequation(md,'macayeal','all');
 md.cluster=generic('name',oshostname(),'np',3);
-md=solve(md,ThermalSolutionEnum);
+md.verbose=verbose('convergence',true,'solution',true);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,5 +16,5 @@
 field_tolerances={1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test351.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test351.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test351.m	(revision 12004)
@@ -6,5 +6,10 @@
 md.initialization.waterfraction=zeros(md.mesh.numberofvertices,1);
 md.cluster=none;
-md=solve(md,EnthalpySolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md.thermal.isenthalpy=1;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -14,12 +19,12 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.EnthalpySolution(1).Enthalpy),...
-	(md.results.EnthalpySolution(1).Waterfraction),...
-	(md.results.EnthalpySolution(1).Temperature),...
-	(md.results.EnthalpySolution(2).Enthalpy),...
-	(md.results.EnthalpySolution(2).Waterfraction),...
-	(md.results.EnthalpySolution(2).Temperature),...
-	(md.results.EnthalpySolution(3).Enthalpy),...
-	(md.results.EnthalpySolution(3).Waterfraction),...
-	(md.results.EnthalpySolution(3).Temperature),...
+	(md.results.TransientSolution(1).Enthalpy),...
+	(md.results.TransientSolution(1).Waterfraction),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(2).Enthalpy),...
+	(md.results.TransientSolution(2).Waterfraction),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(3).Enthalpy),...
+	(md.results.TransientSolution(3).Waterfraction),...
+	(md.results.TransientSolution(3).Temperature),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test352.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test352.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test352.m	(revision 12004)
@@ -6,6 +6,10 @@
 md.cluster=generic('name',oshostname(),'np',3);
 md.initialization.waterfraction=zeros(md.mesh.numberofvertices,1);
-%md=solve(md,ThermalSolutionEnum);
-md=solve(md,EnthalpySolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md.thermal.isenthalpy=1;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -15,12 +19,12 @@
 field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
 field_values={...
-	(md.results.EnthalpySolution(1).Enthalpy),...
-	(md.results.EnthalpySolution(1).Waterfraction),...
-	(md.results.EnthalpySolution(1).Temperature),...
-	(md.results.EnthalpySolution(2).Enthalpy),...
-	(md.results.EnthalpySolution(2).Waterfraction),...
-	(md.results.EnthalpySolution(2).Temperature),...
-	(md.results.EnthalpySolution(3).Enthalpy),...
-	(md.results.EnthalpySolution(3).Waterfraction),...
-	(md.results.EnthalpySolution(3).Temperature),...
+	(md.results.TransientSolution(1).Enthalpy),...
+	(md.results.TransientSolution(1).Waterfraction),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(2).Enthalpy),...
+	(md.results.TransientSolution(2).Waterfraction),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(3).Enthalpy),...
+	(md.results.TransientSolution(3).Waterfraction),...
+	(md.results.TransientSolution(3).Temperature),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test413.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test413.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test413.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'pattyn','all');
 md.cluster=none;
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,5 +15,5 @@
 field_tolerances={1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test414.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test414.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test414.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'pattyn','all');
 md.cluster=generic('name',oshostname(),'np',3);
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -11,5 +15,5 @@
 field_tolerances={1e-13,1e-13};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test529.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test529.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test529.m	(revision 12004)
@@ -5,5 +5,9 @@
 md=setflowequation(md,'pattyn','all');
 md.thermal.stabilization=2;
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -12,7 +16,7 @@
 field_tolerances={1e-13,1e-9,1e-13,1e-9};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(2).Temperature),...
-	(md.results.ThermalSolution(2).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(2).BasalforcingsMeltingRate),...
 	};
Index: /issm/branches/trunk-jpl-damage/test/NightlyRun/test530.m
===================================================================
--- /issm/branches/trunk-jpl-damage/test/NightlyRun/test530.m	(revision 12003)
+++ /issm/branches/trunk-jpl-damage/test/NightlyRun/test530.m	(revision 12004)
@@ -6,5 +6,9 @@
 md.thermal.stabilization=2;
 md.cluster=generic('name',oshostname(),'np',3);
-md=solve(md,ThermalSolutionEnum);
+md.transient.isdiagnostic=0;
+md.transient.isprognostic=0;
+md.transient.isthermal=1;
+md.transient.isgroundingline=0;
+md=solve(md,TransientSolutionEnum);
 
 %Fields and tolerances to track changes
@@ -13,7 +17,7 @@
 field_tolerances={1e-13,1e-8,1e-13,1e-8};
 field_values={...
-	(md.results.ThermalSolution(1).Temperature),...
-	(md.results.ThermalSolution(1).BasalforcingsMeltingRate),...
-	(md.results.ThermalSolution(2).Temperature),...
-	(md.results.ThermalSolution(2).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(1).Temperature),...
+	(md.results.TransientSolution(1).BasalforcingsMeltingRate),...
+	(md.results.TransientSolution(2).Temperature),...
+	(md.results.TransientSolution(2).BasalforcingsMeltingRate),...
 	};
