Index: /issm/oecreview/Archive/17802-17983/Date.tex
===================================================================
--- /issm/oecreview/Archive/17802-17983/Date.tex	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/Date.tex	(revision 17986)
@@ -0,0 +1,1 @@
+May-13-2014
Index: /issm/oecreview/Archive/17802-17983/ISSM-17804-17805.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17804-17805.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17804-17805.diff	(revision 17986)
@@ -0,0 +1,49 @@
+Index: ../trunk-jpl/src
+===================================================================
+--- ../trunk-jpl/src	(revision 17804)
++++ ../trunk-jpl/src	(revision 17805)
+
+Property changes on: ../trunk-jpl/src
+___________________________________________________________________
+Modified: svn:mergeinfo
+   Merged /issm/trunk/src:r16566-17804
+Index: ../trunk-jpl/configs/configure.sh
+===================================================================
+--- ../trunk-jpl/configs/configure.sh	(revision 0)
++++ ../trunk-jpl/configs/configure.sh	(revision 17805)
+@@ -0,0 +1,19 @@
++#!/bin/sh
++
++#Default configuration script
++#petsc 3.4
++#mpich 1.4
++
++./configure \
++	--prefix=$ISSM_DIR \
++	--with-matlab-dir="$ISSM_DIR/externalpackages/matlab/install" \
++	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
++	--with-mpi-include="$ISSM_DIR/externalpackages/mpich/install/include"  \
++	--with-mpi-libflags="-L$ISSM_DIR/externalpackages/mpich/install/lib/ -lmpich" \
++	--with-petsc-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-petsc-arch="$ISSM_ARCH" \
++	--with-metis-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-blas-lapack-dir="$ISSM_DIR/externalpackages/petsc/install" \
++	--with-scalapack-dir="$ISSM_DIR/externalpackages/petsc/install/" \
++	--with-mumps-dir="$ISSM_DIR/externalpackages/petsc/install/" \
++	--with-numthreads=2
+
+Property changes on: ../trunk-jpl/configs/configure.sh
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl
+===================================================================
+--- ../trunk-jpl	(revision 17804)
++++ ../trunk-jpl	(revision 17805)
+
+Property changes on: ../trunk-jpl
+___________________________________________________________________
+Modified: svn:mergeinfo
+   Merged /issm/trunk:r16566-17804
Index: /issm/oecreview/Archive/17802-17983/ISSM-17807-17808.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17807-17808.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17807-17808.diff	(revision 17986)
@@ -0,0 +1,13423 @@
+Index: ../trunk-jpl/src/java/build/gui_elements/PathPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/PathPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/PathPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/PathPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/PathPanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/gui_elements/FramePanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/FramePanel.class
+===================================================================
+--- ../trunk-jpl/src/java/build/gui_elements/FramePanel.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/gui_elements/FramePanel.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/gui_elements/FramePanel.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder.class
+===================================================================
+--- ../trunk-jpl/src/java/build/main/GUIBuilder.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/main/GUIBuilder.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/main/GUIBuilder.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder$1.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder$1.class
+===================================================================
+--- ../trunk-jpl/src/java/build/main/GUIBuilder$1.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/main/GUIBuilder$1.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/main/GUIBuilder$1.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/main/PanelControl.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/PanelControl.class
+===================================================================
+--- ../trunk-jpl/src/java/build/main/PanelControl.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/main/PanelControl.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/main/PanelControl.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/main/XMLHelper.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/XMLHelper.class
+===================================================================
+--- ../trunk-jpl/src/java/build/main/XMLHelper.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/main/XMLHelper.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/main/XMLHelper.class
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/main/GUI.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/GUI.class
+===================================================================
+--- ../trunk-jpl/src/java/build/main/GUI.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/main/GUI.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/main/GUI.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/main/PanelNode.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/PanelNode.class
+===================================================================
+--- ../trunk-jpl/src/java/build/main/PanelNode.class	(revision 17807)
++++ ../trunk-jpl/src/java/build/main/PanelNode.class	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/main/PanelNode.class
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/document-open-2.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/document-open-2.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/document-open-2.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/document-open-2.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/document-open-2.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/document-preview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/document-preview.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/document-preview.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/document-preview.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/document-preview.png
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/document-export-4.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/document-export-4.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/document-export-4.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/document-export-4.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/document-export-4.png
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/config_schema.xsd
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/config_schema.xsd	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/config_schema.xsd	(revision 17808)
+@@ -0,0 +1,141 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++
++<xsd:schema version="1.0"
++xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++
++  <xsd:element name="inishell_config" type="general" />
++  
++	<xsd:complexType name="general">
++      <xsd:choice maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="parametergroup" type="pargroup" />
++			<xsd:element name="include" type="pathonly" /> 
++      </xsd:choice>
++	  <xsd:attribute name="application" />
++    </xsd:complexType>
++	
++	<xsd:complexType name="parametertype">
++		<xsd:complexContent>
++			<xsd:extension base="parbasetype">
++				<xsd:attribute name="key" type="xsd:string" use="required"/> 
++				<xsd:attribute name="default" type="xsd:string" />
++				<xsd:attribute name="counter" type="xsd:integer" />
++			</xsd:extension>
++		</xsd:complexContent>		
++	</xsd:complexType>
++   
++   <xsd:complexType name="nameonly">
++		<xsd:attribute name="name" />   
++   </xsd:complexType>
++   
++   <xsd:complexType name="pathonly">
++		<xsd:attribute name="path" />   
++   </xsd:complexType>
++   
++	<xsd:complexType name="pargroup">
++		<xsd:choice minOccurs="1" maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="reference" type="nameonly" />
++		</xsd:choice>
++		<xsd:attribute name="name" />
++	</xsd:complexType>
++  
++	
++	<xsd:complexType name="parbasetype">
++		<xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="section" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="replace" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="parameter" type="parametertype" />
++			</xsd:sequence>
++			<xsd:choice minOccurs="0" maxOccurs="unbounded">				
++				<xsd:element name="option" minOccurs="0">
++					<xsd:complexType>
++						<xsd:complexContent>
++							<xsd:extension base="parbasetype">
++								<xsd:attribute name="value" type="xsd:string" use="required" />
++								<xsd:attribute name="label" type="xsd:string" use="optional" />
++								<xsd:attribute name="default" type="xsd:boolean"/>
++							</xsd:extension>
++						</xsd:complexContent>
++					</xsd:complexType>
++				</xsd:element>
++			</xsd:choice>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="reference" type="nameonly" />
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="help" type="helptype"/>	
++			</xsd:sequence>
++		</xsd:sequence>
++		
++		<xsd:attribute name="type" use="required">
++		     <xsd:simpleType>
++				<xsd:restriction base="xsd:string">
++					<xsd:enumeration value="integer" />
++					<xsd:enumeration value="integer+" />
++					<xsd:enumeration value="decimal" />
++					<xsd:enumeration value="path" />
++					<xsd:enumeration value="file" />
++					<xsd:enumeration value="choice" />
++					<xsd:enumeration value="alternative" />
++					<xsd:enumeration value="string" />
++					<xsd:enumeration value="combination" />
++					<xsd:enumeration value="selector" />
++				</xsd:restriction>
++			</xsd:simpleType>
++		</xsd:attribute>
++		
++		<xsd:attribute name="maximum" type="xsd:integer"/>
++		<xsd:attribute name="minimum" type="xsd:integer"/>
++		<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++		<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="needstype">
++		<xsd:attribute name="type" type="xsd:string" use="required" />
++		<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++		<xsd:attribute name="value" />
++		<xsd:attribute name="optional" type="xsd:boolean" />
++		<xsd:attribute name="minoccur" type="xsd:integer" />
++		<xsd:attribute name="maxoccur" type="xsd:string" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="baseType">
++		<xsd:sequence minOccurs="0" maxOccurs="1">
++			<xsd:element name="help" type="helptype" />		
++		</xsd:sequence>
++		<xsd:attribute name="key" type="xsd:string" use="required" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="helptype" mixed="true">
++		<xsd:choice minOccurs="0" maxOccurs="unbounded">
++			<xsd:element name="section" type="nameonly" />
++			<xsd:element name="replace" type="nameonly" />
++		</xsd:choice>
++	</xsd:complexType>
++	
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/build/resources/config_schema.xsd
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/default_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/default_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/default_config.xml	(revision 17808)
+@@ -0,0 +1,1284 @@
++<inishell_config application="ISSM prototype">
++
++<!-- mesh -->
++<parameter key ="Dimension" type="alternative" optional="false">
++     <section name="mesh" />
++     <option value="0" type="string" default="true">
++        <help> dimension is 0 </help>
++     </option>
++     <option value="3" type="string">
++        <help> dimension is 3 </help>
++       <!-- Elements and vertices of the original 2d mesh -->
++          <parameter key ="x2d" type="double" default="N/A">
++              <help> vertices x coordinate [m] </help>
++          </parameter>
++          <parameter key ="y2d" type="double" default="N/A">
++              <help> vertices y coordinate [m] </help>
++          </parameter>
++          <parameter key ="elements2d" type="double" default="N/A">
++              <help> vertex indices of the mesh elements </help>
++          </parameter>
++          <parameter key ="numberofvertices2d" type="double" default="0">
++              <help> number of vertices </help>
++          </parameter>
++          <parameter key ="numberofelements2d" type="double" default="0">
++              <help> number of elements </help>
++          </parameter>
++     </option>
++     <help> select a mesh dimension 0(default) or 3 </help>
++</parameter>
++<frame key="1" label="Elements and vertices">
++<section name="mesh" />
++  <parameter key ="numberofelements" type="double" default="0">
++     <section name="mesh" />
++     <help> number of elements </help>
++  </parameter>
++  <parameter key ="numberofvertices" type="double" default="0">
++     <section name="mesh" />
++     <help> number of verticies </help>
++  </parameter>
++  <parameter key ="elements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertex indices of the mesh elements </help>
++  </parameter>
++  <parameter key ="x" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices x coordinate [m] </help>
++  </parameter>
++  <parameter key ="y" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices y coordinate [m] </help>
++  </parameter>
++  <parameter key ="z" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices z coordinate [m] </help>
++  </parameter>
++  <parameter key ="edges" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>
++  </parameter>
++  <parameter key ="numberofedges" type="double" default="0">
++     <section name="mesh" />
++     <help> number of edges of the 2d mesh </help>
++  </parameter>
++</frame>
++<frame key="2" label="Properties">
++<section name="mesh" />
++  <parameter key ="selected dimension" type="double" default="0">
++     <section name="mesh" />
++     <help> mesh dimension </help>
++  </parameter>
++  <parameter key ="numberoflayers" type="double" default="0">
++     <section name="mesh" />
++     <help> number of extrusion layers </help>
++  </parameter>
++  <parameter key ="vertexonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower elements flags list </help>
++  </parameter>
++  <parameter key ="vertexonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element flag list </help>
++  </parameter>
++  <parameter key ="uppervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertex list (NaN for vertex on the upper surface) </help>
++  </parameter>
++  <parameter key ="upperelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element list (NaN for element on the upper layer) </help>
++  </parameter>
++  <parameter key ="lowervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertex list (NaN for vertex on the lower surface) </help>
++  </parameter>
++  <parameter key ="lowerelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower element list (NaN for element on the lower layer </help>
++  </parameter>
++  <parameter key ="vertexonboundary" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices on the boundary of the domain flag list </help>
++  </parameter>
++  <parameter key ="segments" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges on domain boundary (vertex1 vertex2 element) </help>
++  </parameter>
++  <parameter key ="segmentmarkers" type="double" default="N/A">
++     <section name="mesh" />
++     <help> number associated to each segment </help>
++  </parameter>
++  <parameter key ="vertexconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to vertex_i </help>
++  </parameter>
++  <parameter key ="elementconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to element_i </help>
++  </parameter>
++  <parameter key ="average_vertex_connectivity" type="double" default="25">
++     <section name="mesh" />
++     <help> average number of vertices connected to one vertex </help>
++  </parameter>
++</frame>
++<frame key="3" label="Extracted Model">
++<section name="mesh" />
++  <parameter key ="extractedvertices" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices extracted from the model </help>
++  </parameter>
++  <parameter key ="extractedelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> elements extracted from the model </help>
++  </parameter>
++</frame>
++<frame key="4" label="Projection">
++<section name="mesh" />
++  <parameter key ="lat" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices latitude [degrees] </help>
++  </parameter>
++  <parameter key ="long" type="double" default="N/A">
++     <section name="mesh" />
++     <help> verticies longitude [degrees] </help>
++  </parameter>
++  <parameter key ="hemisphere" type="double" default="N/A">
++     <section name="mesh" />
++     <help> Indicate hemisphere 'n' or 's' </help>
++  </parameter></frame>
++
++
++<!-- mask -->
++<parameter key ="groundedice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &amp;lt; 0 </help>
++</parameter>
++<parameter key ="ice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> presence of ice if > 0, icefront position if = 0, no ice if &amp;lt; 0 </help>
++</parameter>
++
++<!-- geometry -->
++<frame key="1" label="Geometry parameters">
++<section name="geometry" />
++<parameter key ="surface" type="path" optional="false">
++     <section name="geometry" />
++     <help> surface elevation [m] </help>
++</parameter>
++<parameter key ="thickness" type="path" optional="false">
++     <section name="geometry" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="bed" type="path" optional="false">
++     <section name="geometry" />
++     <help> bed elevation [m] </help>
++</parameter>
++<parameter key ="bathymetry" type="double" default="N/A">
++     <section name="geometry" />
++     <help> bathymetry elevation [m] </help>
++</parameter>
++<parameter key ="hydrostatic_ratio" type="double" default="N/A">
++     <section name="geometry" />
++     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>
++</parameter></frame>
++
++
++<!-- constants -->
++<parameter key ="g" type="double" default="9.81">
++     <section name="constants" />
++     <help> gravitational acceleration [m/s^2] </help>
++</parameter>
++<parameter key ="yts" type="double" default="31536000">
++     <section name="constants" />
++     <help> number of seconds in a year [s/yr] </help>
++</parameter>
++<parameter key ="referencetemperature" type="double" default="223.15">
++     <section name="constants" />
++     <help> reference temperature used in the enthalpy model [K] </help>
++</parameter>
++
++<!-- surfaceforcings(SMB) -->
++<parameter key ="mass_balance" type="double" default="NaN">
++     <section name="surfaceforcings(SMB)" />
++     <help> surface mass balance [m/yr ice eq] </help>
++</parameter>
++
++<!-- basalforcings -->
++<parameter key ="melting_rate" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> basal melting rate (positive if melting) [m/yr] </help>
++</parameter>
++<parameter key ="melting_rate_correction" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> additional melting applied to compensate for dh/dt [m/yr] </help>
++</parameter>
++<parameter key ="geothermalflux" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> geothermal heat flux [W/m^2] </help>
++</parameter>
++
++<!-- materials -->
++<parameter key ="rho_ice" type="double" default="917">
++     <section name="materials" />
++     <help> ice density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_water" type="double" default="1023">
++     <section name="materials" />
++     <help> ocean water density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_freshwater" type="double" default="1000">
++     <section name="materials" />
++     <help> fresh water density [kg/m^3] </help>
++</parameter>
++<parameter key ="mu_water" type="double" default="0.001787">
++     <section name="materials" />
++     <help> water viscosity [N s/m^2] </help>
++</parameter>
++<parameter key ="heatcapacity" type="double" default="2093">
++     <section name="materials" />
++     <help> heat capacity [J/kg/K] </help>
++</parameter>
++<parameter key ="latentheat" type="double" default="334000">
++     <section name="materials" />
++     <help> latent heat of fusion [J/kg] </help>
++</parameter>
++<parameter key ="thermalconductivity" type="double" default="2.4">
++     <section name="materials" />
++     <help> ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="temperateiceconductivity" type="double" default="0.24">
++     <section name="materials" />
++     <help> temperate ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="meltingpoint" type="double" default="273.15">
++     <section name="materials" />
++     <help> melting point of ice at 1atm in K </help>
++</parameter>
++<parameter key ="beta" type="double" default="9.8e-08">
++     <section name="materials" />
++     <help> rate of change of melting point with pressure [K/Pa] </help>
++</parameter>
++<parameter key ="mixed_layer_capacity" type="double" default="3974">
++     <section name="materials" />
++     <help> mixed layer capacity [W/kg/K] </help>
++</parameter>
++<parameter key ="thermal_exchange_velocity" type="double" default="0.0001">
++     <section name="materials" />
++     <help> thermal exchange velocity [m/s] </help>
++</parameter>
++<parameter key ="rheology_B" type="double" default="N/A">
++     <section name="materials" />
++     <help> flow law parameter [Pa/s^(1/n)] </help>
++</parameter>
++<parameter key ="rheology_n" type="double" default="N/A">
++     <section name="materials" />
++     <help> Glens flow law exponent </help>
++</parameter>
++<parameter key ="rheology_law" type="char" default="'Paterson'">
++     <section name="materials" />
++     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>
++</parameter>
++<parameter key ="lithosphere_shear_modulus" type="double" default="67000000000">
++     <section name="materials" />
++     <help> Lithosphere shear modulus [Pa] </help>
++</parameter>
++<parameter key ="lithosphere_density" type="double" default="3.32">
++     <section name="materials" />
++     <help> Lithosphere density [g/cm^-3] </help>
++</parameter>
++<parameter key ="mantle_shear_modulus" type="double" default="145000000000">
++     <section name="materials" />
++     <help> Mantle shear modulus [Pa] </help>
++</parameter>
++<parameter key ="mantle_density" type="double" default="3.34">
++     <section name="materials" />
++     <help> Mantle density [g/cm^-3] </help>
++</parameter>
++
++
++<!-- damage -->
++<!-- Note: this class depends on different input of law -->
++<parameter key ="law" type="alternative" optional="false">
++	<section name="damage" />
++	<option value="undamage" type="string" default="true">
++		<help> law = undamage </help>
++	</option>
++	<option value="pralong" type="string" default="false">
++		<help> law = pralong </help>
++		<parameter key ="stress_threshold" type="double" default="0">
++			<help> damage stress threshold [Pa] </help>
++		</parameter>
++		<parameter key ="c1" type="double" default="0">
++			<help> damage parameter 1 </help>
++		</parameter>
++		<parameter key ="c2" type="double" default="0">
++			<help> damage parameter 2 </help>
++		</parameter>
++		<parameter key ="c3" type="double" default="0">
++			<help> damage parameter 3 [W/m^2] </help>
++		</parameter>
++		<parameter key ="c4" type="double" default="0">
++			<help> damage parameter 4 </help>
++		</parameter>
++		<parameter key ="healing" type="double" default="0">
++			<help> damage healing parameter 1 </help>
++		</parameter>
++		<parameter key ="equiv_stress" type="double" default="0">
++			<help> 0: von Mises </help>
++		</parameter>
++		<parameter key ="requested_outputs" type="cell" default="{'default'}">
++			<help> additional outputs requested </help>
++		</parameter>
++	</option>
++	<help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="D" type="double" default="0">
++     <section name="damage" />
++     <help> damage tensor (scalar) </help>
++</parameter>
++<parameter key ="law" type="char" default="undamaged">
++     <section name="damage" />
++     <help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="spcdamage" type="double" default="NaN">
++     <section name="damage" />
++     <help> damage constraints (NaN means no constraint) </help>
++</parameter>
++<parameter key ="max_damage" type="double" default="0.99999">
++     <section name="damage" />
++     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="2">
++     <section name="damage" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="damage" />
++     <help> maximum number of non linear iterations </help>
++</parameter>
++<parameter key ="penalty_lock" type="double" default="0">
++     <section name="damage" />
++     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++</parameter>
++<parameter key ="penalty_threshold" type="double" default="0">
++     <section name="damage" />
++     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>
++</parameter>
++<parameter key ="penalty_factor" type="double" default="3">
++     <section name="damage" />
++     <help> scaling exponent (default is 3) </help>
++</parameter>
++
++
++<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->
++<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">
++<section name="friction" />
++<parameter key ="coefficient" type="double" default="N/A">
++     <section name="friction" />
++     <help> friction coefficient [SI] </help>
++</parameter>
++<parameter key ="p" type="double" default="N/A">
++     <section name="friction" />
++     <help> p exponent </help>
++</parameter>
++<parameter key ="q" type="double" default="N/A">
++     <section name="friction" />
++     <help> q exponent </help>
++</parameter></frame>
++
++
++<!-- flowequation -->
++<frame key="1" label="Flow equation parameters">
++<section name="flowequation" />
++<parameter key ="isSIA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shallow Ice Approximation (SIA) used ? </help>
++</parameter>
++<parameter key ="isSSA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>
++</parameter>
++<parameter key ="isL1L2" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the L1L2 approximation used ? </help>
++</parameter>
++<parameter key ="isHO" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Higher-Order (HO) approximation used ? </help>
++</parameter>
++<parameter key ="isFS" type="double" default="0">
++     <section name="flowequation" />
++     <help> are the Full-FS (FS) equations used ? </help>
++</parameter>
++<parameter key ="fe_SSA" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>
++</parameter>
++<parameter key ="fe_HO" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>
++</parameter>
++<parameter key ="fe_FS" type="char" default="'MINIcondensed'">
++     <section name="flowequation" />
++     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>
++</parameter>
++<parameter key ="vertex_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each vertex </help>
++</parameter>
++<parameter key ="element_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each element </help>
++</parameter>
++<parameter key ="borderSSA" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on SSAs border (for tiling) </help>
++</parameter>
++<parameter key ="borderHO" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on HOs border (for tiling) </help>
++</parameter>
++<parameter key ="borderFS" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on FS border (for tiling) </help>
++</parameter></frame>
++
++
++<!-- Timestepping -->
++<parameter key ="start_time" type="double" default="0">
++     <section name="timestepping" />
++     <help> simulation starting time [yr] </help>
++</parameter>
++<parameter key ="final_time" type="double" default="5">
++     <section name="timestepping" />
++     <help> final time to stop the simulation [yr] </help>
++</parameter>
++<parameter key ="time_step" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> length of time steps [yr] </help>
++</parameter>
++<parameter key ="time_adapt" type="double" default="0">
++     <section name="timestepping" />
++     <help> use cfl condition to define time step ? (0 or 1)  </help>
++</parameter>
++<parameter key ="cfl_coefficient" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> coefficient applied to cfl condition </help>
++</parameter>
++
++
++<!-- initialization -->
++<frame key="1" label="Initial field values">
++<section name="initialization" />
++<parameter key ="vx" type="double" default="NaN">
++     <section name="initialization" />
++     <help> x component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vy" type="double" default="NaN">
++     <section name="initialization" />
++     <help> y component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vz" type="double" default="NaN">
++     <section name="initialization" />
++     <help> z component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vel" type="double" default="NaN">
++     <section name="initialization" />
++     <help> velocity norm [m/yr] </help>
++</parameter>
++<parameter key ="pressure" type="double" default="NaN">
++     <section name="initialization" />
++     <help> pressure field [Pa] </help>
++</parameter>
++<parameter key ="temperature" type="double" default="NaN">
++     <section name="initialization" />
++     <help> fraction of water in the ice </help>
++</parameter>
++<parameter key ="waterfraction" type="double" default="NaN">
++     <section name="initialization" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="sediment_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> sediment water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="epl_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> epl water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="watercolumn" type="double" default="NaN">
++     <section name="initialization" />
++     <help> thickness of subglacial water [m] </help>
++</parameter></frame>
++
++
++<!-- rifts -->
++<parameter key ="riftstruct" type="double" default="NaN">
++     <section name="rifts" />
++     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>
++</parameter>
++<parameter key ="riftproperties" type="double" default="NaN">
++     <section name="rifts" />
++     <help> N/A </help>
++</parameter>
++
++
++<!-- Debug -->
++<parameter key ="valgrind" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use Valgrind to debug (0 or 1) </help>
++</parameter>
++<parameter key ="gprof" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use gnu-profiler to find out where the time is spent </help>
++</parameter>
++<parameter key ="profiling" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> enables profiling (memory, flops, time) </help>
++</parameter>
++
++<!-- verbose -->
++<parameter key ="mprocessor" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="module" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solution" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solver" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="convergence" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="control" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="qmu" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="autodiff" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++
++<!-- settings -->
++<parameter key ="results_on_nodes" type="double" default="0">
++     <section name="settings" />
++     <help> results are output for all the nodes of each element </help>
++</parameter>
++<parameter key ="io_gather" type="double" default="1">
++     <section name="settings" />
++     <help> I/O gathering strategy for result outputs (default 1) </help>
++</parameter>
++<parameter key ="lowmem" type="double" default="0">
++     <section name="settings" />
++     <help> is the memory limited ? (0 or 1) </help>
++</parameter>
++<parameter key ="output_frequency" type="double" default="1">
++     <section name="settings" />
++     <help> frequency at which results are saved in all solutions with multiple time_steps </help>
++</parameter>
++<parameter key ="waitonlock" type="double" default="Inf">
++     <section name="settings" />
++     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>
++</parameter>
++<parameter key ="upload_server" type="char" default="N/A">
++     <section name="settings" />
++     <help> server hostname where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_path" type="char" default="N/A">
++     <section name="settings" />
++     <help> path on server where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_login" type="char" default="N/A">
++     <section name="settings" />
++     <help> server login </help>
++</parameter>
++<parameter key ="upload_port" type="double" default="0">
++     <section name="settings" />
++     <help> port login (default is 0) </help>
++</parameter>
++<parameter key ="upload_filename" type="char" default="N/A">
++     <section name="settings" />
++     <help> unique id generated when uploading the file to server </help>
++</parameter>
++
++<!-- generic -->
++<parameter key ="name" type="char" default="'XPS'">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="login" type="char" default="N/A">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="np" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="port" type="double" default="0">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="codepath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/bin">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="executionpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/execution">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="etcpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/etc">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrind" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/bin/valgrind">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindlib" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/lib/libmpidebug.so">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindsup" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/issm.supp">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="verbose" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++
++<!-- balancethickness -->
++<parameter key ="spcthickness" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="thickening_rate" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="balancethickness" />
++     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>
++</parameter>
++
++<!-- StressBalance solution parameters: -->
++<frame key="1" label="Convergence criteria">
++<section name="stressbalance" />
++<parameter key ="restol" type="double" default="0.0001">
++     <section name="stressbalance" />
++     <help> mechanical equilibrium residual convergence criterion </help>
++</parameter>
++<parameter key ="reltol" type="double" default="0.01">
++     <section name="stressbalance" />
++     <help> velocity relative convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="abstol" type="double" default="10">
++     <section name="stressbalance" />
++     <help> velocity absolute convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="isnewton" type="double" default="0">
++     <section name="stressbalance" />
++     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="stressbalance" />
++     <help> maximum number of nonlinear iterations </help>
++</parameter>
++<parameter key ="viscosity_overshoot" type="double" default="0">
++     <section name="stressbalance" />
++     <help> over-shooting constant new=new+C*(new-old) </help>
++</parameter>
++</frame>
++<frame key="2" label="Boundary conditions">
++<section name="stressbalance" />
++<parameter key ="spcvx" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvy" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvz" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++</frame>
++<frame key="3" label="Rift options">
++<section name="stressbalance" />
++<parameter key ="rift_penalty_threshold" type="double" default="0">
++     <section name="stressbalance" />
++     <help> threshold for instability of mechanical constraints </help>
++</parameter>
++<parameter key ="rift_penalty_lock" type="double" default="10">
++     <section name="stressbalance" />
++     <help> number of iterations before rift penalties are locked </help>
++</parameter>
++</frame>
++<frame key="4" label="Other">
++<section name="stressbalance" />
++<parameter key ="shelf_dampening" type="double" default="0">
++     <section name="stressbalance" />
++     <help> use dampening for floating ice ? Only for FS model </help>
++</parameter>
++<parameter key ="FSreconditioning" type="double" default="10000000000000">
++     <section name="stressbalance" />
++     <help> multiplier for incompressibility equation. Only for FS model </help>
++</parameter>
++<parameter key ="referential" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> local referential </help>
++</parameter>
++<parameter key ="loadingforce" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> loading force applied on each point [N/m^3] </help>
++</parameter>
++<parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="stressbalance" />
++     <help> additional outputs requested </help>
++</parameter>
++</frame>
++
++
++<!-- groundingline -->
++<frame key="1" label="Grounding line migration parameters">
++<section name="groundingline" />
++<parameter key ="migration" type="char" default="'None'">
++     <section name="groundingline" />
++     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>
++</parameter>
++<parameter key ="melting_rate" type="double" default="0">
++     <section name="groundingline" />
++     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>
++</parameter></frame>
++
++
++<!-- Hydrology -->
++<frame key="1" label="Hydrologyshreve solution parameters">
++<section name="hydrologyshreve" />
++<parameter key ="spcwatercolumn" type="double" default="N/A">
++     <section name="hydrologyshreve" />
++     <help> water thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="n" type="double" default="0.02">
++     <section name="hydrologyshreve" />
++     <help> Manning roughness coefficient </help>
++</parameter>
++<parameter key ="CR" type="double" default="0.01">
++     <section name="hydrologyshreve" />
++     <help> tortuosity parameter </help>
++</parameter>
++<parameter key ="p" type="double" default="2">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="q" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="kn" type="double" default="0">
++     <section name="hydrologyshreve" />
++     <help> parameter in effective pressure formula </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>
++</parameter>
++</frame>
++<!-- masstransport -->
++<frame key="1" label="Masstransport solution parameters">
++<section name="masstransport" />
++  <parameter key ="spcthickness" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++  </parameter>
++  <parameter key ="calvingrate" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> calving rate at given location [m/a] </help>
++  </parameter>
++  <parameter key ="isfreesurface" type="double" default="0">
++     <section name="masstransport" />
++     <help> do we use free surfaces (FS only) are mass conservation </help>
++  </parameter>
++  <parameter key ="min_thickness" type="double" default="1">
++     <section name="masstransport" />
++     <help> minimum ice thickness allowed [m] </help>
++  </parameter>
++  <parameter key ="hydrostatic_adjustment" type="char" default="'Absolute'">
++     <section name="masstransport" />
++     <help> adjustment of ice shelves surface and bed elevations: 'Incremental' or 'Absolute'  </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="masstransport" />
++     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>
++  </parameter>
++</frame>
++<frame key="2" label="Penalty options">
++<section name="masstransport" />
++  <parameter key ="vertex_pairing" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> offset used by penalties: penalty = Kmax*10^offset </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="masstransport" />
++     <help> pairs of vertices that are penalized </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="masstransport" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- thermal -->
++<frame key="1" label="Thermal solution parameters">
++<section name="thermal" />
++  <parameter key ="spctemperature" type="double" default="N/A">
++     <section name="thermal" />
++     <help> temperature constraints (NaN means no constraint) [K] </help>
++  </parameter>
++  <parameter key ="penalty_threshold" type="double" default="0">
++     <section name="thermal" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="thermal" />
++     <help> maximum number of non linear iterations </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="thermal" />
++     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++  </parameter>
++  <parameter key ="penalty_lock" type="double" default="0">
++     <section name="thermal" />
++     <help> threshold to declare convergence of thermal solution (default is 0)  </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="thermal" />
++     <help> scaling exponent (default is 3) </help>
++  </parameter>
++  <parameter key ="isenthalpy" type="double" default="0">
++     <section name="thermal" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="isdynamicbasalspc" type="double" default="0">
++     <section name="thermal" />
++     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="thermal" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- steadystate -->
++<frame key="1" label="steadystate solution parameters">
++<section name="steadystate" />
++  <parameter key ="reltol" type="double" default="0.01">
++     <section name="steadystate" />
++     <help> relative tolerance criterion [K] </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="steadystate" />
++     <help> maximum number of iterations </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="steadystate" />
++     <help> additional requested outputs </help>
++  </parameter>
++</frame>
++<!-- transient -->
++<frame key="1" label="transient solution parameters">
++<section name="transient" />
++  <parameter key ="ismasstransport" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a masstransport solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isstressbalance" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a stressbalance solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isthermal" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a thermal solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isgroundingline" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a groundingline migration is used in the transient </help>
++  </parameter>
++  <parameter key ="isgia" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a postglacial rebound model is used in the transient </help>
++  </parameter>
++  <parameter key ="isdamage" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether damage evolution is used in the transient </help>
++  </parameter>
++  <parameter key ="islevelset" type="double" default="0">
++     <section name="transient" />
++     <help> LEVEL SET DESCRIPTION...  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="transient" />
++     <help> list of additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- gia -->
++<frame key="1" label="gia parameters">
++<section name="gia" />
++  <parameter key ="mantle_viscosity" type="double" default="N/A">
++     <section name="gia" />
++     <help> mantle viscosity[Pa s] </help>
++  </parameter>
++  <parameter key ="lithosphere_thickness" type="double" default="N/A">
++     <section name="gia" />
++     <help> lithosphere thickness (km) </help>
++  </parameter>
++  <parameter key ="cross_section_shape" type="double" default="1">
++     <section name="gia" />
++     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>
++  </parameter>
++</frame>
++<!-- autodiff -->
++<frame key="1" label="automatic differentiation parameters">
++<section name="autodiff" />
++  <parameter key ="isautodiff" type="logical" optional="false">
++     <section name="autodiff" />
++         <option value="false" type="string" default="true"></option>
++     <help> indicates if the automatic differentiation is activated </help>
++  </parameter>
++  <parameter key ="dependents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of dependent variables </help>
++  </parameter>
++  <parameter key ="independents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of independent variables </help>
++  </parameter>
++  <parameter key ="driver" type="char" default="'fos_forward'">
++     <section name="autodiff" />
++     <help> ADOLC driver ('fos_forward' or 'fov_forward') </help>
++  </parameter>
++  <parameter key ="obufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>
++  </parameter>
++  <parameter key ="lbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="cbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="tbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of taylors per buffer (&amp;lt;=TBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>
++  </parameter>
++</frame>
++<!-- flaim -->
++<frame key="1" label="Input:">
++<section name="flaim" />
++  <parameter key ="targets" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml output targets file </help>
++  </parameter>
++  <parameter key ="tracks" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml input tracks file </help>
++  </parameter>
++  <parameter key ="flightreqs" type="struct" default="N/A">
++     <section name="flaim" />
++     <help> structure of kml flight requirements (not used yet) </help>
++  </parameter>
++  <parameter key ="criterion" type="double" default="N/A">
++     <section name="flaim" />
++     <help> element or nodal criterion for flight path evaluation (metric) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Arguments:">
++<section name="flaim" />
++  <parameter key ="gridsatequator" type="double" default="200000">
++     <section name="flaim" />
++     <help> number of grids at equator (determines resolution) </help>
++  </parameter>
++  <parameter key ="usevalueordering" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to consider target values for flight path evaluation </help>
++  </parameter>
++  <parameter key ="split_antimeridian" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to split polygons on the antimeridian </help>
++  </parameter>
++</frame>
++<frame key="3" label="Optimization:">
++<section name="flaim" />
++  <parameter key ="path_optimize" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="false" type="string" default="true"></option>
++     <help> optimize? (default false) </help>
++  </parameter>
++  <parameter key ="opt_ndir" type="double" default="1">
++     <section name="flaim" />
++     <help> 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] </help>
++  </parameter>
++  <parameter key ="opt_dist" type="double" default="25">
++     <section name="flaim" />
++     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>
++  </parameter>
++  <parameter key ="opt_niter" type="double" default="30000">
++     <section name="flaim" />
++     <help> 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. </help>
++  </parameter>
++</frame>
++<frame key="4" label="Output:">
++<section name="flaim" />
++  <parameter key ="solution" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml solution file </help>
++  </parameter>
++  <parameter key ="quality" type="double" default="0">
++     <section name="flaim" />
++     <help> quality of kml solution </help>
++  </parameter>
++</frame>
++<!-- inversion -->
++<frame key="1" label="inversion parameters">
++<section name="inversion" />
++  <parameter key ="iscontrol" type="double" default="0">
++     <section name="inversion" />
++     <help> is inversion activated? </help>
++  </parameter>
++  <parameter key ="incomplete_adjoint" type="double" default="1">
++     <section name="inversion" />
++     <help> 1: linear viscosity, 0: non-linear viscosity </help>
++  </parameter>
++  <parameter key ="control_parameters" type="cell" default="{'FrictionCoefficient'}">
++     <section name="inversion" />
++     <help> ex: {'FrictionCoefficient'}, or {'MaterialsRheologyBbar'} </help>
++  </parameter>
++  <parameter key ="nsteps" type="double" default="20">
++     <section name="inversion" />
++     <help> number of optimization searches </help>
++  </parameter>
++  <parameter key ="cost_functions" type="double" default="101">
++     <section name="inversion" />
++     <help> indicate the type of response for each optimization step  </help>
++  </parameter>
++  <parameter key ="cost_functions_coefficients" type="double" default="N/A">
++     <section name="inversion" />
++     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>
++  </parameter>
++  <parameter key ="cost_function_threshold" type="double" default="N/A">
++     <section name="inversion" />
++     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>
++  </parameter>
++  <parameter key ="maxiter_per_step" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> maximum iterations during each optimization step  </help>
++  </parameter>
++  <parameter key ="gradient_scaling" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> scaling factor on gradient direction during optimization, for each optimization step </help>
++  </parameter>
++  <parameter key ="step_threshold" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> decrease threshold for misfit, default is 30% </help>
++  </parameter>
++  <parameter key ="min_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="max_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="vx_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity x component [m/yr] </help>
++  </parameter>
++  <parameter key ="vy_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity y component [m/yr]  </help>
++  </parameter>
++  <parameter key ="vel_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity magnitude [m/yr] </help>
++  </parameter>
++  <parameter key ="thickness_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed thickness [m]) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Available cost functions">
++<section name="inversion" />
++  <parameter key ="SurfaceAbsVelMisfit" type="string" default="101">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceRelVelMisfit" type="string" default="102">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="SurfaceLogVelMisfit" type="string" default="103">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceLogVxVyMisfit" type="string" default="104">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceAverageVelMisfit" type="string" default="105">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="ThicknessAbsMisfit" type="string" default="106">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="DragCoefficientAbsGradient" type="string" default="107">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="RheologyBbarAbsGradient" type="string" default="108">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="ThicknessAbsGradient" type="string" default="109">
++     <section name="inversion" />
++     <help> </help>
++  </parameter>
++</frame>
++<!-- qmu -->
++<frame key="1" label="qmu parameters">
++<section name="qmu" />
++  <parameter key ="isdakota" type="double" default="0">
++     <section name="qmu" />
++     <help> is qmu analysis activated? </help>
++  </parameter>
++  <parameter key ="variables" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each variable class) </help>
++  </parameter>
++  <parameter key ="responses" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each response class) </help>
++  </parameter>
++  <parameter key ="numberofresponses" type="double" default="0">
++     <section name="qmu" />
++     <help> number of responses </help>
++  </parameter>
++  <parameter key ="params" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (array of method-independent parameters)  </help>
++  </parameter>
++  <parameter key ="results" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (information from dakota files) </help>
++  </parameter>
++  <parameter key ="partition" type="double" default="N/A">
++     <section name="qmu" />
++     <help> user provided mesh partitioning, defaults to metis if not specified </help>
++  </parameter>
++  <parameter key ="numberofpartitions" type="double" default="0">
++     <section name="qmu" />
++     <help> number of partitions for semi-discrete qmu  </help>
++  </parameter>
++  <parameter key ="variabledescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="responsedescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="method" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> array of dakota_method class </help>
++  </parameter>
++  <parameter key ="mass_flux_profile_directory" type="double" default="N/A">
++     <section name="qmu" />
++     <help> directory for mass flux profiles </help>
++  </parameter>
++  <parameter key ="mass_flux_profiles" type="double" default="N/A">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="mass_flux_segments" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="adjacency" type="double" default="N/A">
++     <section name="qmu" />
++     <help> additional outputs requested </help>
++  </parameter>
++  <parameter key ="vertex_weight" type="double" default="N/A">
++     <section name="qmu" />
++     <help> weight applied to each mesh vertex </help>
++  </parameter>
++</frame>
++<!-- outputdefinition -->
++<frame key="1" label="outputdefinition">
++<section name="outputdefinition" />
++  <parameter key ="definitions" type="cell" default="(0x0)">
++     <section name="outputdefinition" />
++     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>
++  </parameter>
++</frame>
++<!-- miscellaneous -->
++<frame key="1" label="miscellaneous parameters">
++<section name="miscellaneous" />
++  <parameter key ="notes" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> notes in a cell of strings </help>
++  </parameter>
++  <parameter key ="name" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> model name </help>
++  </parameter>
++  <parameter key ="dummy" type="struct" default="N/A">
++     <section name="miscellaneous" />
++     <help> empty field to store some data </help>
++  </parameter>
++</frame>
++
++
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/build/resources/default_config.xml
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/filesave.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/filesave.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/filesave.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/filesave.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/filesave.png
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/viewmag.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/viewmag.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/viewmag.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/viewmag.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/viewmag.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/ini_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/ini_open.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/ini_open.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/ini_open.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/ini_open.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/fileopen.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/fileopen.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/fileopen.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/fileopen.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/fileopen.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/xml_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/xml_open.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/xml_open.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/xml_open.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/xml_open.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/filesaveas.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/filesaveas.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/filesaveas.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/filesaveas.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/filesaveas.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/opensettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/opensettings.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/opensettings.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/opensettings.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/opensettings.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/reset.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/reset.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/reset.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/reset.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/reset.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/mydocuments.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/mydocuments.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/mydocuments.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/mydocuments.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/mydocuments.png
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/readme.txt
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/readme.txt	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/icons/readme.txt	(revision 17808)
+@@ -0,0 +1,10 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++This copyright and license notice covers the images in this directory.
++************************************************************************
++
++TITLE:	Crystal Project Icons
++AUTHOR:	Everaldo Coelho
++SITE:	http://www.everaldo.com
++CONTACT: everaldo@everaldo.com
++
++Copyright (c)  2006-2007  Everaldo Coelho.
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/readme.txt
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/icons/kghostview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/kghostview.png
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/kghostview.png	(revision 17807)
++++ ../trunk-jpl/src/java/build/resources/icons/kghostview.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/build/resources/icons/kghostview.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd	(revision 0)
++++ ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd	(revision 17808)
+@@ -0,0 +1,154 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++  <xsd:element name="inishell_config" type="general" />
++  
++  <xsd:complexType name="general">
++    <xsd:choice maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="parametergroup" type="pargroup" />
++      <xsd:element name="include" type="pathonly" /> 
++      <xsd:element name="frame" type="framegroup" /> 
++    </xsd:choice>
++    <xsd:attribute name="application" />
++  </xsd:complexType>
++
++  <xsd:complexType name="framegroup">
++    <xsd:choice minOccurs="1" maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="reference" type="nameonly" />
++      <xsd:element name="section" type="nameonly"/>
++    </xsd:choice>
++    <xsd:attribute name="key" />
++    <xsd:attribute name="label" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="parametertype">
++    <xsd:complexContent>
++      <xsd:extension base="parbasetype">
++		<xsd:attribute name="key" type="xsd:string" use="required"/> 
++		<xsd:attribute name="default" type="xsd:string" />
++		<xsd:attribute name="counter" type="xsd:integer" />
++      </xsd:extension>
++    </xsd:complexContent>		
++  </xsd:complexType>
++  
++  <xsd:complexType name="nameonly">
++	<xsd:attribute name="name" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="optionvalue">
++	<xsd:attribute name="value" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="pathonly">
++	<xsd:attribute name="path" />   
++  </xsd:complexType>
++  
++  <xsd:complexType name="pargroup">
++	<xsd:choice minOccurs="1" maxOccurs="unbounded">
++	  <xsd:element name="parameter" type="parametertype" />
++	  <xsd:element name="reference" type="nameonly" />
++	  <xsd:element name="option" type="optionvalue" />
++	  <xsd:element name="frame" type="framegroup" /> 
++	</xsd:choice>
++	<xsd:attribute name="name" />
++  </xsd:complexType>
++
++  <xsd:complexType name="parbasetype">
++	<xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="section" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="replace" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="parameter" type="parametertype" />
++	  </xsd:sequence>
++	  <xsd:choice minOccurs="0" maxOccurs="unbounded">				
++		<xsd:element name="option" minOccurs="0">
++		  <xsd:complexType>
++			<xsd:complexContent>
++			  <xsd:extension base="parbasetype">
++				<xsd:attribute name="value" type="xsd:string" use="required" />
++				<xsd:attribute name="label" type="xsd:string" use="optional" />
++				<xsd:attribute name="default" type="xsd:boolean" use="optional"/>
++			  </xsd:extension>
++			</xsd:complexContent>
++		  </xsd:complexType>
++		</xsd:element>
++	  </xsd:choice>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="reference" type="nameonly" />
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="help" type="helptype"/>	
++	  </xsd:sequence>
++	</xsd:sequence>
++	
++	<xsd:attribute name="type" use="required">
++	  <xsd:simpleType>
++		<xsd:restriction base="xsd:string">
++		  <xsd:enumeration value="integer" />
++		  <xsd:enumeration value="integer+" />
++		  <xsd:enumeration value="decimal" />
++		  <xsd:enumeration value="path" />
++		  <xsd:enumeration value="file" />
++		  <xsd:enumeration value="choice" />
++		  <xsd:enumeration value="alternative" />
++		  <xsd:enumeration value="dropdown" />
++		  <xsd:enumeration value="string" />
++		  <xsd:enumeration value="combination" />
++		  <xsd:enumeration value="selector" />
++		</xsd:restriction>
++	  </xsd:simpleType>
++	</xsd:attribute>
++	
++	<xsd:attribute name="maximum" type="xsd:integer"/>
++	<xsd:attribute name="minimum" type="xsd:integer"/>
++	<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++	<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="needstype">
++	<xsd:attribute name="type" type="xsd:string" use="required" />
++	<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++	<xsd:attribute name="value" />
++	<xsd:attribute name="optional" type="xsd:boolean" />
++	<xsd:attribute name="minoccur" type="xsd:integer" />
++	<xsd:attribute name="maxoccur" type="xsd:string" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="baseType">
++	<xsd:sequence minOccurs="0" maxOccurs="1">
++	  <xsd:element name="help" type="helptype" />		
++	</xsd:sequence>
++	<xsd:attribute name="key" type="xsd:string" use="required" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="helptype" mixed="true">
++	<xsd:choice minOccurs="0" maxOccurs="unbounded">
++	  <xsd:element name="section" type="nameonly" />
++	  <xsd:element name="replace" type="nameonly" />
++	</xsd:choice>
++  </xsd:complexType> 
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/License.txt
+===================================================================
+--- ../trunk-jpl/src/java/License.txt	(revision 0)
++++ ../trunk-jpl/src/java/License.txt	(revision 17808)
+@@ -0,0 +1,674 @@
++                    GNU GENERAL PUBLIC LICENSE
++                       Version 3, 29 June 2007
++
++ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
++ Everyone is permitted to copy and distribute verbatim copies
++ of this license document, but changing it is not allowed.
++
++                            Preamble
++
++  The GNU General Public License is a free, copyleft license for
++software and other kinds of works.
++
++  The licenses for most software and other practical works are designed
++to take away your freedom to share and change the works.  By contrast,
++the GNU General Public License is intended to guarantee your freedom to
++share and change all versions of a program--to make sure it remains free
++software for all its users.  We, the Free Software Foundation, use the
++GNU General Public License for most of our software; it applies also to
++any other work released this way by its authors.  You can apply it to
++your programs, too.
++
++  When we speak of free software, we are referring to freedom, not
++price.  Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++them if you wish), that you receive source code or can get it if you
++want it, that you can change the software or use pieces of it in new
++free programs, and that you know you can do these things.
++
++  To protect your rights, we need to prevent others from denying you
++these rights or asking you to surrender the rights.  Therefore, you have
++certain responsibilities if you distribute copies of the software, or if
++you modify it: responsibilities to respect the freedom of others.
++
++  For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must pass on to the recipients the same
++freedoms that you received.  You must make sure that they, too, receive
++or can get the source code.  And you must show them these terms so they
++know their rights.
++
++  Developers that use the GNU GPL protect your rights with two steps:
++(1) assert copyright on the software, and (2) offer you this License
++giving you legal permission to copy, distribute and/or modify it.
++
++  For the developers' and authors' protection, the GPL clearly explains
++that there is no warranty for this free software.  For both users' and
++authors' sake, the GPL requires that modified versions be marked as
++changed, so that their problems will not be attributed erroneously to
++authors of previous versions.
++
++  Some devices are designed to deny users access to install or run
++modified versions of the software inside them, although the manufacturer
++can do so.  This is fundamentally incompatible with the aim of
++protecting users' freedom to change the software.  The systematic
++pattern of such abuse occurs in the area of products for individuals to
++use, which is precisely where it is most unacceptable.  Therefore, we
++have designed this version of the GPL to prohibit the practice for those
++products.  If such problems arise substantially in other domains, we
++stand ready to extend this provision to those domains in future versions
++of the GPL, as needed to protect the freedom of users.
++
++  Finally, every program is threatened constantly by software patents.
++States should not allow patents to restrict development and use of
++software on general-purpose computers, but in those that do, we wish to
++avoid the special danger that patents applied to a free program could
++make it effectively proprietary.  To prevent this, the GPL assures that
++patents cannot be used to render the program non-free.
++
++  The precise terms and conditions for copying, distribution and
++modification follow.
++
++                       TERMS AND CONDITIONS
++
++  0. Definitions.
++
++  "This License" refers to version 3 of the GNU General Public License.
++
++  "Copyright" also means copyright-like laws that apply to other kinds of
++works, such as semiconductor masks.
++
++  "The Program" refers to any copyrightable work licensed under this
++License.  Each licensee is addressed as "you".  "Licensees" and
++"recipients" may be individuals or organizations.
++
++  To "modify" a work means to copy from or adapt all or part of the work
++in a fashion requiring copyright permission, other than the making of an
++exact copy.  The resulting work is called a "modified version" of the
++earlier work or a work "based on" the earlier work.
++
++  A "covered work" means either the unmodified Program or a work based
++on the Program.
++
++  To "propagate" a work means to do anything with it that, without
++permission, would make you directly or secondarily liable for
++infringement under applicable copyright law, except executing it on a
++computer or modifying a private copy.  Propagation includes copying,
++distribution (with or without modification), making available to the
++public, and in some countries other activities as well.
++
++  To "convey" a work means any kind of propagation that enables other
++parties to make or receive copies.  Mere interaction with a user through
++a computer network, with no transfer of a copy, is not conveying.
++
++  An interactive user interface displays "Appropriate Legal Notices"
++to the extent that it includes a convenient and prominently visible
++feature that (1) displays an appropriate copyright notice, and (2)
++tells the user that there is no warranty for the work (except to the
++extent that warranties are provided), that licensees may convey the
++work under this License, and how to view a copy of this License.  If
++the interface presents a list of user commands or options, such as a
++menu, a prominent item in the list meets this criterion.
++
++  1. Source Code.
++
++  The "source code" for a work means the preferred form of the work
++for making modifications to it.  "Object code" means any non-source
++form of a work.
++
++  A "Standard Interface" means an interface that either is an official
++standard defined by a recognized standards body, or, in the case of
++interfaces specified for a particular programming language, one that
++is widely used among developers working in that language.
++
++  The "System Libraries" of an executable work include anything, other
++than the work as a whole, that (a) is included in the normal form of
++packaging a Major Component, but which is not part of that Major
++Component, and (b) serves only to enable use of the work with that
++Major Component, or to implement a Standard Interface for which an
++implementation is available to the public in source code form.  A
++"Major Component", in this context, means a major essential component
++(kernel, window system, and so on) of the specific operating system
++(if any) on which the executable work runs, or a compiler used to
++produce the work, or an object code interpreter used to run it.
++
++  The "Corresponding Source" for a work in object code form means all
++the source code needed to generate, install, and (for an executable
++work) run the object code and to modify the work, including scripts to
++control those activities.  However, it does not include the work's
++System Libraries, or general-purpose tools or generally available free
++programs which are used unmodified in performing those activities but
++which are not part of the work.  For example, Corresponding Source
++includes interface definition files associated with source files for
++the work, and the source code for shared libraries and dynamically
++linked subprograms that the work is specifically designed to require,
++such as by intimate data communication or control flow between those
++subprograms and other parts of the work.
++
++  The Corresponding Source need not include anything that users
++can regenerate automatically from other parts of the Corresponding
++Source.
++
++  The Corresponding Source for a work in source code form is that
++same work.
++
++  2. Basic Permissions.
++
++  All rights granted under this License are granted for the term of
++copyright on the Program, and are irrevocable provided the stated
++conditions are met.  This License explicitly affirms your unlimited
++permission to run the unmodified Program.  The output from running a
++covered work is covered by this License only if the output, given its
++content, constitutes a covered work.  This License acknowledges your
++rights of fair use or other equivalent, as provided by copyright law.
++
++  You may make, run and propagate covered works that you do not
++convey, without conditions so long as your license otherwise remains
++in force.  You may convey covered works to others for the sole purpose
++of having them make modifications exclusively for you, or provide you
++with facilities for running those works, provided that you comply with
++the terms of this License in conveying all material for which you do
++not control copyright.  Those thus making or running the covered works
++for you must do so exclusively on your behalf, under your direction
++and control, on terms that prohibit them from making any copies of
++your copyrighted material outside their relationship with you.
++
++  Conveying under any other circumstances is permitted solely under
++the conditions stated below.  Sublicensing is not allowed; section 10
++makes it unnecessary.
++
++  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
++
++  No covered work shall be deemed part of an effective technological
++measure under any applicable law fulfilling obligations under article
++11 of the WIPO copyright treaty adopted on 20 December 1996, or
++similar laws prohibiting or restricting circumvention of such
++measures.
++
++  When you convey a covered work, you waive any legal power to forbid
++circumvention of technological measures to the extent such circumvention
++is effected by exercising rights under this License with respect to
++the covered work, and you disclaim any intention to limit operation or
++modification of the work as a means of enforcing, against the work's
++users, your or third parties' legal rights to forbid circumvention of
++technological measures.
++
++  4. Conveying Verbatim Copies.
++
++  You may convey verbatim copies of the Program's source code as you
++receive it, in any medium, provided that you conspicuously and
++appropriately publish on each copy an appropriate copyright notice;
++keep intact all notices stating that this License and any
++non-permissive terms added in accord with section 7 apply to the code;
++keep intact all notices of the absence of any warranty; and give all
++recipients a copy of this License along with the Program.
++
++  You may charge any price or no price for each copy that you convey,
++and you may offer support or warranty protection for a fee.
++
++  5. Conveying Modified Source Versions.
++
++  You may convey a work based on the Program, or the modifications to
++produce it from the Program, in the form of source code under the
++terms of section 4, provided that you also meet all of these conditions:
++
++    a) The work must carry prominent notices stating that you modified
++    it, and giving a relevant date.
++
++    b) The work must carry prominent notices stating that it is
++    released under this License and any conditions added under section
++    7.  This requirement modifies the requirement in section 4 to
++    "keep intact all notices".
++
++    c) You must license the entire work, as a whole, under this
++    License to anyone who comes into possession of a copy.  This
++    License will therefore apply, along with any applicable section 7
++    additional terms, to the whole of the work, and all its parts,
++    regardless of how they are packaged.  This License gives no
++    permission to license the work in any other way, but it does not
++    invalidate such permission if you have separately received it.
++
++    d) If the work has interactive user interfaces, each must display
++    Appropriate Legal Notices; however, if the Program has interactive
++    interfaces that do not display Appropriate Legal Notices, your
++    work need not make them do so.
++
++  A compilation of a covered work with other separate and independent
++works, which are not by their nature extensions of the covered work,
++and which are not combined with it such as to form a larger program,
++in or on a volume of a storage or distribution medium, is called an
++"aggregate" if the compilation and its resulting copyright are not
++used to limit the access or legal rights of the compilation's users
++beyond what the individual works permit.  Inclusion of a covered work
++in an aggregate does not cause this License to apply to the other
++parts of the aggregate.
++
++  6. Conveying Non-Source Forms.
++
++  You may convey a covered work in object code form under the terms
++of sections 4 and 5, provided that you also convey the
++machine-readable Corresponding Source under the terms of this License,
++in one of these ways:
++
++    a) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by the
++    Corresponding Source fixed on a durable physical medium
++    customarily used for software interchange.
++
++    b) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by a
++    written offer, valid for at least three years and valid for as
++    long as you offer spare parts or customer support for that product
++    model, to give anyone who possesses the object code either (1) a
++    copy of the Corresponding Source for all the software in the
++    product that is covered by this License, on a durable physical
++    medium customarily used for software interchange, for a price no
++    more than your reasonable cost of physically performing this
++    conveying of source, or (2) access to copy the
++    Corresponding Source from a network server at no charge.
++
++    c) Convey individual copies of the object code with a copy of the
++    written offer to provide the Corresponding Source.  This
++    alternative is allowed only occasionally and noncommercially, and
++    only if you received the object code with such an offer, in accord
++    with subsection 6b.
++
++    d) Convey the object code by offering access from a designated
++    place (gratis or for a charge), and offer equivalent access to the
++    Corresponding Source in the same way through the same place at no
++    further charge.  You need not require recipients to copy the
++    Corresponding Source along with the object code.  If the place to
++    copy the object code is a network server, the Corresponding Source
++    may be on a different server (operated by you or a third party)
++    that supports equivalent copying facilities, provided you maintain
++    clear directions next to the object code saying where to find the
++    Corresponding Source.  Regardless of what server hosts the
++    Corresponding Source, you remain obligated to ensure that it is
++    available for as long as needed to satisfy these requirements.
++
++    e) Convey the object code using peer-to-peer transmission, provided
++    you inform other peers where the object code and Corresponding
++    Source of the work are being offered to the general public at no
++    charge under subsection 6d.
++
++  A separable portion of the object code, whose source code is excluded
++from the Corresponding Source as a System Library, need not be
++included in conveying the object code work.
++
++  A "User Product" is either (1) a "consumer product", which means any
++tangible personal property which is normally used for personal, family,
++or household purposes, or (2) anything designed or sold for incorporation
++into a dwelling.  In determining whether a product is a consumer product,
++doubtful cases shall be resolved in favor of coverage.  For a particular
++product received by a particular user, "normally used" refers to a
++typical or common use of that class of product, regardless of the status
++of the particular user or of the way in which the particular user
++actually uses, or expects or is expected to use, the product.  A product
++is a consumer product regardless of whether the product has substantial
++commercial, industrial or non-consumer uses, unless such uses represent
++the only significant mode of use of the product.
++
++  "Installation Information" for a User Product means any methods,
++procedures, authorization keys, or other information required to install
++and execute modified versions of a covered work in that User Product from
++a modified version of its Corresponding Source.  The information must
++suffice to ensure that the continued functioning of the modified object
++code is in no case prevented or interfered with solely because
++modification has been made.
++
++  If you convey an object code work under this section in, or with, or
++specifically for use in, a User Product, and the conveying occurs as
++part of a transaction in which the right of possession and use of the
++User Product is transferred to the recipient in perpetuity or for a
++fixed term (regardless of how the transaction is characterized), the
++Corresponding Source conveyed under this section must be accompanied
++by the Installation Information.  But this requirement does not apply
++if neither you nor any third party retains the ability to install
++modified object code on the User Product (for example, the work has
++been installed in ROM).
++
++  The requirement to provide Installation Information does not include a
++requirement to continue to provide support service, warranty, or updates
++for a work that has been modified or installed by the recipient, or for
++the User Product in which it has been modified or installed.  Access to a
++network may be denied when the modification itself materially and
++adversely affects the operation of the network or violates the rules and
++protocols for communication across the network.
++
++  Corresponding Source conveyed, and Installation Information provided,
++in accord with this section must be in a format that is publicly
++documented (and with an implementation available to the public in
++source code form), and must require no special password or key for
++unpacking, reading or copying.
++
++  7. Additional Terms.
++
++  "Additional permissions" are terms that supplement the terms of this
++License by making exceptions from one or more of its conditions.
++Additional permissions that are applicable to the entire Program shall
++be treated as though they were included in this License, to the extent
++that they are valid under applicable law.  If additional permissions
++apply only to part of the Program, that part may be used separately
++under those permissions, but the entire Program remains governed by
++this License without regard to the additional permissions.
++
++  When you convey a copy of a covered work, you may at your option
++remove any additional permissions from that copy, or from any part of
++it.  (Additional permissions may be written to require their own
++removal in certain cases when you modify the work.)  You may place
++additional permissions on material, added by you to a covered work,
++for which you have or can give appropriate copyright permission.
++
++  Notwithstanding any other provision of this License, for material you
++add to a covered work, you may (if authorized by the copyright holders of
++that material) supplement the terms of this License with terms:
++
++    a) Disclaiming warranty or limiting liability differently from the
++    terms of sections 15 and 16 of this License; or
++
++    b) Requiring preservation of specified reasonable legal notices or
++    author attributions in that material or in the Appropriate Legal
++    Notices displayed by works containing it; or
++
++    c) Prohibiting misrepresentation of the origin of that material, or
++    requiring that modified versions of such material be marked in
++    reasonable ways as different from the original version; or
++
++    d) Limiting the use for publicity purposes of names of licensors or
++    authors of the material; or
++
++    e) Declining to grant rights under trademark law for use of some
++    trade names, trademarks, or service marks; or
++
++    f) Requiring indemnification of licensors and authors of that
++    material by anyone who conveys the material (or modified versions of
++    it) with contractual assumptions of liability to the recipient, for
++    any liability that these contractual assumptions directly impose on
++    those licensors and authors.
++
++  All other non-permissive additional terms are considered "further
++restrictions" within the meaning of section 10.  If the Program as you
++received it, or any part of it, contains a notice stating that it is
++governed by this License along with a term that is a further
++restriction, you may remove that term.  If a license document contains
++a further restriction but permits relicensing or conveying under this
++License, you may add to a covered work material governed by the terms
++of that license document, provided that the further restriction does
++not survive such relicensing or conveying.
++
++  If you add terms to a covered work in accord with this section, you
++must place, in the relevant source files, a statement of the
++additional terms that apply to those files, or a notice indicating
++where to find the applicable terms.
++
++  Additional terms, permissive or non-permissive, may be stated in the
++form of a separately written license, or stated as exceptions;
++the above requirements apply either way.
++
++  8. Termination.
++
++  You may not propagate or modify a covered work except as expressly
++provided under this License.  Any attempt otherwise to propagate or
++modify it is void, and will automatically terminate your rights under
++this License (including any patent licenses granted under the third
++paragraph of section 11).
++
++  However, if you cease all violation of this License, then your
++license from a particular copyright holder is reinstated (a)
++provisionally, unless and until the copyright holder explicitly and
++finally terminates your license, and (b) permanently, if the copyright
++holder fails to notify you of the violation by some reasonable means
++prior to 60 days after the cessation.
++
++  Moreover, your license from a particular copyright holder is
++reinstated permanently if the copyright holder notifies you of the
++violation by some reasonable means, this is the first time you have
++received notice of violation of this License (for any work) from that
++copyright holder, and you cure the violation prior to 30 days after
++your receipt of the notice.
++
++  Termination of your rights under this section does not terminate the
++licenses of parties who have received copies or rights from you under
++this License.  If your rights have been terminated and not permanently
++reinstated, you do not qualify to receive new licenses for the same
++material under section 10.
++
++  9. Acceptance Not Required for Having Copies.
++
++  You are not required to accept this License in order to receive or
++run a copy of the Program.  Ancillary propagation of a covered work
++occurring solely as a consequence of using peer-to-peer transmission
++to receive a copy likewise does not require acceptance.  However,
++nothing other than this License grants you permission to propagate or
++modify any covered work.  These actions infringe copyright if you do
++not accept this License.  Therefore, by modifying or propagating a
++covered work, you indicate your acceptance of this License to do so.
++
++  10. Automatic Licensing of Downstream Recipients.
++
++  Each time you convey a covered work, the recipient automatically
++receives a license from the original licensors, to run, modify and
++propagate that work, subject to this License.  You are not responsible
++for enforcing compliance by third parties with this License.
++
++  An "entity transaction" is a transaction transferring control of an
++organization, or substantially all assets of one, or subdividing an
++organization, or merging organizations.  If propagation of a covered
++work results from an entity transaction, each party to that
++transaction who receives a copy of the work also receives whatever
++licenses to the work the party's predecessor in interest had or could
++give under the previous paragraph, plus a right to possession of the
++Corresponding Source of the work from the predecessor in interest, if
++the predecessor has it or can get it with reasonable efforts.
++
++  You may not impose any further restrictions on the exercise of the
++rights granted or affirmed under this License.  For example, you may
++not impose a license fee, royalty, or other charge for exercise of
++rights granted under this License, and you may not initiate litigation
++(including a cross-claim or counterclaim in a lawsuit) alleging that
++any patent claim is infringed by making, using, selling, offering for
++sale, or importing the Program or any portion of it.
++
++  11. Patents.
++
++  A "contributor" is a copyright holder who authorizes use under this
++License of the Program or a work on which the Program is based.  The
++work thus licensed is called the contributor's "contributor version".
++
++  A contributor's "essential patent claims" are all patent claims
++owned or controlled by the contributor, whether already acquired or
++hereafter acquired, that would be infringed by some manner, permitted
++by this License, of making, using, or selling its contributor version,
++but do not include claims that would be infringed only as a
++consequence of further modification of the contributor version.  For
++purposes of this definition, "control" includes the right to grant
++patent sublicenses in a manner consistent with the requirements of
++this License.
++
++  Each contributor grants you a non-exclusive, worldwide, royalty-free
++patent license under the contributor's essential patent claims, to
++make, use, sell, offer for sale, import and otherwise run, modify and
++propagate the contents of its contributor version.
++
++  In the following three paragraphs, a "patent license" is any express
++agreement or commitment, however denominated, not to enforce a patent
++(such as an express permission to practice a patent or covenant not to
++sue for patent infringement).  To "grant" such a patent license to a
++party means to make such an agreement or commitment not to enforce a
++patent against the party.
++
++  If you convey a covered work, knowingly relying on a patent license,
++and the Corresponding Source of the work is not available for anyone
++to copy, free of charge and under the terms of this License, through a
++publicly available network server or other readily accessible means,
++then you must either (1) cause the Corresponding Source to be so
++available, or (2) arrange to deprive yourself of the benefit of the
++patent license for this particular work, or (3) arrange, in a manner
++consistent with the requirements of this License, to extend the patent
++license to downstream recipients.  "Knowingly relying" means you have
++actual knowledge that, but for the patent license, your conveying the
++covered work in a country, or your recipient's use of the covered work
++in a country, would infringe one or more identifiable patents in that
++country that you have reason to believe are valid.
++
++  If, pursuant to or in connection with a single transaction or
++arrangement, you convey, or propagate by procuring conveyance of, a
++covered work, and grant a patent license to some of the parties
++receiving the covered work authorizing them to use, propagate, modify
++or convey a specific copy of the covered work, then the patent license
++you grant is automatically extended to all recipients of the covered
++work and works based on it.
++
++  A patent license is "discriminatory" if it does not include within
++the scope of its coverage, prohibits the exercise of, or is
++conditioned on the non-exercise of one or more of the rights that are
++specifically granted under this License.  You may not convey a covered
++work if you are a party to an arrangement with a third party that is
++in the business of distributing software, under which you make payment
++to the third party based on the extent of your activity of conveying
++the work, and under which the third party grants, to any of the
++parties who would receive the covered work from you, a discriminatory
++patent license (a) in connection with copies of the covered work
++conveyed by you (or copies made from those copies), or (b) primarily
++for and in connection with specific products or compilations that
++contain the covered work, unless you entered into that arrangement,
++or that patent license was granted, prior to 28 March 2007.
++
++  Nothing in this License shall be construed as excluding or limiting
++any implied license or other defenses to infringement that may
++otherwise be available to you under applicable patent law.
++
++  12. No Surrender of Others' Freedom.
++
++  If conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License.  If you cannot convey a
++covered work so as to satisfy simultaneously your obligations under this
++License and any other pertinent obligations, then as a consequence you may
++not convey it at all.  For example, if you agree to terms that obligate you
++to collect a royalty for further conveying from those to whom you convey
++the Program, the only way you could satisfy both those terms and this
++License would be to refrain entirely from conveying the Program.
++
++  13. Use with the GNU Affero General Public License.
++
++  Notwithstanding any other provision of this License, you have
++permission to link or combine any covered work with a work licensed
++under version 3 of the GNU Affero General Public License into a single
++combined work, and to convey the resulting work.  The terms of this
++License will continue to apply to the part which is the covered work,
++but the special requirements of the GNU Affero General Public License,
++section 13, concerning interaction through a network will apply to the
++combination as such.
++
++  14. Revised Versions of this License.
++
++  The Free Software Foundation may publish revised and/or new versions of
++the GNU General Public License from time to time.  Such new versions will
++be similar in spirit to the present version, but may differ in detail to
++address new problems or concerns.
++
++  Each version is given a distinguishing version number.  If the
++Program specifies that a certain numbered version of the GNU General
++Public License "or any later version" applies to it, you have the
++option of following the terms and conditions either of that numbered
++version or of any later version published by the Free Software
++Foundation.  If the Program does not specify a version number of the
++GNU General Public License, you may choose any version ever published
++by the Free Software Foundation.
++
++  If the Program specifies that a proxy can decide which future
++versions of the GNU General Public License can be used, that proxy's
++public statement of acceptance of a version permanently authorizes you
++to choose that version for the Program.
++
++  Later license versions may give you additional or different
++permissions.  However, no additional obligations are imposed on any
++author or copyright holder as a result of your choosing to follow a
++later version.
++
++  15. Disclaimer of Warranty.
++
++  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
++APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
++HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
++OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
++IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
++ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
++
++  16. Limitation of Liability.
++
++  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
++THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
++GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
++USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
++DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
++PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
++EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
++SUCH DAMAGES.
++
++  17. Interpretation of Sections 15 and 16.
++
++  If the disclaimer of warranty and limitation of liability provided
++above cannot be given local legal effect according to their terms,
++reviewing courts shall apply local law that most closely approximates
++an absolute waiver of all civil liability in connection with the
++Program, unless a warranty or assumption of liability accompanies a
++copy of the Program in return for a fee.
++
++                     END OF TERMS AND CONDITIONS
++
++            How to Apply These Terms to Your New Programs
++
++  If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these terms.
++
++  To do so, attach the following notices to the program.  It is safest
++to attach them to the start of each source file to most effectively
++state the exclusion of warranty; and each file should have at least
++the "copyright" line and a pointer to where the full notice is found.
++
++    <one line to give the program's name and a brief idea of what it does.>
++    Copyright (C) <year>  <name of author>
++
++    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 3 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, see <http://www.gnu.org/licenses/>.
++
++Also add information on how to contact you by electronic and paper mail.
++
++  If the program does terminal interaction, make it output a short
++notice like this when it starts in an interactive mode:
++
++    <program>  Copyright (C) <year>  <name of author>
++    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
++    This is free software, and you are welcome to redistribute it
++    under certain conditions; type `show c' for details.
++
++The hypothetical commands `show w' and `show c' should show the appropriate
++parts of the General Public License.  Of course, your program's commands
++might be different; for a GUI interface, you would use an "about box".
++
++  You should also get your employer (if you work as a programmer) or school,
++if any, to sign a "copyright disclaimer" for the program, if necessary.
++For more information on this, and how to apply and follow the GNU GPL, see
++<http://www.gnu.org/licenses/>.
++
++  The GNU General Public License does not permit incorporating your program
++into proprietary programs.  If your program is a subroutine library, you
++may consider it more useful to permit linking proprietary applications with
++the library.  If this is what you want to do, use the GNU Lesser General
++Public License instead of this License.  But first, please read
++<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+Property changes on: ../trunk-jpl/src/java/License.txt
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/inishell.sh
+===================================================================
+--- ../trunk-jpl/src/java/inishell.sh	(revision 0)
++++ ../trunk-jpl/src/java/inishell.sh	(revision 17808)
+@@ -0,0 +1,8 @@
++#/bin/bash
++#This is just the necessary command line to run a jar file
++
++#recover file name: 
++xmlfilename=$1
++
++#call inishell
++java -jar dist/inishell.jar $xmlfilename
+
+Property changes on: ../trunk-jpl/src/java/inishell.sh
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/Changelog_1.0.0.txt
+===================================================================
+--- ../trunk-jpl/src/java/Changelog_1.0.0.txt	(revision 0)
++++ ../trunk-jpl/src/java/Changelog_1.0.0.txt	(revision 17808)
+@@ -0,0 +1,29 @@
++This is the changelog for Inishell release 1.0.0
++	*editing existing ini file:
++		+populate the GUI according to the values in an existing ini file
++		+show progress bar while loading
++		+Comments are preserved, nested template parameters properly handled, unknown keys are preserved
++
++	*usability improvements:
++		+the file dialogs remember the last path they pointed to
++		+add ".ini" extension when saving to a config file if necessary
++		+new icons, hoping to make their meaning clearer
++		+reset button on the GUI to revert to defaults
++
++	*layout improvements:
++		+fixed help text horizontal alignements issues
++		+the help text is now verticaly aligned with the top of the widget
++		+Notion of hierarchy for an easier handling of layout issues
++		+layout now consistent between Linux and Windows, still some small spacing differences with osX
++		+possibility to group parameters in a frame with a frame title
++
++	*bug fixes:
++		+default value in comboBox is honored
++		+mandatory comboBox properly handled on osX
++		+better help text handling
++
++	*others:
++		+keys are printed in the order they appear on the GUI
++		+code cleanup and optimizations
++		+add version information in MANIFEST and title bar
++		+clean up and reorganization in build.xml, add help and pack targets
+
+Property changes on: ../trunk-jpl/src/java/Changelog_1.0.0.txt
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/dist/inishell.jar
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/dist/inishell.jar
+===================================================================
+--- ../trunk-jpl/src/java/dist/inishell.jar	(revision 17807)
++++ ../trunk-jpl/src/java/dist/inishell.jar	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/dist/inishell.jar
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/doc/examples/io.ini
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/io.ini	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/io.ini	(revision 17808)
+@@ -0,0 +1,180 @@
++[General]
++PLUGINPATH	= ../../lib/plugins ;super
++BUFF_CHUNK_SIZE = 30
++BUFF_BEFORE	= 1.5
++
++[Input]
++COORDSYS	= CH1903
++TIME_ZONE	= 1
++; COORDSYS	= PROJ4
++; COORDPARAM	= 21781
++
++#reading ARC dem
++DEM		= ARC
++DEMFILE  	= ./input/surface-grids/Switzerland_1000m.asc
++
++#reading ARPS dem
++; DEM		= ARPS
++; DEMFILE 	= ./wgrt10r2_vw4.asc
++; ARPS_X 	= 653400
++; ARPS_Y 	= 112204
++
++#reading PGM image as dem
++; DEM		= PGM
++; DEMFILE	= ./Switzerland.pgm
++; PGM_XCOORD	= 479500.
++; PGM_YCOORD	= 73500.
++; PGM_CELLSIZE	= 1000.
++; PGM_MIN	= 193.
++; PGM_MAX	= 4204.
++
++; LANDUSE	= ARC
++; LANDUSEFILE	= ch_as97.asc
++
++#Alpine3D traditional inputs -> A3D plugin
++; METEO		= A3D
++; METEOPATH	= ./input/meteo
++
++#Borma
++; METEO		= BORMA
++; METEOPATH	= ./input/xml
++; NROFSTATIONS	= 1
++; STATION1	= 00.00.00.2
++
++#Snowpack input
++; METEO		= SNOWPACK
++; METEOPATH	= input
++; METAFILE	= IMIS_Extracted_Info.txt ;metadata for all stations
++; STATION1  	= MST96_RR.inp
++
++#SMET meteorological file format
++METEO		= SMET
++METEOPATH	= ./input/meteo
++STATION1	= FLU2.smet
++STATION2	= FIR2.smet
++STATION3	= FRA2.smet
++STATION4	= GLA2.smet
++STATION5	= ILI2.smet
++STATION6	= OTT2.smet
++STATION7	= TUJ3.smet
++
++#IMIS network database input -> IMIS plugin
++; METEO		= IMIS
++; DBNAME		= sdbo
++; DBUSER		= XXX
++; DBPASS		= XXX
++; NROFSTATIONS	= 4
++; STATION1	= MORN2
++; STATION2	= DAV3
++; STATION3	= KLO2
++; STATION4	= *SAM0
++
++#GEOtop traditional inputs -> GEOTOP plugin
++; METEO		 = GEOTOP
++; METEOPATH       = meteo/
++; METEOPREFIX     = _meteo
++
++#GSN direct input -> GSN plugin
++; METEO		= GSN
++; ENDPOINT	= http://montblanc.slf.ch:22001/services/A3DWebService
++; STATION1	= wan_sen14_2008
++; STATION2	= wan2
++
++[Output]
++COORDSYS	= CH1903
++TIME_ZONE 	= 1
++
++GRID2D		= ARC
++GRID2DPATH	= ./
++
++; GRID2D		= PNG
++; GRID2DPATH	= ./
++; PNG_MIN_SIZE	= 800x600
++; PNG_WORLD_FILE	= true
++; PNG_AUTOSCALE	= false
++; PNG_SCALING	= nearest
++
++METEO		= SMET
++METEOPATH	= ./
++
++[Filters]
++TA::filter1	= min_max
++TA::arg1	= 240 320
++
++RH::filter1	= min_max
++RH::arg1 	= 0.01 1.2
++RH::filter2	= min_max
++RH::arg2	= soft 0.05 1.0
++
++HNW::filter1	= min
++HNW::arg1	= -0.1
++HNW::filter2	= min
++HNW::arg2	= soft 0.
++
++ISWR::filter1	= min_max
++ISWR::arg1	= -10. 1500.
++ISWR::filter2	= min
++ISWR::arg2	= soft 0.
++
++RSWR::filter1	= min_max
++RSWR::arg1 	= -10 1500
++RSWR::filter2	= min
++RSWR::arg2	= soft 0
++
++#for TA between 240 and 320 K
++ILWR::filter1	= min_max
++ILWR::arg1	= 188 600
++ILWR::filter2	= min_max
++ILWR::arg2	= soft 200 400
++
++#we need to consider time with no snow -> TSS>0
++#min(TSS) in db since 1998: -50C
++TSS::filter1	= min_max
++TSS::arg1	= 200 320
++
++#idem
++TSG::filter1	= min_max
++TSG::arg1	= 200 320
++
++HS::filter1	= min
++HS::arg1	= soft 0.0
++HS::filter2	= rate
++HS::arg2	= 5.55e-5 ;0.20 m/h
++
++VW::filter1	= min_max
++VW::arg1	= -2 70
++VW::filter2	= min_max
++VW::arg2	= soft 0.2 50.0
++
++[Interpolations1D]
++WINDOW_SIZE	= 86400
++
++TA::resample	= linear
++
++RH::resample	= linear
++
++HS::resample	= linear
++
++VW::resample	= nearest_neighbour
++VW::args	= extrapolate
++
++HNW::resample	= linear
++
++[Interpolations2D]
++TA::algorithms	= IDW_LAPSE CST_LAPSE
++TA::cst_lapse	= -0.008
++TA::idw_lapse	= -0.008 soft
++
++RH::algorithms	= RH IDW_LAPSE CST
++
++HNW::algorithms	= IDW_LAPSE CST_LAPSE CST
++HNW::cst_lapse	= 0.0005 frac
++
++VW::algorithms	= IDW_LAPSE CST
++
++P::algorithms	= STD_PRESS
++
++ILWR::algorithms = CST_LAPSE
++ILWR::cst_lapse = -0.03125
++
++RSWR::algorithms = IDW CST
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/io.ini
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/doc/examples/meteoio_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/meteoio_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/meteoio_config.xml	(revision 17808)
+@@ -0,0 +1,919 @@
++<inishell_config application="Meteo IO">
++
++	<!-- General Parameters -->
++	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
++		<section name="general" />
++		<help>Size in days of a chunk of data to read at once.</help>
++	</parameter>
++
++	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
++		<section name="general" />
++		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
++		beginning of the buffer (therefore, it takes a value in days).</help>
++	</parameter>
++
++	<!-- Coordinate systems, time zones -->
++	<parameter key="COORDSYS" type="alternative" optional="false">
++		<section name="input" />
++		<section name="output" />
++		<option value="CH1903" type="string" default="true">
++			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UTM" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the zone with the zone letter (for example, 32T)</help>
++			</parameter>
++			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UPS" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the hemisphere (either N or S)</help>
++			</parameter>
++			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
++		</option>
++		<option value="PROJ4" type="string">
++			<parameter key="COORDPARAM" type="string" optional="false" />
++			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
++		</option>
++		<option value="LOCAL"  type="string">
++			<help>uses the horizontal and vertical distance from a reference point</help>
++		</option>
++		<help>coordinate system</help>
++	</parameter>
++
++	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
++		<section name="input" />
++		<section name="output" />
++	</parameter>
++
++	<!-- Datatypes: special pts -->
++	<parameter key="SPECIALPTS" type="alternative">
++		<section name="input" />
++		<option value="A3D" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++		<option value="SMET" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++	</parameter>
++
++	<!-- Datatypes: Meteo Data -->
++	<parameter key="METEO" type="alternative">
++		<section name="input" />
++		<section name="output" />
++
++		<option value="A3D" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="BORMA" type="string">
++			<section name="input" />
++			<reference name="BORMA" />
++		</option>
++		<option value="COSMO" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="input" />
++			<reference name="GEOTOP_IN" />
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="output" />
++			<reference name="GEOTOP_OUT" />
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<reference name="GRIB_METEO" />
++		</option>
++		<option value="GSN" type="string">
++			<section name="input" />
++			<reference name="GSN" />
++		</option>
++		<option value="IMIS" type="string">
++			<section name="input" />
++			<reference name="IMIS" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="input" />
++			<reference name="SMET_IN" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="output" />
++			<reference name="SMET_OUT" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="input" />
++			<reference name="SNIO_IN" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="output" />
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string representing path where SNOWPACK files should be saved</help>
++			</parameter>
++		</option>
++
++		<help>plugin for METEO data </help>
++	</parameter>
++
++	<parameter key="Add Meteo parameter copy" type="selector">
++		<section name="input"/>
++		<parameter key="COPY::%" type="string" optional="false" template="true">
++		  <help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
++		</parameter>
++	</parameter>
++
++	<!-- Datatypes: DEM -->
++	<frame key="dem_frame" label="Digital Elevation Model">
++	<section name="input"/>
++		<parameter key="DEM" type="alternative">
++			<section name="input" />
++			<option value="ARC" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="ARPS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++					<help>x coordinate of the lower left corner of the grids</help>
++				</parameter>
++				<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++					<help>y coordinate of the lower left corner of the grids</help>
++				</parameter>
++			</option>
++			<option value="GRASS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="GRIB" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="GRIB_DEM_UPDATE" type="alternative" optional="true">
++					<option value="TRUE" type="string" />
++					<option value="FALSE" type="string" />
++					<help>recompute slope/azimuth from the elevations when reading a DEM (default=false, that is we use the slope and azimuth included in the GRIB file)</help>
++				</parameter>
++			</option>
++			<option value="PGM" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<reference name="PGM_IN" />
++			</option>
++
++			<help>plugin for Digital Elevation Model data </help>
++		</parameter>
++	</frame>
++
++	<!-- Datatypes: Landuse -->
++	<parameter key="LANDUSE" type="alternative">
++		<section name="input" />
++		<option value="ARC" type="string">
++			<parameter key="LANDUSEFILE" type="file" optional="false">
++				<help>File containing a grid of landuse codes</help>
++			</parameter>
++		</option>
++
++		<help>plugin for land cover data </help>
++	</parameter>
++
++	<!-- Datatypes: Grids -->
++	<parameter key="GRID2D" type="alternative">
++		<section name="input" />
++		<section name="output" />
++		<option value="ARC" type="string">
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARC" />
++		</option>
++		<option value="ARPS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARPS" />
++		</option>
++		<option value="GRASS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="GRIB_GRIDS" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PGM_IN" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="PNG" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PNG" />
++		</option>
++		<help>plugin for 2D gridded data </help>
++	</parameter>
++
++	<!--Parameter group for list of stations -->
++	<parametergroup name="stationgroup_files">
++		<parameter key="STATION#" type="file" counter="1" optional="false">
++			<help>filename for station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_names">
++		<parameter key="STATION#" type="string" counter="1" optional="false">
++			<help>station id for the given station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_pos">
++		<parameter key="STATION#" type="string" counter="1">
++			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Plugins for Meteo Data-->
++	<parametergroup name="BORMA">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the xml files</help>
++		</parameter>
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="IMIS">
++		<parameter key="DBNAME" type="string" optional="false">
++			<help>database name, as provided by your database administrator</help>
++		</parameter>
++		<parameter key="DBUSER" type="string" optional="false">
++			<help>database user name</help>
++		</parameter>
++		<parameter key="DBPASS" type="string" optional="false">
++			<help>database password associated with the user name</help>
++		</parameter>
++		<parameter key="USEANETZ" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
++		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
++		  average to get what should be its local precipitations</help>
++		</parameter>
++		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
++		</parameter>
++		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
++		</parameter>
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="GRIB_METEO">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the grib files</help>
++		</parameter>
++		<parameter key="METEOEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++
++		<reference name="stationgroup_pos" />
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="false">
++			<help>absolute filename of the geotop.inpts file</help>
++		</parameter>
++		<parameter key="METEOPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METEOSEQ" type="string" optional="false">
++			<help>specifiy in which order the columns should be printed out</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GSN">
++		<parameter key="ENDPOINT" type="string" optional="false">
++			<help>webserver running GSN with its port number and full path. For example:
++			http://montblanc.slf.ch:22001/services/A3DWebService</help>
++		</parameter>
++		<parameter key="PROXY" type="string" optional="true">
++			<help>Should the connection go through a proxy? This is useful for servers
++			filtering on domains but usually not necessary.</help>
++		</parameter>
++		<parameter key="PROXYPORT" type="string" optional="true" />
++		<parameter key="PROXYUSER" type="string" optional="true" />
++		<parameter key="PROXYPASS" type="string" optional="true" />
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="SMET_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the smet files</help>
++		</parameter>
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<parametergroup name="SMET_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string representing path where SMET files should be saved</help>
++		</parameter>
++		<parameter key="METEOPARAM" type="alternative">
++		  <option value="ASCII" type="string" default="true">
++		    <help>Write ASCII SMET files</help>
++		  </option>
++		  <option value="BINARY" type="string">
++		    <help>Write BINARY SMET files</help>
++		  </option>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="SNIO_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the SNOWPACK files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="true">
++			<help>filename of the meta data file (in METEOPATH)</help>
++		</parameter>
++
++		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
++		  <help>the number of measured snow temperatures provided</help>
++		</parameter>
++
++		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
++		  <help>the number of solutes for which input data are provided</help>
++		</parameter>
++
++		<parameter key="RSWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="ISWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="VW_DRIFT" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
++		</parameter>
++		<parameter key="RHO_HN" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: measured new snow density is provided</help>
++		</parameter>
++
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<!-- Plugins for Gridded Data-->
++	<parametergroup name="ARC">
++		<parameter key="A3D_VIEW" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate names compatible with Alpine3D's grid viewer?</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="ARPS">
++		<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++			<help>x coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++			<help>y coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GRIB_GRIDS">
++		<parameter key="GRID2DPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading (ie: something like "laf" for Cosmo-Analysis-full domain)</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PNG">
++		<parameter key="PNG_WORLD_FILE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a world file for each output file? This file contains the geolocalization information</help>
++		</parameter>
++		<parameter key="PNG_LEGEND" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a legend?</help>
++		</parameter>
++		<parameter key="PNG_AUTOSCALE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>autoscale color scale?</help>
++		</parameter>
++		<parameter key="PNG_SCALING" type="alternative" optional="true">
++			<option value="nearest" type="string" />
++			<option value="bilinear" type="string" />
++			<help>scaling algorithm (default=bilinear)</help>
++		</parameter>
++		<parameter key="PNG_MIN_SIZE" type="string" optional="false">
++			<help>minimum dimensions of the PNG, like 640x480</help>
++		</parameter>
++		<parameter key="PNG_MAX_SIZE" type="string" optional="false">
++			<help>maximum dimensions of the PNG, like 1024x768</help>
++		</parameter>
++		<parameter key="PNG_INDEXED" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a color indexed file (default=true)</help>
++		</parameter>
++		<parameter key="PNG_SPEED_OPTIMIZE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>optimize for speed (default=false)</help>
++		</parameter>
++		<parameter key="PNG_NR_LEVELS" type="integer+" default="+30" maximum="255" minimum="6" optional="true">
++			<help>number of colors in the palette (default=30)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PGM_IN">
++		<parameter key="PGM_XCOORD" type="decimal" optional="false">
++			<help>lower left x coordinate</help>
++		</parameter>
++		<parameter key="PGM_YCOORD" type="decimal" optional="false">
++			<help>lower left y coordinate</help>
++		</parameter>
++		<parameter key="PGM_CELLSIZE" type="decimal" optional="false">
++			<help>cellsize in meters</help>
++		</parameter>
++		<parameter key="PGM_MIN" type="decimal" optional="false">
++			<help>minimum value in real world coordinates to match with the minimum value read out of the PGM file (such minimum being greater than 0 because 0 is NODATA)</help>
++		</parameter>
++		<parameter key="PGM_MAX" type="decimal" optional="false">
++			<help>maximum value in real world coordinates to match with the maximum value read out of the PGM file</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
++	<parametergroup name="METEOIOPARAMETERS">
++		<option value="TA"/>
++		<option value="RH"/>
++		<option value="VW"/>
++		<option value="DW"/>
++		<option value="VW_MAX"/>
++		<option value="ISWR"/>
++		<option value="RSWR"/>
++		<option value="ILWR"/>
++		<option value="HS"/>
++		<option value="HNW"/>
++		<option value="TSG"/>
++		<option value="TSS"/>
++		<option value="P"/>
++	</parametergroup>
++
++	<!-- Filters -->
++	<parameter key="Add/Remove Filter" type="selector">
++		<section name="filters" />
++
++		<parameter key="%::filter#" type="alternative" counter="1" template="true">
++			<section name="filters" />
++
++			<option label="MeanAvg" value="mean_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++
++			<option label="MedianAvg" value="median_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="decimal" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
++			</option>
++
++			<option label="Std Deviation Filter" value="std_dev" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
++			</option>
++
++			<option label="MAD" value="mad" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
++			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
++			</option>
++
++			<option label="Tukey 53H Filter" value="Tukey" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
++			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
++			    </help>
++			  </parameter>
++			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
++			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
++			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
++			</option>
++
++			<option label="Wind Averaging Filter" value="wind_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
++			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
++			</option>
++
++			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
++			</option>
++
++			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
++			</option>
++
++			<option label="Min Range Filter" value="min" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
++			    assigned the minimum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Min range filter. Reject all values smaller than the min.</help>
++			</option>
++
++			<option label="Max Range Filter" value="max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
++			    assigned the maximum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Max range filter. Reject all values greater than the max.</help>
++			</option>
++
++			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Min adjust to:" value="" type="decimal" />
++			    <option label="Max adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
++			    the maximum permissible value and all data smaller than the min would be assigned the minimum
++			    permissible value or an optional extra set of two user provided values</help>
++			  </parameter>
++			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
++			</option>
++
++			<option label="Rate Filter (1 argument)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Rate Filter (2 arguments)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the minimum and maximum permissible rate of change (per second)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
++			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
++			  </parameter>
++			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
++			</option>
++
++			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Gage type" type="dropdown">
++					<option value="Nipher" type="string" />
++					<option value="Tretyakov" type="string" />
++					<option value="US8sh" type="string" />
++					<option value="US8unsh" type="string" />
++					<option value="Hellmann" type="string" />
++					<option value="Hellmannsh" type="string" />
++				</option>
++			  </parameter>
++			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
++			</option>
++
++			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Kind" type="dropdown">
++					<option value="Cst" type="string" />
++				</option>
++				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
++				<option label="Mixed prec factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
++			  </parameter>
++			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
++			</option>
++
++			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="albedo:" value="0.23" type="decimal" />
++			    <option value="soft" type="choice" />
++			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
++			  </parameter>
++			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
++			</option>
++
++			<option label="Add an offset" value="add" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="offset:" value="0." type="decimal" />
++			  </parameter>
++			  <help>This adds a given offset to the data.</help>
++			</option>
++
++			<option label="Multiply by a factor" value="mult" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="factor:" value="1." type="decimal" />
++			  </parameter>
++			  <help>This multiplies the data by a given factor.</help>
++			</option>
++
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 1D Interpolation -->
++	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
++		<section name="Interpolations1D" />
++		<help>Affects resampling: expresses (in seconds) how far a valid point can be
++		searched for when re-interpolating a missing value</help>
++	</parameter>
++
++	<parameter key="Add/Remove 1D Interpolation" type="selector">
++		<section name="Interpolations1D" />
++
++		<parameter key="%::resample" type="alternative" template="true">
++			<section name="Interpolations1D" />
++			<option label="No Interpolation" value="none" type="string" />
++			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
++			<option label="Linear" value="linear" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="extrapolate" type="choice" />
++			    <help>
++			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
++			      Otherwise, a data point will only be calculated between the original date range.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++			<option label="Accumulate" value="accumulate" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="strict" type="choice" />
++			    <option label="Seconds:" value="900" type="integer" minimum="1" />
++			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
++			  </parameter>
++			  <help>Accumulation over a user given period (filter argument, in seconds -
++			  should coincide with your calculation step!).</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 2D Interpolation -->
++	<parameter key="Add/Remove 2D Interpolation" type="selector">
++		<section name="Interpolations2D" />
++
++		<parameter key="%::algorithms" type="choice" template="true">
++			<section name="Interpolations2D" />
++			<option value="STD_PRESS" type="choice">
++				<help>Generate a standard atmosphere pressure as a function of the cell's elevation</help>
++			</option>
++			<option value="CST" type="choice">
++				<help>Fill the grid with the average over all the stations</help>
++			</option>
++			<option value="CST_LAPSE" type="choice">
++			  <parameter key="%::cst_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, fill the grid with the average over all the stations, reapply the elevation trend</help>
++			</option>
++			<option value="IDW" type="choice">
++				<help>Inverse Distance Weighted average</help>
++			</option>
++			<option value="IDW_LAPSE" type="choice">
++			  <parameter key="%::idw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, apply Inverse Distance Weighted average, reapply elevation trend</help>
++			</option>
++			<option value="LIDW_LAPSE" type="choice">
++			  <parameter key="%::lidw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Same as IDW_LAPSE, but only considering a given number of neighboring stations</help>
++			</option>
++			<option value="RH" type="choice">
++				<help>Computes the dew point temperature, distribute it with IDW_LAPSE, recompute RH at each pixel</help>
++			</option>
++			<option value="ILWR" type="choice">
++				<help>Compute emissivity, distribute it with IDW_LAPSE, recompute ILWR at each pixel</help>
++			</option>
++			<option value="WIND_CURV" type="choice">
++				<help>Distribute wind velocity with IDW_LAPSE, then apply correction factors as a function of local slope and curvature</help>
++			</option>
++			<option value="HNW_SNOW" type="choice">
++				<parameter key="%::hnw_snow" type="combination">
++				<option value="IDW_LAPSE" type="dropdown">
++					<option value="CST" type="string" />
++					<option value="CST_LAPSE" type="string" />
++					<option value="IDW" type="string" />
++					<option value="IDW_LAPSE" type="string" />
++					<option value="ODKRIG" type="string" />
++				</option>
++				<help>Base algorithm (do not forget to add the options for the base algorithm)</help>
++				</parameter>
++				<help>Distribute precipitation with a base algorithm (IDW_LAPSE by default), then reduce/remove precipitation on
++				steep slopes and correct with the local curvature. This is to simulate snow redistribution processes.</help>
++			</option>
++			<option value="USER" type="choice">
++			  <parameter key="%::user" type="path" optional="false"/>
++			  <help>User provided grids, named as {numeric date}_{capitalized meteo parameter}.asc</help>
++			</option>
++			<option value="ODKRIG" type="choice">
++			  <parameter key="%::odkrig" type="combination">
++			  	<option value="" type="dropdown">
++					<option value="LINVARIO" type="string" />
++					<option value="EXPVARIO" type="string" />
++					<option value="SPHERICVARIO" type="string" />
++					<option value="RATQUADVARIO" type="string" />
++				</option>
++				<help>Variogram model</help>
++			  </parameter>
++			  <help>Ordinary kriging (EXPERIMENTAL)</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/meteoio_config.xml
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/doc/examples/snowpack_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/snowpack_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/snowpack_config.xml	(revision 17808)
+@@ -0,0 +1,1084 @@
++<inishell_config application="SNOWPACK">
++	<!-- <include path="doc/examples/meteoio_config.xml" /> -->
++
++	<!-- General Parameters -->
++	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
++		<section name="general" />
++		<help>Size in days of a chunk of data to read at once.</help>
++	</parameter>
++
++	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
++		<section name="general" />
++		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
++		beginning of the buffer (therefore, it takes a value in days).</help>
++	</parameter>
++
++	<!-- Coordinate systems, time zones -->
++	<parameter key="COORDSYS" type="alternative" optional="false">
++		<section name="input" />
++		<section name="output" />
++		<option value="CH1903" type="string">
++			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UTM" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the zone with the zone letter (for example, 32T)</help>
++			</parameter>
++			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UPS" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the hemisphere (either N or S)</help>
++			</parameter>
++			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
++		</option>
++		<option value="PROJ4" type="string">
++			<parameter key="COORDPARAM" type="string" optional="false" />
++			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
++		</option>
++		<option value="LOCAL"  type="string">
++			<help>uses the horizontal and vertical distance from a reference point</help>
++		</option>
++		<help>coordinate system</help>
++	</parameter>
++
++	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
++		<section name="input" />
++		<section name="output" />
++	</parameter>
++
++	<!-- Datatypes: Meteo Data -->
++	<frame key="meteo_frame" label="Meteorological Data">
++	<section name="input"/>
++	<parameter key="METEO" type="alternative" optional="false">
++		<section name="input" />
++
++		<option value="A3D" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="BORMA" type="string">
++			<section name="input" />
++			<reference name="BORMA" />
++		</option>
++		<option value="COSMO" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="input" />
++			<reference name="GEOTOP_IN" />
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<reference name="GRIB_METEO" />
++		</option>
++		<option value="GSN" type="string">
++			<section name="input" />
++			<reference name="GSN" />
++		</option>
++		<option value="IMIS" type="string">
++			<section name="input" />
++			<reference name="IMIS" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="input" />
++			<reference name="SMET_IN" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="input" />
++			<reference name="SNIO_IN" />
++		</option>
++
++		<help>plugin for METEO data </help>
++	</parameter>
++	<parameter key="Add Meteo parameter copy" type="selector">
++		<section name="input"/>
++		<parameter key="COPY::%" type="string" optional="false" template="true">
++			<help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
++		</parameter>
++		<help>Copy a meteo parameter into a new one (you should not need this)</help>
++	</parameter>
++	</frame>
++
++	<!-- Extra Input Parameters -->
++	<frame key="snow_frame" label="Initial Snow Profiles">
++	<section name="input"/>
++	<parameter key="SNOWPATH" type="path" default="./current_snow">
++		<section name="input" />
++		<help>Path to the land surface and snow input parameters</help>
++	</parameter>
++	<parameter key="SNOW" type="alternative" default="SMET" optional="true">
++		<section name="input" />
++		<option value="SNOWPACK" type="string" />
++		<option value="SMET" type="string" />
++		<help>Plugin to use for reading SNO data</help>
++	</parameter>
++	<parameter key="SNOWFILE#" type="file" counter="1" optional="false">
++		<section name="input" />
++		<help>file name for the initial profile for station number #</help>
++	</parameter>
++	<!-- <parameter key="NUMBER_OF_SOLUTES" type="integer" default="0" minimum="0" maximum="0">
++		<section name="input" />
++		<help>SNOWPACK can transport an arbitrary number of trace components in its snow and water phases [special use]</help>
++	</parameter> -->
++	</frame>
++
++	<!-- Output Parameters -->
++	<parameter key="METEOPATH" type="path" default="./output">
++		<section name="output" />
++		<help>Path to the outputs (this path MUST exist, it won't be created)</help>
++	</parameter>
++	<parameter key="EXPERIMENT" type="string" optional="false">
++		<section name="output" />
++		<help>Option to give an additional simulation specific output name to the run in addition to "STATION_NAME")</help>
++	</parameter>
++	<frame key="TS_frame" label="Time Series">
++	<section name="output"/>
++	<parameter key="TS_WRITE" type="alternative" optional="false">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write meteo data out?</help>
++	</parameter>
++	<parameter key="TS_START" type="decimal" default="0" minimum="0" maximum="360">
++		<section name="output" />
++		<help>When to start writing meteo data out (offset, in days)</help>
++	</parameter>
++	<parameter key="TS_DAYS_BETWEEN" type="decimal" default="4.1666e-2" minimum="0" maximum="360">
++		<section name="output" />
++		<help>How often to write meteo data out (in days: 3 hours=.125, 1 hour=4.1666e-2)</help>
++	</parameter>
++	<parameter key="AVGSUM_TIME_SERIES" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>If AVGSUM_TIME_SERIES is set, mean fluxes and cumulated masses since last dump are written, else current energy fluxes, cumulated masses over last COMPUTATION_STEP_LENGTH (recommended setting in operational mode).</help>
++	</parameter>
++	<parameter key="CUMSUM_MASS" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>If CUMSUM_MASS is set, current value of cumulated masses since begin of run are dumped. Precipitations (rain and snow, rain) are always dumped as rates (kg m-2 h-1).</help>
++	</parameter>
++	<parameter key="PRECIP_RATES" type="alternative" optional="true" default="TRUE">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write precipitation as rates (kg m-2 h-1, default) or as sums over the output time step. Please note that the units label in the output file and in SN_GUI &lt;b&gt;will remain kg m-2 h-1&lt;/b&gt; and will therefore not match sums.</help>
++	</parameter>
++	</frame>
++	<frame key="profiles_frame" label="Snow Profiles">
++	<section name="output"/>
++	<parameter key="PROFILE" type="alternative" default="ASCII" optional="false">
++		<section name="output" />
++		<option value="ASCII" type="string" />
++		<option value="IMIS" type="string" />
++		<option value="ASCII IMIS" type="string" />
++		<help>How to write the profiles (default: ASCII)</help>
++	</parameter>
++	<parameter key="PROF_WRITE" type="alternative" optional="false">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write profile data out?</help>
++	</parameter>
++	<parameter key="PROF_START" type="decimal" default="0" minimum="0" maximum="360">
++		<section name="output" />
++		<help>When to start writing profile data out (offset, in days)</help>
++	</parameter>
++	<parameter key="PROF_DAYS_BETWEEN" type="decimal" default="4.1666e-2" minimum="0" maximum="360">
++		<section name="output" />
++		<help>How often to write profile data out (in days: 3 hours=.125, 1 hour=4.1666e-2)</help>
++	</parameter>
++	<parameter key="HARDNESS_IN_NEWTON" type="alternative" default="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write the hand hardness in newtons (default) or as index</help>
++	</parameter>
++	<parameter key="CLASSIFY_PROFILE" type="alternative" default="false">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Classify the profile (default=false)? This is according to Schweizer, J. and M. Luetschg, &lt;i&gt;Characteristics of human-triggered avalanches&lt;/i&gt;, 2001, Cold Reg. Sci. Technol. &lt;b&gt;33&lt;/b&gt;(2-3)</help>
++	</parameter>
++	</frame>
++	<frame key="sno_frame" label="Status files">
++	<section name="output"/>
++	<parameter key="SNOW" type="alternative" default="SMET" optional="true">
++		<section name="output" />
++		<option value="SNOWPACK" type="string" />
++		<option value="SMET" type="string" />
++		<help>Plugin to use for reading SNO data</help>
++	</parameter>
++	<parameter key="BACKUP_DAYS_BETWEEN" type="decimal" default="365" minimum="0">
++		<section name="output" />
++		<help>Dump snow files every BACKUP_DAYS_BETWEEN days</help>
++	</parameter>
++	<parameter key="FIRST_BACKUP" type="decimal" default="400" minimum="0">
++		<section name="output" />
++		<help>First dump of sno files happens at end of run or after FIRST_BACKUP days, whichever happens first</help>
++	</parameter>
++	</frame>
++
++	<frame key="switch_frame" label="Outputs Selection">
++	<section name="output"/>
++	<parameter key="OUT_CANOPY" type="alternative" default="FALSE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write canopy data out? To be set to TRUE only if CANOPY=TRUE</help>
++	</parameter>
++	<parameter key="OUT_HAZ" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write hazard data out? This must be FALSE for Alpine3D</help>
++	</parameter>
++	<parameter key="OUT_HEAT" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write turbulent fluxes out?</help>
++	</parameter>
++	<parameter key="OUT_T" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write snow/soil temperatures out?</help>
++	</parameter>
++	<!-- <parameter key="OUT_LOAD" type="alternative" default="FALSE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write solutes load data out?</help>
++	</parameter> -->
++	<parameter key="OUT_LW" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write long wave radiation out?</help>
++	</parameter>
++	<parameter key="OUT_SW" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write short wave radiation out?</help>
++	</parameter>
++	<parameter key="OUT_MASS" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write mass balance terms out?</help>
++	</parameter>
++	<parameter key="OUT_METEO" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write meteo parameters out?</help>
++	</parameter>
++	<parameter key="OUT_STAB" type="alternative" default="TRUE" optional="true">
++		<section name="output" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Write stability parameters out?</help>
++	</parameter>
++	</frame>
++
++
++	<!-- Snowpack Parameters -->
++	<frame key="sn_parameters_frame" label="Model Parameters">
++	<section name="Snowpack"/>
++	<parameter key="CALCULATION_STEP_LENGTH" type="decimal" default="15" minimum="5" maximum="180">
++		<section name="Snowpack" />
++		<help>Internal time step (in minutes) used for model simulation. Please note that this MUST be the same as HNW::accumulate (the latter being in seconds) if re-acumulating precipitation, otherwise it would lead to wrong results.</help>
++	</parameter>
++	<parameter key="ROUGHNESS_LENGTH" type="decimal" default="0.002">
++		<section name="Snowpack" />
++		<help>Aerodynamic roughness length as a parameter for the Monin-Obukhov bulk formulation; A typical value for complex terrain is 0.01 m and for snow covered flat sites 0.001 m.</help>
++	</parameter>
++	<parameter key="HEIGHT_OF_METEO_VALUES" type="decimal" default="5.0">
++		<section name="Snowpack" />
++		<help>The instrument height (or model layer height) for meteorological input data except for wind, which may be at a different height; note that height is above ground for a standard SNOWPACK application but above surface (snow or ground) for Alpine3D applications.</help>
++	</parameter>
++	<parameter key="HEIGHT_OF_WIND_VALUE" type="decimal" default="5.0">
++		<section name="Snowpack" />
++		<help>The instrument height (or model layer height) for wind input data; note that height is above ground for a standard SNOWPACK application but above surface (snow or ground) for Alpine3D applications</help>
++	</parameter>
++	</frame>
++	<frame key="sn_switch_frame" label="Models Selection">
++	<section name="Snowpack"/>
++	<parameter key="ENFORCE_MEASURED_SNOW_HEIGHTS" type="alternative" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Input mode by which a measurement of snow depth is used to drive the snow cover mass balance</help>
++	</parameter>
++	<parameter key="SW_MODE" type="integer" default="0" minimum="0" maximum="2" optional="false">
++		<section name="Snowpack" />
++		<help>Define the shortwave radiation input: &lt;ol&gt; &lt;li value="0"&gt;Incoming shortwave radiation is measured and albedo estimated by the model;&lt;/li&gt; &lt;li&gt;Reflected shortwave radiation is available as input and albedo is estimated by the model (IMIS standard);&lt;/li&gt; &lt;li&gt;Incoming and reflected shortwave radiation are both measured and the albedo is estimated from both measurements subject to plausibility checks.&lt;/li&gt; &lt;/ol&gt;</help>
++	</parameter>
++	<parameter key="NEUTRAL" type="integer" default="1" minimum="-1" maximum="1" optional="false">
++		<section name="Snowpack" />
++		<help>Select the atmospheric stability correction model:&lt;ol&gt; &lt;li value="-1"&gt; use a simplified Richardson number stability correction;&lt;/li&gt; &lt;li&gt;assume standard Monin-Obukhov bulk formulation for surface exchange iteration with Paulson, Stearns and Weidner (can be used with BC_CHANGE=0); &lt;/li&gt; &lt;li&gt; force Monin-Obukhov formulation to assume neutral conditions regardless of the actual stratification; it has been shown to work well in complex terrain settings. It should be used with BC_CHANGE=1, i.e., Dirichlet bc but also is recommended with Neumann b.c., i.e., BC_CHANGE=0.&lt;/li&gt; &lt;/ol&gt;</help>
++	</parameter>
++	<parameter key="CANOPY" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Switch to tell the model that canopy is present (note that Canopy parameters should then be provided in the *.sno file)</help>
++	</parameter>
++	<parameter key="MEAS_TSS" type="alternative" default="TRUE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>A measured surface temperature is available and can be reliably used for various consistency tests (it needs to be set to true if enabling CHANGE_BC).</help>
++	</parameter>
++	<parameter key="CHANGE_BC" type="alternative" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Use measured surface temperature as Dirichlet temperature BC for sub-freezing snowpacks and switch to Neumann only for melting snowpacks. If set to false, assumes Neumann boundary conditions.</help>
++	</parameter>
++	<parameter key="THRESH_CHANGE_BC" type="decimal" default="-1.3">
++		<section name="Snowpack" />
++		<help>Threshold value (small number below freezing), which switches from Dirichlet to Neumann BCs if CHANGE_BC is selected</help>
++	</parameter>
++	</frame>
++	<frame key="sn_slopes_frame" label="Virtual slopes">
++	<section name="Snowpack"/>
++	<parameter key="NUMBER_SLOPES" type="alternative" default="1" optional="false">
++		<section name="Snowpack" />
++		<option value="1" type="string" />
++		<option value="5" type="string" />
++		<option value="3" type="string" />
++		<option value="9" type="string" />
++		<help>Based on meteorological input from a (flat field) automatic station or numerical weather model, up to 8 expositions can be calculated in addition to the flat field if the corresponding *.sno files are provided. For example, if you provide a flat field *.snow file (mandatory), which is named KLO3.sno and you want 4 slopes to be calculated the corresponding slope files should be named KLO21.sno, …,KLO24.sno</help>
++	</parameter>
++	<parameter key="INCOMING_LONGWAVE" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Use the provided incoming long wave on the virtual slopes?</help>
++	</parameter>
++	<parameter key="SNOW_REDISTRIBUTION" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Specifies if redistribution of snow is allowed from (upwind) expositions to lee slopes. In case just the flat field is calculated, snow erosion is enabled but only for "ENFORCE_MEASURED_SNOW_HEIGHTS".</help>
++	</parameter>
++	</frame>
++	<frame key="soil_frame" label="Soil Modeling">
++	<section name="Snowpack"/>
++	<parameter key="SNP_SOIL" type="alternative" default="TRUE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Soil layers as defined by the *.sno files are included in the simulation</help>
++	</parameter>
++	<parameter key="SOIL_FLUX" type="alternative" default="FALSE" optional="false">
++		<section name="Snowpack" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Assume that the lower temperature boundary condition is given by GEO_HEAT (Neumann) and not by a measured temperature</help>
++	</parameter>
++	<parameter key="GEO_HEAT" type="decimal" default="0.06">
++		<section name="Snowpack" />
++		<help>Constant geothermal heat flux at great) depth W m-2): Lower flux boundary condition for temperature equation if BC is Neumann</help>
++	</parameter>
++	</frame>
++
++
++	<!-- SnowpackAdvanced Parameters -->
++	<parameter key="ASSUME_RESPONSIBILITY" type="alternative" default="AGREE">
++		<section name="SnowpackAdvanced" />
++		<option value="AGREE" type="string" />
++		<help>&lt;font color="FF0000"&gt;The keys in this section deeply affect the operation of the SNOWPACK model. This could lead to unexpected behavior or surprising results. If you are not an experienced Snowpack user, please do NOT change any keys below!&lt;/font&gt;</help>
++	</parameter>
++	<parameter key="VARIANT" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="JAPAN" type="string" />
++		<option value="ANTARTICA" type="string" />
++		<!-- <option value="CALIBRATION" type="string" /> -->
++		<help>variant selection (includes a choice of specific models)</help>
++	</parameter>
++	<!-- <parameter key="RESEARCH" type="alternative" optional="true" default="TRUE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>research_mode</help>
++	</parameter> -->
++	<!-- <parameter key="NUMBER_FIXED_RATES" type="integer" default="0">
++		<section name="SnowpackAdvanced" />
++		<help>number_fixed_rates</help>
++	</parameter> -->
++	<parameter key="PERP_TO_SLOPE" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>perp_to_slope</help>
++	</parameter>
++	<frame key="wind_frame" label="Wind Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="PREVAILING_WIND_DIR" type="decimal" default="0">
++		<section name="SnowpackAdvanced" />
++		<help>Shifts the origin of the wind rose for snow redistribution and slope simulations: e.g. choose 45° to have NE/SE/SW/NW</help>
++	</parameter>
++	<parameter key="WIND_SCALING_FACTOR" type="decimal" default="1.0" minimum="0" maximum="2">
++		<section name="SnowpackAdvanced" />
++		<help>Scaling factor to apply to wind values in case of drifting snow</help>
++	</parameter>
++	</frame>
++	<frame key="hnw_frame" label="Precipitation Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="FORCE_RH_WATER" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Tell the model that relative humidity values are with respect to water regardless of the temperature</help>
++	</parameter>
++	<parameter key="THRESH_RAIN" type="decimal" default="1.2">
++		<section name="SnowpackAdvanced" />
++		<help>Temperature threshold for rain/snow transition</help>
++	</parameter>
++	<parameter key="THRESH_RH" type="decimal" default="0.5">
++		<section name="SnowpackAdvanced" />
++		<help>If ENFORCE_MEASURED_SNOW_HEIGHTS, relative humidity threshold for precipitation to occur</help>
++	</parameter>
++	<parameter key="THRESH_DT_AIR_SNOW" type="decimal" default="3.0">
++		<section name="SnowpackAdvanced" />
++		<help>If ENFORCE_MEASURED_SNOW_HEIGHTS, (TA-TSS) threshold for precipitation to occur</help>
++	</parameter>
++	</frame>
++	<frame key="hoar_frame" label="Hoar Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="HOAR_THRESH_RH" type="decimal" default="0.97">
++		<section name="SnowpackAdvanced" />
++		<help>Relative humidity threshold above which no surface hoar is allowed to form (because at very high humidity, typically no hoar crystals can form)</help>
++	</parameter>
++	<parameter key="HOAR_THRESH_VW" type="decimal" default="3.5">
++		<section name="SnowpackAdvanced" />
++		<help>Wind speed threshold above which no surface hoar is allowed to form (because it will drift away)</help>
++	</parameter>
++	<parameter key="HOAR_DENSITY_BURIED" type="decimal" default="125.0">
++		<section name="SnowpackAdvanced" />
++		<help>Define the initial density for surface hoar at the time it gets buried by new snow</help>
++	</parameter>
++	<parameter key="HOAR_MIN_SIZE_BURIED" type="decimal" default="2.0">
++		<section name="SnowpackAdvanced" />
++		<help>Define a threshold below which any traces of surface hoar will not be given a separate hoar layer when buried.</help>
++	</parameter>
++	<parameter key="HOAR_DENSITY_SURF" type="decimal" default="100.0">
++		<section name="SnowpackAdvanced" />
++		<help>Assumed density of surface hoar while exposed at the surface and not buried</help>
++	</parameter>
++	</frame>
++	<frame key="temps_frame" label="Temperatures Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="FIXED_POSITIONS" type="string" default="">
++		<section name="SnowpackAdvanced" />
++		<help>positions of temperatur sensors in snow or soil: positive values refer to heigths measured from the ground surface (snow only), negative values refer to depths measured from either the ground surface or the snow surface in case no soil layers are present. A sensor must at least be covered by MIN_DEPTH_SUBSURF (m) snow for its temperature to be output.</help>
++	</parameter>
++	<!-- <parameter key="MAX_NUMBER_MEAS_TEMPERATURES" type="integer" default="5">
++		<section name="SnowpackAdvanced" />
++		<help></help>
++	</parameter> -->
++	<parameter key="MIN_DEPTH_SUBSURF" type="decimal" default="0.07">
++		<section name="SnowpackAdvanced" />
++		<help>Minimum snow depth above a temperature sensor to accept the measurement</help>
++	</parameter>
++	<parameter key="T_CRAZY_MIN" type="decimal" default="210.">
++		<section name="SnowpackAdvanced" />
++		<help>If you go to Antarctica or the tropics you may expect different reasonable temperatures</help>
++	</parameter>
++	<parameter key="T_CRAZY_MAX" type="decimal" default="340.">
++		<section name="SnowpackAdvanced" />
++		<help>If you go to Antarctica or the tropics you may expect different reasonable temperatures</help>
++	</parameter>
++	</frame>
++	<frame key="sn_models_frame" label="Models Selection">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="HN_DENSITY_MODEL" type="alternative" default="LEHNING_NEW">
++		<section name="SnowpackAdvanced" />
++		<option value="LEHNING_NEW" type="string" />
++		<option value="ZWART" type="string" />
++		<option value="BELLAIRE" type="string" />
++		<option value="LEHNING_OLD" type="string" />
++		<option value="PAHAUT" type="string" />
++		<help>Choice of new snow density model (diverse statistical models)</help>
++	</parameter>
++	<parameter key="HN_DENSITY" type="string" default="PARAMETERIZED">
++		<section name="SnowpackAdvanced" />
++		<help>Fixed value to be used as new snow density if a constant density model is chosen, otherwise the choices are "PARAMETERIZED" "EVENT" "MEASURED"</help>
++	</parameter>
++	<parameter key="METAMORPHISM_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="NIED" type="string" />
++		<help>metamorphism_model</help>
++	</parameter>
++	<parameter key="NEW_SNOW_GRAIN_RAD" type="decimal" default="0.15">
++		<section name="SnowpackAdvanced" />
++		<help>new_snow_grain_rad</help>
++	</parameter>
++	<parameter key="STRENGTH_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="NIED" type="string" />
++		<help>strength_model</help>
++	</parameter>
++	<parameter key="VISCOSITY_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="DEFAULT" type="string" />
++		<option value="NIED" type="string" />
++		<help>viscosity_model</help>
++	</parameter>
++	<parameter key="HARDNESS_MODEL" type="alternative">
++		<section name="SnowpackAdvanced" />
++		<option value="MONTI" type="string" />
++		<option value="BELLAIRE" type="string" />
++		<option value="ASARC" type="string" />
++		<help>hardness_model</help>
++	</parameter>
++	<parameter key="DOORSCHOT" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Choose the Doorschot saltation model over the simple Sorenson parameterization</help>
++	</parameter>
++	<parameter key="MULTISTREAM" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Select a multi stream model for shortwave radiation penetration into the snow cover</help>
++	</parameter>
++	<parameter key="FIXED_ALBEDO" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Force the model to work with a fixed albedo</help>
++	</parameter>
++	<!-- <parameter key="SURFACECODE" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="NEUMANN_BC" type="string" />
++		<option value="DIRICHLET_BC" type="string" />
++		<help>Select the boundary conditions to use</help>
++	</parameter> -->
++	</frame>
++	<frame key="sn_extra_frame" label="Extra Models Selection">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="DETECT_GRASS" type="alternative" optional="true" default="TRUE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Identify grass growing under the snow height sensor. This usually works well but might sometimes lead to problems</help>
++	</parameter>
++	<parameter key="PLASTIC" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Switch to tell the model that a impermeable layer should be simulated on top of some snow or ice: this requires that the *.sno file contains this layer, which is characterized via the soil parameters; the option has successfully been used to simulate snow and ice protection using geo-textiles and saw dust.</help>
++	</parameter>
++	<parameter key="JAM" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>If switched on, you can also simulate ponding on impermeable ice surfaces below the snow cover</help>
++	</parameter>
++	<parameter key="WATER_LAYER" type="alternative" optional="true" default="FALSE">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Assuming an impermeable surface such as on a road or on geo-textiles (e.g. for snow farming), a liquid water layer is allowed to form on this surface</help>
++	</parameter>
++	</frame>
++	<frame key="elements_frame" label="Elements Handling">
++	<section name="SnowpackAdvanced"/>
++	<parameter key="HEIGHT_NEW_ELEM" type="decimal" default="0.02">
++		<section name="SnowpackAdvanced" />
++		<help>Standard size of a new element added to the stack of elements (layers) during snowfall events</help>
++	</parameter>
++	<parameter key="MINIMUM_L_ELEMENT" type="decimal" default="0">
++		<section name="SnowpackAdvanced" />
++		<help>Threshold value for enforcing the layer to be merged with the layer above or below</help>
++	</parameter>
++	<parameter key="COMBINE_ELEMENTS" type="alternative" optional="true">
++		<section name="SnowpackAdvanced" />
++		<option value="TRUE" type="string" />
++		<option value="FALSE" type="string" />
++		<help>Combine neighboring elements based on a set of similarity conditions which are hard-coded</help>
++	</parameter>
++	</frame>
++
++	<!--Parameter group for list of stations -->
++	<parametergroup name="stationgroup_files">
++		<parameter key="STATION#" type="file" counter="1" optional="false">
++			<help>filename for station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_names">
++		<parameter key="STATION#" type="string" counter="1" optional="false">
++			<help>station id for the given station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_pos">
++		<parameter key="STATION#" type="string" counter="1">
++			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Plugins for Meteo Data-->
++	<parametergroup name="BORMA">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the xml files</help>
++		</parameter>
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="IMIS">
++		<parameter key="DBNAME" type="string" optional="false">
++			<help>database name, as provided by your database administrator</help>
++		</parameter>
++		<parameter key="DBUSER" type="string" optional="false">
++			<help>database user name</help>
++		</parameter>
++		<parameter key="DBPASS" type="string" optional="false">
++			<help>database password associated with the user name</help>
++		</parameter>
++		<parameter key="USEANETZ" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
++		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
++		  average to get what should be its local precipitations</help>
++		</parameter>
++		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
++		</parameter>
++		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
++		</parameter>
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="GRIB_METEO">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the grib files</help>
++		</parameter>
++		<parameter key="METEOEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++
++		<reference name="stationgroup_pos" />
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="false">
++			<help>absolute filename of the geotop.inpts file</help>
++		</parameter>
++		<parameter key="METEOPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GSN">
++		<parameter key="ENDPOINT" type="string" optional="false">
++			<help>webserver running GSN with its port number and full path. For example:
++			http://montblanc.slf.ch:22001/services/A3DWebService</help>
++		</parameter>
++		<parameter key="PROXY" type="string" optional="true">
++			<help>Should the connection go through a proxy? This is useful for servers
++			filtering on domains but usually not necessary.</help>
++		</parameter>
++		<parameter key="PROXYPORT" type="string" optional="true" />
++		<parameter key="PROXYUSER" type="string" optional="true" />
++		<parameter key="PROXYPASS" type="string" optional="true" />
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="SMET_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the smet files</help>
++		</parameter>
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<parametergroup name="SNIO_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the SNOWPACK files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="true">
++			<help>filename of the meta data file (in METEOPATH)</help>
++		</parameter>
++		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
++		  <help>the number of measured snow temperatures that are provided</help>
++		</parameter>
++		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
++		  <help>the number of solutes for which input data are provided</help>
++		</parameter>
++
++		<parameter key="RSWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="ISWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="VW_DRIFT" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
++		</parameter>
++		<parameter key="RHO_HN" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: measured new snow density is provided</help>
++		</parameter>
++
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
++	<parametergroup name="METEOIOPARAMETERS">
++		<option value="TA"/>
++		<option value="RH"/>
++		<option value="VW"/>
++		<option value="DW"/>
++		<option value="VW_MAX"/>
++		<option value="ISWR"/>
++		<option value="RSWR"/>
++		<option value="ILWR"/>
++		<option value="HS"/>
++		<option value="HNW"/>
++		<option value="TSG"/>
++		<option value="TSS"/>
++		<option value="P"/>
++	</parametergroup>
++
++	<!-- Filters -->
++	<parameter key="Add/Remove Filter" type="selector">
++		<section name="filters" />
++
++		<parameter key="%::filter#" type="alternative" counter="1" template="true">
++			<section name="filters" />
++
++			<option label="MeanAvg" value="mean_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++
++
++			<option label="MedianAvg" value="median_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="decimal" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
++			</option>
++
++			<option label="Std Deviation Filter" value="std_dev" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
++			</option>
++
++			<option label="MAD" value="mad" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
++			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
++			</option>
++
++			<option label="Tukey 53H Filter" value="Tukey" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
++			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
++			    </help>
++			  </parameter>
++			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
++			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
++			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
++			</option>
++
++			<option label="Wind Averaging Filter" value="wind_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
++			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
++			</option>
++
++			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
++			</option>
++
++			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
++			</option>
++
++			<option label="Min Range Filter" value="min" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
++			    assigned the minimum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Min range filter. Reject all values smaller than the min.</help>
++			</option>
++
++			<option label="Max Range Filter" value="max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
++			    assigned the maximum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Max range filter. Reject all values greater than the max.</help>
++			</option>
++
++			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Min adjust to:" value="" type="decimal" />
++			    <option label="Max adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
++			    the maximum permissible value and all data smaller than the min would be assigned the minimum
++			    permissible value or an optional extra set of two user provided values</help>
++			  </parameter>
++			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
++			</option>
++
++			<option label="Rate Filter (1 argument)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Rate Filter (2 arguments)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the minimum and maximum permissible rate of change (per second)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
++			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
++			  </parameter>
++			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
++			</option>
++
++			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Gage type" type="dropdown">
++					<option value="Nipher" type="string" />
++					<option value="Tretyakov" type="string" />
++					<option value="US8sh" type="string" />
++					<option value="US8unsh" type="string" />
++					<option value="Hellmann" type="string" />
++					<option value="Hellmannsh" type="string" />
++				</option>
++			  </parameter>
++			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
++			</option>
++
++			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Kind" type="dropdown">
++					<option value="Cst" type="string" />
++				</option>
++				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
++				<option label="Mixed precipitation factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
++			  </parameter>
++			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
++			</option>
++
++			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="albedo:" value="0.23" type="decimal" />
++			    <option value="soft" type="choice" />
++			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
++			  </parameter>
++			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
++			</option>
++
++			<option label="Add an offset" value="add" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="offset:" value="0." type="decimal" />
++			  </parameter>
++			  <help>This adds a given offset to the data.</help>
++			</option>
++
++			<option label="Multiply by a factor" value="mult" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="factor:" value="1." type="decimal" />
++			  </parameter>
++			  <help>This multiplies the data by a given factor.</help>
++			</option>
++
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 1D Interpolation -->
++	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
++		<section name="Interpolations1D" />
++		<help>Affects resampling: expresses (in seconds) how far a valid point can be
++		searched for when re-interpolating a missing value</help>
++	</parameter>
++
++	<parameter key="Add/Remove 1D Interpolation" type="selector">
++		<section name="Interpolations1D" />
++
++		<parameter key="%::resample" type="alternative" template="true">
++			<section name="Interpolations1D" />
++			<option label="No Interpolation" value="none" type="string" />
++			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
++			<option label="Linear" value="linear" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="extrapolate" type="choice" />
++			    <help>
++			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
++			      Otherwise, a data point will only be calculated between the original date range.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++			<option label="Accumulate" value="accumulate" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="strict" type="choice" />
++			    <option label="Seconds:" value="900" type="integer" minimum="1" />
++			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
++			  </parameter>
++			  <help>Accumulation over a user given period (filter argument, in seconds -
++			  should coincide with your calculation step!).</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/snowpack_config.xml
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/doc/examples/issm.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/issm.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/issm.xml	(revision 17808)
+@@ -0,0 +1,1284 @@
++<inishell_config application="ISSM prototype">
++
++<!-- mesh -->
++<parameter key ="Dimension" type="alternative" optional="false">
++     <section name="mesh" />
++     <option value="0" type="string" default="true">
++        <help> dimension is 0 </help>
++     </option>
++     <option value="3" type="string">
++        <help> dimension is 3 </help>
++       <!-- Elements and vertices of the original 2d mesh -->
++          <parameter key ="x2d" type="double" default="N/A">
++              <help> vertices x coordinate [m] </help>
++          </parameter>
++          <parameter key ="y2d" type="double" default="N/A">
++              <help> vertices y coordinate [m] </help>
++          </parameter>
++          <parameter key ="elements2d" type="double" default="N/A">
++              <help> vertex indices of the mesh elements </help>
++          </parameter>
++          <parameter key ="numberofvertices2d" type="double" default="0">
++              <help> number of vertices </help>
++          </parameter>
++          <parameter key ="numberofelements2d" type="double" default="0">
++              <help> number of elements </help>
++          </parameter>
++     </option>
++     <help> select a mesh dimension 0(default) or 3 </help>
++</parameter>
++<frame key="1" label="Elements and vertices">
++<section name="mesh" />
++  <parameter key ="numberofelements" type="double" default="0">
++     <section name="mesh" />
++     <help> number of elements </help>
++  </parameter>
++  <parameter key ="numberofvertices" type="double" default="0">
++     <section name="mesh" />
++     <help> number of verticies </help>
++  </parameter>
++  <parameter key ="elements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertex indices of the mesh elements </help>
++  </parameter>
++  <parameter key ="x" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices x coordinate [m] </help>
++  </parameter>
++  <parameter key ="y" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices y coordinate [m] </help>
++  </parameter>
++  <parameter key ="z" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices z coordinate [m] </help>
++  </parameter>
++  <parameter key ="edges" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>
++  </parameter>
++  <parameter key ="numberofedges" type="double" default="0">
++     <section name="mesh" />
++     <help> number of edges of the 2d mesh </help>
++  </parameter>
++</frame>
++<frame key="2" label="Properties">
++<section name="mesh" />
++  <parameter key ="selected dimension" type="double" default="0">
++     <section name="mesh" />
++     <help> mesh dimension </help>
++  </parameter>
++  <parameter key ="numberoflayers" type="double" default="0">
++     <section name="mesh" />
++     <help> number of extrusion layers </help>
++  </parameter>
++  <parameter key ="vertexonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonbed" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower elements flags list </help>
++  </parameter>
++  <parameter key ="vertexonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertices flags list </help>
++  </parameter>
++  <parameter key ="elementonsurface" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element flag list </help>
++  </parameter>
++  <parameter key ="uppervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper vertex list (NaN for vertex on the upper surface) </help>
++  </parameter>
++  <parameter key ="upperelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> upper element list (NaN for element on the upper layer) </help>
++  </parameter>
++  <parameter key ="lowervertex" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower vertex list (NaN for vertex on the lower surface) </help>
++  </parameter>
++  <parameter key ="lowerelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> lower element list (NaN for element on the lower layer </help>
++  </parameter>
++  <parameter key ="vertexonboundary" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices on the boundary of the domain flag list </help>
++  </parameter>
++  <parameter key ="segments" type="double" default="N/A">
++     <section name="mesh" />
++     <help> edges on domain boundary (vertex1 vertex2 element) </help>
++  </parameter>
++  <parameter key ="segmentmarkers" type="double" default="N/A">
++     <section name="mesh" />
++     <help> number associated to each segment </help>
++  </parameter>
++  <parameter key ="vertexconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to vertex_i </help>
++  </parameter>
++  <parameter key ="elementconnectivity" type="double" default="N/A">
++     <section name="mesh" />
++     <help> list of vertices connected to element_i </help>
++  </parameter>
++  <parameter key ="average_vertex_connectivity" type="double" default="25">
++     <section name="mesh" />
++     <help> average number of vertices connected to one vertex </help>
++  </parameter>
++</frame>
++<frame key="3" label="Extracted Model">
++<section name="mesh" />
++  <parameter key ="extractedvertices" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices extracted from the model </help>
++  </parameter>
++  <parameter key ="extractedelements" type="double" default="N/A">
++     <section name="mesh" />
++     <help> elements extracted from the model </help>
++  </parameter>
++</frame>
++<frame key="4" label="Projection">
++<section name="mesh" />
++  <parameter key ="lat" type="double" default="N/A">
++     <section name="mesh" />
++     <help> vertices latitude [degrees] </help>
++  </parameter>
++  <parameter key ="long" type="double" default="N/A">
++     <section name="mesh" />
++     <help> verticies longitude [degrees] </help>
++  </parameter>
++  <parameter key ="hemisphere" type="double" default="N/A">
++     <section name="mesh" />
++     <help> Indicate hemisphere 'n' or 's' </help>
++  </parameter></frame>
++
++
++<!-- mask -->
++<parameter key ="groundedice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &amp;lt; 0 </help>
++</parameter>
++<parameter key ="ice_levelset" type="double" default="NaN">
++     <section name="mask" />
++     <help> presence of ice if > 0, icefront position if = 0, no ice if &amp;lt; 0 </help>
++</parameter>
++
++<!-- geometry -->
++<frame key="1" label="Geometry parameters">
++<section name="geometry" />
++<parameter key ="surface" type="path" optional="false">
++     <section name="geometry" />
++     <help> surface elevation [m] </help>
++</parameter>
++<parameter key ="thickness" type="path" optional="false">
++     <section name="geometry" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="bed" type="path" optional="false">
++     <section name="geometry" />
++     <help> bed elevation [m] </help>
++</parameter>
++<parameter key ="bathymetry" type="double" default="N/A">
++     <section name="geometry" />
++     <help> bathymetry elevation [m] </help>
++</parameter>
++<parameter key ="hydrostatic_ratio" type="double" default="N/A">
++     <section name="geometry" />
++     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>
++</parameter></frame>
++
++
++<!-- constants -->
++<parameter key ="g" type="double" default="9.81">
++     <section name="constants" />
++     <help> gravitational acceleration [m/s^2] </help>
++</parameter>
++<parameter key ="yts" type="double" default="31536000">
++     <section name="constants" />
++     <help> number of seconds in a year [s/yr] </help>
++</parameter>
++<parameter key ="referencetemperature" type="double" default="223.15">
++     <section name="constants" />
++     <help> reference temperature used in the enthalpy model [K] </help>
++</parameter>
++
++<!-- surfaceforcings(SMB) -->
++<parameter key ="mass_balance" type="double" default="NaN">
++     <section name="surfaceforcings(SMB)" />
++     <help> surface mass balance [m/yr ice eq] </help>
++</parameter>
++
++<!-- basalforcings -->
++<parameter key ="melting_rate" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> basal melting rate (positive if melting) [m/yr] </help>
++</parameter>
++<parameter key ="melting_rate_correction" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> additional melting applied to compensate for dh/dt [m/yr] </help>
++</parameter>
++<parameter key ="geothermalflux" type="double" default="NaN">
++     <section name="basalforcings" />
++     <help> geothermal heat flux [W/m^2] </help>
++</parameter>
++
++<!-- materials -->
++<parameter key ="rho_ice" type="double" default="917">
++     <section name="materials" />
++     <help> ice density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_water" type="double" default="1023">
++     <section name="materials" />
++     <help> ocean water density [kg/m^3] </help>
++</parameter>
++<parameter key ="rho_freshwater" type="double" default="1000">
++     <section name="materials" />
++     <help> fresh water density [kg/m^3] </help>
++</parameter>
++<parameter key ="mu_water" type="double" default="0.001787">
++     <section name="materials" />
++     <help> water viscosity [N s/m^2] </help>
++</parameter>
++<parameter key ="heatcapacity" type="double" default="2093">
++     <section name="materials" />
++     <help> heat capacity [J/kg/K] </help>
++</parameter>
++<parameter key ="latentheat" type="double" default="334000">
++     <section name="materials" />
++     <help> latent heat of fusion [J/kg] </help>
++</parameter>
++<parameter key ="thermalconductivity" type="double" default="2.4">
++     <section name="materials" />
++     <help> ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="temperateiceconductivity" type="double" default="0.24">
++     <section name="materials" />
++     <help> temperate ice thermal conductivity [W/m/K] </help>
++</parameter>
++<parameter key ="meltingpoint" type="double" default="273.15">
++     <section name="materials" />
++     <help> melting point of ice at 1atm in K </help>
++</parameter>
++<parameter key ="beta" type="double" default="9.8e-08">
++     <section name="materials" />
++     <help> rate of change of melting point with pressure [K/Pa] </help>
++</parameter>
++<parameter key ="mixed_layer_capacity" type="double" default="3974">
++     <section name="materials" />
++     <help> mixed layer capacity [W/kg/K] </help>
++</parameter>
++<parameter key ="thermal_exchange_velocity" type="double" default="0.0001">
++     <section name="materials" />
++     <help> thermal exchange velocity [m/s] </help>
++</parameter>
++<parameter key ="rheology_B" type="double" default="N/A">
++     <section name="materials" />
++     <help> flow law parameter [Pa/s^(1/n)] </help>
++</parameter>
++<parameter key ="rheology_n" type="double" default="N/A">
++     <section name="materials" />
++     <help> Glens flow law exponent </help>
++</parameter>
++<parameter key ="rheology_law" type="char" default="'Paterson'">
++     <section name="materials" />
++     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>
++</parameter>
++<parameter key ="lithosphere_shear_modulus" type="double" default="67000000000">
++     <section name="materials" />
++     <help> Lithosphere shear modulus [Pa] </help>
++</parameter>
++<parameter key ="lithosphere_density" type="double" default="3.32">
++     <section name="materials" />
++     <help> Lithosphere density [g/cm^-3] </help>
++</parameter>
++<parameter key ="mantle_shear_modulus" type="double" default="145000000000">
++     <section name="materials" />
++     <help> Mantle shear modulus [Pa] </help>
++</parameter>
++<parameter key ="mantle_density" type="double" default="3.34">
++     <section name="materials" />
++     <help> Mantle density [g/cm^-3] </help>
++</parameter>
++
++
++<!-- damage -->
++<!-- Note: this class depends on different input of law -->
++<parameter key ="law" type="alternative" optional="false">
++	<section name="damage" />
++	<option value="undamage" type="string" default="true">
++		<help> law = undamage </help>
++	</option>
++	<option value="pralong" type="string" default="false">
++		<help> law = pralong </help>
++		<parameter key ="stress_threshold" type="double" default="0">
++			<help> damage stress threshold [Pa] </help>
++		</parameter>
++		<parameter key ="c1" type="double" default="0">
++			<help> damage parameter 1 </help>
++		</parameter>
++		<parameter key ="c2" type="double" default="0">
++			<help> damage parameter 2 </help>
++		</parameter>
++		<parameter key ="c3" type="double" default="0">
++			<help> damage parameter 3 [W/m^2] </help>
++		</parameter>
++		<parameter key ="c4" type="double" default="0">
++			<help> damage parameter 4 </help>
++		</parameter>
++		<parameter key ="healing" type="double" default="0">
++			<help> damage healing parameter 1 </help>
++		</parameter>
++		<parameter key ="equiv_stress" type="double" default="0">
++			<help> 0: von Mises </help>
++		</parameter>
++		<parameter key ="requested_outputs" type="cell" default="{'default'}">
++			<help> additional outputs requested </help>
++		</parameter>
++	</option>
++	<help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="D" type="double" default="0">
++     <section name="damage" />
++     <help> damage tensor (scalar) </help>
++</parameter>
++<parameter key ="law" type="char" default="undamaged">
++     <section name="damage" />
++     <help> damage law (string) from {"undamaged","pralong"} </help>
++</parameter>
++<parameter key ="spcdamage" type="double" default="NaN">
++     <section name="damage" />
++     <help> damage constraints (NaN means no constraint) </help>
++</parameter>
++<parameter key ="max_damage" type="double" default="0.99999">
++     <section name="damage" />
++     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="2">
++     <section name="damage" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="damage" />
++     <help> maximum number of non linear iterations </help>
++</parameter>
++<parameter key ="penalty_lock" type="double" default="0">
++     <section name="damage" />
++     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++</parameter>
++<parameter key ="penalty_threshold" type="double" default="0">
++     <section name="damage" />
++     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>
++</parameter>
++<parameter key ="penalty_factor" type="double" default="3">
++     <section name="damage" />
++     <help> scaling exponent (default is 3) </help>
++</parameter>
++
++
++<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->
++<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">
++<section name="friction" />
++<parameter key ="coefficient" type="double" default="N/A">
++     <section name="friction" />
++     <help> friction coefficient [SI] </help>
++</parameter>
++<parameter key ="p" type="double" default="N/A">
++     <section name="friction" />
++     <help> p exponent </help>
++</parameter>
++<parameter key ="q" type="double" default="N/A">
++     <section name="friction" />
++     <help> q exponent </help>
++</parameter></frame>
++
++
++<!-- flowequation -->
++<frame key="1" label="Flow equation parameters">
++<section name="flowequation" />
++<parameter key ="isSIA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shallow Ice Approximation (SIA) used ? </help>
++</parameter>
++<parameter key ="isSSA" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>
++</parameter>
++<parameter key ="isL1L2" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the L1L2 approximation used ? </help>
++</parameter>
++<parameter key ="isHO" type="double" default="0">
++     <section name="flowequation" />
++     <help> is the Higher-Order (HO) approximation used ? </help>
++</parameter>
++<parameter key ="isFS" type="double" default="0">
++     <section name="flowequation" />
++     <help> are the Full-FS (FS) equations used ? </help>
++</parameter>
++<parameter key ="fe_SSA" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>
++</parameter>
++<parameter key ="fe_HO" type="char" default="'P1'">
++     <section name="flowequation" />
++     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>
++</parameter>
++<parameter key ="fe_FS" type="char" default="'MINIcondensed'">
++     <section name="flowequation" />
++     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>
++</parameter>
++<parameter key ="vertex_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each vertex </help>
++</parameter>
++<parameter key ="element_equation" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> flow equation for each element </help>
++</parameter>
++<parameter key ="borderSSA" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on SSAs border (for tiling) </help>
++</parameter>
++<parameter key ="borderHO" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on HOs border (for tiling) </help>
++</parameter>
++<parameter key ="borderFS" type="double" default="N/A">
++     <section name="flowequation" />
++     <help> vertices on FS border (for tiling) </help>
++</parameter></frame>
++
++
++<!-- Timestepping -->
++<parameter key ="start_time" type="double" default="0">
++     <section name="timestepping" />
++     <help> simulation starting time [yr] </help>
++</parameter>
++<parameter key ="final_time" type="double" default="5">
++     <section name="timestepping" />
++     <help> final time to stop the simulation [yr] </help>
++</parameter>
++<parameter key ="time_step" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> length of time steps [yr] </help>
++</parameter>
++<parameter key ="time_adapt" type="double" default="0">
++     <section name="timestepping" />
++     <help> use cfl condition to define time step ? (0 or 1)  </help>
++</parameter>
++<parameter key ="cfl_coefficient" type="double" default="0.5">
++     <section name="timestepping" />
++     <help> coefficient applied to cfl condition </help>
++</parameter>
++
++
++<!-- initialization -->
++<frame key="1" label="Initial field values">
++<section name="initialization" />
++<parameter key ="vx" type="double" default="NaN">
++     <section name="initialization" />
++     <help> x component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vy" type="double" default="NaN">
++     <section name="initialization" />
++     <help> y component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vz" type="double" default="NaN">
++     <section name="initialization" />
++     <help> z component of velocity [m/yr] </help>
++</parameter>
++<parameter key ="vel" type="double" default="NaN">
++     <section name="initialization" />
++     <help> velocity norm [m/yr] </help>
++</parameter>
++<parameter key ="pressure" type="double" default="NaN">
++     <section name="initialization" />
++     <help> pressure field [Pa] </help>
++</parameter>
++<parameter key ="temperature" type="double" default="NaN">
++     <section name="initialization" />
++     <help> fraction of water in the ice </help>
++</parameter>
++<parameter key ="waterfraction" type="double" default="NaN">
++     <section name="initialization" />
++     <help> ice thickness [m] </help>
++</parameter>
++<parameter key ="sediment_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> sediment water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="epl_head" type="double" default="NaN">
++     <section name="initialization" />
++     <help> epl water head of subglacial system [m] </help>
++</parameter>
++<parameter key ="watercolumn" type="double" default="NaN">
++     <section name="initialization" />
++     <help> thickness of subglacial water [m] </help>
++</parameter></frame>
++
++
++<!-- rifts -->
++<parameter key ="riftstruct" type="double" default="NaN">
++     <section name="rifts" />
++     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>
++</parameter>
++<parameter key ="riftproperties" type="double" default="NaN">
++     <section name="rifts" />
++     <help> N/A </help>
++</parameter>
++
++
++<!-- Debug -->
++<parameter key ="valgrind" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use Valgrind to debug (0 or 1) </help>
++</parameter>
++<parameter key ="gprof" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> use gnu-profiler to find out where the time is spent </help>
++</parameter>
++<parameter key ="profiling" type="logical" optional="false">
++     <section name="debug" />
++        <option value="false" type="string" default="true"></option>
++     <help> enables profiling (memory, flops, time) </help>
++</parameter>
++
++<!-- verbose -->
++<parameter key ="mprocessor" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="module" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solution" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="solver" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="convergence" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="control" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="qmu" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="true" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++<parameter key ="autodiff" type="logical" optional="false">
++     <section name="verbose" />
++        <option value="false" type="string" default="true"></option>
++     <help>  </help>
++</parameter>
++
++<!-- settings -->
++<parameter key ="results_on_nodes" type="double" default="0">
++     <section name="settings" />
++     <help> results are output for all the nodes of each element </help>
++</parameter>
++<parameter key ="io_gather" type="double" default="1">
++     <section name="settings" />
++     <help> I/O gathering strategy for result outputs (default 1) </help>
++</parameter>
++<parameter key ="lowmem" type="double" default="0">
++     <section name="settings" />
++     <help> is the memory limited ? (0 or 1) </help>
++</parameter>
++<parameter key ="output_frequency" type="double" default="1">
++     <section name="settings" />
++     <help> frequency at which results are saved in all solutions with multiple time_steps </help>
++</parameter>
++<parameter key ="waitonlock" type="double" default="Inf">
++     <section name="settings" />
++     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>
++</parameter>
++<parameter key ="upload_server" type="char" default="N/A">
++     <section name="settings" />
++     <help> server hostname where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_path" type="char" default="N/A">
++     <section name="settings" />
++     <help> path on server where model should be uploaded </help>
++</parameter>
++<parameter key ="upload_login" type="char" default="N/A">
++     <section name="settings" />
++     <help> server login </help>
++</parameter>
++<parameter key ="upload_port" type="double" default="0">
++     <section name="settings" />
++     <help> port login (default is 0) </help>
++</parameter>
++<parameter key ="upload_filename" type="char" default="N/A">
++     <section name="settings" />
++     <help> unique id generated when uploading the file to server </help>
++</parameter>
++
++<!-- generic -->
++<parameter key ="name" type="char" default="'XPS'">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="login" type="char" default="N/A">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="np" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="port" type="double" default="0">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="codepath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/bin">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="executionpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/execution">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="etcpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/etc">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrind" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/bin/valgrind">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindlib" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/lib/libmpidebug.so">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="valgrindsup" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/issm.supp">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++<parameter key ="verbose" type="double" default="1">
++     <section name="cluster" />
++     <help> N/A </help>
++</parameter>
++
++<!-- balancethickness -->
++<parameter key ="spcthickness" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="thickening_rate" type="double" default="N/A">
++     <section name="balancethickness" />
++     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="balancethickness" />
++     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>
++</parameter>
++
++<!-- StressBalance solution parameters: -->
++<frame key="1" label="Convergence criteria">
++<section name="stressbalance" />
++<parameter key ="restol" type="double" default="0.0001">
++     <section name="stressbalance" />
++     <help> mechanical equilibrium residual convergence criterion </help>
++</parameter>
++<parameter key ="reltol" type="double" default="0.01">
++     <section name="stressbalance" />
++     <help> velocity relative convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="abstol" type="double" default="10">
++     <section name="stressbalance" />
++     <help> velocity absolute convergence criterion, NaN: not applied </help>
++</parameter>
++<parameter key ="isnewton" type="double" default="0">
++     <section name="stressbalance" />
++     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>
++</parameter>
++<parameter key ="maxiter" type="double" default="100">
++     <section name="stressbalance" />
++     <help> maximum number of nonlinear iterations </help>
++</parameter>
++<parameter key ="viscosity_overshoot" type="double" default="0">
++     <section name="stressbalance" />
++     <help> over-shooting constant new=new+C*(new-old) </help>
++</parameter>
++</frame>
++<frame key="2" label="Boundary conditions">
++<section name="stressbalance" />
++<parameter key ="spcvx" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvy" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++<parameter key ="spcvz" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>
++</parameter>
++</frame>
++<frame key="3" label="Rift options">
++<section name="stressbalance" />
++<parameter key ="rift_penalty_threshold" type="double" default="0">
++     <section name="stressbalance" />
++     <help> threshold for instability of mechanical constraints </help>
++</parameter>
++<parameter key ="rift_penalty_lock" type="double" default="10">
++     <section name="stressbalance" />
++     <help> number of iterations before rift penalties are locked </help>
++</parameter>
++</frame>
++<frame key="4" label="Other">
++<section name="stressbalance" />
++<parameter key ="shelf_dampening" type="double" default="0">
++     <section name="stressbalance" />
++     <help> use dampening for floating ice ? Only for FS model </help>
++</parameter>
++<parameter key ="FSreconditioning" type="double" default="10000000000000">
++     <section name="stressbalance" />
++     <help> multiplier for incompressibility equation. Only for FS model </help>
++</parameter>
++<parameter key ="referential" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> local referential </help>
++</parameter>
++<parameter key ="loadingforce" type="double" default="N/A">
++     <section name="stressbalance" />
++     <help> loading force applied on each point [N/m^3] </help>
++</parameter>
++<parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="stressbalance" />
++     <help> additional outputs requested </help>
++</parameter>
++</frame>
++
++
++<!-- groundingline -->
++<frame key="1" label="Grounding line migration parameters">
++<section name="groundingline" />
++<parameter key ="migration" type="char" default="'None'">
++     <section name="groundingline" />
++     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>
++</parameter>
++<parameter key ="melting_rate" type="double" default="0">
++     <section name="groundingline" />
++     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>
++</parameter></frame>
++
++
++<!-- Hydrology -->
++<frame key="1" label="Hydrologyshreve solution parameters">
++<section name="hydrologyshreve" />
++<parameter key ="spcwatercolumn" type="double" default="N/A">
++     <section name="hydrologyshreve" />
++     <help> water thickness constraints (NaN means no constraint) [m] </help>
++</parameter>
++<parameter key ="n" type="double" default="0.02">
++     <section name="hydrologyshreve" />
++     <help> Manning roughness coefficient </help>
++</parameter>
++<parameter key ="CR" type="double" default="0.01">
++     <section name="hydrologyshreve" />
++     <help> tortuosity parameter </help>
++</parameter>
++<parameter key ="p" type="double" default="2">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="q" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> dimensionless exponent in Manning velocity formula </help>
++</parameter>
++<parameter key ="kn" type="double" default="0">
++     <section name="hydrologyshreve" />
++     <help> parameter in effective pressure formula </help>
++</parameter>
++<parameter key ="stabilization" type="double" default="1">
++     <section name="hydrologyshreve" />
++     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>
++</parameter>
++</frame>
++<!-- masstransport -->
++<frame key="1" label="Masstransport solution parameters">
++<section name="masstransport" />
++  <parameter key ="spcthickness" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> thickness constraints (NaN means no constraint) [m] </help>
++  </parameter>
++  <parameter key ="calvingrate" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> calving rate at given location [m/a] </help>
++  </parameter>
++  <parameter key ="isfreesurface" type="double" default="0">
++     <section name="masstransport" />
++     <help> do we use free surfaces (FS only) are mass conservation </help>
++  </parameter>
++  <parameter key ="min_thickness" type="double" default="1">
++     <section name="masstransport" />
++     <help> minimum ice thickness allowed [m] </help>
++  </parameter>
++  <parameter key ="hydrostatic_adjustment" type="char" default="'Absolute'">
++     <section name="masstransport" />
++     <help> adjustment of ice shelves surface and bed elevations: 'Incremental' or 'Absolute'  </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="masstransport" />
++     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>
++  </parameter>
++</frame>
++<frame key="2" label="Penalty options">
++<section name="masstransport" />
++  <parameter key ="vertex_pairing" type="double" default="N/A">
++     <section name="masstransport" />
++     <help> offset used by penalties: penalty = Kmax*10^offset </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="masstransport" />
++     <help> pairs of vertices that are penalized </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="masstransport" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- thermal -->
++<frame key="1" label="Thermal solution parameters">
++<section name="thermal" />
++  <parameter key ="spctemperature" type="double" default="N/A">
++     <section name="thermal" />
++     <help> temperature constraints (NaN means no constraint) [K] </help>
++  </parameter>
++  <parameter key ="penalty_threshold" type="double" default="0">
++     <section name="thermal" />
++     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
++  </parameter>
++  <parameter key ="stabilization" type="double" default="1">
++     <section name="thermal" />
++     <help> maximum number of non linear iterations </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="thermal" />
++     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
++  </parameter>
++  <parameter key ="penalty_lock" type="double" default="0">
++     <section name="thermal" />
++     <help> threshold to declare convergence of thermal solution (default is 0)  </help>
++  </parameter>
++  <parameter key ="penalty_factor" type="double" default="3">
++     <section name="thermal" />
++     <help> scaling exponent (default is 3) </help>
++  </parameter>
++  <parameter key ="isenthalpy" type="double" default="0">
++     <section name="thermal" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="isdynamicbasalspc" type="double" default="0">
++     <section name="thermal" />
++     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="thermal" />
++     <help> additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- steadystate -->
++<frame key="1" label="steadystate solution parameters">
++<section name="steadystate" />
++  <parameter key ="reltol" type="double" default="0.01">
++     <section name="steadystate" />
++     <help> relative tolerance criterion [K] </help>
++  </parameter>
++  <parameter key ="maxiter" type="double" default="100">
++     <section name="steadystate" />
++     <help> maximum number of iterations </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="steadystate" />
++     <help> additional requested outputs </help>
++  </parameter>
++</frame>
++<!-- transient -->
++<frame key="1" label="transient solution parameters">
++<section name="transient" />
++  <parameter key ="ismasstransport" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a masstransport solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isstressbalance" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a stressbalance solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isthermal" type="double" default="1">
++     <section name="transient" />
++     <help> indicates whether a thermal solution is used in the transient </help>
++  </parameter>
++  <parameter key ="isgroundingline" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a groundingline migration is used in the transient </help>
++  </parameter>
++  <parameter key ="isgia" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether a postglacial rebound model is used in the transient </help>
++  </parameter>
++  <parameter key ="isdamage" type="double" default="0">
++     <section name="transient" />
++     <help> indicates whether damage evolution is used in the transient </help>
++  </parameter>
++  <parameter key ="islevelset" type="double" default="0">
++     <section name="transient" />
++     <help> LEVEL SET DESCRIPTION...  </help>
++  </parameter>
++  <parameter key ="requested_outputs" type="cell" default="{'default'}">
++     <section name="transient" />
++     <help> list of additional outputs requested </help>
++  </parameter>
++</frame>
++<!-- gia -->
++<frame key="1" label="gia parameters">
++<section name="gia" />
++  <parameter key ="mantle_viscosity" type="double" default="N/A">
++     <section name="gia" />
++     <help> mantle viscosity[Pa s] </help>
++  </parameter>
++  <parameter key ="lithosphere_thickness" type="double" default="N/A">
++     <section name="gia" />
++     <help> lithosphere thickness (km) </help>
++  </parameter>
++  <parameter key ="cross_section_shape" type="double" default="1">
++     <section name="gia" />
++     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>
++  </parameter>
++</frame>
++<!-- autodiff -->
++<frame key="1" label="automatic differentiation parameters">
++<section name="autodiff" />
++  <parameter key ="isautodiff" type="logical" optional="false">
++     <section name="autodiff" />
++         <option value="false" type="string" default="true"></option>
++     <help> indicates if the automatic differentiation is activated </help>
++  </parameter>
++  <parameter key ="dependents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of dependent variables </help>
++  </parameter>
++  <parameter key ="independents" type="cell" default="(0x0)">
++     <section name="autodiff" />
++     <help> list of independent variables </help>
++  </parameter>
++  <parameter key ="driver" type="char" default="'fos_forward'">
++     <section name="autodiff" />
++     <help> ADOLC driver ('fos_forward' or 'fov_forward') </help>
++  </parameter>
++  <parameter key ="obufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>
++  </parameter>
++  <parameter key ="lbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="cbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="tbufsize" type="double" default="524288">
++     <section name="autodiff" />
++     <help> Number of taylors per buffer (&amp;lt;=TBUFSIZE in usrparms.h) </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>
++  </parameter>
++  <parameter key ="gcTriggerRatio" type="double" default="2">
++     <section name="autodiff" />
++     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>
++  </parameter>
++</frame>
++<!-- flaim -->
++<frame key="1" label="Input:">
++<section name="flaim" />
++  <parameter key ="targets" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml output targets file </help>
++  </parameter>
++  <parameter key ="tracks" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml input tracks file </help>
++  </parameter>
++  <parameter key ="flightreqs" type="struct" default="N/A">
++     <section name="flaim" />
++     <help> structure of kml flight requirements (not used yet) </help>
++  </parameter>
++  <parameter key ="criterion" type="double" default="N/A">
++     <section name="flaim" />
++     <help> element or nodal criterion for flight path evaluation (metric) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Arguments:">
++<section name="flaim" />
++  <parameter key ="gridsatequator" type="double" default="200000">
++     <section name="flaim" />
++     <help> number of grids at equator (determines resolution) </help>
++  </parameter>
++  <parameter key ="usevalueordering" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to consider target values for flight path evaluation </help>
++  </parameter>
++  <parameter key ="split_antimeridian" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="true" type="string" default="true"></option>
++     <help> flag to split polygons on the antimeridian </help>
++  </parameter>
++</frame>
++<frame key="3" label="Optimization:">
++<section name="flaim" />
++  <parameter key ="path_optimize" type="logical" optional="false">
++     <section name="flaim" />
++         <option value="false" type="string" default="true"></option>
++     <help> optimize? (default false) </help>
++  </parameter>
++  <parameter key ="opt_ndir" type="double" default="1">
++     <section name="flaim" />
++     <help> 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] </help>
++  </parameter>
++  <parameter key ="opt_dist" type="double" default="25">
++     <section name="flaim" />
++     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>
++  </parameter>
++  <parameter key ="opt_niter" type="double" default="30000">
++     <section name="flaim" />
++     <help> 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. </help>
++  </parameter>
++</frame>
++<frame key="4" label="Output:">
++<section name="flaim" />
++  <parameter key ="solution" type="char" default="N/A">
++     <section name="flaim" />
++     <help> name of kml solution file </help>
++  </parameter>
++  <parameter key ="quality" type="double" default="0">
++     <section name="flaim" />
++     <help> quality of kml solution </help>
++  </parameter>
++</frame>
++<!-- inversion -->
++<frame key="1" label="inversion parameters">
++<section name="inversion" />
++  <parameter key ="iscontrol" type="double" default="0">
++     <section name="inversion" />
++     <help> is inversion activated? </help>
++  </parameter>
++  <parameter key ="incomplete_adjoint" type="double" default="1">
++     <section name="inversion" />
++     <help> 1: linear viscosity, 0: non-linear viscosity </help>
++  </parameter>
++  <parameter key ="control_parameters" type="cell" default="{'FrictionCoefficient'}">
++     <section name="inversion" />
++     <help> ex: {'FrictionCoefficient'}, or {'MaterialsRheologyBbar'} </help>
++  </parameter>
++  <parameter key ="nsteps" type="double" default="20">
++     <section name="inversion" />
++     <help> number of optimization searches </help>
++  </parameter>
++  <parameter key ="cost_functions" type="double" default="101">
++     <section name="inversion" />
++     <help> indicate the type of response for each optimization step  </help>
++  </parameter>
++  <parameter key ="cost_functions_coefficients" type="double" default="N/A">
++     <section name="inversion" />
++     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>
++  </parameter>
++  <parameter key ="cost_function_threshold" type="double" default="N/A">
++     <section name="inversion" />
++     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>
++  </parameter>
++  <parameter key ="maxiter_per_step" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> maximum iterations during each optimization step  </help>
++  </parameter>
++  <parameter key ="gradient_scaling" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> scaling factor on gradient direction during optimization, for each optimization step </help>
++  </parameter>
++  <parameter key ="step_threshold" type="double" default="(20x1)">
++     <section name="inversion" />
++     <help> decrease threshold for misfit, default is 30% </help>
++  </parameter>
++  <parameter key ="min_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="max_parameters" type="double" default="N/A">
++     <section name="inversion" />
++     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>
++  </parameter>
++  <parameter key ="vx_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity x component [m/yr] </help>
++  </parameter>
++  <parameter key ="vy_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity y component [m/yr]  </help>
++  </parameter>
++  <parameter key ="vel_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed velocity magnitude [m/yr] </help>
++  </parameter>
++  <parameter key ="thickness_obs" type="double" default="N/A">
++     <section name="inversion" />
++     <help> observed thickness [m]) </help>
++  </parameter>
++</frame>
++<frame key="2" label="Available cost functions">
++<section name="inversion" />
++  <parameter key ="SurfaceAbsVelMisfit" type="string" default="101">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceRelVelMisfit" type="string" default="102">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="SurfaceLogVelMisfit" type="string" default="103">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceLogVxVyMisfit" type="string" default="104">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="SurfaceAverageVelMisfit" type="string" default="105">
++     <section name="inversion" />
++     <help>   </help>
++  </parameter>
++  <parameter key ="ThicknessAbsMisfit" type="string" default="106">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="DragCoefficientAbsGradient" type="string" default="107">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="RheologyBbarAbsGradient" type="string" default="108">
++     <section name="inversion" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="ThicknessAbsGradient" type="string" default="109">
++     <section name="inversion" />
++     <help> </help>
++  </parameter>
++</frame>
++<!-- qmu -->
++<frame key="1" label="qmu parameters">
++<section name="qmu" />
++  <parameter key ="isdakota" type="double" default="0">
++     <section name="qmu" />
++     <help> is qmu analysis activated? </help>
++  </parameter>
++  <parameter key ="variables" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each variable class) </help>
++  </parameter>
++  <parameter key ="responses" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (arrays of each response class) </help>
++  </parameter>
++  <parameter key ="numberofresponses" type="double" default="0">
++     <section name="qmu" />
++     <help> number of responses </help>
++  </parameter>
++  <parameter key ="params" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (array of method-independent parameters)  </help>
++  </parameter>
++  <parameter key ="results" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> (information from dakota files) </help>
++  </parameter>
++  <parameter key ="partition" type="double" default="N/A">
++     <section name="qmu" />
++     <help> user provided mesh partitioning, defaults to metis if not specified </help>
++  </parameter>
++  <parameter key ="numberofpartitions" type="double" default="0">
++     <section name="qmu" />
++     <help> number of partitions for semi-discrete qmu  </help>
++  </parameter>
++  <parameter key ="variabledescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="responsedescriptors" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
++  </parameter>
++  <parameter key ="method" type="struct" default="N/A">
++     <section name="qmu" />
++     <help> array of dakota_method class </help>
++  </parameter>
++  <parameter key ="mass_flux_profile_directory" type="double" default="N/A">
++     <section name="qmu" />
++     <help> directory for mass flux profiles </help>
++  </parameter>
++  <parameter key ="mass_flux_profiles" type="double" default="N/A">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="mass_flux_segments" type="cell" default="(0x0)">
++     <section name="qmu" />
++     <help>  </help>
++  </parameter>
++  <parameter key ="adjacency" type="double" default="N/A">
++     <section name="qmu" />
++     <help> additional outputs requested </help>
++  </parameter>
++  <parameter key ="vertex_weight" type="double" default="N/A">
++     <section name="qmu" />
++     <help> weight applied to each mesh vertex </help>
++  </parameter>
++</frame>
++<!-- outputdefinition -->
++<frame key="1" label="outputdefinition">
++<section name="outputdefinition" />
++  <parameter key ="definitions" type="cell" default="(0x0)">
++     <section name="outputdefinition" />
++     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>
++  </parameter>
++</frame>
++<!-- miscellaneous -->
++<frame key="1" label="miscellaneous parameters">
++<section name="miscellaneous" />
++  <parameter key ="notes" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> notes in a cell of strings </help>
++  </parameter>
++  <parameter key ="name" type="char" default="N/A">
++     <section name="miscellaneous" />
++     <help> model name </help>
++  </parameter>
++  <parameter key ="dummy" type="struct" default="N/A">
++     <section name="miscellaneous" />
++     <help> empty field to store some data </help>
++  </parameter>
++</frame>
++
++
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/issm.xml
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/doc/examples/min_example.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/min_example.xml	(revision 0)
++++ ../trunk-jpl/src/java/doc/examples/min_example.xml	(revision 17808)
+@@ -0,0 +1,40 @@
++<inishell_config>
++	<parameter key="SOME_PARAMETER" type="string">
++		<section name="section1" />
++		<section name="section2" />
++		<help>
++			This is a parameter that asks for a string value and that is present in
++			both the section "section1" and "section2".
++		</help>
++	</parameter>
++	
++	<parameter key="NESTED_PARAMETERS" type="alternative" optional="false">
++		<section name="section1" />
++		<option value="NONE" type="string" />
++		<option value="ONE" type="string">
++			<parameter key="SOME_INTEGER" type="integer" 
++				minimum="-1" maximum="10" default="2">
++				<help>
++					The value for this parameter may be an integer between -1 and 10.
++					The default value is 2.
++					The user may use the + and - buttons to increment/decrement 
++					the number or type the number into the text field.</help>
++				</parameter>
++		</option>
++		<option value="TWO" type="string">
++			<reference name="a_group_that_can_be_referenced" />
++			<help>Here is a reference to two parameters.</help>
++		</option>
++		<help>
++			This parameter belongs to section1. 
++			When the "null" option is selected, the dropdown menu appears
++			red because this parameter is non-optional.
++			When the value "ONE" is selected a nested parameter "SOME_INTEGER" appears. 
++		</help>
++	</parameter>
++	
++	<parametergroup name="a_group_that_can_be_referenced">
++		<parameter key="SOME_FILE" type="file" />
++		<parameter key="A_PATH" type="path" />
++	</parametergroup>
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/doc/examples/min_example.xml
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/lib/miglayout-4.0.jar
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/lib/miglayout-4.0.jar
+===================================================================
+--- ../trunk-jpl/src/java/lib/miglayout-4.0.jar	(revision 17807)
++++ ../trunk-jpl/src/java/lib/miglayout-4.0.jar	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/lib/miglayout-4.0.jar
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/MANIFEST.MF
+===================================================================
+--- ../trunk-jpl/src/java/MANIFEST.MF	(revision 0)
++++ ../trunk-jpl/src/java/MANIFEST.MF	(revision 17808)
+@@ -0,0 +1,14 @@
++Manifest-Version: 1.0
++Ant-Version: Apache Ant 1.8.4
++Created-By: 1.6.0_51-b11-457-11M4509 (Apple Inc.)
++Built-By: larour
++Built-On: 2014-04-14
++Built-At: 14:27:23
++Main-Class: main/GUIBuilder
++Specification-Title: INI file generator
++Specification-Version: 1.0.0-20140414
++Specification-Vendor: SLF, www.slf.ch
++Implementation-Title: INIshell ini creator
++Implementation-Version: 1.0.0
++Implementation-Vendor: SLF, www.slf.ch
++
+Index: ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java	(revision 17808)
+@@ -0,0 +1,267 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ItemEvent;
++import java.text.NumberFormat;
++import java.util.*;
++import java.text.DecimalFormat;
++import java.text.DecimalFormatSymbols;
++
++import javax.swing.JCheckBox;
++import javax.swing.JComponent;
++import javax.swing.JFormattedTextField;
++import javax.swing.JTextField;
++import javax.swing.JLabel;
++import javax.swing.JComboBox;
++
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++import net.miginfocom.swing.MigLayout;
++
++/**
++ * @brief The CombinedPanel may contain other panels, such as check and drop down boxes and text fields
++ *
++ * @author Thomas Egger
++ */
++public class CombinedPanel extends OptionPanel {
++	enum Type { CHOICE, INTEGER, DECIMAL, STRING, DROPDOWN }
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = -6751282938445852408L;;
++
++	private final LinkedList<JComponent> valueComponents;
++
++	/**
++	 * Constructor for a panel that can hold text, numbers and check boxes. It
++	 * corresponds to the parameter type "combination" in the configuration file
++	 * and its subcomponents correspond to the option values.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public CombinedPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent, false); //doing layout by itself
++
++		//System.out.println("Hierarchy: Parent: " + parent.getKey() + ": "+ parent.getHierarchy() + "  own: " + getHierarchy());
++
++		int column1 = 200;
++		column1 -= getHierarchy() * 5;
++		this.setLayout(new MigLayout("gapx 6, wrap 8, ins n 5 n n", "["+column1+"!][78!][78!][78!][78!][78!][78!][20!][200:400:400]", ""));
++
++		this.add(jlabel, "gapleft " + getHierarchy() * 5);
++		this.add(help, "cell 8 0, wrap");
++
++		valueComponents = new LinkedList<JComponent>();
++
++		final Element[] optionElements = XMLHelper.getElementArray(element, "option");
++
++		byte lblcounter = 0;
++
++		DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
++		DecimalFormatSymbols custom = new DecimalFormatSymbols();
++		custom.setDecimalSeparator('.');
++		format.setDecimalFormatSymbols(custom);
++		format.setGroupingUsed(false);
++
++		DecimalFormat integerFormat = (DecimalFormat)DecimalFormat.getIntegerInstance();
++		integerFormat.setGroupingUsed(false);
++
++		int row = 0;
++		int column = 1;
++		
++		for (int i=0;i<optionElements.length;i++) {
++			final Type optionType = Type.valueOf(optionElements[i].getAttribute("type").toUpperCase());
++			final String initialValue = optionElements[i].getAttribute("value");
++			final String label = optionElements[i].getAttribute("label");
++
++			JComponent component = null;
++			JLabel lblcomponent  = null;
++
++			NodeList nodelist = optionElements[i].getChildNodes();
++
++			switch (optionType) {
++			case INTEGER:
++				component = new JFormattedTextField(integerFormat);
++				((JFormattedTextField)component).setColumns(8);
++				if ((initialValue != null) && (!initialValue.equals("")))
++					((JFormattedTextField)component).setValue(new Integer(initialValue));
++				break;
++			case DECIMAL:
++				component = new JFormattedTextField(format);
++				((JFormattedTextField)component).setColumns(8);
++				if ((initialValue != null) && (!initialValue.equals("")))
++					((JFormattedTextField)component).setValue((new Double(initialValue)));
++				break;
++			case STRING:
++				component = new JTextField(10);
++				((JTextField)component).setText(initialValue);
++				break;
++			case CHOICE:
++				component = new JCheckBox(optionElements[i].getAttribute("value"));
++				((JCheckBox)component).addItemListener(this);
++				break;
++			case DROPDOWN:
++				component = new JComboBox();
++
++				for (int jj = 0; jj < nodelist.getLength(); jj++) {
++					if (nodelist.item(jj).getNodeType() == Node.ELEMENT_NODE) {
++						((JComboBox)component).addItem(((Element)nodelist.item(jj)).getAttribute("value"));
++					}
++				}
++
++				((JComboBox)component).setSelectedItem(optionElements[i].getAttribute("value"));
++				((JComboBox)component).addItemListener(this);
++				break;
++			}
++			
++			int width = 1;
++
++			if ((label != null) && (!label.equals(""))){
++				if (label.length() > 12) width = 2; //for oversize labels
++
++				if (column+width >= 7) { 
++					column = 1; 
++					row++; 
++				}
++				lblcomponent = new JLabel(label);
++				valueComponents.add(lblcomponent);
++				
++				//System.out.println("component: " + component.getClass() + ");
++				//System.out.println("component: " + lblcomponent.getClass() + "  size: " + lblcomponent.getWidth() + "  col: " + column + " row: " + row);
++				this.add(lblcomponent, "cell " + column + " " + row + " " + width + " 1");
++				column += width;
++				width = 1;
++				lblcomponent.setVisible(true);
++			}
++
++			if (column >= 7) { 
++				column = 1; 
++				row++; 
++			}
++			//System.out.println("component: " + component.getClass() + "  size: " + component.getWidth() + "  col: " + column + " row: " + row);
++			this.add(component, "cell " + column + " " + row + " " + width + " 1");
++			column++;
++
++			valueComponents.add(component);
++			component.setVisible(true);
++		}
++		
++		//System.out.println("\t-->Instantiated one Combined Panel with " + optionElements.length + " components");
++	}
++
++	@Override
++	public void close() {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void set(HashMap hm, String inkey, String invalue) {
++		if (!hm.containsKey(hashKey)) return;
++		String val = (String)hm.get(hashKey);
++
++		//System.out.println("\tSetting CombinedPanel: " + hashKey + " = " + val);
++		//System.out.println("\tThis CombinedPanel has the key: " + this.getKey() + "  should be: " + inkey + " val: " + invalue);
++
++		//Now loop through valueComponents and see if the value string can be matched
++		if (val == null) return;
++
++		String[] tokens = val.split("\\s+");
++		int counter = 0;
++
++		//System.out.println("\t\tLooking at VAL param: " + val);
++		for (final JComponent comp : valueComponents) {
++			boolean digested = false;
++			if (tokens.length <= counter) break;
++			//System.out.println("\t\tLooking at USER param: " + tokens[counter]);
++
++			if (comp.getClass() == JCheckBox.class) {
++				String cbString = ((JCheckBox) comp).getText();
++				if (tokens[counter].equals(cbString)) {
++					((JCheckBox) comp).setSelected(true);
++					digested = true;
++				}
++			} else if (comp.getClass() == JComboBox.class) {
++				JComboBox box = (JComboBox) comp;
++
++				for (int ii=0; ii<box.getItemCount(); ii++) {
++					String itemString = (String) box.getItemAt(ii);
++					if (itemString.equals(tokens[counter])) {
++						box.setSelectedIndex(ii);
++						digested = true;
++					}
++				}
++			} else if (comp.getClass() == JTextField.class) {
++				((JTextField) comp).setText(tokens[counter]);
++				digested = true;
++			} else if (comp.getClass() == JFormattedTextField.class) {
++				((JFormattedTextField) comp).setText(tokens[counter]);
++				digested = true;
++			}
++
++			if ((comp.getClass() != JLabel.class) && (digested))
++				counter++;
++		}
++	}
++
++	@Override
++	public String getValue() {
++		String value = "";
++
++		for (final JComponent comp : valueComponents) {
++			if (comp.getClass() == JTextField.class) {
++				value += ((JTextField) comp).getText();
++			} else if (comp.getClass() == JFormattedTextField.class) {
++				value += ((JFormattedTextField) comp).getText();
++			} else if (comp.getClass() == JCheckBox.class) {
++				if (((JCheckBox) comp).isSelected())
++					value += ((JCheckBox) comp).getText();
++			} else if (comp.getClass() == JComboBox.class) {
++				value += ((String)((JComboBox)comp).getSelectedItem());
++			}
++
++			if (value.length() > 0)
++				value += " ";
++		}
++
++		if (value.equals("")) return null;
++		else	return value;
++	}
++
++	@Override
++	public void itemStateChanged(ItemEvent arg0) {
++		String selectedOption = null;
++
++		if (arg0.getItemSelectable().getClass() == JCheckBox.class) {
++			selectedOption = ((JCheckBox) arg0.getItemSelectable()).getText();
++			super.handleItemEvent(arg0, selectedOption);
++		} else if (arg0.getItemSelectable().getClass() == JComboBox.class) {
++			selectedOption = ((String)((JComboBox)arg0.getItemSelectable()).getSelectedItem());
++			//HACK: should call super...
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java	(revision 17808)
+@@ -0,0 +1,233 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++ *
++ *   INIshell 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 3 of the License, or
++ *   (at your option) any later version.
++ *
++ *   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++ *
++ */
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++
++import javax.swing.JButton;
++import javax.swing.JOptionPane;
++
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++
++import java.util.List;
++import java.util.ArrayList;
++import java.util.HashMap;
++
++/**
++ * This class introduces more flexibility into the inishell interface:
++ * The SelectorPanel offers the user to add a specific parameter to
++ * the interface.
++ *
++ * @author Thomas Egger
++ */
++public class SelectorPanel extends ControlledPanel implements ActionListener {
++
++	private static final long serialVersionUID = 8610877538909126920L;
++
++	String[] parameters;
++
++	JButton addButton;
++	JButton removeButton;
++	Element template;
++	String  templateKey;
++	HashMap<String, ControlledPanel> mapOfParameters;
++	ControlledPanel cp = null;
++
++	public SelectorPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++		templateKey = ""; //will store the pattern of the key
++
++		addButton = new JButton("+");
++		this.add(addButton, "cell 1 0, split 2, grow");
++		addButton.addActionListener(this);
++
++		removeButton = new JButton("-");
++		this.add(removeButton, "cell 1 0, grow, wrap");
++		removeButton.addActionListener(this);
++
++		//The following lines try to extract the template key (e.g. %::filters#, %::resample, COPY::%)
++		final NodeList nodelist = element.getChildNodes();
++		for (int ii = 0; ii < nodelist.getLength(); ii++) {
++			if (nodelist.item(ii).getNodeType() == Node.ELEMENT_NODE) {
++				Element currentElement = (Element)nodelist.item(ii);
++				if (currentElement.getAttribute("template").equals("true")){
++					template = (Element)currentElement.cloneNode(true);
++					templateKey = template.getAttribute("key");
++					template.setAttribute("template", "false");
++				}
++			}
++		}
++
++		final Element[] options = XMLHelper.getElementArray(element, "option");
++		parameters = new String[options.length + 1];
++		for (int ii=0; ii < options.length; ii++) {
++			parameters[ii] = options[ii].getAttribute("value");
++		}
++		parameters[options.length] = "Other...";
++
++		key = templateKey; //IMPORTANT: this changes the key only, not the label!
++		hashKey = this.getSection().toUpperCase() + "::" + this.getKey().toUpperCase();
++		mapOfParameters  = new HashMap<String, ControlledPanel>();
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent arg0) {
++		if (arg0.getSource() == addButton) {
++			add();
++		} else if (arg0.getSource() == removeButton) {
++			remove();
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//HACK
++		//System.out.println("\tKEY: " + key + "  VAL: " + value);
++
++		String myKey = this.section.toUpperCase() + "::" + templateKey.toUpperCase().replace("%","([a-zA-Z0-9_]+)");
++		myKey = myKey.replace("#","[1-9]+[0-9]*"); //all integer numbers from 1 to infinity
++		//System.out.println("PATTERN: " + myKey);
++		String myKey2 = key.replaceAll(myKey, "$1");
++		String myKey3 = key.replaceAll(myKey, "$0");
++
++		//System.out.println("HUHUI: " + templateKey + " --- " + myKey2 + " -- " + myKey3);
++
++		boolean toAdd = true;
++		if (mapOfParameters.get(myKey2) != null) toAdd = false; //Parameter already exists
++
++		if (toAdd) {
++			ControlledPanel child = add(myKey2, true, hm, key, value);
++			cp = child;
++			if (child != null) child.set(hm, key, value);
++		} else {
++			if (cp != null) cp.set(hm, key, value);
++		}
++	}
++
++	public void add() {
++		String param = "";
++		String choice = "Other...";
++
++		if (parameters.length > 1)
++			choice = (String)JOptionPane.showInputDialog(this, "Add a parameter", "Add", JOptionPane.QUESTION_MESSAGE, null, parameters, null);
++
++		if (choice == null) return;
++
++		if (choice.equals("Other...")) {
++			param = JOptionPane.showInputDialog(this, "Enter the name of a meteo parameter\n(e.g. VW_AVG, P2");
++		} else {
++			param = choice;
++		}
++
++		add(param, false, null, null, null);
++	}
++
++	public ControlledPanel add(String param, boolean doSet, HashMap hm, String key, String value) {
++		//System.out.println("Trying to add SelectorPanel: " + key + " ... " + value);
++
++		if ((param == null) || (param.length() == 0)) return null;
++		param = param.toUpperCase();
++
++		if (mapOfParameters.get(param) != null) return null; //Parameter already exists
++
++		Element child = (Element)template.cloneNode(true);
++		recursiveKeyReplace(child, param);
++		element.appendChild(child);
++
++		ControlledPanel childPanel = null;
++		try {
++			childPanel = ControlledPanel.createSingleParameterPanel(child, this);
++			childPanel.setKey(childPanel.getKey());
++			GUIBuilder.gui.addToTab(childPanel, section, this);
++			childPanel.hold();
++			GUIBuilder.control(childPanel);
++			GUIBuilder.recursiveBuild(child, this, doSet, hm, key, value);
++
++			mapOfParameters.put(param, childPanel);
++		} catch (final GUIBuildException e1) {
++			e1.printStackTrace();
++		}
++
++		this.invalidate();
++
++		return childPanel;
++	}
++
++	@Override
++	public void close() {
++
++	}
++
++	@Override
++	public String getValue() {
++		return null;
++	}
++
++	public void remove() {
++		if (mapOfParameters.size() == 0) return;
++
++		String choice = (String)JOptionPane.showInputDialog(this, "Remove a parameter", "Remove", JOptionPane.QUESTION_MESSAGE, null, mapOfParameters.keySet().toArray(), null);
++
++		if (choice == null) return; //nothing to do
++
++		String childKey = templateKey.replaceAll("%", choice);
++		final Element child = XMLHelper.getCertainChildElement(element, "parameter", "key", childKey);
++
++		if (child == null) return;
++
++		try { //this makes sure that all child nodes are destroyed
++			GUIBuilder.recursiveDestruct(child, this);
++			element.removeChild(child);
++			final ControlledPanel childPanel = GUIBuilder.panelControl.get(section, childKey);
++
++			childPanel.release();
++			childPanel.close();
++
++			if (!childPanel.isNeeded())
++				GUIBuilder.gui.removeFromTab(childPanel, section, this);
++
++			mapOfParameters.remove(choice);
++		} catch (final GUIBuildException e) {
++			e.printStackTrace();
++		}
++
++		this.invalidate();
++	}
++
++	private void recursiveKeyReplace(Element element, String string) {
++		if (element.hasAttribute("key"))
++			element.setAttribute("key", element.getAttribute("key").replaceAll("%", string));
++
++		final NodeList nodelist = element.getChildNodes();
++		for (int i = 0; i < nodelist.getLength(); i++) {
++			if (nodelist.item(i).getNodeType() == Node.ELEMENT_NODE) {
++				recursiveKeyReplace(((Element) nodelist.item(i)), string);
++			}
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java	(revision 17808)
+@@ -0,0 +1,33 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++public class GUIBuildException extends Exception {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 1L;
++
++	public GUIBuildException(String message) {
++		super(message);
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java	(revision 17808)
+@@ -0,0 +1,285 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.Color;
++import java.awt.Component;
++import java.awt.Font;
++
++import javax.swing.JEditorPane;
++import javax.swing.JLabel;
++import javax.swing.JPanel;
++import javax.swing.JSeparator;
++import javax.swing.*;
++import java.util.HashMap;
++import javax.swing.border.*;
++
++import main.GUI;
++import main.GUIBuilder;
++import main.XMLHelper;
++import net.miginfocom.swing.MigLayout;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++/**
++ * Abstract class for JPanels that are maintained with their key and designated
++ * section and can return their current value.
++ */
++public abstract class ControlledPanel extends JPanel {
++
++	private static final long serialVersionUID = 1L;
++
++	private int dependencies;
++
++	protected JLabel jlabel;
++
++	protected String section;
++	protected String key;
++	protected String label;
++	protected String hashKey;
++
++	protected Element element;
++
++	protected boolean optional;
++	protected String replace;
++
++	protected int hierarchy;
++	protected String helptext;
++	protected JEditorPane help;
++
++	/**
++	 * Constructor for a controlled panel.
++	 *
++	 * @param element
++	 */
++	public ControlledPanel(Element element, ControlledPanel parent) {
++		this(element, parent, true);
++	}
++
++	public ControlledPanel(Element element, ControlledPanel parent, boolean doLayout) {
++		super();
++		initialize(element, parent);
++
++		if (doLayout) {
++			int column1 = 200;
++			column1 -= getHierarchy() * 5; //Indentation for the label, 5px per hierarchy level
++
++			setLayout(new MigLayout("gapx 6, wrap 8, top, ins n 5 n n", "["+ column1 + "!][100!][100!][100!][100!][100!][300:400:400]", ""));
++			add(jlabel, "growx, ay top, gaptop 5, gapleft " + getHierarchy() * 5);
++			add(help, "cell 6 0, wrap");
++		}
++	}
++
++	private void initialize(Element element, ControlledPanel parent) {
++		dependencies = 0;
++
++		this.element = element;
++		this.key = element.getAttribute("key");
++		this.label = this.key;
++
++		this.section = element.getAttribute("section");
++		this.hashKey = this.section.toUpperCase() + "::" + this.key.toUpperCase();
++		this.optional = element.getAttribute("optional").equals("true");
++
++		jlabel = new JLabel(this.label + ":      ");
++		jlabel.setForeground(GUI.LABEL_COLOR);
++
++		this.setBackground(Color.white);
++		this.setVisible(true);
++
++		/* Add help to the right side of the panel. */
++		helptext = XMLHelper.getChildElementContent(element, "help");
++		help = ControlledPanel.createHelpPane("<html>"+helptext+"</html>");
++		if (helptext != null) help.setText(helptext);		
++
++		if (parent != null) {
++			setHierarchy(parent.getHierarchy() + 1);
++		} else {
++			setHierarchy(0);
++		}
++	}
++
++	/**
++	 * Creates a ControlledPanel for a parameter that matches its type. (i.e.
++	 * radio buttons for an option parameter, ...
++	 *
++	 * @param element
++	 * @return the Controlled Panel
++	 * @throws GUIBuildException
++	 */
++	public static ControlledPanel createSingleParameterPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		ControlledPanel panel;
++
++		//System.out.println("IN create: " + XMLHelper.getString((Node)element));
++
++		if (element.hasAttribute("counter")) {
++			panel = new DuplicatorPanel(element, parent);
++		} else if (element.getTagName().equals("frame")) {
++			panel = new FramePanel(element, parent);
++		} else if (element.getAttribute("type").equals("path")	|| element.getAttribute("type").equals("file")) {
++			panel = new PathPanel(element, parent);
++		} else if (element.getAttribute("type").equals("alternative") || element.getAttribute("type").equals("logical")) {
++			panel = new AlternativePanel(element, parent);
++		} else if (element.getAttribute("type").equals("choice")) {
++			panel = new CheckBoxPanel(element, parent);
++		} else if (element.getAttribute("type").equals("integer") || element.getAttribute("type").equals("integer+")){
++			panel = new IntegerPanel(element, parent);
++		} else if (element.getAttribute("type").equals("decimal")) {
++			panel = new DecimalPanel(element, parent);
++		} else if (element.getAttribute("type").equals("double")) {
++			panel = new TextfieldPanel(element, parent);
++		} else if (element.getAttribute("type").equals("string") || element.getAttribute("type").equals("char") || element.getAttribute("type").equals("cell")){
++			panel = new TextfieldPanel(element, parent);
++		} else if (element.getAttribute("type").equals("combination")) {
++			panel = new CombinedPanel(element, parent);
++		} else if (element.getAttribute("type").equals("selector")) {
++			panel = new SelectorPanel(element, parent);
++		} else {
++			throw new GUIBuildException("Cannot create a GUI panel for a parameter of type " + element.getAttribute("type"));
++		}
++
++		return panel;
++	}
++
++	public static JEditorPane createHelpPane(String helptext){
++		JEditorPane help = new JEditorPane();
++		help.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
++		help.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
++		help.setEditable(false);
++		help.setContentType("text/html");
++		help.setForeground(Color.GRAY);
++		help.addHyperlinkListener(GUIBuilder.gui);
++
++		if (helptext!=null) {
++			help.setText("<html>"+helptext+"</html>");
++		} else {
++			help.setText("<html></html>");
++		}
++
++		return help;
++	}
++
++	public void setHierarchy(int val) {
++		hierarchy = val;		
++	}
++
++	public int getHierarchy() {
++		return hierarchy;
++	}
++
++	/**
++	 * This method should be called when the panel is removed.
++	 */
++	public abstract void close();
++
++	/**
++	 * @return the GUI component.
++	 */
++	public Component getComponent() {
++		return this;
++	}
++
++	/**
++	 * @return the number of dependencies on the panel.
++	 */
++	public int getDependencies() {
++		return dependencies;
++	}
++
++	/**
++	 * @return the key of the corresponding key / value set
++	 */
++	public String getKey() {
++		return key;
++	}
++
++	/**
++	 * @return the current value of the key / value set null if the key value
++	 *         set should not be printed
++	 */
++	public abstract String getValue();
++
++	/**
++	 * This method should be called when another panel depends needs this panel
++	 * to exist.
++	 */
++	public synchronized void hold() {
++		this.dependencies++;
++	}
++
++	/**
++	 * @return true if dependencies on this panel exist
++	 * @throws GUIBuildException
++	 */
++	public synchronized boolean isNeeded() throws GUIBuildException {
++		if (dependencies == 0) {
++			return false;
++		} else if (dependencies > 0) {
++			return true;
++		} else {
++			throw new GUIBuildException("Inplausible number of dependencies on panel");
++		}
++	}
++
++	/**
++	 * @return true if a value for the underlying parameter is optional
++	 */
++	public boolean isOptional() {
++		return optional;
++	}
++
++	/**
++	 * This method should be called when a panel no longer needs this panel to
++	 * exist. The panel will be removed if no dependency exists.
++	 */
++	public synchronized void release() {
++		this.dependencies--;
++	}
++
++	public void set(HashMap hm, String key, String value) {
++		System.out.println("Set not implemented for ControlledPanel: " + serialVersionUID);
++	}
++
++	public String getHashKey() {
++		return hashKey;
++	}
++
++	/**
++	 * This method sets a new key for a panel and changes its label.
++	 *
++	 * @param key
++	 *            the new key
++	 */
++	public void setKey(String key) {
++		this.key = key;
++		element.setAttribute("key", key);
++		jlabel.setText(this.label + ":      ");
++	}
++
++	/**
++	 * Getter method for the section.
++	 * @return the section
++	 */
++	public String getSection() {
++		return section;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java	(revision 17808)
+@@ -0,0 +1,139 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import main.*;
++
++import java.awt.Color;
++import java.awt.event.ItemEvent;
++import java.util.HashMap;
++
++import javax.swing.JCheckBox;
++import javax.swing.JOptionPane;
++import javax.swing.JLabel;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++public class CheckBoxPanel extends OptionPanel {
++
++	private static final long serialVersionUID = 552186457208697362L;
++	private final JCheckBox[] boxes;
++	String concat;
++	private String setKey = null, setValue = null;
++	private boolean doSet = false;
++	private HashMap setMap;
++
++
++	/**
++	 * Constructor for a panel that can hold a number of checkboxes to compose
++	 * the value for a key/value set.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public CheckBoxPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		concat = "";
++		boxes = new JCheckBox[values.length];
++		for (int i = 0; i < values.length; i++) {
++			boxes[i] = new JCheckBox(values[i]);
++
++			this.add(boxes[i], "cell 1 " + i + ", wrap, ay top");
++
++			String extra = "";
++			if (i > 0)
++				extra = ", gapleft 12";
++
++			this.add(ControlledPanel.createHelpPane(this.helptexts[i]), "cell 6 "+ i +", width 200:400:400, wrap" + extra);
++
++			boxes[i].setBackground(Color.white);
++			boxes[i].setVisible(true);
++			boxes[i].addItemListener(this);
++			if (defaultTrues.contains(values[i])) {
++				boxes[i].setSelected(true);
++				concat += values[i] + " ";
++			}
++		}
++	}
++
++	@Override
++	public void close() {
++		for (final JCheckBox box : boxes)
++			box.setSelected(false);
++	}
++
++	@Override
++	public String getValue() {
++		if (!isOptional() && concat.equals("")) {
++			JOptionPane.showMessageDialog(null, "No option was selected for "
++									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
++									+ ".\nA value is required. Your .ini-file is probably incorrect.",
++									"Problem when building .ini file",
++									JOptionPane.WARNING_MESSAGE);
++		}
++
++		if (concat.equals("")) return null;
++		else	return concat.trim();
++	}
++
++	public synchronized void set(HashMap hm, String key, String value) {
++		String val = ((String)hm.get(hashKey)).toUpperCase();
++		//System.out.println("\tABOUT TO CHANGE CHECKBOXPANEL KEY: " + key + "  VAL: " + val);
++
++		String[] tokens = val.split("\\s+");
++		for (final JCheckBox box : boxes) {
++			box.setSelected(false);
++			
++			for (final String token : tokens) {
++				if (token.equals(box.getText())) {
++					//System.out.println("\t\tSelecting Checkbox: " + token);
++					doSet = true;
++					setKey = key;
++					setValue = value;
++					setMap = hm;
++					box.setSelected(true);
++				}
++			}
++		}
++	}
++
++
++	@Override
++	public synchronized void itemStateChanged(ItemEvent arg0) {
++		final String selectedOption = ((JCheckBox) arg0.getItemSelectable()).getText();
++
++		if (arg0.getStateChange() == ItemEvent.SELECTED) {
++			concat += selectedOption + " ";
++		} else {
++			concat = concat.replaceAll(new String(" " + selectedOption + " "), " ");
++			concat = concat.replaceFirst(new String("^" + selectedOption + " "), ""); //at the beginning of the concat
++		}
++
++		//super.handleItemEvent(arg0, selectedOption);
++		super.handleItemEvent(arg0, selectedOption, doSet, setMap, setKey, setValue);
++		doSet = false;
++		setKey = null;
++		setMap = null;
++		setValue = null;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java	(revision 17808)
+@@ -0,0 +1,175 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.util.*;
++
++import javax.swing.JButton;
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++
++public class DuplicatorPanel extends ControlledPanel implements ActionListener {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 6801877538909126920L;
++	JButton addButton;
++	Element clone;
++
++	JButton removeButton;
++
++	public DuplicatorPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++
++		addButton = new JButton("+");
++		this.add(addButton, "cell 1 0, split 2, grow");
++		addButton.addActionListener(this);
++
++		removeButton = new JButton("-");
++		this.add(removeButton, "cell 1 0, grow, wrap");
++		removeButton.addActionListener(this);
++
++		clone = (Element) element.cloneNode(true);
++		clone.removeAttribute("counter");
++		clone.setAttribute("counted", "true");
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent arg0) {
++		if (arg0.getSource() == addButton) {
++			add();
++		} else if (arg0.getSource() == removeButton) {
++			remove();
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//System.out.println("Trying to add DUPLICATOR Panel: " + key + " ... " + value + "  HashKey: " + this.getHashKey());
++
++		if (key.indexOf('#') == -1) {
++			ControlledPanel child = add(true, hm, key, value);
++			child.set(hm, key, value);
++		}
++	}
++
++	public ControlledPanel add() {
++		return add(false, null, null, null);
++	}
++
++	public ControlledPanel add(boolean doSet, HashMap hm, String key, String value) {
++
++		final Element child = (Element) this.clone.cloneNode(true);
++		final int counter = Integer.parseInt(element.getAttribute("counter"));
++		element.setAttribute("counter", (counter + 1) + "");
++
++		// child.setAttribute("key",element.getAttribute("key").replaceAll("#",counter+""));
++
++		//System.out.println("\t-->Adding a child panel to DUPLICATOR with key: " + key + "  val: " + value + "  HASH: " + this.getHashKey() + "  hier: " + this.getHierarchy());
++
++		recursiveKeyReplace(child, counter + "");
++		element.appendChild(child);
++
++		ControlledPanel childPanel = null;
++		try {
++			childPanel = ControlledPanel.createSingleParameterPanel(child, this);
++			childPanel.setKey(childPanel.getKey());
++			GUIBuilder.gui.addToTab(childPanel, section, this);
++			childPanel.hold();
++			GUIBuilder.control(childPanel);
++			GUIBuilder.recursiveBuild(child, this, doSet, hm, key, value);
++
++		} catch (final GUIBuildException e1) {
++			// TODO Auto-generated catch block
++			e1.printStackTrace();
++		}
++
++		this.invalidate();
++		
++		return childPanel;
++	}
++
++	@Override
++	public void close() {
++		boolean doRemove = true;
++
++		do {
++			doRemove = remove();
++		} while (doRemove);
++	}
++
++	@Override
++	public String getValue() {
++		return null;
++	}
++
++	public boolean remove() {
++		final int counter = Integer.parseInt(element.getAttribute("counter")) - 1;
++		final String childKey = element.getAttribute("key").replace("#", counter + "");
++		final Element child = XMLHelper.getCertainChildElement(element, "parameter", "key", childKey);
++
++		if (child == null) return false;
++
++		element.removeChild(child);
++		element.setAttribute("counter", (counter) + "");
++
++		final ControlledPanel childPanel = GUIBuilder.panelControl.get(section, childKey);
++
++		if (childPanel != null) {
++			childPanel.release();
++			childPanel.close();
++
++			try {
++				if (!childPanel.isNeeded()) {
++					GUIBuilder.gui.removeFromTab(childPanel, section, this);
++				}
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++
++		this.invalidate();
++
++		return true;
++	}
++
++	private void recursiveKeyReplace(Element element, String string) {
++		if (element.hasAttribute("key")) {
++			element.setAttribute("key", element.getAttribute("key").replaceAll("#", string));
++		}
++		final NodeList nodelist = element.getChildNodes();
++		for (int i = 0; i < nodelist.getLength(); i++) {
++			if (nodelist.item(i).getNodeType() == Node.ELEMENT_NODE) {
++				recursiveKeyReplace(((Element) nodelist.item(i)), string);
++			}
++		}
++	}
++
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java	(revision 17808)
+@@ -0,0 +1,144 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ItemEvent;
++import java.awt.event.ItemListener;
++import java.util.LinkedList;
++import java.util.HashMap;
++import javax.swing.event.EventListenerList;
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++
++/**
++ * A ControlledPanel that maintains a group of choices and invokes panel
++ * creation according to the current choices.
++ *
++ * @author korhammer et egger
++ *
++ */
++public abstract class OptionPanel extends ControlledPanel implements ItemListener {
++
++	private static final long serialVersionUID = 88L;
++
++	protected LinkedList<String> defaultTrues;
++	protected EventListenerList listenerList;
++
++	protected String[] values;
++	protected String[] labels;
++	protected String[] helptexts;
++
++	/**
++	 * The constructor for an OptionPanel.
++	 *
++	 * @param element
++	 *            : The xml element which the OptionPanel is created for.
++	 * @throws GUIBuildException
++	 */
++	public OptionPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		this(element, parent, true);
++	}
++
++	public OptionPanel(Element element, ControlledPanel parent, boolean doLayout) throws GUIBuildException {
++		super(element, parent, doLayout);
++		
++		String elementdefault = "";
++
++		if (element.hasAttribute("default"))
++			elementdefault = element.getAttribute("default");
++
++		listenerList = new EventListenerList();
++
++		final Element[] options = XMLHelper.getElementArray(element, "option");
++		defaultTrues = new LinkedList<String>();
++
++		values = new String[options.length];
++		labels = new String[options.length];
++		helptexts = new String[options.length];
++
++		for (int i=0;i<options.length;i++) {
++			values[i] = options[i].getAttribute("value");
++			labels[i] = options[i].getAttribute("label");
++
++			if (labels[i] == "")
++				labels[i] = values[i];
++
++			if (elementdefault.equals(values[i]))
++				defaultTrues.add(values[i]);
++
++			if (options[i].hasAttribute("default") && options[i].getAttribute("default").equals("true"))
++				defaultTrues.add(values[i]);
++
++			helptexts[i] = XMLHelper.getChildElementContent(options[i],"help");
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//System.out.println("Trying to change OptionPanel");
++		//ControlledPanel child = add("TA2");
++		//child.set(element);
++	}
++
++
++	/**
++	 * Invokes the appropriate build or destruct methods when changes are made
++	 * to choices.
++	 *
++	 * @param arg0
++	 * @param selectedOption
++	 */
++	public void handleItemEvent(ItemEvent arg0, String selectedOption) {
++		handleItemEvent(arg0, selectedOption, false, null, null, null);
++	}
++
++	public void handleItemEvent(ItemEvent arg0, String selectedOption, boolean doSet, HashMap hm, String setKey, String setValue) {
++		Element optionElement = XMLHelper.getCertainChildElement(this.element, "option", "label", selectedOption);
++
++		if (optionElement == null)
++			optionElement = XMLHelper.getCertainChildElement(this.element, "option", "value", selectedOption);
++
++		//System.out.println("XML of handleItem("+arg0.getItemSelectable().getClass().toString()+"): " + XMLHelper.getString((Node)optionElement));//this.element));
++
++		if (arg0.getStateChange() == ItemEvent.SELECTED) {
++			try {
++				GUIBuilder.recursiveBuild(optionElement, this, doSet, hm, setKey, setValue);
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++
++		} else {
++			try {
++				GUIBuilder.recursiveDestruct(optionElement, this);
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++
++	}
++
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java	(revision 17808)
+@@ -0,0 +1,129 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import main.GUI;
++
++import java.awt.*;
++import java.awt.event.*;
++import java.util.HashMap;
++
++import javax.swing.JTextField;
++import javax.swing.JOptionPane;
++
++import org.w3c.dom.Element;
++
++/**
++ * A panel that contains a textfield.
++ *
++ * @author korhammer et egger
++ *
++ */
++public class TextfieldPanel extends ControlledPanel implements KeyListener {
++
++	private static final long serialVersionUID = 1L;
++	private String defaultText;
++
++	protected JTextField textfield;
++
++	/**
++	 * The constructor for a TextfieldPanel.
++	 *
++	 * @param element
++	 */
++	public TextfieldPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++		textfield = new JTextField(10);
++		textfield.setVisible(true);
++		this.add(textfield, "width 250:100:400, cell 1 0, growx, ay top, gaptop 3");
++		textfield.addKeyListener(this);
++
++		defaultText = "";
++		if (element.hasAttribute("default")) {
++			defaultText = element.getAttribute("default");
++		}
++		textfield.setText(defaultText);
++
++		if (!optional)
++			textfield.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++
++		this.checkBgColor();
++		textfield.invalidate();
++	}
++
++
++
++	@Override
++	public void close() {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		//System.out.println("\tI'm changing the label of the TextField with key '" + this.getKey() + "'");
++		String val = (String)hm.get(hashKey);
++		if (val != null) textfield.setText(val);
++		this.checkBgColor();
++	}
++
++	@Override
++	public String getValue() {
++		String thetext = textfield.getText();
++
++		if (!isOptional() && thetext.equals("")) {
++			JOptionPane.showMessageDialog(null, "No value was entered for "
++									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
++									+ ".\nA value is required. Your .ini-file is probably incorrect.",
++									"Problem when building .ini file",
++									JOptionPane.WARNING_MESSAGE);
++		}
++
++		if (thetext.equals(""))
++			return null;
++
++		return thetext;
++	}
++
++	/** Handle the key typed event from the text field. */
++	public void keyTyped(KeyEvent e) {}
++
++	/** Handle the key-pressed event from the text field. */
++	public void keyPressed(KeyEvent e) {}
++
++	/** Handle the key-released event from the text field. */
++	public void keyReleased(KeyEvent e) {
++		checkBgColor();
++	}
++
++	public void checkBgColor() {
++		String text = textfield.getText();
++		
++		if (!optional) {
++			if (text.length() > 0) {
++				textfield.setBackground(GUI.NORMAL_BACKGROUND_COLOR);
++			} else {
++				textfield.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++			}
++			textfield.invalidate();
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/FramePanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/FramePanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/FramePanel.java	(revision 17808)
+@@ -0,0 +1,71 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import main.GUIBuilder;
++import main.XMLHelper;
++
++import java.util.HashMap;
++import javax.swing.JPanel;
++import javax.swing.border.*;
++import javax.swing.BorderFactory;
++
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++import net.miginfocom.swing.MigLayout;
++
++public class FramePanel extends ControlledPanel {
++
++	private static final long serialVersionUID = 1987664773406118295L;
++	protected String title = "";
++
++	/**
++	 *
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public FramePanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent, false);
++		this.setLayout(new MigLayout("wrap 8, top, ins n 5 n n", "[200!][100!][100!][100!][100!][100!][300:400:400]", ""));
++
++		if (parent == null)	hierarchy = 1;
++
++		title = element.getAttribute("label");
++
++		Border mytitledborder = BorderFactory.createTitledBorder(title);
++		//Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
++		this.setBorder(mytitledborder);
++
++		this.invalidate();
++	}
++
++	@Override
++	public String getValue() {
++		return null;
++	}
++	
++	@Override
++	public void close() {
++
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/FramePanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/PathPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/PathPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/PathPanel.java	(revision 17808)
+@@ -0,0 +1,118 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.util.HashMap;
++
++import javax.swing.JButton;
++import javax.swing.JFileChooser;
++import javax.swing.JPanel;
++
++import org.w3c.dom.Element;
++
++public class PathPanel extends TextfieldPanel implements ActionListener {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 1486664773406118295L;
++
++	JButton select_button;
++
++	/**
++	 * Creates a panel with a text field and a file / path chooser button.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public PathPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		if (element.getAttribute("type").equals("path")) {
++			select_button = new JButton("Select Path");
++		} else if (element.getAttribute("type").equals("file")) {
++			select_button = new JButton("Select File");
++		} else {
++			throw new GUIBuildException("PathPanel is not applicable for parameter types other than 'file' and 'path'.");
++		}
++
++		this.remove(textfield);
++		this.add(textfield, "cell 1 0, growx, span2");
++
++		select_button.addActionListener(this);
++		select_button.setActionCommand("open chooser");
++		select_button.setVisible(true);
++		this.add(select_button, "cell 3 0, growx, wrap");
++
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent event) {
++		if (event.getActionCommand().equals("open chooser") && event.getSource() == this.select_button) {
++			try {
++				chooseFile();
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		String val = (String)hm.get(hashKey);
++		if (val != null) textfield.setText(val);
++		this.checkBgColor();
++	}
++
++	/**
++	 * Opens the file chooser dialog and writes the path / filepath into the
++	 * texfield.
++	 *
++	 * @throws GUIBuildException
++	 */
++	public void chooseFile() throws GUIBuildException {
++		final JFileChooser filechooser = new JFileChooser(System.getProperty("user.dir"));
++
++		if (element.getAttribute("type").equals("path")) {
++			filechooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
++		} else if (element.getAttribute("type").equals("file")) {
++			filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
++		} else {
++			throw new GUIBuildException("PathPanel is not applicable for parameter types other than 'file' and 'path'.");
++		}
++
++		final int returnVal = filechooser.showOpenDialog(new JPanel());
++
++		if (returnVal == JFileChooser.APPROVE_OPTION) {
++			if (element.getAttribute("type").equals("path")) {
++				textfield.setText(filechooser.getSelectedFile().getAbsolutePath());
++			} else {
++				textfield.setText(filechooser.getSelectedFile().getName());
++			}
++
++			checkBgColor();
++		}
++	}
++
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/PathPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java	(revision 17808)
+@@ -0,0 +1,246 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.*;
++import java.util.HashMap;
++
++import javax.swing.JButton;
++import javax.swing.JOptionPane;
++import javax.swing.SwingConstants;
++
++import org.w3c.dom.Element;
++
++/**
++ * A panel that maintains a number in an editable textfield,
++ * optionally with a maximum and minimum value.
++ * @author korhammer
++ *
++ */
++/**
++ * @author korhammer
++ *
++ */
++public class IntegerPanel extends TextfieldPanel implements ActionListener, FocusListener {
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = -8959578535487185306L;
++
++	private int defaultvalue;
++	private int maximumvalue;
++	private int minimumvalue;
++
++	private boolean printPlus;
++
++	private final JButton down;
++	private final JButton up;
++
++	/**
++	 * Constructor for a NumberPanel.
++	 *
++	 * @param element
++	 * @throws GUIBuildException
++	 */
++	public IntegerPanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		setDefaultvalue(0);
++		minimumvalue = Integer.MIN_VALUE;
++		maximumvalue = Integer.MAX_VALUE;
++		printPlus = false;
++
++		if (element.getAttribute("type").equals("integer+")) {
++			setPrintplus(true);
++		} else {
++			setPrintplus(false);
++		}
++
++		if (element.hasAttribute("default")) {
++			setDefaultvalue(element.getAttribute("default"));
++		}
++		if (element.hasAttribute("maximum")) {
++			setMaximumvalue(element.getAttribute("maximum"));
++		}
++		if (element.hasAttribute("minimum")) {
++			setMinimumvalue(element.getAttribute("minimum"));
++		}
++
++		textfield.setColumns(4);
++		textfield.invalidate();
++		textfield.setHorizontalAlignment(SwingConstants.RIGHT);
++
++		up = new JButton("+");
++		up.addActionListener(this);
++		down = new JButton("-");
++		down.addActionListener(this);
++		this.add(up, "split 2, growx, ay top");
++		this.add(down, "growx, ay top");
++		textfield.addActionListener(this);
++		textfield.addFocusListener(this);
++
++	}
++
++	/**
++	 * Parses a String to an integer. Different from the standard methods as it
++	 * handles the + sign e.g. in time zones.
++	 *
++	 * @param text
++	 * @return the parsed number
++	 * @throws NumberFormatException
++	 */
++	private static int parse(String text) throws NumberFormatException {
++
++		final char first = text.charAt(0);
++
++		if (first == '+')
++			return Integer.parseInt(text.substring(1));
++		if (first == '-')
++			return Integer.parseInt(text);
++		return Integer.parseInt(text);
++	}
++
++	/*
++	 * (non-Javadoc)
++	 *
++	 * @see
++	 * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
++	 */
++	@Override
++	public void actionPerformed(ActionEvent e) {
++		if (e.getSource() == up) {
++			manipulateNumber(1);
++		} else if (e.getSource() == down) {
++			manipulateNumber(-1);
++		} else if (e.getSource() == textfield) {
++			parseTextfield();
++		}
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		String val = (String)hm.get(hashKey);
++		if (val != null) {
++			try {
++				Integer.parseInt(val);
++				textfield.setText(val);
++			} catch (Exception e) {} //Do nothing if conversion fails
++		}
++	}
++
++	@Override
++	public void focusGained(FocusEvent arg0) {
++
++	}
++
++	@Override
++	public void focusLost(FocusEvent arg0) {
++		parseTextfield();
++	}
++
++	/**
++	 * Manipulates the number in the text field by parsing it, adding the
++	 * increment and writing it back into the textfield.
++	 *
++	 * @param increment
++	 */
++	public void manipulateNumber(int increment) {
++		int number;
++
++		try {
++			number = parseTextfield();
++		} catch (final NumberFormatException nfe) {
++			return;
++		}
++
++		if (number + increment <= maximumvalue
++				&& number + increment >= minimumvalue) {
++			number += increment;
++		} else if (number + increment < minimumvalue) {
++			number = minimumvalue;
++		} else if (number + increment > maximumvalue) {
++			number = maximumvalue;
++		}
++
++		printToTextfield(number);
++	}
++
++	/**
++	 * Calls the parse method on the textfield.
++	 *
++	 * @return
++	 * @throws NumberFormatException
++	 */
++	public int parseTextfield() throws NumberFormatException {
++		try {
++			return parse(textfield.getText());
++		} catch (final NumberFormatException nfe) {
++			JOptionPane.showMessageDialog(null, "The textfield " + getKey()
++					+ " does not contain a number.");
++			throw nfe;
++		}
++	}
++
++	/**
++	 * Prints a number to the text field optionally with a plus sign.
++	 *
++	 * @param number
++	 */
++	public void printToTextfield(int number) {
++		if (this.printPlus && number > 0) {
++			textfield.setText("+" + number);
++		} else {
++			textfield.setText("" + number);
++		}
++		checkBgColor();
++	}
++
++	public void setDefaultvalue(int defaultvalue) {
++		this.defaultvalue = defaultvalue;
++		this.printToTextfield(defaultvalue);
++	}
++
++	public void setDefaultvalue(String defaultvalue) {
++		this.defaultvalue = parse(defaultvalue);
++		this.printToTextfield(this.defaultvalue);
++	}
++
++	public void setMaximumvalue(int maximumvalue) {
++		this.maximumvalue = maximumvalue;
++	}
++
++	public void setMaximumvalue(String maximumvalue) {
++		this.maximumvalue = parse(maximumvalue);
++	}
++
++	public void setMinimumvalue(int minimumvalue) {
++		this.minimumvalue = minimumvalue;
++	}
++
++	public void setMinimumvalue(String minimumvalue) {
++		this.minimumvalue = parse(minimumvalue);
++	}
++
++	public void setPrintplus(boolean printPlus) {
++		this.printPlus = printPlus;
++		printToTextfield(parse(textfield.getText()));
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java	(revision 17808)
+@@ -0,0 +1,177 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ItemEvent;
++
++import javax.swing.JComboBox;
++import javax.swing.JOptionPane;
++import java.util.HashMap;
++import javax.swing.*;
++import java.awt.*;
++
++import main.GUI;
++
++import org.w3c.dom.Element;
++
++/**
++ * The AlternativePanel contains a dropdown list with alternatives to choose from.
++ *
++ * @author Thomas Egger
++ *
++ */
++public class AlternativePanel extends OptionPanel {
++
++	private static final long serialVersionUID = 4468480774697888798L;
++	private final JComboBox box;
++
++	private String setKey = null, setValue = null;
++	private boolean doSet = false;
++	private HashMap setMap;
++
++	/**
++	 * Constructor for the AlternativePanel
++	 *
++	 * @param element the <parameter ...> element for which the panel is created.
++	 * @throws GUIBuildException
++	 */
++	public AlternativePanel(Element element, ControlledPanel parent) throws GUIBuildException {
++		super(element, parent);
++
++		box = new JComboBox(labels);
++		box.insertItemAt("", 0);     //Add an empty label
++		box.setVisible(true);
++		box.setSelectedIndex(0);
++		box.addItemListener(this);
++
++		//Issue 263: On OSX the box.setBackground method does not function without this tweak:
++		if (System.getProperty("os.name").equals("Mac OS X")) 
++		    box.setRenderer(new ColorCellRenderer(box.getPreferredSize().width));
++
++		if (!optional) box.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++
++		if (defaultTrues.size() > 1) {
++			throw new GUIBuildException("Element " + getHashKey() + " has multiple default values");
++		} else if (defaultTrues.size() == 1) {
++			box.setSelectedItem(defaultTrues.getFirst());
++		}
++
++		this.add(box, "cell 1 0, growx, ay top, wrap");
++	}
++
++	@Override
++	public void close() {
++		this.box.setSelectedIndex(0);
++	}
++
++	@Override
++	public String getValue() {
++
++		if (box.getSelectedIndex() != 0) {
++			//String selectedString = (String) box.getSelectedItem();
++			int index = box.getSelectedIndex() - 1;
++			if (index < 0)
++				return "";
++
++			return values[index];
++		}
++
++		if (!isOptional()) {
++			JOptionPane.showMessageDialog(null, "No option was selected for "
++									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
++									+ ".\nA value is required. Your .ini-file is probably incorrect.",
++									"Problem when building .ini file",
++									JOptionPane.WARNING_MESSAGE);
++		}
++
++		return null;
++	}
++
++	@Override
++	public synchronized void set(HashMap hm, String key, String value) {
++		doSet = true;
++		setKey = key;
++		setValue = value;
++		setMap = hm;
++
++		if (!hm.containsKey(hashKey)) return;
++		String val = ((String)hm.get(hashKey)).toUpperCase();
++
++		//System.out.println("\tAP: Setting AlternativePanel: " + hashKey + " = " + val);
++
++		for (int ii=0; ii<values.length; ii++) { //loop through all existant items
++			if (val.equals(values[ii].toUpperCase())) { //compare to val
++				this.box.setSelectedIndex(ii+1);
++				break;
++			}
++		}
++	}
++
++	@Override
++	public synchronized void itemStateChanged(ItemEvent arg0) {
++		//Deal with help text
++		help.setText("");
++
++		if ((box.getSelectedIndex() > 0) && (helptexts[box.getSelectedIndex()-1] != null)) {
++			help.setText("<html>" + helptexts[box.getSelectedIndex()-1] + "</html>");
++		} else {
++			if (helptext != null) 
++				help.setText("<html>" + helptext + "</html>");
++		}
++
++		//handle selected Item
++		final String selectedOption = (String) arg0.getItem();
++		if (selectedOption == "") {
++			if (!optional) {
++				box.setBackground(GUI.WARNING_BACKGROUND_COLOR);
++			}
++		} else {
++			if (!optional) {
++				box.setBackground(GUI.NORMAL_BACKGROUND_COLOR);
++			}
++			//System.out.println("\tDOSET of AlternativePanel: " + doSet);
++			super.handleItemEvent(arg0, selectedOption, doSet, setMap, setKey, setValue);
++			doSet = false;
++			setKey = null;
++			setMap = null;
++			setValue = null;
++		}
++	}
++}
++
++class ColorCellRenderer implements ListCellRenderer {
++	protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
++	private Dimension preferredSize = new Dimension(0, 18);
++
++	public ColorCellRenderer(int width) {
++		width -= 50;
++
++		if (width < 100) width = 100; //Default size on OSX
++	
++		preferredSize = new Dimension(width, 18);
++	}
++
++	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
++		JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
++		renderer.setPreferredSize(preferredSize);
++		return renderer;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java	(revision 0)
++++ ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java	(revision 17808)
+@@ -0,0 +1,133 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package gui_elements;
++
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.awt.event.FocusEvent;
++import java.awt.event.FocusListener;
++import java.util.HashMap;
++
++import java.text.DecimalFormat;
++import java.text.ParseException;
++import java.text.DecimalFormatSymbols;
++import javax.swing.JFormattedTextField;
++
++import org.w3c.dom.Element;
++
++public class DecimalPanel extends TextfieldPanel implements ActionListener, FocusListener{
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = 1555742510677354674L;
++	double defaultvalue;
++	double maximumvalue;
++	double minimumvalue;
++
++	JFormattedTextField textfield;
++
++	public DecimalPanel(Element element, ControlledPanel parent) {
++		super(element, parent);
++		this.remove(super.textfield);
++
++		DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
++		DecimalFormatSymbols custom = new DecimalFormatSymbols();
++		custom.setDecimalSeparator('.');
++		format.setDecimalFormatSymbols(custom);
++		format.setGroupingUsed(false);
++
++		textfield = new JFormattedTextField(format);
++		textfield.addActionListener(this);
++		textfield.addFocusListener(this);
++		this.add(textfield,"cell 1 0, growx, ay top, gaptop 3");
++		textfield.setVisible(true);
++		this.invalidate();
++		defaultvalue = 0.0;
++		maximumvalue = Double.MAX_VALUE;
++		minimumvalue = Double.MIN_VALUE;
++
++
++		if(element.hasAttribute("minimum")){
++			minimumvalue = Double.parseDouble(element.getAttribute("minimum"));
++		}
++		if(element.hasAttribute("maximum")){
++			maximumvalue = Double.parseDouble(element.getAttribute("maximum"));
++		}
++		if(element.hasAttribute("default")){
++			defaultvalue = Double.parseDouble(element.getAttribute("default"));
++		}
++		setToDefaultValue();
++	}
++
++	private void setToDefaultValue() {
++		textfield.setValue(new Double(defaultvalue));
++		this.invalidate();
++	}
++
++	private void checkValue(){
++		try {
++			textfield.commitEdit();
++		} catch (ParseException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		}
++		double currentvalue = ((Number)textfield.getValue()).doubleValue();
++		if(currentvalue > maximumvalue){
++			textfield.setValue(new Double(maximumvalue));
++		}
++		else if(currentvalue<minimumvalue){
++			textfield.setValue(new Double(minimumvalue));
++		}
++	}
++
++	public String getValue(){
++		return textfield.getValue().toString();
++	}
++
++	@Override
++	public void set(HashMap hm, String key, String value) {
++		String val = (String)hm.get(hashKey);
++		if (val != null) {
++			try {
++				Double.parseDouble(val);
++				textfield.setText(val);
++			} catch (Exception e) {} //Do nothing if conversion fails
++		}
++	}
++
++	@Override
++	public void focusGained(FocusEvent arg0) {
++		checkValue();
++
++	}
++
++	@Override
++	public void focusLost(FocusEvent arg0) {
++		checkValue();
++
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent arg0) {
++		checkValue();
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/main/PanelControl.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/PanelControl.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/PanelControl.java	(revision 17808)
+@@ -0,0 +1,248 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.ControlledPanel;
++
++import java.io.File;
++import java.io.FileWriter;
++import java.io.IOException;
++import java.util.HashMap;
++import java.util.LinkedList;
++import java.util.Set;
++import java.util.TreeMap;
++import java.util.Iterator;
++
++/**
++ * Class that maintains all ControlledPanels so that values can be retrieved
++ * from panels, ini-files can be written. And a panel is not multiply created.
++ *
++ * @author korhammer
++ *
++ */
++public class PanelControl {
++
++	LinkedList<String> order;
++	HashMap<String, TreeMap<String, ControlledPanel>> panels;
++	HashMap<String, String> comments = null;
++	HashMap<String, String> added_comments = null;
++	HashMap<String, HashMap<String, String>> unusedKeys = null;
++	PanelNode rootNode = null;
++
++	/**
++	 * Constructor for the panel control.
++	 */
++	public PanelControl() {
++		panels = new HashMap<String, TreeMap<String, ControlledPanel>>();
++		order = new LinkedList<String>();
++
++		unusedKeys = new HashMap<String, HashMap<String, String>>();
++	}
++
++	public PanelControl(PanelControl p) {
++		panels = new HashMap<String, TreeMap<String, ControlledPanel>>(p.panels);
++		order = new LinkedList<String>(p.order);
++		if (added_comments != null)
++			added_comments = new HashMap<String, String>(p.added_comments);
++
++		if (comments != null)
++			comments = new HashMap<String, String>(p.comments);
++	}
++
++	public void setUnusedKeys(String key, String value) {
++		//Parse key
++		int offset = key.indexOf("::");
++		String section = key.substring(0, offset);
++		String sectionkey = key.substring(offset + 2);
++
++		HashMap<String, String> hm = unusedKeys.get(section);
++		if (hm == null) unusedKeys.put(section, new HashMap<String, String>());
++
++		unusedKeys.get(section).put(sectionkey, value);
++	}
++
++	public void setComments(HashMap<String, String> inaddedcomments, HashMap<String, String> incomments) {
++		this.added_comments = new HashMap<String, String>(inaddedcomments);
++		this.comments = new HashMap<String, String>(incomments);
++	}
++
++	/**
++	 * @param section
++	 * @param key
++	 * @return true if a panel with such key is maintained in the specified
++	 *         section
++	 */
++	public boolean contains(String section, String key) {
++		if (!panels.containsKey(section))
++			return false;
++
++		return panels.get(section).containsKey(key);
++	}
++
++	/**
++	 *
++	 * @param section
++	 * @param key
++	 * @return the panel with the specified section / key pair
++	 */
++	public ControlledPanel get(String section, String key) {
++		return panels.get(section).get(key);
++	}
++
++	/**
++	 * Prints the ini-file at the specified path.
++	 *
++	 * @param path
++	 */
++	public void printToFile(String path) {
++		/* create file */
++		final File file = new File(path);
++
++		try {
++			final FileWriter writer = new FileWriter(file);
++
++			writer.write(this.toString());
++			writer.close();
++		} catch (final IOException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		}
++	}
++
++	/**
++	 * Adds the panel to the specified section.
++	 *
++	 * @param section
++	 * @param panel
++	 */
++	public void put(String section, ControlledPanel panel) {
++		final String key = panel.getKey();
++		if (!panels.containsKey(section)) {
++			order.add(section);
++			panels.put(section, new TreeMap<String, ControlledPanel>());
++		}
++		panels.get(section).put(key, panel);
++	}
++
++	/**
++	 * Removes the panel with the specified section and key.
++	 *
++	 * @param section
++	 * @param key
++	 * @return the panel
++	 */
++	public ControlledPanel remove(String section, String key) {
++		return panels.get(section).remove(key);
++	}
++
++	/**
++	 * Prints the maintained panels to a string.
++	 *
++	 * @return an ini-file-like structure
++	 */
++	public void setRootNode(PanelNode inrootNode) {
++		rootNode = inrootNode;
++	}
++
++	public String extractKey(String instring) {
++		int offset = instring.indexOf("::");
++		if (offset == -1) return null;
++
++		return instring.substring(offset+2);
++	}
++
++	@Override
++	public String toString() {
++		String out = "";
++
++		for (final String section : order) {
++			/* create section */
++			final String sectionstring = "[" + section.toUpperCase() + "]\n";
++			String keyvaluestring = "";
++
++			/* print section */
++			LinkedList<String> keys = new LinkedList<String>();
++			PanelNode sectionNode = rootNode.get(section.toUpperCase());
++			if (sectionNode != null) sectionNode.getKeyList(keys);
++
++			//final Set<String> keys = panels.get(section).keySet();
++			for (final String hashKey : keys) {
++				String key = extractKey(hashKey);
++				if (key == null) continue;
++
++				final String value = panels.get(section).get(key).getValue();
++				if (value != null) {
++					if ((comments != null) && comments.containsKey(hashKey.toUpperCase())) {
++						String precomments =  comments.get(hashKey.toUpperCase());
++						if (!precomments.equals(""))
++						 	keyvaluestring += precomments;						
++					}
++
++					keyvaluestring += key + "\t=\t" + value;					
++
++					if ((added_comments != null) && added_comments.containsKey(hashKey.toUpperCase()))
++						keyvaluestring += "\t" + added_comments.get(hashKey.toUpperCase());
++
++					keyvaluestring += "\n";
++				}
++			}
++
++			//Add unused keys
++			HashMap<String, String> extra = unusedKeys.get(section.toUpperCase());
++			if (extra != null) {
++				if (!keyvaluestring.equals("")) keyvaluestring += "\n";
++
++				for (String extrakey : extra.keySet()) {
++					String hashKey = section.toUpperCase() + "::" + extrakey.toUpperCase();
++					if ((comments != null) && comments.containsKey(hashKey)) {
++						String precomments =  comments.get(hashKey);
++						if (!precomments.equals(""))
++						 	keyvaluestring += precomments;						
++					}
++				
++					keyvaluestring += extrakey + "\t=\t" + extra.get(extrakey);
++
++					if ((added_comments != null) && added_comments.containsKey(hashKey))
++					    keyvaluestring += "\t" + added_comments.get(hashKey);
++
++					keyvaluestring += "\n";
++				}
++			}
++			
++			//check if there aren't any comments in that section
++			String hashKey = section.toUpperCase() + "::";
++			if ((comments != null) && comments.containsKey(hashKey)) {
++				String precomments =  comments.get(hashKey);
++				if (!precomments.equals("")) {
++					if (precomments.indexOf("\n") == -1) precomments += "\n";
++					keyvaluestring = precomments + keyvaluestring + "\n";
++				}
++			}
++			
++			/* add section only if keys / values are printed */
++			if (!keyvaluestring.equals("")) {
++				out += sectionstring + keyvaluestring + "\n";
++			}
++		}
++
++		return out;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/PanelControl.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/main/XMLHelper.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/XMLHelper.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/XMLHelper.java	(revision 17808)
+@@ -0,0 +1,525 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.GUIBuildException;
++
++import java.io.IOException;
++import java.util.LinkedList;
++
++import javax.xml.parsers.DocumentBuilder;
++import javax.xml.parsers.DocumentBuilderFactory;
++import javax.xml.parsers.ParserConfigurationException;
++import javax.xml.transform.TransformerConfigurationException;
++import javax.xml.transform.TransformerException;
++import javax.xml.transform.TransformerFactory;
++
++import org.w3c.dom.Document;
++import org.w3c.dom.Element;
++import org.w3c.dom.Node;
++import org.w3c.dom.NodeList;
++import org.xml.sax.SAXException;
++
++//for the XML printing
++import javax.xml.transform.stream.StreamResult;
++import javax.xml.transform.*;
++import javax.xml.transform.dom.*;
++import java.io.StringWriter;
++
++public class XMLHelper {
++
++	/**
++	 * Find the parameter values for which the element should be cloned
++	 * e.g. for section tags.
++	 *
++	 * @param element
++	 * @param tagName
++	 * @param attributeName
++	 * @param parentArgument
++	 * @return the
++	 */
++	public static String[] findApplicableValues(Element element,
++			String tagName, String attributeName, String parentArgument) {
++
++		final String[] argumentsFromElement = getAttributesFromChildren(
++				element, tagName, attributeName);
++
++		/*
++		 * If no such arguments are specified for the current element but there
++		 * are for the parent element, take that of the parent.
++		 */
++		if (argumentsFromElement.length == 0 && parentArgument != null)
++			return new String[] { parentArgument };
++		else if ((argumentsFromElement.length > 0 && parentArgument != null)) {
++			if (getCertainChildElement(element, tagName, attributeName,
++					parentArgument) != null)
++				return new String[] { parentArgument };
++			else
++				/*
++				 * The empty intersection is an empty array so that his case can
++				 * be handled differently from the null case below.
++				 */
++				return new String[0];
++		}
++
++		/*
++		 * If no arguments are specified for the parent use all element
++		 * arguments.
++		 */
++		else if (argumentsFromElement.length > 0 && parentArgument == null)
++			return argumentsFromElement;
++		else if (argumentsFromElement.length == 0 && parentArgument == null)
++			return null;
++		return null;
++	}
++
++	/**
++	 * Get all children of an element that have a certain element tag and
++	 * extract the values for a certain attribute.
++	 *
++	 * @param parent
++	 *            the parent element
++	 * @param tag
++	 *            the element tag
++	 * @param attribute
++	 *            the attribute name
++	 *
++	 * @return a String array with the attribute values
++	 */
++	public static String[] getAttributesFromChildren(Element parent, String tag, String attribute) {
++		final Element[] elements = getElementArray(parent, tag);
++
++		final String[] attributes = new String[elements.length];
++		for (int i = 0; i < elements.length; i++) {
++			attributes[i] = elements[i].getAttribute(attribute);
++		}
++		return attributes;
++	}
++
++	/**
++	 * Returns the first child element that has the specified element tag and
++	 * the value for the specified attribute.
++	 *
++	 * @param parent
++	 * @param tag
++	 * @param attribute
++	 * @param value
++	 * @return the first child element that meets the criteria
++	 */
++	public static Element getCertainChildElement(Element parent, String tag,
++			String attribute, String value) {
++		final Element[] allElements = getElementArray(parent, tag);
++		for (final Element element : allElements) {
++			if (element.hasAttribute(attribute)) {
++				if (element.getAttribute(attribute).equals(value))
++					return element;
++			}
++		}
++		return null;
++	}
++
++	/**
++	 * For the specified element gets the text that is contained in the first
++	 * child that has a certain element name.
++	 *
++	 *
++	 * @param parent
++	 *            the parent element
++	 * @param tag
++	 *            the element tag for the child
++	 * @return the text content
++	 */
++	public static String getChildElementContent(Element parent, String tag) {
++		final Element[] elements = getElementArray(parent, tag);
++		if (elements.length == 0)
++			return null;
++
++		return elements[0].getTextContent();
++	}
++
++
++
++	/**
++	 * @param parent
++	 * @param tag
++	 * @return all child elements of the parent with the specified tag
++	 */
++	public static Element[] getElementArray(Element parent, String tag) {
++		if (!parent.hasChildNodes())
++			return new Element[0];
++
++		final NodeList nodeList = parent.getChildNodes();
++		final LinkedList<Element> elementlist = new LinkedList<Element>();
++		for (int i = 0; i < nodeList.getLength(); i++) {
++
++			final Node element = nodeList.item(i);
++			if (element.getNodeType() == Node.ELEMENT_NODE && ((Element) element).getTagName().equals(tag)) {
++				elementlist.add((Element) element);
++			}
++		}
++		final Element[] elements = new Element[elementlist.size()];
++
++		return elementlist.toArray(elements);
++	}
++
++	public static Element[] getElementArray(Element parent, String[] tags) {
++		if (!parent.hasChildNodes())
++			return new Element[0];
++
++		final NodeList nodeList = parent.getChildNodes();
++		final LinkedList<Element> elementlist = new LinkedList<Element>();
++		for (int ii = 0; ii < nodeList.getLength(); ii++) {
++
++			final Node element = nodeList.item(ii);
++			if (element.getNodeType() == Node.ELEMENT_NODE) {
++				//Loop through all possible tags
++				for (int jj=0; jj<tags.length; jj++) {
++					if (((Element) element).getTagName().equals(tags[jj])) {
++						elementlist.add((Element) element);
++						break;
++					}
++				}
++			}
++		}
++
++		final Element[] elements = new Element[elementlist.size()];
++		return elementlist.toArray(elements);
++	}
++
++	/**
++	 * Prints the Document object to the console. as XML.
++	 *
++	 * @param doc
++	 */
++	public static String printToScreen(Document doc) {
++
++		final javax.xml.transform.TransformerFactory tfactory = TransformerFactory
++				.newInstance();
++
++		javax.xml.transform.Transformer xform;
++		try {
++			xform = tfactory.newTransformer();
++
++			final javax.xml.transform.Source src = new javax.xml.transform.dom.DOMSource(
++					doc);
++
++			final java.io.StringWriter writer = new java.io.StringWriter();
++			final javax.xml.transform.Result result = new javax.xml.transform.stream.StreamResult(
++					writer);
++
++			xform.transform(src, result);
++
++			return writer.toString();
++
++		} catch (final TransformerConfigurationException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		} catch (final TransformerException e) {
++			// TODO Auto-generated catch block
++			e.printStackTrace();
++		}
++		return null;
++	}
++
++
++
++	/**
++	 * Reads an XML file and writes it into a Document structure.
++	 *
++	 * @param filepath
++	 * @param xsdpath
++	 *            the path of the W3 XML schema that the file is based on.
++	 * @throws GUIBuildException
++	 */
++	public static Document readXML(String filepath, String xsdpath)
++			throws GUIBuildException {
++
++		/* read XML file and write it into Document structure */
++
++		final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
++		dbf.setIgnoringComments(true);
++		dbf.setValidating(true);
++		dbf.setIgnoringElementContentWhitespace(true);
++
++		dbf.setAttribute(
++				"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
++				"http://www.w3.org/2001/XMLSchema");
++		dbf.setAttribute(
++				"http://java.sun.com/xml/jaxp/properties/schemaSource", xsdpath);
++
++
++		DocumentBuilder db;
++		Document doc;
++
++		try {
++
++			db = dbf.newDocumentBuilder();
++			doc = db.parse(filepath);
++		} catch (final ParserConfigurationException e) {
++			throw new GUIBuildException(e.getMessage());
++		} catch (final SAXException e) {
++			throw new GUIBuildException(e.getMessage());
++		} catch (final IOException e) {
++			throw new GUIBuildException(e.getMessage());
++		}
++
++		doc.normalize();
++		doc.normalizeDocument();
++
++		resolveIncludes(doc, xsdpath);
++		resolveReferences(doc);
++		recursivelyResolveSections(doc.getDocumentElement(), null);
++		recursivelyResolveReplaces(doc.getDocumentElement(), null);
++
++		return doc;
++	}
++
++	/**
++	 * This method recursively traverses the document tree and replaces all
++	 * parameters that contain replace elements with the corresponding number of
++	 * cloned elements.
++	 *
++	 * @param current
++	 *            the current element
++	 * @param parentReplace
++	 *
++	 */
++	public static void recursivelyResolveReplaces(Element current,
++			String parentReplace) {
++
++		final String[] replacements = XMLHelper.findApplicableValues(
++				current, "replace", "name", parentReplace);
++
++		/* delete replace children */
++		final Element[] replaceChildren = XMLHelper.getElementArray(current,
++				"replace");
++		for (final Element replace : replaceChildren) {
++			current.removeChild(replace);
++		}
++
++		if (replacements == null) {
++			final NodeList childNodes = current.getChildNodes();
++			final Node[] nodes = new Node[childNodes.getLength()];
++			for (int i = 0; i < childNodes.getLength(); i++) {
++				nodes[i] = childNodes.item(i);
++			}
++
++			for (final Node node : nodes) {
++				if (node.getNodeType() == Node.ELEMENT_NODE) {
++					XMLHelper.recursivelyResolveReplaces((Element) node,
++							parentReplace);
++				}
++			}
++		} else if (replacements.length == 0) {
++			current.getParentNode().removeChild(current);
++		} else if (replacements != null) {
++			/* clone element */
++			for (final String replace : replacements) {
++				final Element clone = (Element) current.cloneNode(true);
++				clone.setAttribute("key",
++						clone.getAttribute("key").replaceAll("%", replace));
++				clone.setAttribute("replaced", replace);
++				current.getParentNode().appendChild(clone);
++
++				/* Recursion: Do not do recursion on NodeList as it is updated */
++				final NodeList childNodes = clone.getChildNodes();
++				final Node[] nodes = new Node[childNodes.getLength()];
++				for (int i = 0; i < childNodes.getLength(); i++) {
++					nodes[i] = childNodes.item(i);
++				}
++
++				for (final Node node : nodes) {
++					if (node.getNodeType() == Node.ELEMENT_NODE) {
++						XMLHelper.recursivelyResolveReplaces((Element) node,
++								replace);
++					}
++				}
++
++			}
++			current.getParentNode().removeChild(current);
++		}
++	}
++
++	/**
++	 * This method recursively traverses the document tree and replaces all
++	 * parameters that contain section elements with the corresponding number of
++	 * cloned elements.
++	 *
++	 * @param current
++	 */
++	public static void recursivelyResolveSections(Element current,
++			String parentSection) {
++
++		final String[] sections = XMLHelper.findApplicableValues(current,
++				"section", "name", parentSection);
++
++
++		final Element[] sectionChildren = XMLHelper.getElementArray(current,
++				"section");
++		for (final Element section : sectionChildren) {
++			current.removeChild(section);
++		}
++
++		if (sections == null) {
++			final NodeList childNodes = current.getChildNodes();
++			final Node[] nodes = new Node[childNodes.getLength()];
++			for (int i = 0; i < childNodes.getLength(); i++) {
++				nodes[i] = childNodes.item(i);
++			}
++
++			for (final Node node : nodes) {
++				if (node.getNodeType() == Node.ELEMENT_NODE) {
++					XMLHelper.recursivelyResolveSections((Element) node,
++							parentSection);
++				}
++			}
++		} else if (sections != null) {
++			/* clone element */
++			for (final String section : sections) {
++				final Element clone = (Element) current.cloneNode(true);
++				clone.setAttribute("section", section);
++
++				current.getParentNode().appendChild(clone);
++
++				/* Recursion: Do not do recursion on NodeList as it is updated */
++				final NodeList childNodes = clone.getChildNodes();
++				final Node[] nodes = new Node[childNodes.getLength()];
++				for (int i = 0; i < childNodes.getLength(); i++) {
++					nodes[i] = childNodes.item(i);
++				}
++
++				for (final Node node : nodes) {
++					if (node.getNodeType() == Node.ELEMENT_NODE) {
++						XMLHelper.recursivelyResolveSections((Element) node,
++								section);
++					}
++				}
++
++			}
++			current.getParentNode().removeChild(current);
++		}
++	}
++
++	/**
++	 * Parses an XML file as specified in the path of an "include" element and
++	 * replaces the include element with the content of the XML file.
++	 *
++	 * @param doc
++	 */
++	public static Document resolveIncludes(Document doc, String xsdpath) {
++		final NodeList include = doc.getElementsByTagName("include");
++
++		for (int i = 0; i < include.getLength(); i++) {
++
++			final String includePath = ((Element) include.item(i))
++					.getAttribute("path");
++
++			try {
++				final Document partialDocument = readXML(includePath, xsdpath);
++
++				final NodeList children = partialDocument.getChildNodes()
++						.item(0).getChildNodes();
++				final Node parent = include.item(i).getParentNode();
++
++				for (int j = 0; j < children.getLength(); j++) {
++					final Node imported = doc
++							.importNode(children.item(j), true);
++					parent.appendChild(imported);
++				}
++
++				// parent.replaceChild(fragment, include.item(i));
++			} catch (final GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++
++		}
++
++		return doc;
++	}
++
++	/**
++	 * Manipulates the document structure, so that "reference" elements are
++	 * replaced by the corresponding "parametergroup".
++	 *
++	 * @param doc
++	 * @return
++	 */
++	public static Document resolveReferences(Document doc) {
++
++		final NodeList references = doc.getElementsByTagName("reference");
++		final NodeList parametergroups = doc.getElementsByTagName("parametergroup");
++
++		while (references.getLength() != 0) {
++
++			final Element referenceElement = (Element) references.item(0);
++
++			final Element parent = (Element) referenceElement.getParentNode();
++
++			parent.removeChild(referenceElement);
++
++			for (int i = 0; i < parametergroups.getLength(); i++) {
++
++				final Node parametergroupElement = parametergroups.item(i);
++
++				if (((Element) parametergroupElement).getAttribute("name")
++						.equals(referenceElement.getAttribute("name"))) {
++					final NodeList children = parametergroupElement
++							.getChildNodes();
++
++					for (int j = 0; j < children.getLength(); j++) {
++						final Node clone = children.item(j).cloneNode(true);
++						parent.appendChild(clone);
++					}
++				}
++			}
++		}
++
++		while (parametergroups.getLength() != 0) {
++			parametergroups.item(0).getParentNode()
++					.removeChild(parametergroups.item(0));
++		}
++
++		return doc;
++	}
++
++
++	/**
++	 * @brief  The funciton expects a Node element as argument and transform the XML
++	 *         (sub)tree starting with the given Node into a string
++	 * @return A string representing the (sub)tree starting with node
++	 * @author Thomas Egger
++	 */
++	public static String getString(Node node){
++		String str = "";
++
++		try {
++			Transformer transformer = TransformerFactory.newInstance().newTransformer();
++			StringWriter buffer = new StringWriter();
++			transformer.transform(new DOMSource(node), new StreamResult(buffer));
++			str = buffer.toString();
++		} catch (Exception ex) {
++			throw new RuntimeException("Error converting to String", ex);
++		}
++
++		return str;
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/XMLHelper.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/main/GUI.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/GUI.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/GUI.java	(revision 17808)
+@@ -0,0 +1,548 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.ControlledPanel;
++import gui_elements.GUIBuildException;
++
++import java.awt.BorderLayout;
++import java.awt.Color;
++import java.awt.Component;
++import java.awt.Container;
++import java.awt.Desktop;
++import java.awt.*;
++import java.awt.event.ActionEvent;
++import java.awt.event.ActionListener;
++import java.awt.event.WindowEvent;
++import java.awt.event.WindowListener;
++import java.io.IOException;
++import java.net.URISyntaxException;
++import java.util.HashMap;
++import java.util.LinkedList;
++
++import javax.swing.BoxLayout;
++import javax.swing.ImageIcon;
++import javax.swing.JButton;
++import javax.swing.JEditorPane;
++import javax.swing.JFileChooser;
++import javax.swing.JFrame;
++import javax.swing.JOptionPane;
++import javax.swing.JPanel;
++import javax.swing.JScrollPane;
++import javax.swing.JTabbedPane;
++import javax.swing.JToolBar;
++import javax.swing.event.HyperlinkEvent;
++import javax.swing.event.HyperlinkListener;
++import javax.swing.filechooser.FileNameExtensionFilter;
++import java.io.*;
++import javax.swing.*;
++import java.awt.*;
++import java.awt.event.*;
++
++import net.miginfocom.swing.MigLayout;
++
++/**
++ * The GUI created by the author.
++ *
++ * @author korhammer et egger
++ *
++ */
++public class GUI extends JFrame implements WindowListener, ActionListener, HyperlinkListener {
++
++	/**
++	 *
++	 */
++	private static final long serialVersionUID = -2428732881181670225L;
++	public static PanelNode rootNode = null;
++
++	private static String title = GUI.class.getPackage().getImplementationTitle() + " " + GUI.class.getPackage().getImplementationVersion();
++
++	public static final Color LABEL_COLOR = Color.decode("#000080");
++	public static Color NORMAL_BACKGROUND_COLOR = Color.decode("#EEEEEE");
++	public static Color WARNING_BACKGROUND_COLOR = Color.decode("#FF0011");
++
++	public static ImageIcon openicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/xml_open.png"));
++	public static ImageIcon openiniicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/fileopen.png"));
++	public static ImageIcon exporticon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/filesave.png"));
++	public static ImageIcon previewicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/kghostview.png"));
++	public static ImageIcon reseticon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/reset.png"));
++
++	private final JButton createbutton;
++	private final JButton previewButton;
++	private final JButton openbutton;
++	private final JButton openinibutton;
++	private final JButton resetbutton;
++
++	private final JTabbedPane tabpane;
++	private final JToolBar toolbar;
++	private HashMap<String,JPanel> tabpanels;
++
++	private String configFilePath, iniFilePath;
++
++	/*
++	 * Creates a window with the static components of the GUI, i.e. components
++	 * that do not depend on the configuration file.
++	 */
++	public GUI() throws GUIBuildException {
++		super(title);
++
++		configFilePath = System.getProperty("user.dir");
++		iniFilePath = System.getProperty("user.dir");
++
++		tabpanels = new HashMap<String,JPanel>();
++
++		Dimension screenDim = new Dimension(1280, 800);
++		Dimension maxDim = null;
++
++		if (this.getMaximizedBounds() == null) {
++			Toolkit tk = Toolkit.getDefaultToolkit();
++			maxDim = tk.getScreenSize();
++			this.setMaximizedBounds(new Rectangle(0, 0, (int)maxDim.getWidth(), (int)maxDim.getHeight()));
++		} else {
++			maxDim = this.getMaximizedBounds().getSize();
++		}
++
++		if (maxDim.height < screenDim.height) {
++			screenDim.height = maxDim.height;
++			if (screenDim.height > 100)
++				screenDim.height -= 25;
++		}
++
++		if (maxDim.width < screenDim.width) {
++			screenDim.width = maxDim.width;
++			if (screenDim.width > 100)
++				screenDim.width -= 25;
++		}
++
++		this.setSize(screenDim);
++		//this.setExtendedState(MAXIMIZED_BOTH);
++		this.setVisible(true);
++		this.setLayout(new BorderLayout());
++
++		this.toolbar = new JToolBar();
++		toolbar.setLayout(new BoxLayout(toolbar, 1));
++		toolbar.setFloatable(false);
++		this.setVisible(true);
++		this.add(toolbar, BorderLayout.WEST);
++
++		this.tabpane = new JTabbedPane();
++		this.add(tabpane);
++		tabpane.setVisible(true);
++
++		this.openbutton = new JButton(openicon);
++		this.openbutton.setActionCommand("open config");
++		this.openbutton.setToolTipText("Open XML-configuration");
++		openbutton.addActionListener(this);
++		toolbar.add(this.openbutton);
++
++		this.openinibutton = new JButton(openiniicon);
++		this.openinibutton.setActionCommand("open ini");
++		this.openinibutton.setToolTipText("Open existing INI file");
++		openinibutton.addActionListener(this);
++		toolbar.add(this.openinibutton);
++
++		this.resetbutton = new JButton(reseticon);
++		this.resetbutton.setActionCommand("reset");
++		this.resetbutton.setToolTipText("Reset Interface");
++		resetbutton.addActionListener(this);
++		toolbar.add(this.resetbutton);
++
++		this.createbutton = new JButton(exporticon);
++		this.createbutton.setActionCommand("write config");
++		this.createbutton.setToolTipText("Write to INI-file");
++		createbutton.addActionListener(this);
++		toolbar.add(this.createbutton);
++
++		this.previewButton = new JButton(previewicon);
++		this.previewButton.setActionCommand("preview");
++		this.previewButton.setToolTipText("Preview INI-file");
++		previewButton.addActionListener(this);
++		toolbar.add(previewButton);
++
++		this.addWindowListener(this);
++
++		rootNode = new PanelNode("");
++	}
++
++	/**
++	 * Writes the application name into the GUI window title bar.
++	 *
++	 * @param application
++	 */
++	public void setApplicationForTitle(String application){
++		if(application.equals("")){
++			this.setTitle(title);
++		}
++		else{
++			this.setTitle(title + " for "+application);
++		}
++	}
++
++	public void hideOpenButton(){
++		openbutton.setVisible(false);
++	}
++
++	/**
++	 * Closes all tabs.
++	 */
++	public void closeAllTabs(){
++		tabpane.removeAll();
++	}
++
++	/**
++	 * Adds a component to the tab specified and creates the tab if it does not
++	 * already exist.
++	 *
++	 * @param comp
++	 * @param tabName
++	 * @throws GUIBuildException
++	 */
++	public void addToTab(ControlledPanel comp, String tabName, ControlledPanel parentPanel) throws GUIBuildException {
++		tabName = Character.toUpperCase(tabName.charAt(0)) + tabName.substring(1).toLowerCase();
++
++		String section = ((ControlledPanel)comp).getSection().toUpperCase();
++		String key = section + "::" + ((ControlledPanel)comp).getKey();//((ControlledPanel)comp).getHashKey();
++		//System.out.println("\tPanel: " + ((ControlledPanel)comp).getHashKey() + "   Section: " + ((ControlledPanel)comp).getSection());
++
++		PanelNode sectionNode = rootNode.getChild(section);
++		if (sectionNode == null) {
++			PanelNode tmp = new PanelNode(section);
++			//System.out.println("\t--Adding section '" + section + "' to tree");
++			sectionNode = rootNode.add(tmp);
++		}
++
++		if (parentPanel != null) {
++			//System.out.println("\tLooking for node: " + parentPanel.getHashKey());
++			sectionNode = sectionNode.get(parentPanel.getSection().toUpperCase() + "::" + parentPanel.getKey());
++		}
++
++		if (sectionNode != null) {
++			PanelNode keyNode = sectionNode.get(key);
++			if (keyNode == null) {
++				PanelNode tmp = new PanelNode(key);
++				keyNode = sectionNode.add(tmp);
++				//System.out.println("\t--Adding key '" + key + "' to tree as leaf to " + sectionNode.getData());
++			}
++		}
++
++		JPanel tab;
++		if (tabpane.indexOfTab(tabName) == -1) {
++
++			tab = new JPanel();
++			tab.setBackground(Color.white);
++			tab.setVisible(true);
++			tab.setLayout(new MigLayout("wrap 1"));
++
++			JScrollPane scrollpane = new JScrollPane(tab);
++			tabpane.add(tabName, scrollpane);
++			tabpanels.put(tabName, tab);
++
++		} else {
++			tab = tabpanels.get(tabName);
++		}
++
++		if (parentPanel != null && containsPanel(tab, parentPanel)) {
++			parentPanel.add(comp, "span");
++		} else {
++			tab.add(comp);
++		}
++
++		//JViewport jv = ((JScrollPane)tabpane.getComponentAt(tabpane.indexOfTab(tabName))).getViewport();
++		//jv.setViewPosition(new Point(0,0));
++
++		this.validate();
++	}
++
++	public void removeFromTab(ControlledPanel parameterPanel, String section, ControlledPanel parentPanel) {
++		final String tabTitle = section.substring(0, 1).toUpperCase() + section.substring(1).toLowerCase();
++		final int index = tabpane.indexOfTab(tabTitle);
++
++		final Container container = (Container) tabpane.getComponentAt(index);
++
++		//System.out.println("Removing Panel: " + parameterPanel.getHashKey());
++		PanelNode tmp = rootNode.get(parameterPanel.getSection().toUpperCase() + "::" + parameterPanel.getKey());
++		tmp.getParent().remove(tmp);
++
++		if (parentPanel != null && containsPanel(container, parentPanel)) {
++			parentPanel.remove(parameterPanel);
++		} else {
++			container.remove(parameterPanel);
++		}
++
++		GUIBuilder.panelControl.remove(section, parameterPanel.getKey());
++
++		container.repaint();
++		this.validate();
++	}
++
++	public boolean containsPanel(Container container, JPanel panel) {
++
++		for (final Component component : container.getComponents()) {
++			if (component == panel)
++				return true;
++			if (containsPanel((Container) component, panel))
++				return true;
++		}
++		return false;
++	}
++
++	@Override
++	public void actionPerformed(ActionEvent e) {
++		if (e.getActionCommand().equals("write config") && GUIBuilder.application!=null ) {
++			GUIBuilder.panelControl.setRootNode(rootNode);
++
++			try {
++				GUIBuilder.printIOFile();
++			} catch (final IOException e1) {
++				// TODO Auto-generated catch block
++				e1.printStackTrace();
++			} catch (final GUIBuildException e2) {
++				// TODO Auto-generated catch block
++				e2.printStackTrace();
++			}
++		} else if (e.getActionCommand().equals("preview") && GUIBuilder.application!=null) {
++			GUIBuilder.panelControl.setRootNode(rootNode);
++			previewINIFile();
++		} else if (e.getActionCommand().equals("reset") && GUIBuilder.application!=null) {
++			resetGUI();
++		} else if( (e.getActionCommand().equals("open config"))) {
++			openFile();
++		} else if( (e.getActionCommand().equals("open ini"))) {
++			openINIFile();
++		}
++	}
++
++	public void resetGUI() {
++		try {
++			int returnval = GUIBuilder.closeFile();
++			if (returnval == JOptionPane.CANCEL_OPTION) return;
++			GUIBuilder.buildGUI(GUIBuilder.currentConfigFile);
++		} catch (GUIBuildException e) {
++			e.printStackTrace();
++		}
++	}
++
++	public void previewINIFile(){
++		JFrame frame = new JFrame();
++		frame.setSize(600,800);
++		frame.setVisible(true);
++		//frame.setLayout(new BorderLayout());
++
++		JEditorPane pane = new JEditorPane();
++
++		pane.setText(GUIBuilder.panelControl.toString());
++		pane.setVisible(true);
++		pane.setEditable(false);
++
++		JScrollPane scrollPane = new JScrollPane(pane);
++		scrollPane.setVisible(true);
++		frame.add(scrollPane);
++
++		frame.validate();
++		frame.repaint();
++	}
++
++	public void openINIFile(){
++		final FileNameExtensionFilter inifilter = new FileNameExtensionFilter(".ini files", "ini");
++		final JFileChooser filechooser = new JFileChooser(iniFilePath);
++		filechooser.setFileFilter(inifilter);
++		final int returnval = filechooser.showOpenDialog(new JPanel());
++
++		HashMap<String, String> hm = new HashMap<String, String>();
++		HashMap<String, String> comments = new HashMap<String, String>();
++		HashMap<String, String> added_comments = new HashMap<String, String>();
++
++		if (returnval == JFileChooser.APPROVE_OPTION) {
++			final String path = filechooser.getSelectedFile().toString();
++			if (filechooser.getSelectedFile().isDirectory()) return;
++
++			iniFilePath = filechooser.getSelectedFile().getParent();
++
++			System.out.println("Opening INI file: " + path);
++
++			try {
++				BufferedReader br = new BufferedReader(new FileReader(path));
++				String line;
++
++				String section = "GENERAL::";
++				String clines = "";
++
++				while((line = br.readLine()) != null) {
++					int offset = line.indexOf(";");
++					int offset2 = line.indexOf("#");
++
++					if ((offset2 != -1) && (offset != -1)) {
++						if (offset2 < offset) offset = offset2;
++					} else if ((offset2 != -1) && (offset == -1)) {
++						offset = offset2;
++					}
++
++					String comment = null;
++				     //System.out.println("CLINES" + clines);
++					if (offset != -1) {
++						//System.out.println("COMMENT: " + line.substring(offset));
++						comment = line.substring(offset);
++					} else {
++						//System.out.println("COMMENTLESS");
++					}
++
++					if (-1 != offset) line = line.substring(0, offset);
++
++					offset = line.indexOf("#");
++					if (-1 != offset) line = line.substring(0, offset);
++
++					line = line.trim(); //take away ws
++
++					if (line.length()>1) {
++
++						if (line.charAt(0) == '[') {
++							offset = line.indexOf("]");
++							if ((offset == -1) || (offset <= 1)) continue;
++
++							if (!clines.equals("")) {
++								int lbr = clines.indexOf("\n");
++								clines = clines.substring(0, lbr);
++								//System.out.println("Adding the precomment: " + clines);
++								comments.put(section, clines);
++								clines = "";
++							}
++
++							section = line.substring(1, offset).toUpperCase() + "::";
++							//System.out.println("New Section: " + section);
++
++						} else {
++							String[] tokens = line.split("=");
++							if (tokens.length == 2) {
++								String key = tokens[0].trim();
++								String value = tokens[1].trim();
++								if (key.length() > 0) {
++									hm.put(section + key.toUpperCase(), value);
++									if (comment != null) added_comments.put(section + key.toUpperCase(), comment);
++									if (!clines.equals("")) {
++										//System.out.println("Adding the precomment: " + clines);
++										comments.put(section + key.toUpperCase(), clines);
++										clines = "";
++									}
++								}
++							}
++						}
++
++						//System.out.println(line);
++					} else {
++						//it was a comment line only, associate it with the next key
++						if (comment != null) clines += comment;
++						clines += "\n";
++					}
++				}
++				br.close();
++
++				GUIBuilder.setValues(hm, added_comments, comments);
++			} catch (Exception e) {
++					// TODO Auto-generated catch block
++					e.printStackTrace();
++			}
++		}
++	}
++
++	public void openFile(){
++		/* If a configuration is already open, ask for close. */
++		final FileNameExtensionFilter xmlfilter = new FileNameExtensionFilter(".xml files", "xml");
++		final JFileChooser filechooser = new JFileChooser(configFilePath);
++		filechooser.setFileFilter(xmlfilter);
++		final int returnval = filechooser.showOpenDialog(new JPanel());
++		if (returnval == JFileChooser.APPROVE_OPTION) {
++			if(GUIBuilder.application != null){
++				final int returnval2 = GUIBuilder.closeFile();
++				if (returnval2 == JOptionPane.CANCEL_OPTION) return;
++			}
++
++			final String path = filechooser.getSelectedFile().toString();
++			if (filechooser.getSelectedFile().isDirectory()) return;
++
++			configFilePath = filechooser.getSelectedFile().getParent();
++
++			try {
++				GUIBuilder.buildGUI(path);
++			} catch (GUIBuildException e) {
++				// TODO Auto-generated catch block
++				e.printStackTrace();
++			}
++		}
++	}
++
++	@Override
++	public void windowActivated(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowClosed(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowClosing(WindowEvent e) {
++		System.exit(NORMAL);
++
++	}
++
++	@Override
++	public void windowDeactivated(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowDeiconified(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowIconified(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void windowOpened(WindowEvent e) {
++		// TODO Auto-generated method stub
++
++	}
++
++	@Override
++	public void hyperlinkUpdate(HyperlinkEvent e) {
++
++		if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
++		      try {
++				Desktop.getDesktop().browse(e.getURL().toURI());
++			} catch (IOException e1) {
++				// TODO Auto-generated catch block
++				e1.printStackTrace();
++			} catch (URISyntaxException e1) {
++				// TODO Auto-generated catch block
++				e1.printStackTrace();
++			}
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/GUI.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/main/PanelNode.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/PanelNode.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/PanelNode.java	(revision 17808)
+@@ -0,0 +1,69 @@
++package main;
++
++import java.util.List;
++import java.util.LinkedList;
++
++public class PanelNode {
++	private String data;
++	private PanelNode parent;
++	private LinkedList<PanelNode> children = new LinkedList<PanelNode>();
++
++	public PanelNode(String indata) {
++		data = indata;
++		parent = null;
++	}
++
++	public PanelNode(PanelNode p) {
++		data = p.data;
++		parent = p.parent;
++		children = new LinkedList<PanelNode>(p.children);
++	}
++
++	public String getData() {
++		return data;
++	}
++
++	public PanelNode getChild(String data) {
++		for (PanelNode child : children) {
++			if (child.data.equals(data))
++				return child;
++		}
++
++		return null;
++	}
++
++	public PanelNode add(PanelNode c) {
++		c.parent = this;
++		children.add(c);
++
++		return children.getLast();
++	}
++
++	public PanelNode get(String searchstring) {
++		if (data.equals(searchstring)) return this;
++
++		for (PanelNode child : children) {
++			PanelNode tmp = child.get(searchstring);
++			if (tmp != null) return tmp;
++		}
++
++		return null; //Nothing found in subtree
++	}
++
++	public boolean remove(PanelNode tmp) {
++		return children.remove(tmp);
++	}
++
++	public PanelNode getParent() {
++		return parent;
++	}
++
++	public void getKeyList(LinkedList<String> keyList) {
++		if ((data.indexOf('#') == -1) && (data.indexOf('%') == -1))
++			keyList.add(data);
++
++		for (PanelNode child : children) {
++			child.getKeyList(keyList);
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/PanelNode.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/main/GUIBuilder.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/GUIBuilder.java	(revision 0)
++++ ../trunk-jpl/src/java/src/main/GUIBuilder.java	(revision 17808)
+@@ -0,0 +1,391 @@
++/***********************************************************************************/
++/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
++/***********************************************************************************/
++/*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*
++*/
++
++package main;
++
++import gui_elements.ControlledPanel;
++import gui_elements.GUIBuildException;
++
++import java.io.IOException;
++
++import javax.swing.ProgressMonitor;
++import javax.swing.JFileChooser;
++import javax.swing.JOptionPane;
++import javax.swing.JPanel;
++import javax.swing.filechooser.FileNameExtensionFilter;
++
++import java.util.*;
++
++import org.w3c.dom.Document;
++import org.w3c.dom.Element;
++
++/**
++ * The main class to build the .ini file creator. Upon construction it reads an
++ * XML file and creates the corresponding GUI. Maintains an ElementControl
++ * object.
++ *
++ * @author korhammer et egger
++ *
++ */
++public class GUIBuilder {
++	public static ProgressMonitor monitor;
++
++	public static final String xsd = GUIBuilder.class.getClassLoader().getResource("resources/config_schema-0.1.1.xsd").toString();
++	public static String res_filepath = GUIBuilder.class.getClassLoader().getResource("resources/default_config.xml").toString(); //the default config to start with
++	public static Document doc;
++
++	public static GUI gui;
++	public static PanelControl panelControl;
++
++	public static String application;
++	public static String currentConfigFile;
++
++	public static String saveFilePath = System.getProperty("user.dir");
++
++
++	private static String getFileExtension(final String file_and_path) {
++		final String file_sep = System.getProperty("file.separator");
++
++		// get filename without path
++		final int fileSepIndex = file_and_path.lastIndexOf(file_sep);
++		if (fileSepIndex == -1) {
++			return "";
++		}
++		final String filename = file_and_path.substring(fileSepIndex+1); //remove path
++
++		// get the extension from the filename
++		final int extIndex = filename.lastIndexOf(".");
++		if (extIndex == -1)
++			return "";
++
++		return filename.substring(extIndex+1);
++	}
++
++	/**
++	 * The main method. Opens the GUI Builder with a menu bar on the side.
++	 * If an XML filepath is handed over as an argument,
++	 * the XML file is opened.
++	 *
++	 * @param args
++	 * @throws GUIBuildException
++	 */
++	public static void main(String args[]) throws GUIBuildException {
++
++		new GUIBuilder();
++
++		if ((args.length != 0) && (args[0].length() > 0))
++			res_filepath = args[0]; //User may provice xml file as first argument
++
++		buildGUI(res_filepath);
++		//gui.hideOpenButton();
++	}
++
++	/**
++	 * Builds a GUI from the XML-file specified with validation through
++	 * the specified schema.
++	 *
++	 * @param filepath
++	 * @param schemapath
++	 * @throws GUIBuildException
++	 */
++	public GUIBuilder()	throws GUIBuildException {
++		if (System.getProperty("mrj.version") != null) {  //detect if running on mac
++			System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Inishell");
++			System.setProperty("apple.awt.brushMetalLook", "true");
++		}
++		gui = new GUI();
++	}
++
++	public static void setComments(HashMap<String, String> added_comments, HashMap<String, String> comments) {
++		panelControl.setComments(added_comments, comments);
++	}
++
++	/**
++	 * Builds the gui for a filepath that can either be handed over as an argument
++	 * on application start or chosen by using the open button.
++	 *
++	 * @param filepath
++	 * @throws GUIBuildException
++	 */
++	public static void buildGUI(String filepath) throws GUIBuildException{
++		currentConfigFile = filepath;
++
++		doc = XMLHelper.readXML(filepath, xsd);
++		doc = XMLHelper.resolveReferences(doc);
++
++		application = doc.getDocumentElement().getAttribute("application");
++
++		gui.setApplicationForTitle(application);
++
++		panelControl = new PanelControl();
++
++		final Element root = doc.getDocumentElement();
++		recursiveBuild(root, null, false);
++	}
++
++
++	public static void setValues(final HashMap<String, String> hm, final HashMap<String, String> added_comments, final HashMap<String, String> comments) {
++		if (hm == null) return;
++
++		monitor = new ProgressMonitor(gui, "Loading INI file", "0 out of " + panelControl.order.size() + " sections loaded", 0, panelControl.order.size());
++		monitor.setMillisToPopup(0);
++
++		Thread myrunner = new Thread() {
++				public void run() {
++					int progress_counter = 0; //Effectively counts the sections already parsed into the GUI
++					try {
++						final int returnval = GUIBuilder.closeFile();
++						if (returnval == JOptionPane.CANCEL_OPTION) return;
++						monitor.setProgress(progress_counter);
++
++						GUIBuilder.buildGUI(currentConfigFile);
++					} catch (GUIBuildException e) {
++						e.printStackTrace();
++					}
++
++					gui.setEnabled(false); //Disable user interaction while the ProgressMonitor is on
++
++					HashSet<String> usedKeys = new HashSet<String>(); //save all keys that were used from the HashMap
++					HashSet<String> unusedKeys = new HashSet<String>(); //save all keys that were used from the HashMap
++
++					Iterator<Map.Entry<String, TreeMap<String, ControlledPanel>>> sectionIterator = panelControl.panels.entrySet().iterator();
++					while (sectionIterator.hasNext()) {
++						progress_counter++;
++						monitor.setProgress(progress_counter);
++						monitor.setNote(progress_counter + " out of " + panelControl.order.size() + " sections loaded");
++
++						if (monitor.isCanceled()) { //user cancelled loading
++							monitor.close();
++							gui.setEnabled(true);
++							break; //HACK, should reset the whole environment before breaking
++						}
++
++						Map.Entry<String, TreeMap<String, ControlledPanel>> entry = sectionIterator.next();
++						TreeMap<String, ControlledPanel> value = entry.getValue();
++
++						List<String> sectionKeys = new ArrayList<String>(hm.keySet()); //all keys as defined in the existing ini
++						String sectionKey = entry.getKey().toUpperCase() + "::"; //The section string
++						filterList(sectionKey, sectionKeys); //filter keys for current section only (optimization)
++
++						LinkedList<ControlledPanel> todos = new LinkedList<ControlledPanel>();
++						LinkedList<String> keys = new LinkedList<String>();
++						LinkedList<String> values = new LinkedList<String>();
++
++						do {
++							todos.clear();
++							keys.clear();
++							values.clear();
++
++							Iterator<Map.Entry<String, ControlledPanel>> keyIterator = value.entrySet().iterator();
++							while(keyIterator.hasNext()) { //go through all keys of current section
++								final ControlledPanel mypanel = keyIterator.next().getValue();
++								//System.out.println("\t" + mypanel.getKey());
++
++								String pattern = mypanel.getHashKey();
++								pattern = pattern.replace("%","[a-zA-Z0-9_]+");
++								pattern = pattern.replace("#","[1-9]+[0-9]*"); //all integer numbers from 1 to infinity
++								//System.out.println("Current pattern: " + pattern);
++
++								//Loop through all defined keys of this section and compare them with pattern
++								Iterator<String> keyit = sectionKeys.iterator();
++								while (keyit.hasNext()) {
++									final String currkey = keyit.next();
++									//System.out.println("sectionKeys contains: " + currkey);
++
++									if ((!usedKeys.contains(currkey)) && currkey.matches(pattern)) {
++										//Add mypanel to list of todos
++										//System.out.println("Adding panel for " + currkey);
++										todos.add(mypanel);
++										keys.add(currkey);
++										values.add(hm.get(currkey));
++
++										usedKeys.add(currkey);
++									}
++								}
++							}
++
++							for (int jj = 0; jj < todos.size(); jj++) {
++								//System.out.println("--> SETTING " + keys.get(jj) + "  = " +values.get(jj));
++								todos.get(jj).set(hm, keys.get(jj), values.get(jj));
++							}
++						} while (todos.size() != 0);
++
++						if (progress_counter == panelControl.order.size()) gui.setEnabled(true);
++					}
++
++					//Now find out all keys that were not used in the hashmap
++					for (String key : hm.keySet()) {
++						if (!usedKeys.contains(key)) {
++							//System.out.println("Unknown key = " + key);
++							unusedKeys.add(key);
++							panelControl.setUnusedKeys(key, hm.get(key));
++						}
++					}
++
++					setComments(added_comments, comments);
++				}
++			};//thread
++		myrunner.start();
++	}
++
++	private static void filterList(String filter, List<String> list) {
++		for (Iterator<String> it=list.iterator(); it.hasNext();) {
++			final String next = it.next();
++			if (!next.startsWith(filter)) {
++				it.remove();
++			}
++		}
++	}
++
++	public static int closeFile(){
++		final int returnval = JOptionPane.showConfirmDialog(new JPanel(),
++				"You will lose all changes made to the current ini-file. " +
++				"Do you want this?", "Inishell is already open for " + application, JOptionPane.OK_CANCEL_OPTION);
++
++
++
++		if (returnval == JOptionPane.OK_OPTION) {
++			gui.closeAllTabs();
++			gui.rootNode = new PanelNode("");
++			application = null;
++			doc = null;
++			panelControl = null;
++		}
++
++		return returnval;
++	}
++
++
++	/**
++	 * Puts the specified panel into the panel control.
++	 * @param panel
++	 */
++	public static void control(ControlledPanel panel) {
++		final String section = panel.getSection();
++		panelControl.put(section, panel);
++	}
++
++
++	/**
++	 * Recursively traverses all children of the specified element
++	 * and builds the corresponding panels.
++	 *
++	 * @param parentElement
++	 * @param parentPanel
++	 * @throws GUIBuildException
++	 */
++	public static void recursiveBuild(Element parentElement, ControlledPanel parentPanel, boolean doSet) throws GUIBuildException {
++		recursiveBuild(parentElement, parentPanel, doSet, null, null, null);
++	}
++
++
++	public static void recursiveBuild(Element parentElement, ControlledPanel parentPanel, boolean doSet, HashMap hm, String key, String value) throws GUIBuildException {
++
++		/* get all child elements for the root */
++		final String[] tags = {"parameter", "frame"};
++		final Element[] parameterElements = XMLHelper.getElementArray(parentElement, tags);
++
++		for (final Element element : parameterElements) {
++			final String section = element.getAttribute("section");
++			ControlledPanel parameterPanel;
++
++			if (!panelControl.contains(section, element.getAttribute("key"))) {
++				//System.out.println("Adding through recursiveBuild: " + element.getAttribute("key"));
++				parameterPanel = ControlledPanel.createSingleParameterPanel(element, parentPanel);
++				parameterPanel.setKey(parameterPanel.getKey());
++
++				if (!element.getAttribute("template").equals("true")) {
++					//if (doSet) System.out.println("\tSETTING component key: " + key + "  value: " + value);
++					if (doSet) parameterPanel.set(hm, parameterPanel.getKey(), value);
++
++					gui.addToTab(parameterPanel, section, parentPanel);
++					control(parameterPanel);
++				}
++			} else {
++				parameterPanel = panelControl.get(section, element.getAttribute("key"));
++			}
++
++			parameterPanel.hold();
++			recursiveBuild(element, parameterPanel, doSet);
++		}
++
++		gui.validate();
++	}
++
++	/**
++	 * Recursively destructs child elements of the specified root.
++	 *
++	 * @param rootElement
++	 * @param rootPanel
++	 * @throws GUIBuildException
++	 */
++	public static void recursiveDestruct(Element rootElement, ControlledPanel rootPanel)
++		throws GUIBuildException {
++
++		/* get all child elements for the root */
++		final Element[] parameterElements = XMLHelper.getElementArray(rootElement, "parameter");
++
++		for (final Element element : parameterElements) {
++			final String section = element.getAttribute("section");
++			final ControlledPanel parameterPanel = panelControl.get(section, element.getAttribute("key"));
++			recursiveDestruct(element, parameterPanel);
++
++			parameterPanel.release();
++			parameterPanel.close();
++
++			if (!parameterPanel.isNeeded()) {
++				gui.removeFromTab(parameterPanel, section, rootPanel);
++			}
++
++		}
++
++		gui.validate();
++	}
++
++
++	/**
++	 * Opens a prompt for the path to save the ini file to. Then prints the ini
++	 * to the path specified.
++	 *
++	 * @throws IOException
++	 * @throws GUIBuildException
++	 */
++	public static void printIOFile() throws IOException, GUIBuildException {
++		final FileNameExtensionFilter inifilter = new FileNameExtensionFilter(".ini files", "ini");
++
++		final JFileChooser filechooser = new JFileChooser(saveFilePath);
++		filechooser.setFileFilter(inifilter);
++
++		final int returnval = filechooser.showSaveDialog(new JPanel());
++
++		if (returnval == JFileChooser.APPROVE_OPTION) {
++			String path = filechooser.getSelectedFile().getAbsolutePath();
++			final String ext = getFileExtension(path).toLowerCase();
++			if(!ext.equals("ini")) {
++				path += ".ini";
++			}
++
++			if (filechooser.getSelectedFile().isDirectory()) return;
++			saveFilePath = filechooser.getSelectedFile().getParent();
++
++			panelControl.printToFile(path);
++		}
++	}
++}
+
+Property changes on: ../trunk-jpl/src/java/src/main/GUIBuilder.java
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/document-open-2.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/document-open-2.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/document-open-2.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/document-open-2.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/document-open-2.png
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/document-preview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/document-preview.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/document-preview.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/document-preview.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/document-preview.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/document-export-4.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/document-export-4.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/document-export-4.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/document-export-4.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/document-export-4.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/config_schema.xsd
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/config_schema.xsd	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/config_schema.xsd	(revision 17808)
+@@ -0,0 +1,141 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++
++<xsd:schema version="1.0"
++xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++
++  <xsd:element name="inishell_config" type="general" />
++  
++	<xsd:complexType name="general">
++      <xsd:choice maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="parametergroup" type="pargroup" />
++			<xsd:element name="include" type="pathonly" /> 
++      </xsd:choice>
++	  <xsd:attribute name="application" />
++    </xsd:complexType>
++	
++	<xsd:complexType name="parametertype">
++		<xsd:complexContent>
++			<xsd:extension base="parbasetype">
++				<xsd:attribute name="key" type="xsd:string" use="required"/> 
++				<xsd:attribute name="default" type="xsd:string" />
++				<xsd:attribute name="counter" type="xsd:integer" />
++			</xsd:extension>
++		</xsd:complexContent>		
++	</xsd:complexType>
++   
++   <xsd:complexType name="nameonly">
++		<xsd:attribute name="name" />   
++   </xsd:complexType>
++   
++   <xsd:complexType name="pathonly">
++		<xsd:attribute name="path" />   
++   </xsd:complexType>
++   
++	<xsd:complexType name="pargroup">
++		<xsd:choice minOccurs="1" maxOccurs="unbounded">
++			<xsd:element name="parameter" type="parametertype" />
++			<xsd:element name="reference" type="nameonly" />
++		</xsd:choice>
++		<xsd:attribute name="name" />
++	</xsd:complexType>
++  
++	
++	<xsd:complexType name="parbasetype">
++		<xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="section" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="replace" type="nameonly"/>
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="parameter" type="parametertype" />
++			</xsd:sequence>
++			<xsd:choice minOccurs="0" maxOccurs="unbounded">				
++				<xsd:element name="option" minOccurs="0">
++					<xsd:complexType>
++						<xsd:complexContent>
++							<xsd:extension base="parbasetype">
++								<xsd:attribute name="value" type="xsd:string" use="required" />
++								<xsd:attribute name="label" type="xsd:string" use="optional" />
++								<xsd:attribute name="default" type="xsd:boolean"/>
++							</xsd:extension>
++						</xsd:complexContent>
++					</xsd:complexType>
++				</xsd:element>
++			</xsd:choice>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="reference" type="nameonly" />
++			</xsd:sequence>
++			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
++				<xsd:element name="help" type="helptype"/>	
++			</xsd:sequence>
++		</xsd:sequence>
++		
++		<xsd:attribute name="type" use="required">
++		     <xsd:simpleType>
++				<xsd:restriction base="xsd:string">
++					<xsd:enumeration value="integer" />
++					<xsd:enumeration value="integer+" />
++					<xsd:enumeration value="decimal" />
++					<xsd:enumeration value="path" />
++					<xsd:enumeration value="file" />
++					<xsd:enumeration value="choice" />
++					<xsd:enumeration value="alternative" />
++					<xsd:enumeration value="string" />
++					<xsd:enumeration value="combination" />
++					<xsd:enumeration value="selector" />
++				</xsd:restriction>
++			</xsd:simpleType>
++		</xsd:attribute>
++		
++		<xsd:attribute name="maximum" type="xsd:integer"/>
++		<xsd:attribute name="minimum" type="xsd:integer"/>
++		<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++		<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="needstype">
++		<xsd:attribute name="type" type="xsd:string" use="required" />
++		<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++		<xsd:attribute name="value" />
++		<xsd:attribute name="optional" type="xsd:boolean" />
++		<xsd:attribute name="minoccur" type="xsd:integer" />
++		<xsd:attribute name="maxoccur" type="xsd:string" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="baseType">
++		<xsd:sequence minOccurs="0" maxOccurs="1">
++			<xsd:element name="help" type="helptype" />		
++		</xsd:sequence>
++		<xsd:attribute name="key" type="xsd:string" use="required" />
++	</xsd:complexType>
++	
++	<xsd:complexType name="helptype" mixed="true">
++		<xsd:choice minOccurs="0" maxOccurs="unbounded">
++			<xsd:element name="section" type="nameonly" />
++			<xsd:element name="replace" type="nameonly" />
++		</xsd:choice>
++	</xsd:complexType>
++	
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/src/resources/config_schema.xsd
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/default_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/default_config.xml	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/default_config.xml	(revision 17808)
+@@ -0,0 +1,919 @@
++<inishell_config application="Meteo IO">
++
++	<!-- General Parameters -->
++	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
++		<section name="general" />
++		<help>Size in days of a chunk of data to read at once.</help>
++	</parameter>
++
++	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
++		<section name="general" />
++		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
++		beginning of the buffer (therefore, it takes a value in days).</help>
++	</parameter>
++
++	<!-- Coordinate systems, time zones -->
++	<parameter key="COORDSYS" type="alternative" optional="false">
++		<section name="input" />
++		<section name="output" />
++		<option value="CH1903" type="string" default="true">
++			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UTM" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the zone with the zone letter (for example, 32T)</help>
++			</parameter>
++			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
++		</option>
++		<option value="UPS" type="string">
++			<parameter key="COORDPARAM" type="string">
++				<help>specify the hemisphere (either N or S)</help>
++			</parameter>
++			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
++		</option>
++		<option value="PROJ4" type="string">
++			<parameter key="COORDPARAM" type="string" optional="false" />
++			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
++		</option>
++		<option value="LOCAL"  type="string">
++			<help>uses the horizontal and vertical distance from a reference point</help>
++		</option>
++		<help>coordinate system</help>
++	</parameter>
++
++	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
++		<section name="input" />
++		<section name="output" />
++	</parameter>
++
++	<!-- Datatypes: special pts -->
++	<parameter key="SPECIALPTS" type="alternative">
++		<section name="input" />
++		<option value="A3D" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++		<option value="SMET" type="string">
++			<parameter key="SPECIALPTSFILE" type="file" optional="false">
++				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
++			</parameter>
++		</option>
++	</parameter>
++
++	<!-- Datatypes: Meteo Data -->
++	<parameter key="METEO" type="alternative">
++		<section name="input" />
++		<section name="output" />
++
++		<option value="A3D" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="BORMA" type="string">
++			<section name="input" />
++			<reference name="BORMA" />
++		</option>
++		<option value="COSMO" type="string">
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string containing the path to the meteorological files</help>
++			</parameter>
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="input" />
++			<reference name="GEOTOP_IN" />
++		</option>
++		<option value="GEOTOP" type="string">
++			<section name="output" />
++			<reference name="GEOTOP_OUT" />
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<reference name="GRIB_METEO" />
++		</option>
++		<option value="GSN" type="string">
++			<section name="input" />
++			<reference name="GSN" />
++		</option>
++		<option value="IMIS" type="string">
++			<section name="input" />
++			<reference name="IMIS" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="input" />
++			<reference name="SMET_IN" />
++		</option>
++		<option value="SMET" type="string">
++			<section name="output" />
++			<reference name="SMET_OUT" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="input" />
++			<reference name="SNIO_IN" />
++		</option>
++		<option value="SNOWPACK" type="string">
++			<section name="output" />
++			<parameter key="METEOPATH" type="path" optional="false">
++				<help>string representing path where SNOWPACK files should be saved</help>
++			</parameter>
++		</option>
++
++		<help>plugin for METEO data </help>
++	</parameter>
++
++	<parameter key="Add Meteo parameter copy" type="selector">
++		<section name="input"/>
++		<parameter key="COPY::%" type="string" optional="false" template="true">
++		  <help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
++		</parameter>
++	</parameter>
++
++	<!-- Datatypes: DEM -->
++	<frame key="dem_frame" label="Digital Elevation Model">
++	<section name="input"/>
++		<parameter key="DEM" type="alternative">
++			<section name="input" />
++			<option value="ARC" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="ARPS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++					<help>x coordinate of the lower left corner of the grids</help>
++				</parameter>
++				<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++					<help>y coordinate of the lower left corner of the grids</help>
++				</parameter>
++			</option>
++			<option value="GRASS" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++			</option>
++			<option value="GRIB" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<parameter key="GRIB_DEM_UPDATE" type="alternative" optional="true">
++					<option value="TRUE" type="string" />
++					<option value="FALSE" type="string" />
++					<help>recompute slope/azimuth from the elevations when reading a DEM (default=false, that is we use the slope and azimuth included in the GRIB file)</help>
++				</parameter>
++			</option>
++			<option value="PGM" type="string">
++				<parameter key="DEMFILE" type="file" optional="false">
++					<help>For reading the data as a DEMObject</help>
++				</parameter>
++				<reference name="PGM_IN" />
++			</option>
++
++			<help>plugin for Digital Elevation Model data </help>
++		</parameter>
++	</frame>
++
++	<!-- Datatypes: Landuse -->
++	<parameter key="LANDUSE" type="alternative">
++		<section name="input" />
++		<option value="ARC" type="string">
++			<parameter key="LANDUSEFILE" type="file" optional="false">
++				<help>File containing a grid of landuse codes</help>
++			</parameter>
++		</option>
++
++		<help>plugin for land cover data </help>
++	</parameter>
++
++	<!-- Datatypes: Grids -->
++	<parameter key="GRID2D" type="alternative">
++		<section name="input" />
++		<section name="output" />
++		<option value="ARC" type="string">
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARC" />
++		</option>
++		<option value="ARPS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="ARPS" />
++		</option>
++		<option value="GRASS" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="GRIB" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="GRIB_GRIDS" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="input" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PGM_IN" />
++		</option>
++		<option value="PGM" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++		</option>
++		<option value="PNG" type="string">
++			<section name="output" />
++			<parameter key="GRID2DPATH" type="path" optional="false">
++				<help>string representing path where grid files should be read from</help>
++			</parameter>
++			<reference name="PNG" />
++		</option>
++		<help>plugin for 2D gridded data </help>
++	</parameter>
++
++	<!--Parameter group for list of stations -->
++	<parametergroup name="stationgroup_files">
++		<parameter key="STATION#" type="file" counter="1" optional="false">
++			<help>filename for station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_names">
++		<parameter key="STATION#" type="string" counter="1" optional="false">
++			<help>station id for the given station number # </help>
++		</parameter>
++	</parametergroup>
++	<parametergroup name="stationgroup_pos">
++		<parameter key="STATION#" type="string" counter="1">
++			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Plugins for Meteo Data-->
++	<parametergroup name="BORMA">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the xml files</help>
++		</parameter>
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="IMIS">
++		<parameter key="DBNAME" type="string" optional="false">
++			<help>database name, as provided by your database administrator</help>
++		</parameter>
++		<parameter key="DBUSER" type="string" optional="false">
++			<help>database user name</help>
++		</parameter>
++		<parameter key="DBPASS" type="string" optional="false">
++			<help>database password associated with the user name</help>
++		</parameter>
++		<parameter key="USEANETZ" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
++		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
++		  average to get what should be its local precipitations</help>
++		</parameter>
++		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
++		</parameter>
++		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
++		</parameter>
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="GRIB_METEO">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the grib files</help>
++		</parameter>
++		<parameter key="METEOEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++
++		<reference name="stationgroup_pos" />
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="false">
++			<help>absolute filename of the geotop.inpts file</help>
++		</parameter>
++		<parameter key="METEOPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GEOTOP_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the data files</help>
++		</parameter>
++		<parameter key="METEOSEQ" type="string" optional="false">
++			<help>specifiy in which order the columns should be printed out</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GSN">
++		<parameter key="ENDPOINT" type="string" optional="false">
++			<help>webserver running GSN with its port number and full path. For example:
++			http://montblanc.slf.ch:22001/services/A3DWebService</help>
++		</parameter>
++		<parameter key="PROXY" type="string" optional="true">
++			<help>Should the connection go through a proxy? This is useful for servers
++			filtering on domains but usually not necessary.</help>
++		</parameter>
++		<parameter key="PROXYPORT" type="string" optional="true" />
++		<parameter key="PROXYUSER" type="string" optional="true" />
++		<parameter key="PROXYPASS" type="string" optional="true" />
++
++		<reference name="stationgroup_names" />
++	</parametergroup>
++
++	<parametergroup name="SMET_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the smet files</help>
++		</parameter>
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<parametergroup name="SMET_OUT">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string representing path where SMET files should be saved</help>
++		</parameter>
++		<parameter key="METEOPARAM" type="alternative">
++		  <option value="ASCII" type="string" default="true">
++		    <help>Write ASCII SMET files</help>
++		  </option>
++		  <option value="BINARY" type="string">
++		    <help>Write BINARY SMET files</help>
++		  </option>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="SNIO_IN">
++		<parameter key="METEOPATH" type="path" optional="false">
++			<help>string containing the path to the SNOWPACK files</help>
++		</parameter>
++		<parameter key="METAFILE" type="file" optional="true">
++			<help>filename of the meta data file (in METEOPATH)</help>
++		</parameter>
++
++		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
++		  <help>the number of measured snow temperatures provided</help>
++		</parameter>
++
++		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
++		  <help>the number of solutes for which input data are provided</help>
++		</parameter>
++
++		<parameter key="RSWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="ISWR_INP" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		</parameter>
++		<parameter key="VW_DRIFT" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
++		</parameter>
++		<parameter key="RHO_HN" type="alternative" optional="true">
++		  <option value="TRUE" type="string" />
++		  <option value="FALSE" type="string" />
++		  <help>OPTIONAL: measured new snow density is provided</help>
++		</parameter>
++
++		<reference name="stationgroup_files" />
++	</parametergroup>
++
++	<!-- Plugins for Gridded Data-->
++	<parametergroup name="ARC">
++		<parameter key="A3D_VIEW" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate names compatible with Alpine3D's grid viewer?</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="ARPS">
++		<parameter key="ARPS_XCOORD" type="decimal" optional="false">
++			<help>x coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="ARPS_YCOORD" type="decimal" optional="false">
++			<help>y coordinate of the lower left corner of the grids</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grid file extension, or none for no file extension (default: .asc)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="GRIB_GRIDS">
++		<parameter key="GRID2DPREFIX" type="string" optional="true">
++			<help>prefix to append when generating a file name for reading (ie: something like "laf" for Cosmo-Analysis-full domain)</help>
++		</parameter>
++		<parameter key="GRID2DEXT" type="string" optional="true">
++			<help>grib file extension, or none for no file extension (default: .grb)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PNG">
++		<parameter key="PNG_WORLD_FILE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a world file for each output file? This file contains the geolocalization information</help>
++		</parameter>
++		<parameter key="PNG_LEGEND" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a legend?</help>
++		</parameter>
++		<parameter key="PNG_AUTOSCALE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>autoscale color scale?</help>
++		</parameter>
++		<parameter key="PNG_SCALING" type="alternative" optional="true">
++			<option value="nearest" type="string" />
++			<option value="bilinear" type="string" />
++			<help>scaling algorithm (default=bilinear)</help>
++		</parameter>
++		<parameter key="PNG_MIN_SIZE" type="string" optional="false">
++			<help>minimum dimensions of the PNG, like 640x480</help>
++		</parameter>
++		<parameter key="PNG_MAX_SIZE" type="string" optional="false">
++			<help>maximum dimensions of the PNG, like 1024x768</help>
++		</parameter>
++		<parameter key="PNG_INDEXED" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>generate a color indexed file (default=true)</help>
++		</parameter>
++		<parameter key="PNG_SPEED_OPTIMIZE" type="alternative" optional="true">
++			<option value="TRUE" type="string" />
++			<option value="FALSE" type="string" />
++			<help>optimize for speed (default=false)</help>
++		</parameter>
++		<parameter key="PNG_NR_LEVELS" type="integer+" default="+30" maximum="255" minimum="6" optional="true">
++			<help>number of colors in the palette (default=30)</help>
++		</parameter>
++	</parametergroup>
++
++	<parametergroup name="PGM_IN">
++		<parameter key="PGM_XCOORD" type="decimal" optional="false">
++			<help>lower left x coordinate</help>
++		</parameter>
++		<parameter key="PGM_YCOORD" type="decimal" optional="false">
++			<help>lower left y coordinate</help>
++		</parameter>
++		<parameter key="PGM_CELLSIZE" type="decimal" optional="false">
++			<help>cellsize in meters</help>
++		</parameter>
++		<parameter key="PGM_MIN" type="decimal" optional="false">
++			<help>minimum value in real world coordinates to match with the minimum value read out of the PGM file (such minimum being greater than 0 because 0 is NODATA)</help>
++		</parameter>
++		<parameter key="PGM_MAX" type="decimal" optional="false">
++			<help>maximum value in real world coordinates to match with the maximum value read out of the PGM file</help>
++		</parameter>
++	</parametergroup>
++
++	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
++	<parametergroup name="METEOIOPARAMETERS">
++		<option value="TA"/>
++		<option value="RH"/>
++		<option value="VW"/>
++		<option value="DW"/>
++		<option value="VW_MAX"/>
++		<option value="ISWR"/>
++		<option value="RSWR"/>
++		<option value="ILWR"/>
++		<option value="HS"/>
++		<option value="HNW"/>
++		<option value="TSG"/>
++		<option value="TSS"/>
++		<option value="P"/>
++	</parametergroup>
++
++	<!-- Filters -->
++	<parameter key="Add/Remove Filter" type="selector">
++		<section name="filters" />
++
++		<parameter key="%::filter#" type="alternative" counter="1" template="true">
++			<section name="filters" />
++
++			<option label="MeanAvg" value="mean_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++
++			<option label="MedianAvg" value="median_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="decimal" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
++			</option>
++
++			<option label="Std Deviation Filter" value="std_dev" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
++			</option>
++
++			<option label="MAD" value="mad" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
++			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
++			</option>
++
++			<option label="Tukey 53H Filter" value="Tukey" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
++			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
++			    </help>
++			  </parameter>
++			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
++			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
++			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
++			</option>
++
++			<option label="Wind Averaging Filter" value="wind_avg" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			    </help>
++			  </parameter>
++			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
++			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
++			</option>
++
++			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
++			</option>
++
++			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option value="center" type="dropdown">
++			      <option value="left" type="string" />
++			      <option value="center" type="string" />
++			      <option value="right" type="string" />
++			    </option>
++			    <option label="# of points:" value="1" type="integer" minimum="1" />
++			    <option label="Duration:" value="0" type="integer" minimum="0" />
++			    <help>
++			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
++			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
++			      Please note that the standard filter works with a left window!
++			    </help>
++			  </parameter>
++			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
++			</option>
++
++			<option label="Min Range Filter" value="min" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
++			    assigned the minimum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Min range filter. Reject all values smaller than the min.</help>
++			</option>
++
++			<option label="Max Range Filter" value="max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
++			    assigned the maximum permissible value or another value given as an extra argument</help>
++			  </parameter>
++			  <help>Max range filter. Reject all values greater than the max.</help>
++			</option>
++
++			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="Min:" value="" type="decimal" />
++			    <option label="Max:" value="" type="decimal" />
++			    <option label="Min adjust to:" value="" type="decimal" />
++			    <option label="Max adjust to:" value="" type="decimal" />
++			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
++			    the maximum permissible value and all data smaller than the min would be assigned the minimum
++			    permissible value or an optional extra set of two user provided values</help>
++			  </parameter>
++			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
++			</option>
++
++			<option label="Rate Filter (1 argument)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Rate Filter (2 arguments)" value="rate" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
++			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
++			    <help>the minimum and maximum permissible rate of change (per second)</help>
++			  </parameter>
++			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
++			</option>
++
++			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option value="soft" type="choice" />
++			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
++			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
++			  </parameter>
++			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
++			</option>
++
++			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Gage type" type="dropdown">
++					<option value="Nipher" type="string" />
++					<option value="Tretyakov" type="string" />
++					<option value="US8sh" type="string" />
++					<option value="US8unsh" type="string" />
++					<option value="Hellmann" type="string" />
++					<option value="Hellmannsh" type="string" />
++				</option>
++			  </parameter>
++			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
++			</option>
++
++			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option value="Kind" type="dropdown">
++					<option value="Cst" type="string" />
++				</option>
++				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
++				<option label="Mixed prec factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
++			  </parameter>
++			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
++			</option>
++
++			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
++			  <parameter key="%::arg#" type="combination">
++			    <option label="albedo:" value="0.23" type="decimal" />
++			    <option value="soft" type="choice" />
++			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
++			  </parameter>
++			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
++			</option>
++
++			<option label="Add an offset" value="add" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="offset:" value="0." type="decimal" />
++			  </parameter>
++			  <help>This adds a given offset to the data.</help>
++			</option>
++
++			<option label="Multiply by a factor" value="mult" type="string">
++			  <parameter key="%::arg#" type="combination">
++				<option label="factor:" value="1." type="decimal" />
++			  </parameter>
++			  <help>This multiplies the data by a given factor.</help>
++			</option>
++
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 1D Interpolation -->
++	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
++		<section name="Interpolations1D" />
++		<help>Affects resampling: expresses (in seconds) how far a valid point can be
++		searched for when re-interpolating a missing value</help>
++	</parameter>
++
++	<parameter key="Add/Remove 1D Interpolation" type="selector">
++		<section name="Interpolations1D" />
++
++		<parameter key="%::resample" type="alternative" template="true">
++			<section name="Interpolations1D" />
++			<option label="No Interpolation" value="none" type="string" />
++			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
++			<option label="Linear" value="linear" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="extrapolate" type="choice" />
++			    <help>
++			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
++			      Otherwise, a data point will only be calculated between the original date range.
++			    </help>
++			  </parameter>
++			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
++			</option>
++			<option label="Accumulate" value="accumulate" type="string">
++			  <parameter key="%::args" type="combination">
++			    <option value="strict" type="choice" />
++			    <option label="Seconds:" value="900" type="integer" minimum="1" />
++			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
++			  </parameter>
++			  <help>Accumulation over a user given period (filter argument, in seconds -
++			  should coincide with your calculation step!).</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++
++	<!-- 2D Interpolation -->
++	<parameter key="Add/Remove 2D Interpolation" type="selector">
++		<section name="Interpolations2D" />
++
++		<parameter key="%::algorithms" type="choice" template="true">
++			<section name="Interpolations2D" />
++			<option value="STD_PRESS" type="choice">
++				<help>Generate a standard atmosphere pressure as a function of the cell's elevation</help>
++			</option>
++			<option value="CST" type="choice">
++				<help>Fill the grid with the average over all the stations</help>
++			</option>
++			<option value="CST_LAPSE" type="choice">
++			  <parameter key="%::cst_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, fill the grid with the average over all the stations, reapply the elevation trend</help>
++			</option>
++			<option value="IDW" type="choice">
++				<help>Inverse Distance Weighted average</help>
++			</option>
++			<option value="IDW_LAPSE" type="choice">
++			  <parameter key="%::idw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Detrend the measured data, apply Inverse Distance Weighted average, reapply elevation trend</help>
++			</option>
++			<option value="LIDW_LAPSE" type="choice">
++			  <parameter key="%::lidw_lapse" type="combination">
++			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
++			    <option value="" type="dropdown">
++			      <option value="" type="string" />
++			      <option value="soft" type="string" />
++			      <option value="frac" type="string" />
++			    </option>
++			  </parameter>
++			  <help>Same as IDW_LAPSE, but only considering a given number of neighboring stations</help>
++			</option>
++			<option value="RH" type="choice">
++				<help>Computes the dew point temperature, distribute it with IDW_LAPSE, recompute RH at each pixel</help>
++			</option>
++			<option value="ILWR" type="choice">
++				<help>Compute emissivity, distribute it with IDW_LAPSE, recompute ILWR at each pixel</help>
++			</option>
++			<option value="WIND_CURV" type="choice">
++				<help>Distribute wind velocity with IDW_LAPSE, then apply correction factors as a function of local slope and curvature</help>
++			</option>
++			<option value="HNW_SNOW" type="choice">
++				<parameter key="%::hnw_snow" type="combination">
++				<option value="IDW_LAPSE" type="dropdown">
++					<option value="CST" type="string" />
++					<option value="CST_LAPSE" type="string" />
++					<option value="IDW" type="string" />
++					<option value="IDW_LAPSE" type="string" />
++					<option value="ODKRIG" type="string" />
++				</option>
++				<help>Base algorithm (do not forget to add the options for the base algorithm)</help>
++				</parameter>
++				<help>Distribute precipitation with a base algorithm (IDW_LAPSE by default), then reduce/remove precipitation on
++				steep slopes and correct with the local curvature. This is to simulate snow redistribution processes.</help>
++			</option>
++			<option value="USER" type="choice">
++			  <parameter key="%::user" type="path" optional="false"/>
++			  <help>User provided grids, named as {numeric date}_{capitalized meteo parameter}.asc</help>
++			</option>
++			<option value="ODKRIG" type="choice">
++			  <parameter key="%::odkrig" type="combination">
++			  	<option value="" type="dropdown">
++					<option value="LINVARIO" type="string" />
++					<option value="EXPVARIO" type="string" />
++					<option value="SPHERICVARIO" type="string" />
++					<option value="RATQUADVARIO" type="string" />
++				</option>
++				<help>Variogram model</help>
++			  </parameter>
++			  <help>Ordinary kriging (EXPERIMENTAL)</help>
++			</option>
++		</parameter>
++
++		<reference name="METEOIOPARAMETERS" />
++	</parameter>
++</inishell_config>
+\ No newline at end of file
+
+Property changes on: ../trunk-jpl/src/java/src/resources/default_config.xml
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/filesave.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/filesave.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/filesave.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/filesave.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/filesave.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/viewmag.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/viewmag.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/viewmag.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/viewmag.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/viewmag.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/ini_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/ini_open.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/ini_open.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/ini_open.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/ini_open.png
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/fileopen.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/fileopen.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/fileopen.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/fileopen.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/fileopen.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/xml_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/xml_open.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/xml_open.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/xml_open.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/xml_open.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/filesaveas.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/filesaveas.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/filesaveas.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/filesaveas.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/filesaveas.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/opensettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/opensettings.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/opensettings.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/opensettings.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/opensettings.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/reset.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/reset.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/reset.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/reset.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/reset.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/mydocuments.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/mydocuments.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/mydocuments.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/mydocuments.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/mydocuments.png
+___________________________________________________________________
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/readme.txt
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/readme.txt	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/icons/readme.txt	(revision 17808)
+@@ -0,0 +1,10 @@
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++This copyright and license notice covers the images in this directory.
++************************************************************************
++
++TITLE:	Crystal Project Icons
++AUTHOR:	Everaldo Coelho
++SITE:	http://www.everaldo.com
++CONTACT: everaldo@everaldo.com
++
++Copyright (c)  2006-2007  Everaldo Coelho.
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/readme.txt
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/icons/kghostview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/kghostview.png
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/kghostview.png	(revision 17807)
++++ ../trunk-jpl/src/java/src/resources/icons/kghostview.png	(revision 17808)
+
+Property changes on: ../trunk-jpl/src/java/src/resources/icons/kghostview.png
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Added: svn:mime-type
+## -0,0 +1 ##
++application/octet-stream
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd	(revision 0)
++++ ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd	(revision 17808)
+@@ -0,0 +1,154 @@
++<?xml version="1.0"?>
++<!-- 
++*   
++*	This file is part of INIshell.
++*
++*   INIshell 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 3 of the License, or
++*   (at your option) any later version.
++*
++*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
++*    	
++* -->
++<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
++  <xsd:element name="inishell_config" type="general" />
++  
++  <xsd:complexType name="general">
++    <xsd:choice maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="parametergroup" type="pargroup" />
++      <xsd:element name="include" type="pathonly" /> 
++      <xsd:element name="frame" type="framegroup" /> 
++    </xsd:choice>
++    <xsd:attribute name="application" />
++  </xsd:complexType>
++
++  <xsd:complexType name="framegroup">
++    <xsd:choice minOccurs="1" maxOccurs="unbounded">
++      <xsd:element name="parameter" type="parametertype" />
++      <xsd:element name="reference" type="nameonly" />
++      <xsd:element name="section" type="nameonly"/>
++    </xsd:choice>
++    <xsd:attribute name="key" />
++    <xsd:attribute name="label" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="parametertype">
++    <xsd:complexContent>
++      <xsd:extension base="parbasetype">
++		<xsd:attribute name="key" type="xsd:string" use="required"/> 
++		<xsd:attribute name="default" type="xsd:string" />
++		<xsd:attribute name="counter" type="xsd:integer" />
++      </xsd:extension>
++    </xsd:complexContent>		
++  </xsd:complexType>
++  
++  <xsd:complexType name="nameonly">
++	<xsd:attribute name="name" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="optionvalue">
++	<xsd:attribute name="value" />   
++  </xsd:complexType>
++
++  <xsd:complexType name="pathonly">
++	<xsd:attribute name="path" />   
++  </xsd:complexType>
++  
++  <xsd:complexType name="pargroup">
++	<xsd:choice minOccurs="1" maxOccurs="unbounded">
++	  <xsd:element name="parameter" type="parametertype" />
++	  <xsd:element name="reference" type="nameonly" />
++	  <xsd:element name="option" type="optionvalue" />
++	  <xsd:element name="frame" type="framegroup" /> 
++	</xsd:choice>
++	<xsd:attribute name="name" />
++  </xsd:complexType>
++
++  <xsd:complexType name="parbasetype">
++	<xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="section" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="replace" type="nameonly"/>
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="parameter" type="parametertype" />
++	  </xsd:sequence>
++	  <xsd:choice minOccurs="0" maxOccurs="unbounded">				
++		<xsd:element name="option" minOccurs="0">
++		  <xsd:complexType>
++			<xsd:complexContent>
++			  <xsd:extension base="parbasetype">
++				<xsd:attribute name="value" type="xsd:string" use="required" />
++				<xsd:attribute name="label" type="xsd:string" use="optional" />
++				<xsd:attribute name="default" type="xsd:boolean" use="optional"/>
++			  </xsd:extension>
++			</xsd:complexContent>
++		  </xsd:complexType>
++		</xsd:element>
++	  </xsd:choice>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="reference" type="nameonly" />
++	  </xsd:sequence>
++	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
++		<xsd:element name="help" type="helptype"/>	
++	  </xsd:sequence>
++	</xsd:sequence>
++	
++	<xsd:attribute name="type" use="required">
++	  <xsd:simpleType>
++		<xsd:restriction base="xsd:string">
++		  <xsd:enumeration value="integer" />
++		  <xsd:enumeration value="integer+" />
++		  <xsd:enumeration value="decimal" />
++		  <xsd:enumeration value="path" />
++		  <xsd:enumeration value="file" />
++		  <xsd:enumeration value="choice" />
++		  <xsd:enumeration value="alternative" />
++		  <xsd:enumeration value="dropdown" />
++		  <xsd:enumeration value="string" />
++		  <xsd:enumeration value="combination" />
++		  <xsd:enumeration value="selector" />
++		</xsd:restriction>
++	  </xsd:simpleType>
++	</xsd:attribute>
++	
++	<xsd:attribute name="maximum" type="xsd:integer"/>
++	<xsd:attribute name="minimum" type="xsd:integer"/>
++	<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
++	<xsd:attribute name="optional" type="xsd:boolean" default="true" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="needstype">
++	<xsd:attribute name="type" type="xsd:string" use="required" />
++	<xsd:attribute name="name" type="xsd:string" use="required" />
++	
++	<xsd:attribute name="value" />
++	<xsd:attribute name="optional" type="xsd:boolean" />
++	<xsd:attribute name="minoccur" type="xsd:integer" />
++	<xsd:attribute name="maxoccur" type="xsd:string" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="baseType">
++	<xsd:sequence minOccurs="0" maxOccurs="1">
++	  <xsd:element name="help" type="helptype" />		
++	</xsd:sequence>
++	<xsd:attribute name="key" type="xsd:string" use="required" />
++  </xsd:complexType>
++  
++  <xsd:complexType name="helptype" mixed="true">
++	<xsd:choice minOccurs="0" maxOccurs="unbounded">
++	  <xsd:element name="section" type="nameonly" />
++	  <xsd:element name="replace" type="nameonly" />
++	</xsd:choice>
++  </xsd:complexType> 
++</xsd:schema>
+
+Property changes on: ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/COPYING
+===================================================================
+--- ../trunk-jpl/src/java/COPYING	(revision 0)
++++ ../trunk-jpl/src/java/COPYING	(revision 17808)
+@@ -0,0 +1,674 @@
++                    GNU GENERAL PUBLIC LICENSE
++                       Version 3, 29 June 2007
++
++ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
++ Everyone is permitted to copy and distribute verbatim copies
++ of this license document, but changing it is not allowed.
++
++                            Preamble
++
++  The GNU General Public License is a free, copyleft license for
++software and other kinds of works.
++
++  The licenses for most software and other practical works are designed
++to take away your freedom to share and change the works.  By contrast,
++the GNU General Public License is intended to guarantee your freedom to
++share and change all versions of a program--to make sure it remains free
++software for all its users.  We, the Free Software Foundation, use the
++GNU General Public License for most of our software; it applies also to
++any other work released this way by its authors.  You can apply it to
++your programs, too.
++
++  When we speak of free software, we are referring to freedom, not
++price.  Our General Public Licenses are designed to make sure that you
++have the freedom to distribute copies of free software (and charge for
++them if you wish), that you receive source code or can get it if you
++want it, that you can change the software or use pieces of it in new
++free programs, and that you know you can do these things.
++
++  To protect your rights, we need to prevent others from denying you
++these rights or asking you to surrender the rights.  Therefore, you have
++certain responsibilities if you distribute copies of the software, or if
++you modify it: responsibilities to respect the freedom of others.
++
++  For example, if you distribute copies of such a program, whether
++gratis or for a fee, you must pass on to the recipients the same
++freedoms that you received.  You must make sure that they, too, receive
++or can get the source code.  And you must show them these terms so they
++know their rights.
++
++  Developers that use the GNU GPL protect your rights with two steps:
++(1) assert copyright on the software, and (2) offer you this License
++giving you legal permission to copy, distribute and/or modify it.
++
++  For the developers' and authors' protection, the GPL clearly explains
++that there is no warranty for this free software.  For both users' and
++authors' sake, the GPL requires that modified versions be marked as
++changed, so that their problems will not be attributed erroneously to
++authors of previous versions.
++
++  Some devices are designed to deny users access to install or run
++modified versions of the software inside them, although the manufacturer
++can do so.  This is fundamentally incompatible with the aim of
++protecting users' freedom to change the software.  The systematic
++pattern of such abuse occurs in the area of products for individuals to
++use, which is precisely where it is most unacceptable.  Therefore, we
++have designed this version of the GPL to prohibit the practice for those
++products.  If such problems arise substantially in other domains, we
++stand ready to extend this provision to those domains in future versions
++of the GPL, as needed to protect the freedom of users.
++
++  Finally, every program is threatened constantly by software patents.
++States should not allow patents to restrict development and use of
++software on general-purpose computers, but in those that do, we wish to
++avoid the special danger that patents applied to a free program could
++make it effectively proprietary.  To prevent this, the GPL assures that
++patents cannot be used to render the program non-free.
++
++  The precise terms and conditions for copying, distribution and
++modification follow.
++
++                       TERMS AND CONDITIONS
++
++  0. Definitions.
++
++  "This License" refers to version 3 of the GNU General Public License.
++
++  "Copyright" also means copyright-like laws that apply to other kinds of
++works, such as semiconductor masks.
++
++  "The Program" refers to any copyrightable work licensed under this
++License.  Each licensee is addressed as "you".  "Licensees" and
++"recipients" may be individuals or organizations.
++
++  To "modify" a work means to copy from or adapt all or part of the work
++in a fashion requiring copyright permission, other than the making of an
++exact copy.  The resulting work is called a "modified version" of the
++earlier work or a work "based on" the earlier work.
++
++  A "covered work" means either the unmodified Program or a work based
++on the Program.
++
++  To "propagate" a work means to do anything with it that, without
++permission, would make you directly or secondarily liable for
++infringement under applicable copyright law, except executing it on a
++computer or modifying a private copy.  Propagation includes copying,
++distribution (with or without modification), making available to the
++public, and in some countries other activities as well.
++
++  To "convey" a work means any kind of propagation that enables other
++parties to make or receive copies.  Mere interaction with a user through
++a computer network, with no transfer of a copy, is not conveying.
++
++  An interactive user interface displays "Appropriate Legal Notices"
++to the extent that it includes a convenient and prominently visible
++feature that (1) displays an appropriate copyright notice, and (2)
++tells the user that there is no warranty for the work (except to the
++extent that warranties are provided), that licensees may convey the
++work under this License, and how to view a copy of this License.  If
++the interface presents a list of user commands or options, such as a
++menu, a prominent item in the list meets this criterion.
++
++  1. Source Code.
++
++  The "source code" for a work means the preferred form of the work
++for making modifications to it.  "Object code" means any non-source
++form of a work.
++
++  A "Standard Interface" means an interface that either is an official
++standard defined by a recognized standards body, or, in the case of
++interfaces specified for a particular programming language, one that
++is widely used among developers working in that language.
++
++  The "System Libraries" of an executable work include anything, other
++than the work as a whole, that (a) is included in the normal form of
++packaging a Major Component, but which is not part of that Major
++Component, and (b) serves only to enable use of the work with that
++Major Component, or to implement a Standard Interface for which an
++implementation is available to the public in source code form.  A
++"Major Component", in this context, means a major essential component
++(kernel, window system, and so on) of the specific operating system
++(if any) on which the executable work runs, or a compiler used to
++produce the work, or an object code interpreter used to run it.
++
++  The "Corresponding Source" for a work in object code form means all
++the source code needed to generate, install, and (for an executable
++work) run the object code and to modify the work, including scripts to
++control those activities.  However, it does not include the work's
++System Libraries, or general-purpose tools or generally available free
++programs which are used unmodified in performing those activities but
++which are not part of the work.  For example, Corresponding Source
++includes interface definition files associated with source files for
++the work, and the source code for shared libraries and dynamically
++linked subprograms that the work is specifically designed to require,
++such as by intimate data communication or control flow between those
++subprograms and other parts of the work.
++
++  The Corresponding Source need not include anything that users
++can regenerate automatically from other parts of the Corresponding
++Source.
++
++  The Corresponding Source for a work in source code form is that
++same work.
++
++  2. Basic Permissions.
++
++  All rights granted under this License are granted for the term of
++copyright on the Program, and are irrevocable provided the stated
++conditions are met.  This License explicitly affirms your unlimited
++permission to run the unmodified Program.  The output from running a
++covered work is covered by this License only if the output, given its
++content, constitutes a covered work.  This License acknowledges your
++rights of fair use or other equivalent, as provided by copyright law.
++
++  You may make, run and propagate covered works that you do not
++convey, without conditions so long as your license otherwise remains
++in force.  You may convey covered works to others for the sole purpose
++of having them make modifications exclusively for you, or provide you
++with facilities for running those works, provided that you comply with
++the terms of this License in conveying all material for which you do
++not control copyright.  Those thus making or running the covered works
++for you must do so exclusively on your behalf, under your direction
++and control, on terms that prohibit them from making any copies of
++your copyrighted material outside their relationship with you.
++
++  Conveying under any other circumstances is permitted solely under
++the conditions stated below.  Sublicensing is not allowed; section 10
++makes it unnecessary.
++
++  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
++
++  No covered work shall be deemed part of an effective technological
++measure under any applicable law fulfilling obligations under article
++11 of the WIPO copyright treaty adopted on 20 December 1996, or
++similar laws prohibiting or restricting circumvention of such
++measures.
++
++  When you convey a covered work, you waive any legal power to forbid
++circumvention of technological measures to the extent such circumvention
++is effected by exercising rights under this License with respect to
++the covered work, and you disclaim any intention to limit operation or
++modification of the work as a means of enforcing, against the work's
++users, your or third parties' legal rights to forbid circumvention of
++technological measures.
++
++  4. Conveying Verbatim Copies.
++
++  You may convey verbatim copies of the Program's source code as you
++receive it, in any medium, provided that you conspicuously and
++appropriately publish on each copy an appropriate copyright notice;
++keep intact all notices stating that this License and any
++non-permissive terms added in accord with section 7 apply to the code;
++keep intact all notices of the absence of any warranty; and give all
++recipients a copy of this License along with the Program.
++
++  You may charge any price or no price for each copy that you convey,
++and you may offer support or warranty protection for a fee.
++
++  5. Conveying Modified Source Versions.
++
++  You may convey a work based on the Program, or the modifications to
++produce it from the Program, in the form of source code under the
++terms of section 4, provided that you also meet all of these conditions:
++
++    a) The work must carry prominent notices stating that you modified
++    it, and giving a relevant date.
++
++    b) The work must carry prominent notices stating that it is
++    released under this License and any conditions added under section
++    7.  This requirement modifies the requirement in section 4 to
++    "keep intact all notices".
++
++    c) You must license the entire work, as a whole, under this
++    License to anyone who comes into possession of a copy.  This
++    License will therefore apply, along with any applicable section 7
++    additional terms, to the whole of the work, and all its parts,
++    regardless of how they are packaged.  This License gives no
++    permission to license the work in any other way, but it does not
++    invalidate such permission if you have separately received it.
++
++    d) If the work has interactive user interfaces, each must display
++    Appropriate Legal Notices; however, if the Program has interactive
++    interfaces that do not display Appropriate Legal Notices, your
++    work need not make them do so.
++
++  A compilation of a covered work with other separate and independent
++works, which are not by their nature extensions of the covered work,
++and which are not combined with it such as to form a larger program,
++in or on a volume of a storage or distribution medium, is called an
++"aggregate" if the compilation and its resulting copyright are not
++used to limit the access or legal rights of the compilation's users
++beyond what the individual works permit.  Inclusion of a covered work
++in an aggregate does not cause this License to apply to the other
++parts of the aggregate.
++
++  6. Conveying Non-Source Forms.
++
++  You may convey a covered work in object code form under the terms
++of sections 4 and 5, provided that you also convey the
++machine-readable Corresponding Source under the terms of this License,
++in one of these ways:
++
++    a) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by the
++    Corresponding Source fixed on a durable physical medium
++    customarily used for software interchange.
++
++    b) Convey the object code in, or embodied in, a physical product
++    (including a physical distribution medium), accompanied by a
++    written offer, valid for at least three years and valid for as
++    long as you offer spare parts or customer support for that product
++    model, to give anyone who possesses the object code either (1) a
++    copy of the Corresponding Source for all the software in the
++    product that is covered by this License, on a durable physical
++    medium customarily used for software interchange, for a price no
++    more than your reasonable cost of physically performing this
++    conveying of source, or (2) access to copy the
++    Corresponding Source from a network server at no charge.
++
++    c) Convey individual copies of the object code with a copy of the
++    written offer to provide the Corresponding Source.  This
++    alternative is allowed only occasionally and noncommercially, and
++    only if you received the object code with such an offer, in accord
++    with subsection 6b.
++
++    d) Convey the object code by offering access from a designated
++    place (gratis or for a charge), and offer equivalent access to the
++    Corresponding Source in the same way through the same place at no
++    further charge.  You need not require recipients to copy the
++    Corresponding Source along with the object code.  If the place to
++    copy the object code is a network server, the Corresponding Source
++    may be on a different server (operated by you or a third party)
++    that supports equivalent copying facilities, provided you maintain
++    clear directions next to the object code saying where to find the
++    Corresponding Source.  Regardless of what server hosts the
++    Corresponding Source, you remain obligated to ensure that it is
++    available for as long as needed to satisfy these requirements.
++
++    e) Convey the object code using peer-to-peer transmission, provided
++    you inform other peers where the object code and Corresponding
++    Source of the work are being offered to the general public at no
++    charge under subsection 6d.
++
++  A separable portion of the object code, whose source code is excluded
++from the Corresponding Source as a System Library, need not be
++included in conveying the object code work.
++
++  A "User Product" is either (1) a "consumer product", which means any
++tangible personal property which is normally used for personal, family,
++or household purposes, or (2) anything designed or sold for incorporation
++into a dwelling.  In determining whether a product is a consumer product,
++doubtful cases shall be resolved in favor of coverage.  For a particular
++product received by a particular user, "normally used" refers to a
++typical or common use of that class of product, regardless of the status
++of the particular user or of the way in which the particular user
++actually uses, or expects or is expected to use, the product.  A product
++is a consumer product regardless of whether the product has substantial
++commercial, industrial or non-consumer uses, unless such uses represent
++the only significant mode of use of the product.
++
++  "Installation Information" for a User Product means any methods,
++procedures, authorization keys, or other information required to install
++and execute modified versions of a covered work in that User Product from
++a modified version of its Corresponding Source.  The information must
++suffice to ensure that the continued functioning of the modified object
++code is in no case prevented or interfered with solely because
++modification has been made.
++
++  If you convey an object code work under this section in, or with, or
++specifically for use in, a User Product, and the conveying occurs as
++part of a transaction in which the right of possession and use of the
++User Product is transferred to the recipient in perpetuity or for a
++fixed term (regardless of how the transaction is characterized), the
++Corresponding Source conveyed under this section must be accompanied
++by the Installation Information.  But this requirement does not apply
++if neither you nor any third party retains the ability to install
++modified object code on the User Product (for example, the work has
++been installed in ROM).
++
++  The requirement to provide Installation Information does not include a
++requirement to continue to provide support service, warranty, or updates
++for a work that has been modified or installed by the recipient, or for
++the User Product in which it has been modified or installed.  Access to a
++network may be denied when the modification itself materially and
++adversely affects the operation of the network or violates the rules and
++protocols for communication across the network.
++
++  Corresponding Source conveyed, and Installation Information provided,
++in accord with this section must be in a format that is publicly
++documented (and with an implementation available to the public in
++source code form), and must require no special password or key for
++unpacking, reading or copying.
++
++  7. Additional Terms.
++
++  "Additional permissions" are terms that supplement the terms of this
++License by making exceptions from one or more of its conditions.
++Additional permissions that are applicable to the entire Program shall
++be treated as though they were included in this License, to the extent
++that they are valid under applicable law.  If additional permissions
++apply only to part of the Program, that part may be used separately
++under those permissions, but the entire Program remains governed by
++this License without regard to the additional permissions.
++
++  When you convey a copy of a covered work, you may at your option
++remove any additional permissions from that copy, or from any part of
++it.  (Additional permissions may be written to require their own
++removal in certain cases when you modify the work.)  You may place
++additional permissions on material, added by you to a covered work,
++for which you have or can give appropriate copyright permission.
++
++  Notwithstanding any other provision of this License, for material you
++add to a covered work, you may (if authorized by the copyright holders of
++that material) supplement the terms of this License with terms:
++
++    a) Disclaiming warranty or limiting liability differently from the
++    terms of sections 15 and 16 of this License; or
++
++    b) Requiring preservation of specified reasonable legal notices or
++    author attributions in that material or in the Appropriate Legal
++    Notices displayed by works containing it; or
++
++    c) Prohibiting misrepresentation of the origin of that material, or
++    requiring that modified versions of such material be marked in
++    reasonable ways as different from the original version; or
++
++    d) Limiting the use for publicity purposes of names of licensors or
++    authors of the material; or
++
++    e) Declining to grant rights under trademark law for use of some
++    trade names, trademarks, or service marks; or
++
++    f) Requiring indemnification of licensors and authors of that
++    material by anyone who conveys the material (or modified versions of
++    it) with contractual assumptions of liability to the recipient, for
++    any liability that these contractual assumptions directly impose on
++    those licensors and authors.
++
++  All other non-permissive additional terms are considered "further
++restrictions" within the meaning of section 10.  If the Program as you
++received it, or any part of it, contains a notice stating that it is
++governed by this License along with a term that is a further
++restriction, you may remove that term.  If a license document contains
++a further restriction but permits relicensing or conveying under this
++License, you may add to a covered work material governed by the terms
++of that license document, provided that the further restriction does
++not survive such relicensing or conveying.
++
++  If you add terms to a covered work in accord with this section, you
++must place, in the relevant source files, a statement of the
++additional terms that apply to those files, or a notice indicating
++where to find the applicable terms.
++
++  Additional terms, permissive or non-permissive, may be stated in the
++form of a separately written license, or stated as exceptions;
++the above requirements apply either way.
++
++  8. Termination.
++
++  You may not propagate or modify a covered work except as expressly
++provided under this License.  Any attempt otherwise to propagate or
++modify it is void, and will automatically terminate your rights under
++this License (including any patent licenses granted under the third
++paragraph of section 11).
++
++  However, if you cease all violation of this License, then your
++license from a particular copyright holder is reinstated (a)
++provisionally, unless and until the copyright holder explicitly and
++finally terminates your license, and (b) permanently, if the copyright
++holder fails to notify you of the violation by some reasonable means
++prior to 60 days after the cessation.
++
++  Moreover, your license from a particular copyright holder is
++reinstated permanently if the copyright holder notifies you of the
++violation by some reasonable means, this is the first time you have
++received notice of violation of this License (for any work) from that
++copyright holder, and you cure the violation prior to 30 days after
++your receipt of the notice.
++
++  Termination of your rights under this section does not terminate the
++licenses of parties who have received copies or rights from you under
++this License.  If your rights have been terminated and not permanently
++reinstated, you do not qualify to receive new licenses for the same
++material under section 10.
++
++  9. Acceptance Not Required for Having Copies.
++
++  You are not required to accept this License in order to receive or
++run a copy of the Program.  Ancillary propagation of a covered work
++occurring solely as a consequence of using peer-to-peer transmission
++to receive a copy likewise does not require acceptance.  However,
++nothing other than this License grants you permission to propagate or
++modify any covered work.  These actions infringe copyright if you do
++not accept this License.  Therefore, by modifying or propagating a
++covered work, you indicate your acceptance of this License to do so.
++
++  10. Automatic Licensing of Downstream Recipients.
++
++  Each time you convey a covered work, the recipient automatically
++receives a license from the original licensors, to run, modify and
++propagate that work, subject to this License.  You are not responsible
++for enforcing compliance by third parties with this License.
++
++  An "entity transaction" is a transaction transferring control of an
++organization, or substantially all assets of one, or subdividing an
++organization, or merging organizations.  If propagation of a covered
++work results from an entity transaction, each party to that
++transaction who receives a copy of the work also receives whatever
++licenses to the work the party's predecessor in interest had or could
++give under the previous paragraph, plus a right to possession of the
++Corresponding Source of the work from the predecessor in interest, if
++the predecessor has it or can get it with reasonable efforts.
++
++  You may not impose any further restrictions on the exercise of the
++rights granted or affirmed under this License.  For example, you may
++not impose a license fee, royalty, or other charge for exercise of
++rights granted under this License, and you may not initiate litigation
++(including a cross-claim or counterclaim in a lawsuit) alleging that
++any patent claim is infringed by making, using, selling, offering for
++sale, or importing the Program or any portion of it.
++
++  11. Patents.
++
++  A "contributor" is a copyright holder who authorizes use under this
++License of the Program or a work on which the Program is based.  The
++work thus licensed is called the contributor's "contributor version".
++
++  A contributor's "essential patent claims" are all patent claims
++owned or controlled by the contributor, whether already acquired or
++hereafter acquired, that would be infringed by some manner, permitted
++by this License, of making, using, or selling its contributor version,
++but do not include claims that would be infringed only as a
++consequence of further modification of the contributor version.  For
++purposes of this definition, "control" includes the right to grant
++patent sublicenses in a manner consistent with the requirements of
++this License.
++
++  Each contributor grants you a non-exclusive, worldwide, royalty-free
++patent license under the contributor's essential patent claims, to
++make, use, sell, offer for sale, import and otherwise run, modify and
++propagate the contents of its contributor version.
++
++  In the following three paragraphs, a "patent license" is any express
++agreement or commitment, however denominated, not to enforce a patent
++(such as an express permission to practice a patent or covenant not to
++sue for patent infringement).  To "grant" such a patent license to a
++party means to make such an agreement or commitment not to enforce a
++patent against the party.
++
++  If you convey a covered work, knowingly relying on a patent license,
++and the Corresponding Source of the work is not available for anyone
++to copy, free of charge and under the terms of this License, through a
++publicly available network server or other readily accessible means,
++then you must either (1) cause the Corresponding Source to be so
++available, or (2) arrange to deprive yourself of the benefit of the
++patent license for this particular work, or (3) arrange, in a manner
++consistent with the requirements of this License, to extend the patent
++license to downstream recipients.  "Knowingly relying" means you have
++actual knowledge that, but for the patent license, your conveying the
++covered work in a country, or your recipient's use of the covered work
++in a country, would infringe one or more identifiable patents in that
++country that you have reason to believe are valid.
++
++  If, pursuant to or in connection with a single transaction or
++arrangement, you convey, or propagate by procuring conveyance of, a
++covered work, and grant a patent license to some of the parties
++receiving the covered work authorizing them to use, propagate, modify
++or convey a specific copy of the covered work, then the patent license
++you grant is automatically extended to all recipients of the covered
++work and works based on it.
++
++  A patent license is "discriminatory" if it does not include within
++the scope of its coverage, prohibits the exercise of, or is
++conditioned on the non-exercise of one or more of the rights that are
++specifically granted under this License.  You may not convey a covered
++work if you are a party to an arrangement with a third party that is
++in the business of distributing software, under which you make payment
++to the third party based on the extent of your activity of conveying
++the work, and under which the third party grants, to any of the
++parties who would receive the covered work from you, a discriminatory
++patent license (a) in connection with copies of the covered work
++conveyed by you (or copies made from those copies), or (b) primarily
++for and in connection with specific products or compilations that
++contain the covered work, unless you entered into that arrangement,
++or that patent license was granted, prior to 28 March 2007.
++
++  Nothing in this License shall be construed as excluding or limiting
++any implied license or other defenses to infringement that may
++otherwise be available to you under applicable patent law.
++
++  12. No Surrender of Others' Freedom.
++
++  If conditions are imposed on you (whether by court order, agreement or
++otherwise) that contradict the conditions of this License, they do not
++excuse you from the conditions of this License.  If you cannot convey a
++covered work so as to satisfy simultaneously your obligations under this
++License and any other pertinent obligations, then as a consequence you may
++not convey it at all.  For example, if you agree to terms that obligate you
++to collect a royalty for further conveying from those to whom you convey
++the Program, the only way you could satisfy both those terms and this
++License would be to refrain entirely from conveying the Program.
++
++  13. Use with the GNU Affero General Public License.
++
++  Notwithstanding any other provision of this License, you have
++permission to link or combine any covered work with a work licensed
++under version 3 of the GNU Affero General Public License into a single
++combined work, and to convey the resulting work.  The terms of this
++License will continue to apply to the part which is the covered work,
++but the special requirements of the GNU Affero General Public License,
++section 13, concerning interaction through a network will apply to the
++combination as such.
++
++  14. Revised Versions of this License.
++
++  The Free Software Foundation may publish revised and/or new versions of
++the GNU General Public License from time to time.  Such new versions will
++be similar in spirit to the present version, but may differ in detail to
++address new problems or concerns.
++
++  Each version is given a distinguishing version number.  If the
++Program specifies that a certain numbered version of the GNU General
++Public License "or any later version" applies to it, you have the
++option of following the terms and conditions either of that numbered
++version or of any later version published by the Free Software
++Foundation.  If the Program does not specify a version number of the
++GNU General Public License, you may choose any version ever published
++by the Free Software Foundation.
++
++  If the Program specifies that a proxy can decide which future
++versions of the GNU General Public License can be used, that proxy's
++public statement of acceptance of a version permanently authorizes you
++to choose that version for the Program.
++
++  Later license versions may give you additional or different
++permissions.  However, no additional obligations are imposed on any
++author or copyright holder as a result of your choosing to follow a
++later version.
++
++  15. Disclaimer of Warranty.
++
++  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
++APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
++HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
++OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
++THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
++IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
++ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
++
++  16. Limitation of Liability.
++
++  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
++WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
++THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
++GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
++USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
++DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
++PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
++EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
++SUCH DAMAGES.
++
++  17. Interpretation of Sections 15 and 16.
++
++  If the disclaimer of warranty and limitation of liability provided
++above cannot be given local legal effect according to their terms,
++reviewing courts shall apply local law that most closely approximates
++an absolute waiver of all civil liability in connection with the
++Program, unless a warranty or assumption of liability accompanies a
++copy of the Program in return for a fee.
++
++                     END OF TERMS AND CONDITIONS
++
++            How to Apply These Terms to Your New Programs
++
++  If you develop a new program, and you want it to be of the greatest
++possible use to the public, the best way to achieve this is to make it
++free software which everyone can redistribute and change under these terms.
++
++  To do so, attach the following notices to the program.  It is safest
++to attach them to the start of each source file to most effectively
++state the exclusion of warranty; and each file should have at least
++the "copyright" line and a pointer to where the full notice is found.
++
++    <one line to give the program's name and a brief idea of what it does.>
++    Copyright (C) <year>  <name of author>
++
++    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 3 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, see <http://www.gnu.org/licenses/>.
++
++Also add information on how to contact you by electronic and paper mail.
++
++  If the program does terminal interaction, make it output a short
++notice like this when it starts in an interactive mode:
++
++    <program>  Copyright (C) <year>  <name of author>
++    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
++    This is free software, and you are welcome to redistribute it
++    under certain conditions; type `show c' for details.
++
++The hypothetical commands `show w' and `show c' should show the appropriate
++parts of the General Public License.  Of course, your program's commands
++might be different; for a GUI interface, you would use an "about box".
++
++  You should also get your employer (if you work as a programmer) or school,
++if any, to sign a "copyright disclaimer" for the program, if necessary.
++For more information on this, and how to apply and follow the GNU GPL, see
++<http://www.gnu.org/licenses/>.
++
++  The GNU General Public License does not permit incorporating your program
++into proprietary programs.  If your program is a subroutine library, you
++may consider it more useful to permit linking proprietary applications with
++the library.  If this is what you want to do, use the GNU Lesser General
++Public License instead of this License.  But first, please read
++<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
+Property changes on: ../trunk-jpl/src/java/COPYING
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/java/build.xml
+===================================================================
+--- ../trunk-jpl/src/java/build.xml	(revision 0)
++++ ../trunk-jpl/src/java/build.xml	(revision 17808)
+@@ -0,0 +1,126 @@
++<project name="inishell" default="help" basedir=".">
++	<description>
++	Build and run the inishell Application from the command line.
++	</description>
++
++
++	<!-- set global properties for the build -->
++	<property name="src" location="src"/>
++	<property name="examples" location="doc/examples"/>
++	<property name="build" location="build"/>
++	<property name="dist"  location="dist"/>
++	<property name="lib.dir" location="lib"/>
++	<tstamp prefix="build-info">
++		<format property="date" pattern="yyyy-MM-dd" locale="en" />
++		<format property="time" pattern="HH:mm:ss" locale="en" />
++		<format property="num-date" pattern="yyyyMMdd" locale="en" />
++	</tstamp>
++	<property name="version.num" value="1.0.0" />
++	<!--<buildnumber file="dist/build.num"/>-->
++	<!--<property name="version-number" value="${version.num}-${build.number}" />-->
++	<property name="version-number" value="${version.num}" />
++	<property name="version-full" value="${version.num}-${build-info.num-date}" />
++
++	<path id="classpath">
++		<fileset dir="${lib.dir}" includes="**/*.jar"/>
++	</path>
++
++
++	<!-- targets -->
++	<target name="help">
++		<echo>You can use the following targets:</echo>
++		<echo> </echo>
++		<echo>  help     : (default) Prints this message </echo>
++		<echo>  init     : create necessary directories</echo>
++		<echo>  clean    : Deletes work directories</echo>
++		<echo>  compile  : Compiles into class files</echo>
++		<echo>  dist     : pack all necessary files into a JAR file</echo>
++		<echo>  issm 	 : create inishell GUI using issm.xml</echo>
++		<echo>  snowpack : dist tailored for snowpack</echo>
++		<echo>  meteoio  : dist tailored for meteoio</echo>
++		<echo>  run      : run the previously compiled version</echo>
++		<echo>  pack     : pack all in a zip file for a release</echo>
++		<echo></echo>
++	</target>
++
++	<target name="init">
++		<mkdir dir="${build}"/>
++		<mkdir dir="${dist}"/>
++	</target>
++
++	<target name="snowpack" depends="init" description="Make doc/examples/snowpack_config.xml the default XML config">
++		<copy file="${examples}/snowpack_config.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
++		<antcall target="dist"/>
++	</target>
++
++	<target name="meteoio" depends="init" description="Make doc/examples/meteoio_config.xml the default XML config">
++		<copy file="${examples}/meteoio_config.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
++		<antcall target="dist"/>
++	</target>
++	
++	<target name="issm" depends="init" description="Make doc/examples/issm.xml the default XML config">
++		<copy file="./doc/examples/issm.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
++		<antcall target="dist"/>
++	</target>
++
++	<target name="compile" depends="init" description="Compile from ${src} to ${build}">
++		<javac srcdir="${src}" destdir="${build}" includeantruntime="false">
++			<classpath>
++				<fileset dir="lib">
++				<include name="**/*.jar"/>
++				</fileset>
++			</classpath>
++		</javac>
++		<copy todir="${build}/resources">
++		<fileset dir="${src}/resources" includes="**"/>
++	</copy>
++	</target>
++
++	<target name="dist" depends="compile" description="generate the distribution" >
++		<!-- Create the distribution directory -->
++		<delete file="MANIFEST.MF"/>
++		<manifest file="MANIFEST.MF">
++			<attribute name="Built-By" value="${user.name}"/>
++			<attribute name="Built-On" value="${build-info.date}" />
++			<attribute name="Built-At" value="${build-info.time}" />
++			<attribute name="Main-Class" value="main/GUIBuilder"/>
++			<attribute name="Specification-Title" value="INI file generator"/>
++			<attribute name="Specification-Version" value="${version-full}"/>
++			<attribute name="Specification-Vendor" value="SLF, www.slf.ch"/>
++			<attribute name="Implementation-Title" value="INIshell ini creator"/>
++			<attribute name="Implementation-Version" value="${version-number}"/>
++			<attribute name="Implementation-Vendor" value="SLF, www.slf.ch"/>
++		</manifest>
++
++		<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
++		<jar jarfile="${dist}/inishell.jar" basedir="${build}" manifest="MANIFEST.MF" index="true" >
++			<zipfileset src="${lib.dir}/miglayout-4.0.jar" includes="**/*.class"/>
++		</jar>
++	</target>
++
++	<target name="run" depends="dist">
++		<java fork="true" classname="main/GUIBuilder">
++			<classpath>
++				<path refid="classpath"/>
++				<path location="${dist}/inishell.jar"/>
++			</classpath>
++		</java>
++	</target>
++
++	<target name="clean" description="clean up" >
++		<!-- Delete the ${build} and ${dist} directory trees -->
++		<delete file="MANIFEST.MF"/>
++		<delete dir="${build}"/>
++		<delete dir="${dist}"/>
++	</target>
++
++	<target name="pack" depends="dist" description="pack for distribution">
++		<zip destfile="inishell-${version.num}.zip">
++			<zipfileset dir="doc/examples" prefix="inishell-${version.num}/doc/examples"/>
++			<zipfileset dir="dist" prefix="inishell-${version.num}/bin"/>
++			<zipfileset dir="." includes="inishell.sh" prefix="inishell-${version.num}/bin"/>
++			<zipfileset dir="." includes="Changelog_${version.num}.txt" prefix="inishell-${version.num}/doc"/>
++		</zip>
++	</target>
++
++</project>
+
+Property changes on: ../trunk-jpl/src/java/build.xml
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17807)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17808)
+@@ -88,8 +88,172 @@
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+-	_error_("NOT IMPLEMENTED YET");
++	if(!element->IsOnBase()) return NULL;
++	Element* basalelement = element->SpawnBasalElement();
+ 
++	/*Intermediaries */
++	int  dim, domaintype;
++	int i, row, col;
++	IssmDouble kappa;
++	IssmDouble Jdet, dt, D_scalar;
++	IssmDouble h,hx,hy,hz;
++	IssmDouble vel, calvingrate;
++	IssmDouble norm_dlsf;
++	IssmDouble* xyz_list = NULL;
++
++	/*Get problem dimension*/
++	basalelement->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:   dim = 1; break;
++		case Domain2DhorizontalEnum: dim = 2; break;
++		case Domain3DEnum:           dim = 2; break;
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
++	}
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes    = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke       = basalelement->NewElementMatrix();
++	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
++	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
++	IssmDouble*    D        = xNew<IssmDouble>(dim*dim);
++	IssmDouble*    v        = xNew<IssmDouble>(dim);
++	IssmDouble*    w        = xNew<IssmDouble>(dim);
++	IssmDouble*    c        = xNew<IssmDouble>(dim);
++	IssmDouble*    dlsf     = xNew<IssmDouble>(dim);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
++	Input* vx_input=NULL;
++	Input* vy_input=NULL;
++	if(domaintype==Domain2DhorizontalEnum){
++		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
++		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
++	}
++	else{
++		if(dim==1){
++			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
++		}
++		if(dim==2){
++			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
++			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
++		}
++	}
++
++	Input* lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
++	Input* lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
++	Input* calvingrate_input  = basalelement->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
++	
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		D_scalar=gauss->weight*Jdet;
++
++		/* Transient */
++		if(dt!=0.){
++			basalelement->NodalFunctions(basis,gauss);
++			TripleMultiply(basis,numnodes,1,0,
++						&D_scalar,1,1,0,
++						basis,1,numnodes,0,
++						&Ke->values[0],1);
++			D_scalar*=dt;
++		}
++
++		/* Advection */
++		GetB(B,basalelement,xyz_list,gauss); 
++		GetBprime(Bprime,basalelement,xyz_list,gauss); 
++		vx_input->GetInputValue(&v[0],gauss); // in 3D case, add mesh velocity 
++		vy_input->GetInputValue(&v[1],gauss); 
++		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
++		lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
++		calvingrate_input->GetInputValue(&calvingrate,gauss);
++
++		norm_dlsf=0.;
++		for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
++		norm_dlsf=sqrt(norm_dlsf);
++
++		if(norm_dlsf>1.e-10)
++			for(i=0;i<dim;i++) c[i]=calvingrate*dlsf[i]/norm_dlsf;
++		else
++			for(i=0;i<dim;i++) c[i]=0.;
++		
++		for(i=0;i<dim;i++) w[i]=v[i]-c[i];
++
++		for(row=0;row<dim;row++)
++			for(col=0;col<dim;col++)
++				if(row==col)
++					D[row*dim+col]=D_scalar*w[row];
++				else
++				   D[row*dim+col]=0.;
++
++		TripleMultiply(B,dim,numnodes,1,
++					D,dim,dim,0,
++					Bprime,dim,numnodes,0,
++					&Ke->values[0],1);
++
++		/* Stabilization */
++		int stabilization=2;
++		vel=0.;
++		for(i=0;i<dim;i++) vel+=v[i]*v[i];
++		vel=sqrt(vel)+1.e-14;
++		switch(stabilization){
++			case 0:
++				// no stabilization, do nothing
++				break;
++			case 1:
++				/* Artificial Diffusion */
++				basalelement->ElementSizes(&hx,&hy,&hz);
++				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) ); 
++				kappa=h*vel/2.;
++				for(row=0;row<dim;row++)
++					for(col=0;col<dim;col++)
++					if(row==col)
++						D[row*dim+col]=D_scalar*kappa;
++					else
++						D[row*dim+col]=0.;
++
++				TripleMultiply(Bprime,dim,numnodes,1,
++							D,dim,dim,0,
++							Bprime,dim,numnodes,0,
++							&Ke->values[0],1);
++				break;	
++			case 2:
++				/* Streamline Upwinding */
++				basalelement->ElementSizes(&hx,&hy,&hz);
++				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) );
++				for(row=0;row<dim;row++) 
++					for(col=0;col<dim;col++) 
++						D[row*dim+col] = D_scalar*h/(2.*vel)*v[row]*v[col];
++
++				TripleMultiply(Bprime,dim,numnodes,1,
++							D,dim,dim,0,
++							Bprime,dim,numnodes,0,
++							&Ke->values[0],1);
++				break;
++			default:
++				_error_("unknown type of stabilization in LevelsetAnalysis.cpp");
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(B);
++	xDelete<IssmDouble>(D);
++	xDelete<IssmDouble>(Bprime);
++	xDelete<IssmDouble>(v);
++	xDelete<IssmDouble>(w);
++	xDelete<IssmDouble>(c);
++	xDelete<IssmDouble>(dlsf);
++	delete gauss;
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	return Ke;
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+ 	
Index: /issm/oecreview/Archive/17802-17983/ISSM-17810-17811.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17810-17811.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17810-17811.diff	(revision 17986)
@@ -0,0 +1,62 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17810)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17811)
+@@ -802,26 +802,11 @@
+ 		mesh=mesh2d()
+ 		mesh.x=md.mesh.x2d
+ 		mesh.y=md.mesh.y2d
+-		mesh.z=numpy.zeros_like(md.mesh.x2d)
+ 		mesh.numberofvertices=md.mesh.numberofvertices2d
+ 		mesh.numberofelements=md.mesh.numberofelements2d
+ 		mesh.elements=md.mesh.elements2d
+ 		md.mesh=mesh
+ 
+-		#Keep a trace of lower and upper nodes
+-		md.mesh.lowervertex=numpy.nan
+-		md.mesh.uppervertex=numpy.nan
+-		md.mesh.lowerelements=numpy.nan
+-		md.mesh.upperelements=numpy.nan
+-
+-		#Remove old mesh 
+-		md.mesh.x2d=numpy.nan
+-		md.mesh.y2d=numpy.nan
+-		md.mesh.elements2d=numpy.nan
+-		md.mesh.numberofelements2d=md.mesh.numberofelements
+-		md.mesh.numberofvertices2d=md.mesh.numberofvertices
+-		md.mesh.numberoflayers=0
+-
+ 		return md
+ 
+ #}}}
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17810)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17811)
+@@ -246,26 +246,11 @@
+ 			mesh=mesh2d();
+ 			mesh.x=md.mesh.x2d;
+ 			mesh.y=md.mesh.y2d;
+-			mesh.z=zeros(size(md.mesh.x2d));
+ 			mesh.numberofvertices=md.mesh.numberofvertices2d;
+ 			mesh.numberofelements=md.mesh.numberofelements2d;
+ 			mesh.elements=md.mesh.elements2d;
+ 			md.mesh=mesh;
+ 
+-			%Keep a trace of lower and upper nodes
+-			md.mesh.lowervertex=NaN;
+-			md.mesh.uppervertex=NaN;
+-			md.mesh.lowerelements=NaN;
+-			md.mesh.upperelements=NaN;
+-
+-			%Remove old mesh 
+-			md.mesh.x2d=NaN;
+-			md.mesh.y2d=NaN;
+-			md.mesh.elements2d=NaN;
+-			md.mesh.numberofelements2d=md.mesh.numberofelements;
+-			md.mesh.numberofvertices2d=md.mesh.numberofvertices;
+-			md.mesh.numberoflayers=0;
+-
+ 		end % }}}
+ 		function md2 = extract(md,area) % {{{
+ 			%extract - extract a model according to an Argus contour or flag list
Index: /issm/oecreview/Archive/17802-17983/ISSM-17811-17812.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17811-17812.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17811-17812.diff	(revision 17986)
@@ -0,0 +1,110 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17811)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17812)
+@@ -203,7 +203,48 @@
+ /*}}}*/
+ /*FUNCTION Tria::ComputeStrainRate {{{*/
+ void  Tria::ComputeStrainRate(Vector<IssmDouble>* eps){
+-	_error_("Not Implemented yet");
++
++	IssmDouble      xyz_list[NUMVERTICES][3];
++	IssmDouble      epsilon[6]; /* epsilon=[exx,eyy,exy];*/
++	IssmDouble      eps_xx[NUMVERTICES];
++	IssmDouble		 eps_yy[NUMVERTICES];
++	IssmDouble		 eps_zz[NUMVERTICES]={0,0,0};
++	IssmDouble      eps_xy[NUMVERTICES];
++	IssmDouble		 eps_xz[NUMVERTICES]={0,0,0};
++	IssmDouble		 eps_yz[NUMVERTICES]={0,0,0};
++	GaussPenta*     gauss=NULL;
++
++	/* Get node coordinates and dof list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
++	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
++
++	/* Start looping on the number of vertices: */
++	gauss=new GaussPenta();
++	for (int iv=0;iv<NUMVERTICES;iv++){
++		gauss->GaussVertex(iv);
++
++		/*Compute strain rate viscosity and pressure: */
++		this->StrainRateSSA(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
++
++		eps_xx[iv]=epsilon[0]; 
++		eps_yy[iv]=epsilon[1];
++		eps_xy[iv]=epsilon[2];
++	}
++
++	/*Add Stress tensor components into inputs*/
++	this->inputs->AddInput(new TriaInput(StrainRatexxEnum,&eps_xx[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(StrainRatexyEnum,&eps_xy[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(StrainRatexzEnum,&eps_xz[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(StrainRateyyEnum,&eps_yy[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(StrainRateyzEnum,&eps_yz[0],P1Enum));
++	this->inputs->AddInput(new TriaInput(StrainRatezzEnum,&eps_zz[0],P1Enum));
++
++	/*Clean up and return*/
++	delete gauss;
++
+ }
+ /*}}}*/
+ /*FUNCTION Tria::ComputeStressTensor {{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17811)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17812)
+@@ -278,8 +278,50 @@
+ /*FUNCTION Penta::ComputeStrainRate {{{*/
+ void  Penta::ComputeStrainRate(Vector<IssmDouble>* eps){
+ 
+-	_error_("Not implemented yet");
++	IssmDouble      xyz_list[NUMVERTICES][3];
++	IssmDouble      epsilon[6]; /* epsilon=[exx,eyy,exy];*/
++	IssmDouble      eps_xx[NUMVERTICES];
++	IssmDouble		 eps_yy[NUMVERTICES];
++	IssmDouble		 eps_zz[NUMVERTICES];
++	IssmDouble      eps_xy[NUMVERTICES];
++	IssmDouble		 eps_xz[NUMVERTICES];
++	IssmDouble		 eps_yz[NUMVERTICES];
++	GaussPenta*     gauss=NULL;
+ 
++	/* Get node coordinates and dof list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* vx_input=inputs->GetInput(VxEnum);             _assert_(vx_input);
++	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
++	Input* vz_input=inputs->GetInput(VzEnum);             _assert_(vz_input);
++
++	/* Start looping on the number of vertices: */
++	gauss=new GaussPenta();
++	for (int iv=0;iv<NUMVERTICES;iv++){
++		gauss->GaussVertex(iv);
++
++		/*Compute strain rate viscosity and pressure: */
++		this->StrainRateFS(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input,vz_input);
++
++		eps_xx[iv]=epsilon[0]; 
++		eps_yy[iv]=epsilon[1];
++		eps_zz[iv]=epsilon[2];
++		eps_xy[iv]=epsilon[3];
++		eps_xz[iv]=epsilon[4];
++		eps_yz[iv]=epsilon[5];
++	}
++
++	/*Add Stress tensor components into inputs*/
++	this->inputs->AddInput(new PentaInput(StrainRatexxEnum,&eps_xx[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StrainRatexyEnum,&eps_xy[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StrainRatexzEnum,&eps_xz[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StrainRateyyEnum,&eps_yy[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StrainRateyzEnum,&eps_yz[0],P1Enum));
++	this->inputs->AddInput(new PentaInput(StrainRatezzEnum,&eps_zz[0],P1Enum));
++
++	/*Clean up and return*/
++	delete gauss;
+ }
+ /*}}}*/
+ /*FUNCTION Penta::ComputeStressTensor {{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17812-17813.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17812-17813.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17812-17813.diff	(revision 17986)
@@ -0,0 +1,104 @@
+Index: ../trunk-jpl/test/NightlyRun/test511.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.py	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test511.py	(revision 17813)
+@@ -38,7 +38,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','MaterialsRheologyB','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-11,5e-12,1e-11,1e-09,2e-12,1e-11,1e-11]
++field_tolerances=[5e-11,5e-11,5e-11,1e-09,1e-11,5e-11,1e-11]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test404.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.py	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test404.py	(revision 17813)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[2e-07,2e-07,2e-06,1e-06,1e-07]
++field_tolerances=[2e-07,4e-07,2e-06,1e-06,1e-07]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test427.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.py	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test427.py	(revision 17813)
+@@ -33,7 +33,7 @@
+ 	'Bed3','Surface3','Thickness3','Floatingice3']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,\
+ 	5e-12,3e-12,7e-12,2e-11,\
+-	1e-10,1e-11,1e-10,1e-13]
++	1e-10,5e-11,1e-10,7e-10]
+ field_values=[\
+ 	md.results.TransientSolution[0].Base,\
+ 	md.results.TransientSolution[0].Surface,\
+Index: ../trunk-jpl/test/NightlyRun/test315.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test315.py	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test315.py	(revision 17813)
+@@ -21,7 +21,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+ 	1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-	1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
++	1e-10,2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test427.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test427.m	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test427.m	(revision 17813)
+@@ -23,7 +23,7 @@
+ 	'Bed3','Surface3','Thickness3','Floatingice3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,...
+ 	5e-12,3e-12,7e-12,2e-11,...
+-	1e-10,3e-11,1e-10,7e-11};
++	1e-10,5e-11,1e-10,7e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+Index: ../trunk-jpl/test/NightlyRun/test404.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.m	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test404.m	(revision 17813)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={2e-07,2e-07,2e-06,1e-06,1e-07};
++field_tolerances={2e-07,5e-07,2e-06,1e-06,1e-07};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test511.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test511.m	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test511.m	(revision 17813)
+@@ -27,7 +27,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','MaterialsRheologyB','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-11,5e-12,1e-11,1e-09,2e-12,1e-11,1e-11};
++field_tolerances={5e-11,5e-11,5e-11,1e-09,1e-11,5e-11,1e-11};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test315.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test315.m	(revision 17812)
++++ ../trunk-jpl/test/NightlyRun/test315.m	(revision 17813)
+@@ -12,7 +12,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...,
+ 	1e-10,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-	1e-10,1.5e-13,1.5e-13,1.5e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
++	1e-10,2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17813-17814.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17813-17814.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17813-17814.diff	(revision 17986)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/jenkins/linux64_murdo_ad
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 17813)
++++ ../trunk-jpl/jenkins/linux64_murdo_ad	(revision 17814)
+@@ -15,6 +15,7 @@
+ 				--prefix=$ISSM_DIR \
+ 				--without-kriging \
+ 				--without-kml \
++				--without-Gia \
+ 				--with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
+ 				--with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install \
+ 				--with-matlab-dir=$MATLAB_DIR \
+Index: ../trunk-jpl/jenkins/linux64_murdo_ampi
+===================================================================
+--- ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 17813)
++++ ../trunk-jpl/jenkins/linux64_murdo_ampi	(revision 17814)
+@@ -15,6 +15,7 @@
+ ISSM_CONFIG='--prefix=$ISSM_DIR\
+ 				  --without-kriging \
+ 				  --without-kml \
++				  --without-Gia \
+ 				  --with-gsl-dir=$ISSM_DIR/externalpackages/gsl/install \
+ 				  --with-adolc-dir=$ISSM_DIR/externalpackages/adolc/install \
+ 				  --with-ampi-dir=$ISSM_DIR/externalpackages/adjoinablempi/install \
Index: /issm/oecreview/Archive/17802-17983/ISSM-17814-17815.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17814-17815.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17814-17815.diff	(revision 17986)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17814)
++++ ../trunk-jpl/jenkins/windows	(revision 17815)
+@@ -14,6 +14,7 @@
+ #ISSM CONFIGURATION 
+ ISSM_CONFIG='--prefix=$ISSM_DIR \
+    --disable-static \
++	--without-Gia \
+ 	--with-vendor=intel-win7-64  \
+ 	--with-matlab-dir=""$ISSM_DIR/externalpackages/matlab/install"" \
+ 	--with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
Index: /issm/oecreview/Archive/17802-17983/ISSM-17815-17816.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17815-17816.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17815-17816.diff	(revision 17986)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/c/shared/Elements/Arrhenius.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/Arrhenius.cpp	(revision 17815)
++++ ../trunk-jpl/src/c/shared/Elements/Arrhenius.cpp	(revision 17816)
+@@ -33,6 +33,7 @@
+ 
+ 	/*convert temperature to absolute temperature*/
+ 	_assert_(depth>0);
++	printf("temperature = %g beta = %g depth = %g\n",temperature,beta,depth);
+ 	Tstar=temperature-beta*depth;
+ 	_assert_(Tstar>0);
+ 
+Index: ../trunk-jpl/src/c/solutionsequences/solutionsequence_newton.cpp
+===================================================================
+--- ../trunk-jpl/src/c/solutionsequences/solutionsequence_newton.cpp	(revision 17815)
++++ ../trunk-jpl/src/c/solutionsequences/solutionsequence_newton.cpp	(revision 17816)
+@@ -67,7 +67,7 @@
+ 		uf=old_uf->Duplicate(); old_uf->Copy(uf);
+ 
+ 		/*Prepare next iteration using Newton's method*/
+-		SystemMatricesx(&Kff,&Kfs,&pf,&df,NULL,femmodel);delete df;
++		SystemMatricesx(&Kff,&Kfs,&pf,&df,&kmax,femmodel);delete df;
+ 		CreateNodalConstraintsx(&ys,femmodel->nodes,configuration_type);
+ 		Reduceloadx(pf,Kfs,ys);delete Kfs;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17815)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17816)
+@@ -149,7 +149,7 @@
+ /*FUNCTION Tria::ComputeSigmaNN {{{*/
+ void  Tria::ComputeSigmaNN(){
+ 
+-	if(~IsOnBase()){
++	if(!IsOnBase()){
+ 		IssmDouble sigma_nn=0;
+ 		this->inputs->AddInput(new TriaInput(SigmaNNEnum,&sigma_nn,P0Enum));
+ 		return;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17816-17817.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17816-17817.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17816-17817.diff	(revision 17986)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17816)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17817)
+@@ -23,12 +23,12 @@
+ 		self.max_damage			= float('NaN')
+ 		
+ 		#numerical
+-		stabilization				= float('NaN')
+-		maxiter						= float('NaN')
+-		elementinterp           = ''
+-		penalty_threshold			= float('NaN')
+-		penalty_lock				= float('NaN')
+-		penalty_factor				= float('NaN')
++		self.stabilization		= float('NaN')
++		self.maxiter				= float('NaN')
++		self.elementinterp      = ''
++		self.penalty_threshold	= float('NaN')
++		self.penalty_lock			= float('NaN')
++		self.penalty_factor		= float('NaN')
+ 
+ 		#general parameters for evolution law: 
+ 		self.stress_threshold   = float('NaN')
+@@ -58,7 +58,7 @@
+ 
+ 			s+="%s\n" % fielddisplay(self,"stabilization","0: no, 1: artificial_diffusivity, 2: SUPG")
+ 			s+="%s\n" % fielddisplay(self,"maxiter","maximum number of non linear iterations")
+-			s+="%s\n" %	fielddisplay(self,"elementinterp","interpolation scheme for finite elements {''P1'',''P2''}")
++			s+="%s\n" %	fielddisplay(self,"elementinterp","interpolation scheme for finite elements [''P1'',''P2'']")
+ 			s+="%s\n" % fielddisplay(self,"penalty_lock","stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization)")
+ 			s+="%s\n" % fielddisplay(self,"penalty_threshold","threshold to declare convergence of damage evolution solution (default is 0)")
+ 			s+="%s\n" % fielddisplay(self,"penalty_factor","scaling exponent (default is 3)")
+@@ -133,7 +133,6 @@
+ 			md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0)
+ 			md = checkfield(md,'fieldname','damage.law','values',['undamaged','pralong'])
+ 			md = checkfield(md,'fieldname','damage.spcdamage','forcing',1)
+-				
+ 			md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0,1,2])
+ 			md = checkfield(md,'fieldname','damage.maxiter','>=0',0)
+ 			md = checkfield(md,'fieldname','damage.elementinterp','values',['P1','P2'])
+@@ -165,7 +164,6 @@
+ 			WriteData(fid,'object',self,'fieldname','law','format','String')
+ 			WriteData(fid,'object',self,'fieldname','spcdamage','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
+ 			WriteData(fid,'object',self,'fieldname','max_damage','format','Double')
+-
+ 			WriteData(fid,'object',self,'fieldname','stabilization','format','Integer')
+ 			WriteData(fid,'object',self,'fieldname','elementinterp','format','String')
+ 			WriteData(fid,'object',self,'fieldname','penalty_threshold','format','Integer')
Index: /issm/oecreview/Archive/17802-17983/ISSM-17817-17818.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17817-17818.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17817-17818.diff	(revision 17986)
@@ -0,0 +1,14 @@
+Index: ../trunk-jpl/src/m/mech/mechanicalproperties.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/mechanicalproperties.py	(revision 17817)
++++ ../trunk-jpl/src/m/mech/mechanicalproperties.py	(revision 17818)
+@@ -75,7 +75,8 @@
+ 		location=npy.nonzero(npy.logical_and(second_inv==0,power!=0))
+ 		nu[location]=10^18
+ 	elif 'matdamageice' in md.materials.__module__:
+-		Zinv=npy.dot(md.materials.rheology_Z[index-1],summation/3.).reshape(-1,)
++		print 'computing damage-dependent properties!'
++		Zinv=npy.dot(1-md.damage.D[index-1],summation/3.).reshape(-1,)
+ 		location=npy.nonzero(second_inv)
+ 		nu[location]=Zinv[location]*B_bar[location]/npy.power(second_inv[location],power[location])
+ 		location=npy.nonzero(npy.logical_and(second_inv==0,power==0))
Index: /issm/oecreview/Archive/17802-17983/ISSM-17818-17819.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17818-17819.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17818-17819.diff	(revision 17986)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17818)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17819)
+@@ -41,8 +41,10 @@
+ 		ncols=options.list[0].getfieldvalue('ncols')
+ 		nc=True
+ 	else:
+-		ncols=subplotwidth
++		ncols=int(subplotwidth)
+ 		nc=False
++	ncols=int(ncols)
++	nrows=int(nrows)
+ 	
+ 	#check that nrows and ncols were given at the same time!
+ 	if not nr==nc:
+@@ -70,7 +72,7 @@
+ 				add_all=True,
+ 				share_all=True,
+ 				label_mode='all',
+-				cbar_mode='single',
++				cbar_mode='each',
+ 				cbar_location='right',
+ 				cbar_size='5%',
+ 				cbar_pad=0.05
Index: /issm/oecreview/Archive/17802-17983/ISSM-17819-17820.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17819-17820.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17819-17820.diff	(revision 17986)
@@ -0,0 +1,25 @@
+Index: ../trunk-jpl/src/m/plot/plot_manager.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17819)
++++ ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17820)
+@@ -59,6 +59,7 @@
+ 			return
+ 		elif data.lower()=='none':
+ 			print 'no data provided to plot (TODO: write plot_none.py)'
++			applyoptions(md,[],options,fig,ax)
+ 			return
+ 		else:
+ 			print "WARNING: '%s' is not implemented or is not a valid string for option 'data'" % data
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17819)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17820)
+@@ -64,7 +64,7 @@
+ 			fig=plt.figure(figurenumber,tight_layout=True)
+ 		fig.clf()
+ 	
+-		# options to pass: axes_pad, share_all, label_mode ("1","L","all"), cbar_mode (none,single,each), cbar_location(right,top)
++		# options to pass/construct: axes_pad, share_all, label_mode ("1","L","all"), cbar_mode (none,single,each), cbar_location(right,top)
+ 		axgrid=ImageGrid(fig, 111,
+ 				nrows_ncols=(nrows,ncols),
+ 				direction='row',
Index: /issm/oecreview/Archive/17802-17983/ISSM-17820-17821.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17820-17821.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17820-17821.diff	(revision 17986)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/externalpackages/latex2html/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/latex2html/install.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/latex2html/install.sh	(revision 17821)
+@@ -0,0 +1,21 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf install src latex2html-2008
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://www.latex2html.org/~latex2ht/current/latex2html-2008.tar.gz' 'latex2html-2008.tar.gz'
++
++#untar 
++tar -zxvf  latex2html-2008.tar.gz
++mv latex2html-2008 install
++
++#Configure
++cd install
++./configure --prefix "$ISSM_DIR/externalpackages/latex2html/install/"
++exit 0
++
++#Install
++make
++make install
+
+Property changes on: ../trunk-jpl/externalpackages/latex2html/install.sh
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
Index: /issm/oecreview/Archive/17802-17983/ISSM-17821-17822.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17821-17822.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17821-17822.diff	(revision 17986)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17821)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17822)
+@@ -63,19 +63,29 @@
+ 		else:
+ 			fig=plt.figure(figurenumber,tight_layout=True)
+ 		fig.clf()
+-	
+-		# options to pass/construct: axes_pad, share_all, label_mode ("1","L","all"), cbar_mode (none,single,each), cbar_location(right,top)
++
++		# options needed to define plot grid
++		direction=options.list[0].getfieldvalue('direction','row') # row,column
++		axes_pad=options.list[0].getfieldvalue('axes_pad',0.05)
++		add_all=options.list[0].getfieldvalue('add_all',True) # True,False
++		share_all=options.list[0].getfieldvalue('share_all',True) # True,False
++		label_mode=options.list[0].getfieldvalue('label_mode','1') # 1,L,all
++		cbar_mode=options.list[0].getfieldvalue('cbar_mode','each') # none,single,each
++		cbar_location=options.list[0].getfieldvalue('cbar_location','right') # right,top
++		cbar_size=options.list[0].getfieldvalue('cbar_size','5%')
++		cbar_pad=options.list[0].getfieldvalue('cbar_pad','5%') # None or %
++		
+ 		axgrid=ImageGrid(fig, 111,
+ 				nrows_ncols=(nrows,ncols),
+-				direction='row',
+-				axes_pad=0.05,
+-				add_all=True,
+-				share_all=True,
+-				label_mode='all',
+-				cbar_mode='each',
+-				cbar_location='right',
+-				cbar_size='5%',
+-				cbar_pad=0.05
++				direction=direction,
++				axes_pad=axes_pad,
++				add_all=add_all,
++				share_all=share_all,
++				label_mode=label_mode,
++				cbar_mode=cbar_mode,
++				cbar_location=cbar_location,
++				cbar_size=cbar_size,
++				cbar_pad=cbar_pad
+ 				)
+ 
+ 		for i in xrange(numberofplots):
Index: /issm/oecreview/Archive/17802-17983/ISSM-17822-17823.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17822-17823.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17822-17823.diff	(revision 17986)
@@ -0,0 +1,78 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17822)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17823)
+@@ -27,7 +27,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	5e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
++	5e-08,5e-08,1e-05,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+ 	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test274.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test274.py	(revision 17822)
++++ ../trunk-jpl/test/NightlyRun/test274.py	(revision 17823)
+@@ -26,7 +26,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure']
+-field_tolerances=[4.5e-8,1.35e-8,1.55e-8,1e-11]
++field_tolerances=[7e-8,3e-8,3e-8,1e-11]
+ field_values=[\
+ 	   md.results.StressbalanceSolution.Vx,\
+ 	   md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test274.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test274.m	(revision 17822)
++++ ../trunk-jpl/test/NightlyRun/test274.m	(revision 17823)
+@@ -13,7 +13,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure'};
+-field_tolerances={5.0e-8,2.0e-8,2.0e-8,1e-11};
++field_tolerances={7e-8,3e-8,3e-8,1e-11};
+ field_values={...
+ 	   (md.results.StressbalanceSolution.Vx),...
+ 	   (md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.m	(revision 17822)
++++ ../trunk-jpl/test/NightlyRun/test285.m	(revision 17823)
+@@ -12,7 +12,7 @@
+ 	md.flowequation.fe_HO=i{1};
+ 	md=solve(md,StressbalanceSolutionEnum());
+ 	field_names     ={field_names{:},['Vx' i{1}],['Vy' i{1}],['Vz' i{1}],['Vel' i{1}],['Pressure' i{1}]};
+-	field_tolerances={field_tolerances{:},6e-08,4e-08,2e-08,4e-08,1e-13};
++	field_tolerances={field_tolerances{:},6e-08,5e-08,2e-08,5e-08,1e-13};
+ 	field_values={field_values{:},...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test285.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test285.py	(revision 17822)
++++ ../trunk-jpl/test/NightlyRun/test285.py	(revision 17823)
+@@ -22,7 +22,7 @@
+ 	md.flowequation.fe_HO=i
+ 	md=solve(md,StressbalanceSolutionEnum())
+ 	field_names     =field_names+['Vx'+i,'Vy'+i,'Vz'+i,'Vel'+i,'Pressure'+i]
+-	field_tolerances=field_tolerances+[6e-08,4e-08,2e-08,4e-08,1e-13]
++	field_tolerances=field_tolerances+[6e-08,5e-08,2e-08,5e-08,1e-13]
+ 	field_values=field_values+[\
+ 		md.results.StressbalanceSolution.Vx,\
+ 		md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17822)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17823)
+@@ -14,7 +14,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	5e-08,3e-08,1e-06,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
++	5e-08,5e-08,1e-05,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+ 	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17823-17824.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17823-17824.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17823-17824.diff	(revision 17986)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/c/shared/Elements/Arrhenius.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Elements/Arrhenius.cpp	(revision 17823)
++++ ../trunk-jpl/src/c/shared/Elements/Arrhenius.cpp	(revision 17824)
+@@ -33,7 +33,6 @@
+ 
+ 	/*convert temperature to absolute temperature*/
+ 	_assert_(depth>0);
+-	printf("temperature = %g beta = %g depth = %g\n",temperature,beta,depth);
+ 	Tstar=temperature-beta*depth;
+ 	_assert_(Tstar>0);
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17824-17825.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17824-17825.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17824-17825.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17824)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17825)
+@@ -424,17 +424,15 @@
+ 
+ 	/*Get inputs*/
+ 	if(converged){
+-		IssmDouble penalty_factor,kmax,kappa,h_max;
+-		IssmDouble rho_freshwater,rho_ice;
+-		IssmDouble g;
++		IssmDouble  penalty_factor,kmax,kappa,h_max;
+ 		IssmDouble* thickness = xNew<IssmDouble>(numnodes);
+ 		IssmDouble* base      = xNew<IssmDouble>(numnodes);
+ 
+ 		basalelement->FindParam(&kmax,HydrologySedimentKmaxEnum);
+ 		basalelement->FindParam(&penalty_factor,HydrologydcPenaltyFactorEnum);
+-		basalelement->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+-		basalelement->GetMaterialParameter(MaterialsRhoIceEnum);
+-		basalelement->GetMaterialParameter(ConstantsGEnum);
++		IssmDouble rho_freshwater = basalelement->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
++		IssmDouble rho_ice        = basalelement->GetMaterialParameter(MaterialsRhoIceEnum);
++		IssmDouble g              = basalelement->GetMaterialParameter(ConstantsGEnum);
+ 		
+ 		basalelement->GetInputListOnVertices(thickness,ThicknessEnum);
+ 		basalelement->GetInputListOnVertices(base,BaseEnum);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17825-17826.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17825-17826.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17825-17826.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17825)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17826)
+@@ -27,7 +27,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	5e-08,5e-08,1e-05,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
++	5e-08,5e-08,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+ 	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17825)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17826)
+@@ -14,7 +14,7 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	5e-08,5e-08,1e-05,3e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
++	5e-08,5e-08,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+ 	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17826-17827.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17826-17827.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17826-17827.diff	(revision 17986)
@@ -0,0 +1,110 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17827)
+@@ -201,6 +201,7 @@
+ 		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type)=0;
+ 		virtual void   ComputeSigmaNN(void)=0;
+ 		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
++		virtual void   ComputeStrainRate()=0;
+ 		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
+ 		virtual void   ComputeStressTensor(void)=0;
+ 		virtual void   ComputeDeviatoricStressTensor(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17827)
+@@ -202,7 +202,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Tria::ComputeStrainRate {{{*/
+-void  Tria::ComputeStrainRate(Vector<IssmDouble>* eps){
++void  Tria::ComputeStrainRate(){
+ 
+ 	IssmDouble      xyz_list[NUMVERTICES][3];
+ 	IssmDouble      epsilon[6]; /* epsilon=[exx,eyy,exy];*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17827)
+@@ -52,7 +52,8 @@
+ 		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void        ComputeSigmaNN();
+-		void        ComputeStrainRate(Vector<IssmDouble>* eps);
++		void		   ComputeStrainRate();
++		void		   ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor();
+ 		void        ComputeDeviatoricStressTensor();
+ 		void        ComputeSurfaceNormalVelocity();
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17827)
+@@ -276,7 +276,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Penta::ComputeStrainRate {{{*/
+-void  Penta::ComputeStrainRate(Vector<IssmDouble>* eps){
++void  Penta::ComputeStrainRate(){
+ 
+ 	IssmDouble      xyz_list[NUMVERTICES][3];
+ 	IssmDouble      epsilon[6]; /* epsilon=[exx,eyy,exy];*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17827)
+@@ -54,7 +54,8 @@
+ 		void   BasalFrictionCreateInput(void);
+ 		IssmDouble CharacteristicLength(void){_error_("not implemented yet");};
+ 		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+-		void   ComputeStrainRate(Vector<IssmDouble>* eps);
++		void   ComputeStrainRate();
++		void   ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void   ComputeSigmaNN(){_error_("not implemented yet");};
+ 		void   ComputeStressTensor();
+ 		void   ComputeDeviatoricStressTensor();
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17827)
+@@ -54,6 +54,7 @@
+ 		IssmDouble  CharacteristicLength(void);
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeSigmaNN(){_error_("not implemented yet");};
++		void        ComputeStrainRate(){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17827)
+@@ -54,6 +54,7 @@
+ 		IssmDouble  CharacteristicLength(void){_error_("not implemented yet");};
+ 		void        ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");};
+ 		void        ComputeSigmaNN(){_error_("not implemented yet");};
++		void        ComputeStrainRate(){_error_("not implemented yet");};
+ 		void        ComputeStrainRate(Vector<IssmDouble>* eps){_error_("not implemented yet");};
+ 		void        ComputeStressTensor(){_error_("not implemented yet");};
+ 		void        ComputeDeviatoricStressTensor(){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17826)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17827)
+@@ -817,6 +817,15 @@
+ 				this->ComputeStressTensor();
+ 				input=this->inputs->GetInput(output_enum);
+ 				break;
++			case StrainRatexxEnum:
++			case StrainRatexyEnum:
++			case StrainRatexzEnum:
++			case StrainRateyyEnum:
++			case StrainRateyzEnum:
++			case StrainRatezzEnum:
++				this->ComputeStrainRate();
++				input=this->inputs->GetInput(output_enum);
++				break;
+ 			case DeviatoricStressxxEnum: 
+ 			case DeviatoricStressxyEnum: 
+ 			case DeviatoricStressxzEnum: 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17827-17828.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17827-17828.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17827-17828.diff	(revision 17986)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/test/NightlyRun/test3001.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3001.m	(revision 17827)
++++ ../trunk-jpl/test/NightlyRun/test3001.m	(revision 17828)
+@@ -3,7 +3,7 @@
+ md=parameterize(md,'../Par/SquareShelfConstrained.par');
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',1);
+-md.stressbalance.requested_outputs={'default','StressTensorxx','StressTensoryy','StressTensorxy'};
++md.stressbalance.requested_outputs={'default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy'};
+ md.autodiff.isautodiff=true;
+ md.toolkits.DefaultAnalysis=issmgslsolver();
+ 
+@@ -19,7 +19,7 @@
+ 	(md.results.StressbalanceSolution.Vy),...
+ 	(md.results.StressbalanceSolution.Vel),...
+ 	(md.results.StressbalanceSolution.Pressure),...
+-	(md.results.StressbalanceSolution.StressTensorxx),...
+-	(md.results.StressbalanceSolution.StressTensoryy),...
+-	(md.results.StressbalanceSolution.StressTensorxy),...
++	(md.results.StressbalanceSolution.DeviatoricStressxx),...
++	(md.results.StressbalanceSolution.DeviatoricStressyy),...
++	(md.results.StressbalanceSolution.DeviatoricStressxy),...
+ 	};
+Index: ../trunk-jpl/test/Archives/Archive3001.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive3004.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: /issm/oecreview/Archive/17802-17983/ISSM-17828-17829.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17828-17829.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17828-17829.diff	(revision 17986)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/test/NightlyRun/test804.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.py	(revision 17828)
++++ ../trunk-jpl/test/NightlyRun/test804.py	(revision 17829)
+@@ -31,7 +31,7 @@
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',\
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,\
++		2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13,\
+ 		2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+Index: ../trunk-jpl/test/NightlyRun/test804.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test804.m	(revision 17828)
++++ ../trunk-jpl/test/NightlyRun/test804.m	(revision 17829)
+@@ -21,7 +21,7 @@
+ 		'Vx2','Vy2','Vel2','Pressure2','Thickness2','Surface2','MaskIceLevelset2',...
+ 		'Vx3','Vy3','Vel3','Pressure3','Thickness3','Surface3','MaskIceLevelset3'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
+-		1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,1e-13,...
++		2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13,...
+ 		2e-13,2e-13,2e-13,1e-13,1e-13,1e-13,1e-13};
+ field_values={...
+ 	md.results.TransientSolution(1).Vx,...
+Index: ../trunk-jpl/jenkins/windows
+===================================================================
+--- ../trunk-jpl/jenkins/windows	(revision 17828)
++++ ../trunk-jpl/jenkins/windows	(revision 17829)
+@@ -100,7 +100,7 @@
+ #ex: "'id',[101 102 103]"
+ 
+ #In Windows, we don't yet have MUMPS, can't do full stokes, so exclude all FS runs. Also exclude all runs with Dakota. And exclude higher order runs that have penalties.
+-MATLAB_NROPTIONS="'exclude',[104, 124, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514, 435]"
++MATLAB_NROPTIONS="'exclude',[104, 124, 204, 211, 215, 220, 221, 285, 290, 308, 322, 404, 421, 422, 503, 507, 510, 511, 701, 702, 703, 218, 234, 235, 412, 413, 414, 417, 418, 420, 205, 274, 331, 405, 409, 455, 612, 514, 435 280]"
+ PYTHON_NROPTIONS=""
+ 
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17829-17830.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17829-17830.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17829-17830.diff	(revision 17986)
@@ -0,0 +1,118 @@
+Index: ../trunk-jpl/test/NightlyRun/test3001.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3001.m	(revision 17829)
++++ ../trunk-jpl/test/NightlyRun/test3001.m	(revision 17830)
+@@ -11,7 +11,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure',...
+-	'StressTensorxx','StressTensoryy','StressTensorxy'};
++	'DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,...
+ 	1e-13,1e-13,1e-13};
+ field_values={...
+Index: ../trunk-jpl/test/NightlyRun/test3101.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3101.m	(revision 17829)
++++ ../trunk-jpl/test/NightlyRun/test3101.m	(revision 17830)
+@@ -3,7 +3,7 @@
+ md=parameterize(md,'../Par/SquareShelfConstrained.par');
+ md=setflowequation(md,'SSA','all');
+ md.cluster=generic('name',oshostname(),'np',3);
+-md.stressbalance.requested_outputs={'default','StressTensorxx','StressTensoryy','StressTensorxy'};
++md.stressbalance.requested_outputs={'default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy'};
+ md.autodiff.isautodiff=true;
+ md.toolkits.DefaultAnalysis=issmmumpssolver();
+ 
+@@ -11,7 +11,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vel','Pressure',...
+-	'StressTensorxx','StressTensoryy','StressTensorxy'};
++	'DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13,...
+ 	1e-13,1e-13,1e-13};
+ field_values={...
+@@ -19,7 +19,7 @@
+ 	(md.results.StressbalanceSolution.Vy),...
+ 	(md.results.StressbalanceSolution.Vel),...
+ 	(md.results.StressbalanceSolution.Pressure),...
+-	(md.results.StressbalanceSolution.StressTensorxx),...
+-	(md.results.StressbalanceSolution.StressTensoryy),...
+-	(md.results.StressbalanceSolution.StressTensorxy),...
++	(md.results.StressbalanceSolution.DeviatoricStressxx),...
++	(md.results.StressbalanceSolution.DeviatoricStressyy),...
++	(md.results.StressbalanceSolution.DeviatoricStressxy),...
+ 	};
+Index: ../trunk-jpl/test/NightlyRun/test3001.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3001.py	(revision 17829)
++++ ../trunk-jpl/test/NightlyRun/test3001.py	(revision 17830)
+@@ -12,14 +12,14 @@
+ md=parameterize(md,'../Par/SquareShelfConstrained.py')
+ md=setflowequation(md,'SSA','all')
+ md.cluster=generic('name',oshostname(),'np',1)
+-md.stressbalance.requested_outputs=['default','StressTensorxx','StressTensoryy','StressTensorxy']
++md.stressbalance.requested_outputs=['default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy']
+ md.toolkits.DefaultAnalysis=issmgslsolver()
+ md.autodiff.isautodiff=True
+ md=solve(md,StressbalanceSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure',\
+-	'StressTensorxx','StressTensoryy','StressTensorxy']
++	'DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,\
+ 	1e-13,1e-13,1e-13]
+ field_values=[\
+@@ -27,7 +27,7 @@
+ 	md.results.StressbalanceSolution.Vy,\
+ 	md.results.StressbalanceSolution.Vel,\
+ 	md.results.StressbalanceSolution.Pressure,\
+-	md.results.StressbalanceSolution.StressTensorxx,\
+-	md.results.StressbalanceSolution.StressTensoryy,\
+-	md.results.StressbalanceSolution.StressTensorxy,\
++	md.results.StressbalanceSolution.DeviatoricStressxx,\
++	md.results.StressbalanceSolution.DeviatoricStressyy,\
++	md.results.StressbalanceSolution.DeviatoricStressxy,\
+ 	]
+Index: ../trunk-jpl/test/NightlyRun/test3101.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test3101.py	(revision 17829)
++++ ../trunk-jpl/test/NightlyRun/test3101.py	(revision 17830)
+@@ -12,14 +12,14 @@
+ md=parameterize(md,'../Par/SquareShelfConstrained.py')
+ md=setflowequation(md,'SSA','all')
+ md.cluster=generic('name',oshostname(),'np',3)
+-md.stressbalance.requested_outputs=['StressTensor']
++md.stressbalance.requested_outputs=['default','DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy']
+ md.toolkits.DefaultAnalysis=issmmumpssolver()
+ md.autodiff.isautodiff=True
+ md=solve(md,StressbalanceSolutionEnum())
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vel','Pressure',\
+-	'StressTensorxx','StressTensoryy','StressTensorxy']
++	'DeviatoricStressxx','DeviatoricStressyy','DeviatoricStressxy']
+ field_tolerances=[1e-13,1e-13,1e-13,1e-13,\
+ 	1e-13,1e-13,1e-13]
+ field_values=[\
+@@ -27,7 +27,7 @@
+ 	md.results.StressbalanceSolution.Vy,\
+ 	md.results.StressbalanceSolution.Vel,\
+ 	md.results.StressbalanceSolution.Pressure,\
+-	md.results.StressbalanceSolution.StressTensorxx,\
+-	md.results.StressbalanceSolution.StressTensoryy,\
+-	md.results.StressbalanceSolution.StressTensorxy,\
++	md.results.StressbalanceSolution.DeviatoricStressxx,\
++	md.results.StressbalanceSolution.DeviatoricStressyy,\
++	md.results.StressbalanceSolution.DeviatoricStressxy,\
+ 	]
+Index: ../trunk-jpl/test/Archives/Archive3101.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive3104.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: /issm/oecreview/Archive/17802-17983/ISSM-17830-17831.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17830-17831.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17830-17831.diff	(revision 17986)
@@ -0,0 +1,887 @@
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17830)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17831)
+@@ -22,6 +22,9 @@
+ 		#ifdef _HAVE_BALANCETHICKNESS_
+ 		case BalancethicknessAnalysisEnum : return new BalancethicknessAnalysis();
+ 		#endif
++		#ifdef _HAVE_BALANCETHICKNESS2_
++		case Balancethickness2AnalysisEnum : return new Balancethickness2Analysis();
++		#endif
+ 		#ifdef _HAVE_BALANCETHICKNESSSOFT_
+ 		case BalancethicknessSoftAnalysisEnum : return new BalancethicknessSoftAnalysis();
+ 		#endif
+Index: ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.h	(revision 0)
++++ ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.h	(revision 17831)
+@@ -0,0 +1,35 @@
++/*! \file Balancethickness2Analysis.h 
++ *  \brief: header file for generic external result object
++ */
++
++#ifndef _Balancethickness2Analysis_
++#define _Balancethickness2Analysis_
++
++/*Headers*/
++#include "./Analysis.h"
++
++class Balancethickness2Analysis: public Analysis{
++
++	public:
++		/*Model processing*/
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
++		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++		void CreateNodes(Nodes* nodes,IoModel* iomodel);
++		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
++		ElementVector* CreateDVector(Element* element);
++		ElementMatrix* CreateJacobianMatrix(Element* element);
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
++		ElementVector* CreatePVectorVolume(Element* element);
++		ElementVector* CreatePVectorBoundary(Element* element);
++		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
++};
++#endif
+Index: ../trunk-jpl/src/c/analyses/analyses.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 17830)
++++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 17831)
+@@ -10,6 +10,7 @@
+ #include "./AdjointBalancethicknessAnalysis.h"
+ #include "./AdjointHorizAnalysis.h"
+ #include "./BalancethicknessAnalysis.h"
++#include "./Balancethickness2Analysis.h"
+ #include "./BalancethicknessSoftAnalysis.h"
+ #include "./BalancevelocityAnalysis.h"
+ #include "./DamageEvolutionAnalysis.h"
+Index: ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 0)
++++ ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 17831)
+@@ -0,0 +1,304 @@
++#include "./Balancethickness2Analysis.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++
++/*Model processing*/
++int  Balancethickness2Analysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
++	return 1;
++}/*}}}*/
++void Balancethickness2Analysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++}/*}}}*/
++void Balancethickness2Analysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
++
++	/*Finite element type*/
++	int finiteelement = P1Enum;
++
++	/*Update elements: */
++	int counter=0;
++	for(int i=0;i<iomodel->numberofelements;i++){
++		if(iomodel->my_elements[i]){
++			Element* element=(Element*)elements->GetObjectByOffset(counter);
++			element->Update(i,iomodel,analysis_counter,analysis_type,finiteelement);
++			counter++;
++		}
++	}
++
++	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
++	iomodel->FetchDataToInput(elements,VxEnum);
++	iomodel->FetchDataToInput(elements,VyEnum);
++	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
++	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
++	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
++	iomodel->FetchDataToInput(elements,MeshVertexonboundaryEnum);
++	iomodel->FetchDataToInput(elements,ThicknessEnum);
++}/*}}}*/
++void Balancethickness2Analysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++
++	int finiteelement = P1Enum;
++	::CreateNodes(nodes,iomodel,Balancethickness2AnalysisEnum,finiteelement);
++}/*}}}*/
++void Balancethickness2Analysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
++
++	/*Do not add constraints in DG*/
++	IoModelToConstraintsx(constraints,iomodel,BalancethicknessSpcthicknessEnum,Balancethickness2AnalysisEnum,P1Enum);
++
++}/*}}}*/
++void Balancethickness2Analysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
++
++}/*}}}*/
++
++/*Finite Element Analysis*/
++void           Balancethickness2Analysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++ElementVector* Balancethickness2Analysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
++ElementMatrix* Balancethickness2Analysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
++ElementMatrix* Balancethickness2Analysis::CreateKMatrix(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble Jdet,D_scalar;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementMatrix* Ke  = element->NewElementMatrix();
++	IssmDouble*    B   = xNew<IssmDouble>(2*numnodes);
++	IssmDouble     D[2][2];
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		for(int i=0;i<numnodes;i++){
++			for(int j=0;j<numnodes;j++){
++				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j]);
++			}
++		}
++		//GetB(B,element,xyz_list,gauss);
++
++		//D_scalar=gauss->weight*Jdet;
++
++		//D[0][0]=D_scalar;
++		//D[0][1]=0.;
++		//D[1][0]=0.;
++		//D[1][1]=D_scalar;
++		//TripleMultiply(B,2,numnodes,1,
++		//			&D[0][0],2,2,0,
++		//			B,2,numnodes,0,
++		//			&Ke->values[0],1);
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(B);
++	delete gauss;
++	return Ke;
++}/*}}}*/
++ElementVector* Balancethickness2Analysis::CreatePVector(Element* element){/*{{{*/
++
++	/*compute all load vectors for this element*/
++	ElementVector* pe1=CreatePVectorVolume(element);
++	ElementVector* pe2=CreatePVectorBoundary(element);
++	ElementVector* pe =new ElementVector(pe1,pe2);
++
++	/*clean-up and return*/
++	delete pe1;
++	delete pe2;
++	return pe;
++}/*}}}*/
++ElementVector* Balancethickness2Analysis::CreatePVectorVolume(Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  dhdt,mb,ms,Jdet;
++	IssmDouble* xyz_list = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* mb_input   = element->GetInput(BasalforcingsMeltingRateEnum);       _assert_(mb_input);
++	Input* ms_input   = element->GetInput(SurfaceforcingsMassBalanceEnum);     _assert_(ms_input);
++	Input* dhdt_input = element->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
++
++	/*Initialize mb_correction to 0, do not forget!:*/
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		ms_input->GetInputValue(&ms,gauss);
++		mb_input->GetInputValue(&mb,gauss);
++		dhdt_input->GetInputValue(&dhdt,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(ms-mb-dhdt)*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
++ElementVector* Balancethickness2Analysis::CreatePVectorBoundary(Element* element){/*{{{*/
++
++	/*If no front, return NULL*/
++	if(!element->IsFaceOnBoundary()) return NULL;
++
++	/*Intermediaries*/
++	IssmDouble  Jdet,thickness,vx,vy;
++	IssmDouble *xyz_list = NULL;
++	IssmDouble *xyz_list_front = NULL;
++	IssmDouble  normal[2];
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Initialize Element vector and other vectors*/
++	ElementVector* pe    = element->NewElementVector();
++	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
++	Input* vx_input        = element->GetInput(VxEnum);        _assert_(vx_input);
++	Input* vy_input        = element->GetInput(VyEnum);        _assert_(vy_input);
++
++	element->GetVerticesCoordinates(&xyz_list);
++	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
++	element->NormalSection(&normal[0],xyz_list_front);
++
++	/*Start looping on Gaussian points*/
++	Gauss* gauss=element->NewGauss(xyz_list,xyz_list_front,3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++		thickness_input->GetInputValue(&thickness,gauss);
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
++		element->NodalFunctions(basis,gauss);
++
++		for(int i=0;i<numnodes;i++) pe->values[i] += Jdet*gauss->weight*thickness*(vx*normal[0] + vy*normal[1])*basis[i];
++	}
++
++	/*Clean up and return*/
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_front);
++	xDelete<IssmDouble>(basis);
++	delete gauss;
++	return pe;
++}/*}}}*/
++void Balancethickness2Analysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
++	 * For node i, Bi can be expressed in the actual coordinate system
++	 * by: 
++	 *       Bi=[ dN/dx ]
++	 *          [ dN/dy ]
++	 * where N is the finiteelement function for node i.
++	 *
++	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
++	 */
++
++	/*Fetch number of nodes for this finite element*/
++	int numnodes = element->GetNumberOfNodes();
++
++	/*Get nodal functions derivatives*/
++	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
++	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++	/*Build B': */
++	for(int i=0;i<numnodes;i++){
++		B[numnodes*0+i] = dbasis[0*numnodes+i];
++		B[numnodes*1+i] = dbasis[1*numnodes+i];
++	}
++
++	/*Clean-up*/
++	xDelete<IssmDouble>(dbasis);
++
++}/*}}}*/
++void Balancethickness2Analysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	   _error_("not implemented yet");
++}/*}}}*/
++void Balancethickness2Analysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++
++	/*Intermediaries */
++	IssmDouble  vx,vy,vel,h,normdphi,dphi[2];
++	IssmDouble* xyz_list = NULL;
++	int       * doflist  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes    = element->GetNumberOfNodes();
++	int numvertices = element->GetNumberOfVertices();
++
++	/*Fetch dof list and allocate solution vector*/
++	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
++	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
++	IssmDouble* values    = xNew<IssmDouble>(numnodes);
++
++	/*Use the dof list to index into the solution vector: */
++	for(int i=0;i<numnodes;i++){
++		values[i]=solution[doflist[i]];
++
++		/*Check solution*/
++		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
++	}
++
++	element->AddInput(EnthalpyEnum,values,element->GetElementType());//FIXME
++
++	/*Retrieve all inputs and parameters*/
++	element->GetVerticesCoordinates(&xyz_list);
++	Input* potential_input = element->GetInput(EnthalpyEnum); _assert_(potential_input);
++	Input* vx_input        = element->GetInput(VxEnum);       _assert_(vx_input);
++	Input* vy_input        = element->GetInput(VyEnum);       _assert_(vy_input);
++
++	Gauss* gauss=element->NewGauss();
++	for (int iv=0;iv<numvertices;iv++){
++		gauss->GaussVertex(iv);
++
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		potential_input->GetInputDerivativeValue(&dphi[0],xyz_list,gauss);
++
++		vel = sqrt(vx*vx + vy*vy) + 1.e-10;
++		normdphi = sqrt(dphi[0]*dphi[0] + dphi[1]*dphi[1]);
++
++		thickness[iv] = normdphi/vel;
++	}
++	element->AddInput(ThicknessEnum,thickness,P1Enum);
++
++	/*Clean up and return*/
++	delete gauss;
++	xDelete<int>(doflist);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(values);
++	xDelete<IssmDouble>(thickness);
++}/*}}}*/
++void Balancethickness2Analysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/Synchronize.sh
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/Synchronize.sh	(revision 17830)
++++ ../trunk-jpl/src/c/shared/Enum/Synchronize.sh	(revision 17831)
+@@ -34,7 +34,7 @@
+ 	switch(analysis_enum){
+ END
+ #core
+-cat temp | grep [a-zA-Z]Analysis | \
++cat temp | grep [a-zA-Z0-9]Analysis | \
+ 	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
+ 	awk '{print "\t\t#ifdef _HAVE_"toupper(substr($1,1,length($1)-12))"_\n\t\t" "case " $1" : return new " substr($1,1,length($1)-4) "();\n\t\t#endif"}' \
+ 		>> $ISSM_DIR/src/c/analyses/EnumToAnalysis.cpp
+@@ -62,7 +62,7 @@
+ 
+ END
+ #core
+-cat temp | grep [a-zA-Z]Analysis | \
++cat temp | grep [a-zA-Z0-9]Analysis | \
+ 	grep -v DefaultAnalysis | grep -v FlaimAnalysis | grep -v SurfaceSlopeAnalysis | grep -v BedSlopeAnalysis | \
+ 	sed -e "s/AnalysisEnum//g" | \
+ 	awk '{print "dnl with-" $1"{{{\n\
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17830)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17831)
+@@ -211,6 +211,7 @@
+ 	MeshUpperelementsEnum,
+ 	MeshVertexonbaseEnum,
+ 	MeshVertexonsurfaceEnum,
++	MeshVertexonboundaryEnum,
+ 	MeshXEnum,
+ 	MeshYEnum,
+ 	MeshZEnum,
+@@ -323,6 +324,8 @@
+ 	DefaultAnalysisEnum,
+ 	BalancethicknessAnalysisEnum,
+ 	BalancethicknessSolutionEnum,
++	Balancethickness2AnalysisEnum,
++	Balancethickness2SolutionEnum,
+ 	BalancethicknessSoftAnalysisEnum,
+ 	BalancethicknessSoftSolutionEnum,
+ 	BalancevelocityAnalysisEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17830)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17831)
+@@ -219,6 +219,7 @@
+ 		case MeshUpperelementsEnum : return "MeshUpperelements";
+ 		case MeshVertexonbaseEnum : return "MeshVertexonbase";
+ 		case MeshVertexonsurfaceEnum : return "MeshVertexonsurface";
++		case MeshVertexonboundaryEnum : return "MeshVertexonboundary";
+ 		case MeshXEnum : return "MeshX";
+ 		case MeshYEnum : return "MeshY";
+ 		case MeshZEnum : return "MeshZ";
+@@ -324,6 +325,8 @@
+ 		case DefaultAnalysisEnum : return "DefaultAnalysis";
+ 		case BalancethicknessAnalysisEnum : return "BalancethicknessAnalysis";
+ 		case BalancethicknessSolutionEnum : return "BalancethicknessSolution";
++		case Balancethickness2AnalysisEnum : return "Balancethickness2Analysis";
++		case Balancethickness2SolutionEnum : return "Balancethickness2Solution";
+ 		case BalancethicknessSoftAnalysisEnum : return "BalancethicknessSoftAnalysis";
+ 		case BalancethicknessSoftSolutionEnum : return "BalancethicknessSoftSolution";
+ 		case BalancevelocityAnalysisEnum : return "BalancevelocityAnalysis";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17830)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17831)
+@@ -222,6 +222,7 @@
+ 	      else if (strcmp(name,"MeshUpperelements")==0) return MeshUpperelementsEnum;
+ 	      else if (strcmp(name,"MeshVertexonbase")==0) return MeshVertexonbaseEnum;
+ 	      else if (strcmp(name,"MeshVertexonsurface")==0) return MeshVertexonsurfaceEnum;
++	      else if (strcmp(name,"MeshVertexonboundary")==0) return MeshVertexonboundaryEnum;
+ 	      else if (strcmp(name,"MeshX")==0) return MeshXEnum;
+ 	      else if (strcmp(name,"MeshY")==0) return MeshYEnum;
+ 	      else if (strcmp(name,"MeshZ")==0) return MeshZEnum;
+@@ -258,11 +259,11 @@
+ 	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
+ 	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+-	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
++	      if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
++	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+@@ -330,6 +331,8 @@
+ 	      else if (strcmp(name,"DefaultAnalysis")==0) return DefaultAnalysisEnum;
+ 	      else if (strcmp(name,"BalancethicknessAnalysis")==0) return BalancethicknessAnalysisEnum;
+ 	      else if (strcmp(name,"BalancethicknessSolution")==0) return BalancethicknessSolutionEnum;
++	      else if (strcmp(name,"Balancethickness2Analysis")==0) return Balancethickness2AnalysisEnum;
++	      else if (strcmp(name,"Balancethickness2Solution")==0) return Balancethickness2SolutionEnum;
+ 	      else if (strcmp(name,"BalancethicknessSoftAnalysis")==0) return BalancethicknessSoftAnalysisEnum;
+ 	      else if (strcmp(name,"BalancethicknessSoftSolution")==0) return BalancethicknessSoftSolutionEnum;
+ 	      else if (strcmp(name,"BalancevelocityAnalysis")==0) return BalancevelocityAnalysisEnum;
+@@ -379,13 +382,13 @@
+ 	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+ 	      else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
+ 	      else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
+-	      else if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
+-	      else if (strcmp(name,"HOApproximation")==0) return HOApproximationEnum;
+-	      else if (strcmp(name,"HOFSApproximation")==0) return HOFSApproximationEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
++	      if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
++	      else if (strcmp(name,"HOApproximation")==0) return HOApproximationEnum;
++	      else if (strcmp(name,"HOFSApproximation")==0) return HOFSApproximationEnum;
++	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
+ 	      else if (strcmp(name,"FSvelocity")==0) return FSvelocityEnum;
+ 	      else if (strcmp(name,"FSpressure")==0) return FSpressureEnum;
+ 	      else if (strcmp(name,"Constraints")==0) return ConstraintsEnum;
+@@ -502,13 +505,13 @@
+ 	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
+ 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
+-	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
+-	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
+-	      else if (strcmp(name,"Vel")==0) return VelEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"Velocity")==0) return VelocityEnum;
++	      if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
++	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
++	      else if (strcmp(name,"Vel")==0) return VelEnum;
++	      else if (strcmp(name,"Velocity")==0) return VelocityEnum;
+ 	      else if (strcmp(name,"VxAverage")==0) return VxAverageEnum;
+ 	      else if (strcmp(name,"Vx")==0) return VxEnum;
+ 	      else if (strcmp(name,"VxPicard")==0) return VxPicardEnum;
+@@ -625,13 +628,13 @@
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+-	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+-	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+-	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
++	      if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
++	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
++	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
++	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
+ 	      else if (strcmp(name,"Contact")==0) return ContactEnum;
+ 	      else if (strcmp(name,"MaskGroundediceLevelset")==0) return MaskGroundediceLevelsetEnum;
+ 	      else if (strcmp(name,"QmuMaskGroundediceLevelset")==0) return QmuMaskGroundediceLevelsetEnum;
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17830)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17831)
+@@ -429,6 +429,7 @@
+ 					./cores/stressbalance_core.cpp\
+ 					./solutionsequences/solutionsequence_stokescoupling_nonlinear.cpp\
+ 					./cores/balancethickness_core.cpp \
++					./cores/balancethickness2_core.cpp \
+ 					./cores/balancevelocity_core.cpp \
+ 					./cores/dummy_core.cpp\
+ 					./cores/surfaceslope_core.cpp\
+@@ -521,6 +522,9 @@
+ if BALANCETHICKNESS
+ issm_sources += ./analyses/BalancethicknessAnalysis.cpp
+ endif
++if BALANCETHICKNESS2
++issm_sources += ./analyses/Balancethickness2Analysis.cpp
++endif
+ if BALANCETHICKNESSSOFT
+ issm_sources += ./analyses/BalancethicknessSoftAnalysis.cpp
+ endif
+@@ -865,7 +869,7 @@
+ libISSM_la_LIBADD = libISSMCore.la libISSMOverload.la
+ 
+ libISSMCore_la_SOURCES  = $(issm_sources)
+-libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)   $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) 
++libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)   $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) 
+ libISSMCore_la_FFLAGS = $(AM_FFLAGS)
+ endif
+ 
+@@ -912,10 +916,10 @@
+ LDADD = ./libISSMCore.a ./libISSMOverload.a
+ 
+ #External packages
+-LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB)  $(MATHLIB) $(FORTRANLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB)
++LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB)  $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB)
+ 
+ if FORTRAN
+-LDADD += $(FLIBS)
++LDADD += $(FLIBS) $(FORTRANLIB)
+ endif
+ 
+ issm_SOURCES = main/issm.h main/globals.h main/issm.cpp
+Index: ../trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp	(revision 17830)
++++ ../trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp	(revision 17831)
+@@ -34,6 +34,9 @@
+ 		case BalancethicknessSolutionEnum:
+ 			solutioncore=&balancethickness_core;
+ 			break;
++		case Balancethickness2SolutionEnum:
++			solutioncore=&balancethickness2_core;
++			break;
+ 		case BalancethicknessSoftSolutionEnum:
+ 			solutioncore=&dummy_core;
+ 			break;
+Index: ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17830)
++++ ../trunk-jpl/src/c/cores/AnalysisConfiguration.cpp	(revision 17831)
+@@ -77,6 +77,12 @@
+ 			analyses[0]=BalancethicknessAnalysisEnum;
+ 			break;
+ 
++		case Balancethickness2SolutionEnum:
++			numanalyses=1;
++			analyses=xNew<int>(numanalyses);
++			analyses[0]=Balancethickness2AnalysisEnum;
++			break;
++
+ 		case BalancethicknessSoftSolutionEnum:
+ 			numanalyses=1;
+ 			analyses=xNew<int>(numanalyses);
+Index: ../trunk-jpl/src/c/cores/cores.h
+===================================================================
+--- ../trunk-jpl/src/c/cores/cores.h	(revision 17830)
++++ ../trunk-jpl/src/c/cores/cores.h	(revision 17831)
+@@ -33,6 +33,7 @@
+ void extrudefrombase_core(FemModel* femmodel);
+ void extrudefromtop_core(FemModel* femmodel);
+ void balancethickness_core(FemModel* femmodel);
++void balancethickness2_core(FemModel* femmodel);
+ void balancevelocity_core(FemModel* femmodel);
+ void slopecompute_core(FemModel* femmodel);
+ void steadystate_core(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/cores/balancethickness2_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 0)
++++ ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 17831)
+@@ -0,0 +1,32 @@
++/*!\file: balancethickness_core.cpp
++ * \brief: core of the balancethickness solution 
++ */ 
++
++#include "./cores.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
++
++void balancethickness2_core(FemModel* femmodel){
++
++	/*parameters: */
++	bool save_results;
++
++	/*activate formulation: */
++	femmodel->SetCurrentConfiguration(Balancethickness2AnalysisEnum);
++
++	/*recover parameters: */
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++
++	if(VerboseSolution()) _printf0_("call computational core:\n");
++	solutionsequence_linear(femmodel);
++
++	if(save_results){
++		if(VerboseSolution()) _printf0_("   saving results\n");
++		int outputs[2] = {ThicknessEnum,EnthalpyEnum};
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
++	}
++
++}
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17830)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17831)
+@@ -30,7 +30,6 @@
+ Matice::Matice(){
+ 	this->helement=NULL;
+ 	this->element=NULL;
+-	this->isdamaged=NULL;
+ 	return;
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17830)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17831)
+@@ -242,6 +242,7 @@
+ 		virtual int    PressureInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+ 		virtual bool   IsIcefront(void)=0;
++		virtual bool   IsFaceOnBoundary(void)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17830)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17831)
+@@ -2256,6 +2256,26 @@
+ 	}
+ 	return isicefront;
+ }/*}}}*/
++bool Tria::IsFaceOnBoundary(void){/*{{{*/
++
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonboundaryEnum);
++	sum = values[0]+values[1]+values[2];
++
++	_assert_(sum==0. || sum==1. || sum==2.);
++
++	if(sum==3.)  _error_("Two edges on boundary not supported yet...");
++
++	if(sum>1.){
++		return true;
++	}
++	else{
++		return false;
++	}
++}/*}}}*/
+ /*FUNCTION Tria::AverageOntoPartition {{{*/
+ void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17830)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17831)
+@@ -111,6 +111,7 @@
+ 	    void        GetNormalFromLSF(IssmDouble *pnormal);
+ 		bool        IsZeroLevelset(int levelset_enum);
+ 		bool		IsIcefront(void);
++		bool		IsFaceOnBoundary(void);
+ 
+ 		void       AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+ 		IssmDouble IceVolume(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17830)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17831)
+@@ -94,6 +94,7 @@
+ 		int    PressureInterpolation();
+ 		bool   IsZeroLevelset(int levelset_enum);
+ 		bool   IsIcefront(void);
++		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17830)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17831)
+@@ -125,6 +125,7 @@
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		bool		   IsIcefront(void);
++		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17830)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17831)
+@@ -130,6 +130,7 @@
+ 		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		bool		   IsIcefront(void);
++		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+ 		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/m/consistency/ismodelselfconsistent.m
+===================================================================
+--- ../trunk-jpl/src/m/consistency/ismodelselfconsistent.m	(revision 17830)
++++ ../trunk-jpl/src/m/consistency/ismodelselfconsistent.m	(revision 17831)
+@@ -60,6 +60,9 @@
+ 	case BalancethicknessSolutionEnum(),
+ 		analyses=[BalancethicknessAnalysisEnum()];
+ 
++	case Balancethickness2SolutionEnum(),
++		analyses=[Balancethickness2AnalysisEnum()];
++
+ 	case BalancethicknessSoftSolutionEnum(),
+ 		analyses=[BalancethicknessAnalysisEnum()];
+ 
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17830)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17831)
+@@ -189,6 +189,7 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','average_vertex_connectivity','format','Integer');
++			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonboundary','format','DoubleMat','mattype',1);
+ 		end % }}}
+ 		function t = domaintype(obj) % {{{
+ 			t = '2Dhorizontal';
+Index: ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17830)
++++ ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17831)
+@@ -96,6 +96,8 @@
+ 			else
+ 				error('not supported');
+ 			end
++		case 15, %point
++			continue;
+ 		otherwise,
+ 			error(['Type ' num2str(ty) ' not supported']);
+ 	end
+Index: ../trunk-jpl/src/m/enum/Balancethickness2SolutionEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Balancethickness2SolutionEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/Balancethickness2SolutionEnum.m	(revision 17831)
+@@ -0,0 +1,11 @@
++function macro=Balancethickness2SolutionEnum()
++%BALANCETHICKNESS2SOLUTIONENUM - Enum of Balancethickness2Solution
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=Balancethickness2SolutionEnum()
++
++macro=StringToEnum('Balancethickness2Solution');
+Index: ../trunk-jpl/src/m/enum/Balancethickness2AnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Balancethickness2AnalysisEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/Balancethickness2AnalysisEnum.m	(revision 17831)
+@@ -0,0 +1,11 @@
++function macro=Balancethickness2AnalysisEnum()
++%BALANCETHICKNESS2ANALYSISENUM - Enum of Balancethickness2Analysis
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=Balancethickness2AnalysisEnum()
++
++macro=StringToEnum('Balancethickness2Analysis');
+Index: ../trunk-jpl/src/m/enum/MeshVertexonboundaryEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshVertexonboundaryEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MeshVertexonboundaryEnum.m	(revision 17831)
+@@ -0,0 +1,11 @@
++function macro=MeshVertexonboundaryEnum()
++%MESHVERTEXONBOUNDARYENUM - Enum of MeshVertexonboundary
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MeshVertexonboundaryEnum()
++
++macro=StringToEnum('MeshVertexonboundary');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17830)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17831)
+@@ -211,6 +211,7 @@
+ def MeshUpperelementsEnum(): return StringToEnum("MeshUpperelements")[0]
+ def MeshVertexonbaseEnum(): return StringToEnum("MeshVertexonbase")[0]
+ def MeshVertexonsurfaceEnum(): return StringToEnum("MeshVertexonsurface")[0]
++def MeshVertexonboundaryEnum(): return StringToEnum("MeshVertexonboundary")[0]
+ def MeshXEnum(): return StringToEnum("MeshX")[0]
+ def MeshYEnum(): return StringToEnum("MeshY")[0]
+ def MeshZEnum(): return StringToEnum("MeshZ")[0]
+@@ -316,6 +317,8 @@
+ def DefaultAnalysisEnum(): return StringToEnum("DefaultAnalysis")[0]
+ def BalancethicknessAnalysisEnum(): return StringToEnum("BalancethicknessAnalysis")[0]
+ def BalancethicknessSolutionEnum(): return StringToEnum("BalancethicknessSolution")[0]
++def Balancethickness2AnalysisEnum(): return StringToEnum("Balancethickness2Analysis")[0]
++def Balancethickness2SolutionEnum(): return StringToEnum("Balancethickness2Solution")[0]
+ def BalancethicknessSoftAnalysisEnum(): return StringToEnum("BalancethicknessSoftAnalysis")[0]
+ def BalancethicknessSoftSolutionEnum(): return StringToEnum("BalancethicknessSoftSolution")[0]
+ def BalancevelocityAnalysisEnum(): return StringToEnum("BalancevelocityAnalysis")[0]
+@@ -519,6 +522,7 @@
+ def QmuTemperatureEnum(): return StringToEnum("QmuTemperature")[0]
+ def HydrologyWaterVxEnum(): return StringToEnum("HydrologyWaterVx")[0]
+ def HydrologyWaterVyEnum(): return StringToEnum("HydrologyWaterVy")[0]
++def SigmaNNEnum(): return StringToEnum("SigmaNN")[0]
+ def StressTensorEnum(): return StringToEnum("StressTensor")[0]
+ def StressTensorxxEnum(): return StringToEnum("StressTensorxx")[0]
+ def StressTensorxyEnum(): return StringToEnum("StressTensorxy")[0]
+Index: ../trunk-jpl/src/m/enum/SigmaNNEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/SigmaNNEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/SigmaNNEnum.m	(revision 17831)
+@@ -0,0 +1,11 @@
++function macro=SigmaNNEnum()
++%SIGMANNENUM - Enum of SigmaNN
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=SigmaNNEnum()
++
++macro=StringToEnum('SigmaNN');
Index: /issm/oecreview/Archive/17802-17983/ISSM-17831-17832.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17831-17832.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17831-17832.diff	(revision 17986)
@@ -0,0 +1,815 @@
+Index: ../trunk-jpl/m4/analyses.m4
+===================================================================
+--- ../trunk-jpl/m4/analyses.m4	(revision 17831)
++++ ../trunk-jpl/m4/analyses.m4	(revision 17832)
+@@ -10,424 +10,810 @@
+ [
+ 
+ dnl with-AdjointBalancethickness{{{
++
+ AC_ARG_WITH([AdjointBalancethickness],
++
+ 	AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
++
+ 	[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes])
++
+ AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
+ 
++
+ HAVE_ADJOINTBALANCETHICKNESS=no 
++
+ if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
++
+ 	HAVE_ADJOINTBALANCETHICKNESS=yes
++
+ 	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethicknesscapability])
++
+ fi
++
+ AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
++
+ AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
++
+ dnl }}}
+ dnl with-AdjointHoriz{{{
++
+ AC_ARG_WITH([AdjointHoriz],
++
+ 	AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
++
+ 	[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes])
++
+ AC_MSG_CHECKING(for AdjointHoriz capability compilation)
+ 
++
+ HAVE_ADJOINTHORIZ=no 
++
+ if test "x$ADJOINTHORIZ" = "xyes"; then
++
+ 	HAVE_ADJOINTHORIZ=yes
++
+ 	AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHorizcapability])
++
+ fi
++
+ AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
++
+ AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
++
+ dnl }}}
+ dnl with-Balancethickness{{{
++
+ AC_ARG_WITH([Balancethickness],
++
+ 	AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
++
+ 	[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes])
++
+ AC_MSG_CHECKING(for Balancethickness capability compilation)
+ 
++
+ HAVE_BALANCETHICKNESS=no 
++
+ if test "x$BALANCETHICKNESS" = "xyes"; then
++
+ 	HAVE_BALANCETHICKNESS=yes
++
+ 	AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethicknesscapability])
++
+ fi
++
+ AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
++
+ AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
++
+ dnl }}}
++dnl with-Balancethickness2{{{
++
++AC_ARG_WITH([Balancethickness2],
++
++	AS_HELP_STRING([--with-Balancethickness2 = YES], [compile with Balancethickness2 capabilities (default is yes)]),
++
++	[BALANCETHICKNESS2=$withval],[BALANCETHICKNESS2=yes])
++
++AC_MSG_CHECKING(for Balancethickness2 capability compilation)
++
++
++HAVE_BALANCETHICKNESS2=no 
++
++if test "x$BALANCETHICKNESS2" = "xyes"; then
++
++	HAVE_BALANCETHICKNESS2=yes
++
++	AC_DEFINE([_HAVE_BALANCETHICKNESS2_],[1],[with Balancethickness2capability])
++
++fi
++
++AM_CONDITIONAL([BALANCETHICKNESS2], [test x$HAVE_BALANCETHICKNESS2 = xyes])
++
++AC_MSG_RESULT($HAVE_BALANCETHICKNESS2)
++
++dnl }}}
+ dnl with-BalancethicknessSoft{{{
++
+ AC_ARG_WITH([BalancethicknessSoft],
++
+ 	AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
++
+ 	[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes])
++
+ AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
+ 
++
+ HAVE_BALANCETHICKNESSSOFT=no 
++
+ if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
++
+ 	HAVE_BALANCETHICKNESSSOFT=yes
++
+ 	AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoftcapability])
++
+ fi
++
+ AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
++
+ AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
++
+ dnl }}}
+ dnl with-Balancevelocity{{{
++
+ AC_ARG_WITH([Balancevelocity],
++
+ 	AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
++
+ 	[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes])
++
+ AC_MSG_CHECKING(for Balancevelocity capability compilation)
+ 
++
+ HAVE_BALANCEVELOCITY=no 
++
+ if test "x$BALANCEVELOCITY" = "xyes"; then
++
+ 	HAVE_BALANCEVELOCITY=yes
++
+ 	AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocitycapability])
++
+ fi
++
+ AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
++
+ AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
++
+ dnl }}}
+ dnl with-L2ProjectionEPL{{{
++
+ AC_ARG_WITH([L2ProjectionEPL],
++
+ 	AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
++
+ 	[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes])
++
+ AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
+ 
++
+ HAVE_L2PROJECTIONEPL=no 
++
+ if test "x$L2PROJECTIONEPL" = "xyes"; then
++
+ 	HAVE_L2PROJECTIONEPL=yes
++
+ 	AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPLcapability])
++
+ fi
++
+ AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
++
+ AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
++
+ dnl }}}
+ dnl with-L2ProjectionBase{{{
++
+ AC_ARG_WITH([L2ProjectionBase],
++
+ 	AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
++
+ 	[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes])
++
+ AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
+ 
++
+ HAVE_L2PROJECTIONBASE=no 
++
+ if test "x$L2PROJECTIONBASE" = "xyes"; then
++
+ 	HAVE_L2PROJECTIONBASE=yes
++
+ 	AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBasecapability])
++
+ fi
++
+ AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
++
+ AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
++
+ dnl }}}
+ dnl with-DamageEvolution{{{
++
+ AC_ARG_WITH([DamageEvolution],
++
+ 	AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
++
+ 	[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes])
++
+ AC_MSG_CHECKING(for DamageEvolution capability compilation)
+ 
++
+ HAVE_DAMAGEEVOLUTION=no 
++
+ if test "x$DAMAGEEVOLUTION" = "xyes"; then
++
+ 	HAVE_DAMAGEEVOLUTION=yes
++
+ 	AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolutioncapability])
++
+ fi
++
+ AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
++
+ AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
++
+ dnl }}}
+ dnl with-Stressbalance{{{
++
+ AC_ARG_WITH([Stressbalance],
++
+ 	AS_HELP_STRING([--with-Stressbalance = YES], [compile with Stressbalance capabilities (default is yes)]),
++
+ 	[STRESSBALANCE=$withval],[STRESSBALANCE=yes])
++
+ AC_MSG_CHECKING(for Stressbalance capability compilation)
+ 
++
+ HAVE_STRESSBALANCE=no 
++
+ if test "x$STRESSBALANCE" = "xyes"; then
++
+ 	HAVE_STRESSBALANCE=yes
++
+ 	AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with Stressbalancecapability])
++
+ fi
++
+ AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
++
+ AC_MSG_RESULT($HAVE_STRESSBALANCE)
++
+ dnl }}}
+ dnl with-StressbalanceSIA{{{
++
+ AC_ARG_WITH([StressbalanceSIA],
++
+ 	AS_HELP_STRING([--with-StressbalanceSIA = YES], [compile with StressbalanceSIA capabilities (default is yes)]),
++
+ 	[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes])
++
+ AC_MSG_CHECKING(for StressbalanceSIA capability compilation)
+ 
++
+ HAVE_STRESSBALANCESIA=no 
++
+ if test "x$STRESSBALANCESIA" = "xyes"; then
++
+ 	HAVE_STRESSBALANCESIA=yes
++
+ 	AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with StressbalanceSIAcapability])
++
+ fi
++
+ AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
++
+ AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
++
+ dnl }}}
+ dnl with-StressbalanceVertical{{{
++
+ AC_ARG_WITH([StressbalanceVertical],
++
+ 	AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
++
+ 	[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes])
++
+ AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
+ 
++
+ HAVE_STRESSBALANCEVERTICAL=no 
++
+ if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
++
+ 	HAVE_STRESSBALANCEVERTICAL=yes
++
+ 	AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVerticalcapability])
++
+ fi
++
+ AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
++
+ AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
++
+ dnl }}}
+ dnl with-Enthalpy{{{
++
+ AC_ARG_WITH([Enthalpy],
++
+ 	AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
++
+ 	[ENTHALPY=$withval],[ENTHALPY=yes])
++
+ AC_MSG_CHECKING(for Enthalpy capability compilation)
+ 
++
+ HAVE_ENTHALPY=no 
++
+ if test "x$ENTHALPY" = "xyes"; then
++
+ 	HAVE_ENTHALPY=yes
++
+ 	AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpycapability])
++
+ fi
++
+ AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
++
+ AC_MSG_RESULT($HAVE_ENTHALPY)
++
+ dnl }}}
+ dnl with-HydrologyShreve{{{
++
+ AC_ARG_WITH([HydrologyShreve],
++
+ 	AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
++
+ 	[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes])
++
+ AC_MSG_CHECKING(for HydrologyShreve capability compilation)
+ 
++
+ HAVE_HYDROLOGYSHREVE=no 
++
+ if test "x$HYDROLOGYSHREVE" = "xyes"; then
++
+ 	HAVE_HYDROLOGYSHREVE=yes
++
+ 	AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShrevecapability])
++
+ fi
++
+ AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
++
+ AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
++
+ dnl }}}
+ dnl with-HydrologyDCInefficient{{{
++
+ AC_ARG_WITH([HydrologyDCInefficient],
++
+ 	AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
++
+ 	[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes])
++
+ AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
+ 
++
+ HAVE_HYDROLOGYDCINEFFICIENT=no 
++
+ if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
++
+ 	HAVE_HYDROLOGYDCINEFFICIENT=yes
++
+ 	AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficientcapability])
++
+ fi
++
+ AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
++
+ AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
++
+ dnl }}}
+ dnl with-HydrologyDCEfficient{{{
++
+ AC_ARG_WITH([HydrologyDCEfficient],
++
+ 	AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
++
+ 	[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes])
++
+ AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
+ 
++
+ HAVE_HYDROLOGYDCEFFICIENT=no 
++
+ if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
++
+ 	HAVE_HYDROLOGYDCEFFICIENT=yes
++
+ 	AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficientcapability])
++
+ fi
++
+ AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
++
+ AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
++
+ dnl }}}
+ dnl with-Melting{{{
++
+ AC_ARG_WITH([Melting],
++
+ 	AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
++
+ 	[MELTING=$withval],[MELTING=yes])
++
+ AC_MSG_CHECKING(for Melting capability compilation)
+ 
++
+ HAVE_MELTING=no 
++
+ if test "x$MELTING" = "xyes"; then
++
+ 	HAVE_MELTING=yes
++
+ 	AC_DEFINE([_HAVE_MELTING_],[1],[with Meltingcapability])
++
+ fi
++
+ AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
++
+ AC_MSG_RESULT($HAVE_MELTING)
++
+ dnl }}}
+ dnl with-Masstransport{{{
++
+ AC_ARG_WITH([Masstransport],
++
+ 	AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
++
+ 	[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes])
++
+ AC_MSG_CHECKING(for Masstransport capability compilation)
+ 
++
+ HAVE_MASSTRANSPORT=no 
++
+ if test "x$MASSTRANSPORT" = "xyes"; then
++
+ 	HAVE_MASSTRANSPORT=yes
++
+ 	AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransportcapability])
++
+ fi
++
+ AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
++
+ AC_MSG_RESULT($HAVE_MASSTRANSPORT)
++
+ dnl }}}
+ dnl with-FreeSurfaceBase{{{
++
+ AC_ARG_WITH([FreeSurfaceBase],
++
+ 	AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
++
+ 	[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes])
++
+ AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
+ 
++
+ HAVE_FREESURFACEBASE=no 
++
+ if test "x$FREESURFACEBASE" = "xyes"; then
++
+ 	HAVE_FREESURFACEBASE=yes
++
+ 	AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBasecapability])
++
+ fi
++
+ AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
++
+ AC_MSG_RESULT($HAVE_FREESURFACEBASE)
++
+ dnl }}}
+ dnl with-FreeSurfaceTop{{{
++
+ AC_ARG_WITH([FreeSurfaceTop],
++
+ 	AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
++
+ 	[FREESURFACETOP=$withval],[FREESURFACETOP=yes])
++
+ AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
+ 
++
+ HAVE_FREESURFACETOP=no 
++
+ if test "x$FREESURFACETOP" = "xyes"; then
++
+ 	HAVE_FREESURFACETOP=yes
++
+ 	AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTopcapability])
++
+ fi
++
+ AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
++
+ AC_MSG_RESULT($HAVE_FREESURFACETOP)
++
+ dnl }}}
+ dnl with-ExtrudeFromBase{{{
++
+ AC_ARG_WITH([ExtrudeFromBase],
++
+ 	AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
++
+ 	[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes])
++
+ AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
+ 
++
+ HAVE_EXTRUDEFROMBASE=no 
++
+ if test "x$EXTRUDEFROMBASE" = "xyes"; then
++
+ 	HAVE_EXTRUDEFROMBASE=yes
++
+ 	AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBasecapability])
++
+ fi
++
+ AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
++
+ AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
++
+ dnl }}}
+ dnl with-ExtrudeFromTop{{{
++
+ AC_ARG_WITH([ExtrudeFromTop],
++
+ 	AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
++
+ 	[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes])
++
+ AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
+ 
++
+ HAVE_EXTRUDEFROMTOP=no 
++
+ if test "x$EXTRUDEFROMTOP" = "xyes"; then
++
+ 	HAVE_EXTRUDEFROMTOP=yes
++
+ 	AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTopcapability])
++
+ fi
++
+ AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
++
+ AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
++
+ dnl }}}
+ dnl with-DepthAverage{{{
++
+ AC_ARG_WITH([DepthAverage],
++
+ 	AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
++
+ 	[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes])
++
+ AC_MSG_CHECKING(for DepthAverage capability compilation)
+ 
++
+ HAVE_DEPTHAVERAGE=no 
++
+ if test "x$DEPTHAVERAGE" = "xyes"; then
++
+ 	HAVE_DEPTHAVERAGE=yes
++
+ 	AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAveragecapability])
++
+ fi
++
+ AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
++
+ AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
++
+ dnl }}}
+ dnl with-SmoothedSurfaceSlopeX{{{
++
+ AC_ARG_WITH([SmoothedSurfaceSlopeX],
++
+ 	AS_HELP_STRING([--with-SmoothedSurfaceSlopeX = YES], [compile with SmoothedSurfaceSlopeX capabilities (default is yes)]),
++
+ 	[SMOOTHEDSURFACESLOPEX=$withval],[SMOOTHEDSURFACESLOPEX=yes])
++
+ AC_MSG_CHECKING(for SmoothedSurfaceSlopeX capability compilation)
+ 
++
+ HAVE_SMOOTHEDSURFACESLOPEX=no 
++
+ if test "x$SMOOTHEDSURFACESLOPEX" = "xyes"; then
++
+ 	HAVE_SMOOTHEDSURFACESLOPEX=yes
++
+ 	AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEX_],[1],[with SmoothedSurfaceSlopeXcapability])
++
+ fi
++
+ AM_CONDITIONAL([SMOOTHEDSURFACESLOPEX], [test x$HAVE_SMOOTHEDSURFACESLOPEX = xyes])
++
+ AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEX)
++
+ dnl }}}
+ dnl with-SmoothedSurfaceSlopeY{{{
++
+ AC_ARG_WITH([SmoothedSurfaceSlopeY],
++
+ 	AS_HELP_STRING([--with-SmoothedSurfaceSlopeY = YES], [compile with SmoothedSurfaceSlopeY capabilities (default is yes)]),
++
+ 	[SMOOTHEDSURFACESLOPEY=$withval],[SMOOTHEDSURFACESLOPEY=yes])
++
+ AC_MSG_CHECKING(for SmoothedSurfaceSlopeY capability compilation)
+ 
++
+ HAVE_SMOOTHEDSURFACESLOPEY=no 
++
+ if test "x$SMOOTHEDSURFACESLOPEY" = "xyes"; then
++
+ 	HAVE_SMOOTHEDSURFACESLOPEY=yes
++
+ 	AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEY_],[1],[with SmoothedSurfaceSlopeYcapability])
++
+ fi
++
+ AM_CONDITIONAL([SMOOTHEDSURFACESLOPEY], [test x$HAVE_SMOOTHEDSURFACESLOPEY = xyes])
++
+ AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEY)
++
+ dnl }}}
+ 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)
+ 
++
+ HAVE_THERMAL=no 
++
+ if test "x$THERMAL" = "xyes"; then
++
+ 	HAVE_THERMAL=yes
++
+ 	AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermalcapability])
++
+ fi
++
+ AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
++
+ AC_MSG_RESULT($HAVE_THERMAL)
++
+ dnl }}}
+ dnl with-Gia{{{
++
+ AC_ARG_WITH([Gia],
++
+ 	AS_HELP_STRING([--with-Gia = YES], [compile with Gia capabilities (default is yes)]),
++
+ 	[GIA=$withval],[GIA=yes])
++
+ AC_MSG_CHECKING(for Gia capability compilation)
+ 
++
+ HAVE_GIA=no 
++
+ if test "x$GIA" = "xyes"; then
++
+ 	HAVE_GIA=yes
++
+ 	AC_DEFINE([_HAVE_GIA_],[1],[with Giacapability])
++
+ fi
++
+ AM_CONDITIONAL([GIA], [test x$HAVE_GIA = xyes])
++
+ AC_MSG_RESULT($HAVE_GIA)
++
+ dnl }}}
+ dnl with-Meshdeformation{{{
++
+ AC_ARG_WITH([Meshdeformation],
++
+ 	AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
++
+ 	[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes])
++
+ AC_MSG_CHECKING(for Meshdeformation capability compilation)
+ 
++
+ HAVE_MESHDEFORMATION=no 
++
+ if test "x$MESHDEFORMATION" = "xyes"; then
++
+ 	HAVE_MESHDEFORMATION=yes
++
+ 	AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformationcapability])
++
+ fi
++
+ AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
++
+ AC_MSG_RESULT($HAVE_MESHDEFORMATION)
++
+ dnl }}}
+ dnl with-Levelset{{{
++
+ AC_ARG_WITH([Levelset],
++
+ 	AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
++
+ 	[LEVELSET=$withval],[LEVELSET=yes])
++
+ AC_MSG_CHECKING(for Levelset capability compilation)
+ 
++
+ HAVE_LEVELSET=no 
++
+ if test "x$LEVELSET" = "xyes"; then
++
+ 	HAVE_LEVELSET=yes
++
+ 	AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelsetcapability])
++
+ fi
++
+ AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
++
+ AC_MSG_RESULT($HAVE_LEVELSET)
++
+ dnl }}}
+ dnl with-Extrapolation{{{
++
+ AC_ARG_WITH([Extrapolation],
++
+ 	AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
++
+ 	[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes])
++
+ AC_MSG_CHECKING(for Extrapolation capability compilation)
+ 
++
+ HAVE_EXTRAPOLATION=no 
++
+ if test "x$EXTRAPOLATION" = "xyes"; then
++
+ 	HAVE_EXTRAPOLATION=yes
++
+ 	AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolationcapability])
++
+ fi
++
+ AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
++
+ AC_MSG_RESULT($HAVE_EXTRAPOLATION)
++
+ dnl }}}
+ dnl with-LsfReinitialization{{{
++
+ AC_ARG_WITH([LsfReinitialization],
++
+ 	AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
++
+ 	[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes])
++
+ AC_MSG_CHECKING(for LsfReinitialization capability compilation)
+ 
++
+ HAVE_LSFREINITIALIZATION=no 
++
+ if test "x$LSFREINITIALIZATION" = "xyes"; then
++
+ 	HAVE_LSFREINITIALIZATION=yes
++
+ 	AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitializationcapability])
++
+ fi
++
+ AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
++
+ AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
++
+ dnl }}}
+ 
+ ])
Index: /issm/oecreview/Archive/17802-17983/ISSM-17832-17833.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17832-17833.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17832-17833.diff	(revision 17986)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17832)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17833)
+@@ -107,6 +107,7 @@
+ 	matice->mid=this->mid;
+ 	matice->helement=(Hook*)this->helement->copy();
+ 	matice->element =(Element*)this->helement->delivers();
++	matice->isdamaged = this->isdamaged;
+ 
+ 	return matice;
+ }
+@@ -124,6 +125,7 @@
+ 	matice->mid=this->mid;
+ 	matice->helement=(Hook*)this->helement->copy();
+ 	matice->element =element_in;
++	matice->isdamaged = this->isdamaged;
+ 
+ 	return matice;
+ }
Index: /issm/oecreview/Archive/17802-17983/ISSM-17833-17834.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17833-17834.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17833-17834.diff	(revision 17986)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/m/interp/SectionValues.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.py	(revision 17833)
++++ ../trunk-jpl/src/m/interp/SectionValues.py	(revision 17834)
+@@ -4,7 +4,7 @@
+ from project2d import project2d
+ #from InterpFromMesh2d import InterpFromMesh2d
+ from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
+-#from InterpFromMeshToMesh3d import InterpFromMeshToMesh3d
++from InterpFromMeshToMesh3d import InterpFromMeshToMesh3d
+ 
+ def SectionValues(md,data,infile,resolution):
+ 	'''
+@@ -127,7 +127,7 @@
+ 				index3[(i-1)*elementsperlayer:i*elementsperlayer,:]=ids
+ 
+ 		#Interpolation of data on specified points
+-		# TODO data_interp=InterpFromMeshToMesh3d(md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.z,data,X3,Y3,Z3,npy.nan)
++		data_interp=InterpFromMeshToMesh3d(md.mesh.elements,md.mesh.x,md.mesh.y,md.mesh.z,data,X3,Y3,Z3,npy.nan)
+ 	
+ 		#build outputs
+ 		X=X3 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17834-17835.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17834-17835.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17834-17835.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/externalpackages/latex2html/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/latex2html/install.sh	(revision 17834)
++++ ../trunk-jpl/externalpackages/latex2html/install.sh	(revision 17835)
+@@ -1,21 +0,0 @@
+-#!/bin/bash
+-set -eu
+-
+-#Some cleanup
+-rm -rf install src latex2html-2008
+-
+-#Download from ISSM server
+-$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://www.latex2html.org/~latex2ht/current/latex2html-2008.tar.gz' 'latex2html-2008.tar.gz'
+-
+-#untar 
+-tar -zxvf  latex2html-2008.tar.gz
+-mv latex2html-2008 install
+-
+-#Configure
+-cd install
+-./configure --prefix "$ISSM_DIR/externalpackages/latex2html/install/"
+-exit 0
+-
+-#Install
+-make
+-make install
Index: /issm/oecreview/Archive/17802-17983/ISSM-17835-17836.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17835-17836.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17835-17836.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/mech/robintemperature.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/robintemperature.py	(revision 17835)
++++ ../trunk-jpl/src/m/mech/robintemperature.py	(revision 17836)
+@@ -36,6 +36,7 @@
+ 	zstar=npy.sqrt(2.*alphaT*thickness/accumrate)
+ 	
+ 	tprofile=surftemp+npy.sqrt(2.*thickness*npy.pi/accumrate/alphaT)*(-heatflux)/2./rho/c*(erf(z/zstar)-erf(thickness/zstar))
+-	
++
++	return tprofile	
+ 	# difference between surface and base temperature for check (Cuffey2010 p412):
+ 	# print tprofile-surftemp
Index: /issm/oecreview/Archive/17802-17983/ISSM-17836-17837.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17836-17837.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17836-17837.diff	(revision 17986)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/externalpackages/ssh/README
+===================================================================
+--- ../trunk-jpl/externalpackages/ssh/README	(revision 17836)
++++ ../trunk-jpl/externalpackages/ssh/README	(revision 17837)
+@@ -1,6 +0,0 @@
+-These two command line tools are taken from the Putty web page: 
+-http://www.chiark.greenend.org.uk/~sgtatham/putty
+-
+-These two tools are used instead of ssh and scp (the ones that ship with cygwin),
+-because ssh and scp do not work when called directly from matlab using the 'system' 
+-command.
Index: /issm/oecreview/Archive/17802-17983/ISSM-17837-17838.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17837-17838.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17837-17838.diff	(revision 17986)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/m/plot/plot_overlay.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17837)
++++ ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17838)
+@@ -100,4 +100,7 @@
+ 
+ 	norm=mpl.colors.Normalize(vmin=overlaylims[0],vmax=overlaylims[1])
+ 
+-	ax.pcolormesh(xgmap, ygmap, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
++	pc=ax.pcolormesh(xgmap, ygmap, npy.flipud(arr), cmap=mpl.cm.Greys, norm=norm)
++	#rasterization? 
++	if options.getfieldvalue('rasterized',0):
++		pc.set_rasterized(True)
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17837)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17838)
+@@ -108,16 +108,13 @@
+ 	#xticklabels,yticklabels,zticklabels {{{
+ 	if options.exist('xticklabels'):
+ 		xticklabels=options.getfieldvalue('xticklabels')
+-		xtickloc=p.xticks()[0]	
+-		ax.set_xticks(xtickloc,xticklabels)
++		ax.set_xticklabels(xticklabels)
+ 	if options.exist('yticklabels'):
+ 		yticklabels=options.getfieldvalue('yticklabels')
+-		ytickloc=p.yticks()[0]	
+-		ax.set_yticks(ytickloc,yticklabels)
++		ax.set_yticklabels(yticklabels)
+ 	if options.exist('zticklabels'):
+ 		zticklabels=options.getfieldvalue('zticklabels')
+-		ztickloc=p.zticks()[0]	
+-		ax.set_zticks(ztickloc,zticklabels)
++		ax.set_zticklabels(zticklabels)
+ 	#}}}
+ 
+ 	#ticklabel notation {{{
+@@ -170,6 +167,7 @@
+ 		options.addfielddefault('clim',lims)
+ 	else:
+ 		if len(data)>0: lims=[data.min(),data.max()]
++		else: lims=[0,1]
+ 	#}}}
+ 
+ 	#shading
Index: /issm/oecreview/Archive/17802-17983/ISSM-17838-17839.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17838-17839.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17838-17839.diff	(revision 17986)
@@ -0,0 +1,267 @@
+Index: ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 17838)
++++ ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 17839)
+@@ -257,8 +257,10 @@
+ 
+ 	/*Fetch dof list and allocate solution vector*/
+ 	element->GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
+-	IssmDouble* thickness = xNew<IssmDouble>(numvertices);
+-	IssmDouble* values    = xNew<IssmDouble>(numnodes);
++	IssmDouble* values         = xNew<IssmDouble>(numnodes);
++	IssmDouble* thickness_list = xNew<IssmDouble>(numvertices);
++	IssmDouble* vx_list        = xNew<IssmDouble>(numvertices);
++	IssmDouble* vy_list        = xNew<IssmDouble>(numvertices);
+ 
+ 	/*Use the dof list to index into the solution vector: */
+ 	for(int i=0;i<numnodes;i++){
+@@ -287,16 +289,22 @@
+ 		vel = sqrt(vx*vx + vy*vy) + 1.e-10;
+ 		normdphi = sqrt(dphi[0]*dphi[0] + dphi[1]*dphi[1]);
+ 
+-		thickness[iv] = normdphi/vel;
++		thickness_list[iv] = normdphi/vel;
++		vx_list[iv]        = 1./thickness_list[iv] * dphi[0];
++		vy_list[iv]        = 1./thickness_list[iv] * dphi[1];
+ 	}
+-	element->AddInput(ThicknessEnum,thickness,P1Enum);
++	element->AddInput(ThicknessEnum,thickness_list,P1Enum);
++	element->AddInput(VxEnum,vx_list,P1Enum);
++	element->AddInput(VyEnum,vy_list,P1Enum);
+ 
+ 	/*Clean up and return*/
+ 	delete gauss;
+ 	xDelete<int>(doflist);
+ 	xDelete<IssmDouble>(xyz_list);
+ 	xDelete<IssmDouble>(values);
+-	xDelete<IssmDouble>(thickness);
++	xDelete<IssmDouble>(thickness_list);
++	xDelete<IssmDouble>(vx_list);
++	xDelete<IssmDouble>(vy_list);
+ }/*}}}*/
+ void Balancethickness2Analysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
+ 	/*Default, do nothing*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17838)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17839)
+@@ -100,7 +100,7 @@
+ 	EffectivePressureEnum,
+ 	EplHeadEnum,
+ 	EplHeadOldEnum,
+-  EplHeadSlopeXEnum,
++	EplHeadSlopeXEnum,
+ 	EplHeadSlopeYEnum,
+ 	HydrologydcMaxIterEnum,
+ 	HydrologydcRelTolEnum,
+@@ -249,7 +249,6 @@
+ 	SettingsLowmemEnum,
+ 	SettingsOutputFrequencyEnum,
+ 	SettingsWaitonlockEnum,
+-
+ 	DebugProfilingEnum,
+ 	ProfilingCurrentMemEnum,
+ 	ProfilingCurrentFlopsEnum,
+@@ -260,7 +259,6 @@
+ 	SteadystateReltolEnum,
+ 	SteadystateRequestedOutputsEnum,
+ 	SurfaceEnum,
+-
+ 	ThermalIsenthalpyEnum,
+ 	ThermalIsdynamicbasalspcEnum,
+ 	ThermalMaxiterEnum,
+@@ -288,6 +286,10 @@
+ 	TransientIshydrologyEnum,
+ 	TransientNumRequestedOutputsEnum,
+ 	TransientRequestedOutputsEnum,
++	PotentialEnum,
++	Balancethickness2MisfitEnum,
++	NuXEnum,
++	NuYEnum,
+ 	/*}}}*/
+ 	/*Surfaceforcings{{{*/
+ 	SurfaceforcingsEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17838)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17839)
+@@ -294,6 +294,10 @@
+ 		case TransientIshydrologyEnum : return "TransientIshydrology";
+ 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
+ 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
++		case PotentialEnum : return "Potential";
++		case Balancethickness2MisfitEnum : return "Balancethickness2Misfit";
++		case NuXEnum : return "NuX";
++		case NuYEnum : return "NuY";
+ 		case SurfaceforcingsEnum : return "Surfaceforcings";
+ 		case SMBEnum : return "SMB";
+ 		case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17838)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17839)
+@@ -300,6 +300,10 @@
+ 	      else if (strcmp(name,"TransientIshydrology")==0) return TransientIshydrologyEnum;
+ 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
++	      else if (strcmp(name,"Potential")==0) return PotentialEnum;
++	      else if (strcmp(name,"Balancethickness2Misfit")==0) return Balancethickness2MisfitEnum;
++	      else if (strcmp(name,"NuX")==0) return NuXEnum;
++	      else if (strcmp(name,"NuY")==0) return NuYEnum;
+ 	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
+ 	      else if (strcmp(name,"SMB")==0) return SMBEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+@@ -378,14 +382,14 @@
+ 	      else if (strcmp(name,"LsfReinitializationAnalysis")==0) return LsfReinitializationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+-	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
++         else stage=4;
++   }
++   if(stage==4){
++	      if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+ 	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+ 	      else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
+ 	      else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
+-         else stage=4;
+-   }
+-   if(stage==4){
+-	      if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
++	      else if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
+ 	      else if (strcmp(name,"HOApproximation")==0) return HOApproximationEnum;
+ 	      else if (strcmp(name,"HOFSApproximation")==0) return HOFSApproximationEnum;
+ 	      else if (strcmp(name,"FSApproximation")==0) return FSApproximationEnum;
+@@ -501,14 +505,14 @@
+ 	      else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
+-	      else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
++         else stage=5;
++   }
++   if(stage==5){
++	      if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
+ 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
+-         else stage=5;
+-   }
+-   if(stage==5){
+-	      if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
++	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
+ 	      else if (strcmp(name,"Vel")==0) return VelEnum;
+ 	      else if (strcmp(name,"Velocity")==0) return VelocityEnum;
+@@ -624,14 +628,14 @@
+ 	      else if (strcmp(name,"IceVolumeAboveFloatation")==0) return IceVolumeAboveFloatationEnum;
+ 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+-	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
++         else stage=6;
++   }
++   if(stage==6){
++	      if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+-         else stage=6;
+-   }
+-   if(stage==6){
+-	      if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
++	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
+Index: ../trunk-jpl/src/c/cores/balancethickness2_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 17838)
++++ ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 17839)
+@@ -25,8 +25,8 @@
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+-		int outputs[2] = {ThicknessEnum,EnthalpyEnum};
+-		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
++		int outputs[4] = {ThicknessEnum,EnthalpyEnum,VxEnum,VyEnum};
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],4);
+ 	}
+ 
+ }
+Index: ../trunk-jpl/src/m/enum/NuXEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/NuXEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/NuXEnum.m	(revision 17839)
+@@ -0,0 +1,11 @@
++function macro=NuXEnum()
++%NUXENUM - Enum of NuX
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=NuXEnum()
++
++macro=StringToEnum('NuX');
+Index: ../trunk-jpl/src/m/enum/PotentialEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/PotentialEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/PotentialEnum.m	(revision 17839)
+@@ -0,0 +1,11 @@
++function macro=PotentialEnum()
++%POTENTIALENUM - Enum of Potential
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=PotentialEnum()
++
++macro=StringToEnum('Potential');
+Index: ../trunk-jpl/src/m/enum/NuYEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/NuYEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/NuYEnum.m	(revision 17839)
+@@ -0,0 +1,11 @@
++function macro=NuYEnum()
++%NUYENUM - Enum of NuY
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=NuYEnum()
++
++macro=StringToEnum('NuY');
+Index: ../trunk-jpl/src/m/enum/Balancethickness2MisfitEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/Balancethickness2MisfitEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/Balancethickness2MisfitEnum.m	(revision 17839)
+@@ -0,0 +1,11 @@
++function macro=Balancethickness2MisfitEnum()
++%BALANCETHICKNESS2MISFITENUM - Enum of Balancethickness2Misfit
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=Balancethickness2MisfitEnum()
++
++macro=StringToEnum('Balancethickness2Misfit');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17838)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17839)
+@@ -286,6 +286,10 @@
+ def TransientIshydrologyEnum(): return StringToEnum("TransientIshydrology")[0]
+ def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
+ def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
++def PotentialEnum(): return StringToEnum("Potential")[0]
++def Balancethickness2MisfitEnum(): return StringToEnum("Balancethickness2Misfit")[0]
++def NuXEnum(): return StringToEnum("NuX")[0]
++def NuYEnum(): return StringToEnum("NuY")[0]
+ def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
+ def SMBEnum(): return StringToEnum("SMB")[0]
+ def SurfaceforcingsMassBalanceEnum(): return StringToEnum("SurfaceforcingsMassBalance")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17839-17840.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17839-17840.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17839-17840.diff	(revision 17986)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/m/extrusion/project2d.py
+===================================================================
+--- ../trunk-jpl/src/m/extrusion/project2d.py	(revision 17839)
++++ ../trunk-jpl/src/m/extrusion/project2d.py	(revision 17840)
+@@ -33,10 +33,10 @@
+ 		value=npy.array(value)
+ 
+ 	vec2d=False
+-	if value.ndim==2: 
++	if value.ndim==2 and value.shape[1]==1: 
+ 		value=value.reshape(-1,)
+ 		vec2d=True
+-	
++
+ 	if value.size==1:
+ 		projection_value=value[(layer-1)*md3d.mesh.numberofelements2d:layer*md3d.mesh.numberofelements2d]
+ 	elif value.shape[0]==md3d.mesh.numberofvertices:
Index: /issm/oecreview/Archive/17802-17983/ISSM-17840-17841.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17840-17841.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17840-17841.diff	(revision 17986)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17840)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17841)
+@@ -59,7 +59,7 @@
+ 		#if figsize specified
+ 		if options.list[0].exist('figsize'):
+ 			figsize=options.list[0].getfieldvalue('figsize')
+-			fig=plt.figure(figurenumber,figsize=figsize,tight_layout=True)
++			fig=plt.figure(figurenumber,figsize=(figsize[0],figsize[1]),tight_layout=True)
+ 		else:
+ 			fig=plt.figure(figurenumber,tight_layout=True)
+ 		fig.clf()
+@@ -88,9 +88,12 @@
+ 				cbar_pad=cbar_pad
+ 				)
+ 
++		if cbar_mode=='none':
++			for ax in axgrid.cbar_axes: fig._axstack.remove(ax)
++
+ 		for i in xrange(numberofplots):
+ 			plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],fig,axgrid[i])
+ 
+-		plt.show()
++		fig.show()
+ 	else:
+ 		raise StandardError('plotmodel error message: no output data found.')
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17840)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17841)
+@@ -54,7 +54,7 @@
+ 	elif datatype==2:
+ 		#node plot
+ 		if is2d:
+-			tri=ax.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha)
++			tri=ax.tricontourf(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha,extend='both')
+ 			if edgecolor != 'None':
+ 				ax.triplot(x,y,elements,color=edgecolor)
+ 		else:
Index: /issm/oecreview/Archive/17802-17983/ISSM-17841-17842.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17841-17842.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17841-17842.diff	(revision 17986)
@@ -0,0 +1,467 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17841)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17842)
+@@ -125,49 +125,53 @@
+ 
+ 	/*Intermediaries*/
+ 	bool exist;
+-	int  i,j,k,v0,cols;
+-	int  maxnbf,nbf,elementnbf,elementnbv,facemaxnbv;
++	int  i,j,k,v0,cols,facescols;
++	int  maxnbf,nbf,elementnbf,elementnbv,facenbv,facemaxnbv;
+ 	int *elementfaces         = NULL;
+ 	int *elementfaces_markers = NULL;
+ 
+-	/*Maximum number of faces*/
+-	maxnbf = 5*iomodel->numberofelements;
++	/*Mesh specific face indexing per element*/
++	switch(iomodel->meshelementtype){
++		case PentaEnum:
++			elementnbv = 6; /*Number of vertices per element*/
++			elementnbf = 5; /*Number of faces per element*/
++			facemaxnbv = 4; /*Maximum number of vertices per face*/
++			cols       = facemaxnbv + 1;
++			elementfaces         = xNew<int>(elementnbf*cols);
++			elementfaces_markers = xNew<int>(elementnbf);
++			/*2 triangles*/
++			elementfaces_markers[0] = 1;
++			elementfaces_markers[1] = 1;
++			elementfaces[cols*0+0] = 3; elementfaces[cols*0+1] = 0;  elementfaces[cols*0+2] = 1; elementfaces[cols*0+3] = 2;
++			elementfaces[cols*1+0] = 3; elementfaces[cols*1+1] = 3;  elementfaces[cols*1+2] = 4; elementfaces[cols*1+3] = 5;
++			/*3 quads*/
++			elementfaces_markers[2] = 2;
++			elementfaces_markers[3] = 2;
++			elementfaces_markers[4] = 2;
++			elementfaces[cols*2+0] = 4; elementfaces[cols*2+1] = 1;  elementfaces[cols*2+2] = 2; elementfaces[cols*2+3] = 5;  elementfaces[cols*2+4] = 4;
++			elementfaces[cols*3+0] = 4; elementfaces[cols*3+1] = 2;  elementfaces[cols*3+2] = 0; elementfaces[cols*3+3] = 3;  elementfaces[cols*3+4] = 5;
++			elementfaces[cols*4+0] = 4; elementfaces[cols*4+1] = 0;  elementfaces[cols*4+2] = 1; elementfaces[cols*4+3] = 4;  elementfaces[cols*4+4] = 3;
++			break;
++		default:
++		_error_("mesh "<< EnumToStringx(iomodel->meshelementtype) <<" not supported");
++	}
+ 
++	/*Allocate connectivity*/
++	int *element_face_connectivity = xNew<int>(iomodel->numberofelements*elementnbf); /*format: [face1 face2 ...] */
++
++	/*Maximum number of faces for initial allocation*/
++	maxnbf     = elementnbf*iomodel->numberofelements;
++	facescols  = 4+facemaxnbv; _assert_(facescols>6);
++
+ 	/*Initialize intermediaries*/
+-	int*  facestemp = xNew<int>(maxnbf*6);         /*format: [vertex1 vertex2 vertex3 element1 element2 marker]    */
+-	for(i=0;i<maxnbf;i++) facestemp[i*6+4]=-1;     /*Initialize last column of faces as -1 (boundary face)         */
++	int* facestemp = xNew<int>(maxnbf*facescols);        /*format: [element1 element2 marker nbv vertex1 vertex2 vertex3 ...]    */
++	for(i=0;i<maxnbf;i++) facestemp[i*facescols+1]=-1;   /*Initialize second column of faces as -1 (boundary face)               */
+ 
+ 	/*Initialize chain*/
+ 	int* head_minv = xNew<int>(iomodel->numberofvertices);
+ 	int* next_face = xNew<int>(maxnbf);
+ 	for(i=0;i<iomodel->numberofvertices;i++) head_minv[i]=-1;
+ 
+-	/*Mesh specific face indexing per element*/
+-	if(iomodel->meshelementtype==PentaEnum){
+-		elementnbv = 6; /*Number of vertices per element*/
+-		elementnbf = 5; /*Number of faces per element*/
+-		facemaxnbv = 4; /*Maximum number of vertices per face*/
+-		cols       = facemaxnbv + 1;
+-		elementfaces         = xNew<int>(elementnbf*cols);
+-		elementfaces_markers = xNew<int>(elementnbf);
+-		/*2 triangles*/
+-		elementfaces_markers[0] = 1;
+-		elementfaces_markers[1] = 1;
+-		elementfaces[cols*0+0] = 3; elementfaces[cols*0+1] = 0;  elementfaces[cols*0+2] = 1; elementfaces[cols*0+3] = 2;
+-		elementfaces[cols*1+0] = 3; elementfaces[cols*1+1] = 3;  elementfaces[cols*1+2] = 4; elementfaces[cols*1+3] = 5;
+-		/*3 quads*/
+-		elementfaces_markers[2] = 2;
+-		elementfaces_markers[3] = 2;
+-		elementfaces_markers[4] = 2;
+-		elementfaces[cols*2+0] = 4; elementfaces[cols*2+1] = 1;  elementfaces[cols*2+2] = 2; elementfaces[cols*2+3] = 5;  elementfaces[cols*2+4] = 4;
+-		elementfaces[cols*3+0] = 4; elementfaces[cols*3+1] = 2;  elementfaces[cols*3+2] = 0; elementfaces[cols*3+3] = 3;  elementfaces[cols*3+4] = 5;
+-		elementfaces[cols*4+0] = 4; elementfaces[cols*4+1] = 0;  elementfaces[cols*4+2] = 1; elementfaces[cols*4+3] = 4;  elementfaces[cols*4+4] = 3;
+-	}
+-	else{
+-		_error_("mesh dimension not supported yet");
+-	}
+-	int *element_face_connectivity = xNew<int>(iomodel->numberofelements*elementnbf); /*format: [face1 face2 ...] */
+-
+ 	/*Initialize number of faces and list of vertex indices*/
+ 	nbf = 0;
+ 	int* v = xNew<int>(facemaxnbv);
+@@ -176,24 +180,24 @@
+ 		for(j=0;j<elementnbf;j++){
+ 
+ 			/*Get indices of current face*/
+-			for(k=0;k<elementfaces[cols*j+0];k++){
++			facenbv = elementfaces[cols*j+0];
++			for(k=0;k<facenbv;k++){
+ 				v[k] = iomodel->elements[i*elementnbv + elementfaces[cols*j+k+1]] - 1;
+ 			}
+ 
+ 			/*Sort list of vertices*/
+ 			HeapSort(v,elementfaces[cols*j+0]);
+-			v0 = v[0];
++			v0 = v[0]; _assert_(v0>=0 && v0<iomodel->numberofvertices);
+ 
+ 			/*This face a priori has not been processed yet*/
+ 			exist = false;
+ 
+-			/*Go through all processed faces connected to v1 and check whether we have seen this edge yet*/
+-			_assert_(v0>=0 && v0<iomodel->numberofvertices);
+-			for(int e=head_minv[v0]; e!=-1; e=next_face[e]){
+-				if(facestemp[e*6+1]==v[1]+1 && facestemp[e*6+2]==v[2]+1){
++			/*Go through all processed faces connected to v0 and check whether we have seen this face yet*/
++			for(int f=head_minv[v0]; f!=-1; f=next_face[f]){
++				if(facestemp[f*facescols+5]==v[1]+1 && facestemp[f*facescols+6]==v[2]+1){
+ 					exist = true;
+-					facestemp[e*6+4]=i+1;
+-					element_face_connectivity[i*elementnbf+j]=e;
++					facestemp[f*facescols+1]=i+1;
++					element_face_connectivity[i*elementnbf+j]=f;
+ 					break;
+ 				}
+ 			}
+@@ -203,11 +207,10 @@
+ 				_assert_(nbf<maxnbf);
+ 
+ 				/*Update faces*/
+-				facestemp[nbf*6+0] = v[0]+1;
+-				facestemp[nbf*6+1] = v[1]+1;
+-				facestemp[nbf*6+2] = v[2]+1;
+-				facestemp[nbf*6+3] = i+1;
+-				facestemp[nbf*6+5] = elementfaces_markers[j];
++				facestemp[nbf*facescols+0] = i+1;
++				facestemp[nbf*facescols+2] = elementfaces_markers[j];
++				facestemp[nbf*facescols+3] = facenbv;
++				for(k=0;k<facenbv;k++) facestemp[nbf*facescols+4+k] = v[k]+1;
+ 
+ 				/*Update Connectivity*/
+ 				element_face_connectivity[i*elementnbf+j]=nbf;
+@@ -230,82 +233,13 @@
+ 	xDelete<int>(elementfaces_markers);
+ 
+ 	/*Create final faces (now that we have the correct size)*/
+-	int* faces = xNew<int>(nbf*6); /*vertex1 vertex2 vertex3 element1 element2 marker*/
+-	xMemCpy<int>(faces,facestemp,nbf*6);
++	int* faces = xNew<int>(nbf*facescols);
++	xMemCpy<int>(faces,facestemp,nbf*facescols);
+ 	xDelete<int>(facestemp);
+ 
+ 	/*Assign output pointers*/
+ 	iomodel->faces                     = faces;
+ 	iomodel->numberoffaces             = nbf;
++	iomodel->facescols                 = facescols;
+ 	iomodel->elementtofaceconnectivity = element_face_connectivity;
+ }/*}}}*/
+-void FaceGetVertexIndices(IoModel* iomodel,int* pnumvertices,int** pverticesid,int facenumber){/*{{{*/
+-
+-	int numbervertices;
+-	if(iomodel->domaintype==Domain3DEnum){
+-		if((iomodel->faces[6*facenumber+5])==1){
+-			numbervertices=3;
+-		}
+-		else if((iomodel->faces[6*facenumber+5])==2){
+-			numbervertices=4;
+-		}
+-		else _error_("face marker not supported yet ");
+-	}
+-	else _error_("mesh type not supported yet");
+-
+-	int* facevertices = xNew<int>(numbervertices);
+-	if(numbervertices==3){
+-		for(int i=0;i<3;i++) facevertices[i]=iomodel->faces[6*facenumber+i]-1;
+-	}
+-	else if(numbervertices==4){
+-		int  i,j,k,cols,faceid;
+-		int  maxnbf,nbf,elementnbf,elementnbv,facemaxnbv;
+-		int *elementfaces         = NULL;
+-		int *elementfaces_markers = NULL;
+-		int elementid=iomodel->faces[6*facenumber+3];
+-		int counter=0;
+-
+-		/*Recreate element properties*/
+-		elementnbv = 6; /*Number of vertices per element*/
+-		elementnbf = 5; /*Number of faces per element*/
+-		facemaxnbv = 4; /*Maximum number of vertices per face*/
+-		cols       = facemaxnbv + 1;
+-		elementfaces         = xNew<int>(elementnbf*cols);
+-		elementfaces_markers = xNew<int>(elementnbf);
+-		/*2 triangles*/
+-		elementfaces_markers[0] = 1;
+-		elementfaces_markers[1] = 1;
+-		elementfaces[cols*0+0] = 3; elementfaces[cols*0+1] = 0;  elementfaces[cols*0+2] = 1; elementfaces[cols*0+3] = 2;
+-		elementfaces[cols*1+0] = 3; elementfaces[cols*1+1] = 3;  elementfaces[cols*1+2] = 4; elementfaces[cols*1+3] = 5;
+-		/*3 quads*/
+-		elementfaces_markers[2] = 2;
+-		elementfaces_markers[3] = 2;
+-		elementfaces_markers[4] = 2;
+-		elementfaces[cols*2+0] = 4; elementfaces[cols*2+1] = 1;  elementfaces[cols*2+2] = 2; elementfaces[cols*2+3] = 5;  elementfaces[cols*2+4] = 4;
+-		elementfaces[cols*3+0] = 4; elementfaces[cols*3+1] = 2;  elementfaces[cols*3+2] = 0; elementfaces[cols*3+3] = 3;  elementfaces[cols*3+4] = 5;
+-		elementfaces[cols*4+0] = 4; elementfaces[cols*4+1] = 0;  elementfaces[cols*4+2] = 1; elementfaces[cols*4+3] = 4;  elementfaces[cols*4+4] = 3;
+-
+-		for(faceid=2;faceid<5;faceid++){
+-			counter=0;
+-			for(j=0;j<3;j++){
+-				for(k=1;k<5;k++){
+-					if(iomodel->elements[(elementid-1)*6+elementfaces[cols*faceid+k]] == iomodel->faces[6*facenumber+j]) counter++;
+-				}
+-			}
+-			if(counter==3) break;
+-		}
+-		if(counter!=3) _error_("face not found in element");
+-
+-		for(j=0;j<4;j++){
+-			facevertices[j]=iomodel->elements[(elementid-1)*6+elementfaces[cols*faceid+j+1]];
+-		}
+-
+-		/*Delete*/
+-		xDelete<int>(elementfaces);
+-		xDelete<int>(elementfaces_markers);
+-	}
+-
+-	/*Output results*/
+-	*pverticesid=facevertices;
+-	*pnumvertices=numbervertices;
+-}/*}}}*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17841)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17842)
+@@ -4,8 +4,9 @@
+ 
+ #include "../../classes/classes.h"
+ #include "../../shared/shared.h"
++#include "./ModelProcessorx.h"
+ 
+-void CreateEdges(IoModel* iomodel){
++void CreateEdges(IoModel* iomodel){/*{{{*/
+ 
+ 	/*If edges are already present, exit*/
+ 	if(iomodel->edges) return;
+@@ -141,4 +142,25 @@
+ 	iomodel->edges                     = edges;
+ 	iomodel->elementtoedgeconnectivity = element_edge_connectivity;
+ 	iomodel->numberofedges             = nbe;
++}/*}}}*/
++void EdgeOnBoundaryFlags(IoModel* iomodel,bool** pflags){
++
++	/*Get faces and edges*/
++	if(!iomodel->edges) CreateEdges(iomodel);
++	if(!iomodel->faces) CreateFaces(iomodel);
++
++	/*Allocate output*/
++	bool* flags = xNew<bool>(iomodel->numberofedges);
++
++	/*Now, loop over the faces, whenever it is not connected to a second element, all edges are on boundary*/
++	for(int i=0;i<iomodel->numberoffaces;i++){
++
++		if(iomodel->faces[i*iomodel->facescols+4]==-1){
++
++			/*Get all edges for this face*/
++		}
++	}
++
++	/*Clean up and return*/
++	*pflags = flags;
+ }
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17841)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp	(revision 17842)
+@@ -146,13 +146,13 @@
+ 	      if(iomodel->meshelementtype==PentaEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+-					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++					if(iomodel->faces[i*iomodel->facescols+2]==2){/*Vertical quads*/
+ 						if(my_faces[i]){
+ 							node = new Node(id0+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,0,iomodel,analysis,approximation);
+ 							nodes->AddObject(node);
+ 						}
+ 					}
+-					else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++					else if(iomodel->faces[i*iomodel->facescols+2]==1){/*Triangular base/top*/
+ 						/*Nothing*/
+ 					}
+ 					else{
+@@ -195,7 +195,7 @@
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+3*iomodel->numberofedges;
+ 			for(i=0;i<iomodel->numberoffaces;i++){
+-				if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++				if(iomodel->faces[i*iomodel->facescols+2]==2){/*Vertical quads*/
+ 					if(my_faces[i]){
+ 						node = new Node(id0+3*i+1,counter+1,lid++,0,iomodel,analysis,approximation);
+ 						nodes->AddObject(node);
+@@ -206,7 +206,7 @@
+ 					}
+ 					counter=counter+3;
+ 				}
+-				else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++				else if(iomodel->faces[i*iomodel->facescols+2]==1){/*Triangular base/top*/
+ 					/*Nothing*/
+ 				}
+ 				else{
+@@ -311,13 +311,13 @@
+ 	      if(iomodel->meshelementtype==PentaEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+-					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++					if(iomodel->faces[i*iomodel->facescols+2]==2){/*Vertical quads*/
+ 						if(my_faces[i]){
+ 							node = new Node(id0+i+1,iomodel->numberofvertices+iomodel->numberofedges+i,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 							nodes->AddObject(node);
+ 						}
+ 					}
+-					else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++					else if(iomodel->faces[i*iomodel->facescols+2]==1){/*Triangular base/top*/
+ 						/*Nothing*/
+ 					}
+ 					else{
+@@ -376,7 +376,7 @@
+ 			}
+ 			id0 = id0+iomodel->numberofvertices+3*iomodel->numberofedges;
+ 			for(i=0;i<iomodel->numberoffaces;i++){
+-				if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++				if(iomodel->faces[i*iomodel->facescols+2]==2){/*Vertical quads*/
+ 					if(my_faces[i]){
+ 						node = new Node(id0+3*i+1,counter+1,lid++,0,iomodel,analysis,FSvelocityEnum);
+ 						nodes->AddObject(node);
+@@ -387,7 +387,7 @@
+ 					}
+ 					counter=counter+3;
+ 				}
+-				else if(iomodel->faces[i*6+5]==1){/*Triangular base/top*/
++				else if(iomodel->faces[i*iomodel->facescols+2]==1){/*Triangular base/top*/
+ 					/*Nothing*/
+ 				}
+ 				else{
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 17841)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 17842)
+@@ -32,7 +32,7 @@
+ void CreateEdges(IoModel* iomodel);
+ void CreateFaces(IoModel* iomodel);
+ void CreateFaces3d(IoModel* iomodel);
+-void FaceGetVertexIndices(IoModel* iomodel,int* pnumvertices,int** pverticesid,int facenumber);
++void EdgeOnBoundaryFlags(IoModel* iomodel,bool** pflags);
+ 
+ /*Connectivity*/
+ void CreateSingleNodeToElementConnectivity(IoModel* iomodel);
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17841)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17842)
+@@ -34,7 +34,6 @@
+ 	/*intermediary: */
+ 	bool        isnan;
+ 	int         i,j,count,elementnbv,numfacevertices;
+-	int*        faceverticesid   = NULL;
+ 	IssmDouble  value;
+ 	IssmDouble *times            = NULL;
+ 	IssmDouble *values           = NULL;
+@@ -118,23 +117,20 @@
+ 				}
+ 				if(iomodel->meshelementtype==PentaEnum){
+ 					for(i=0;i<iomodel->numberoffaces;i++){
+-						if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++						if(iomodel->faces[i*iomodel->facescols+2]==2){/*Vertical quads*/
+ 							if(my_faces[i]){
+-								FaceGetVertexIndices(iomodel,&numfacevertices,&faceverticesid,i);
+-								isnan=0;
++								numfacevertices = iomodel->faces[i*iomodel->facescols+3];
++								value=0.;
+ 								for(j=0;j<numfacevertices;j++){
+-									if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]-1])) isnan=1;
++									value += spcdata[iomodel->faces[i*iomodel->facescols+4+j] -1];
+ 								}
+-								if(isnan==0){
+-									value=0;
+-									for(j=0;j<numfacevertices;j++){
+-										value=value+spcdata[faceverticesid[j]-1]/numfacevertices;
+-									}
+-									constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,
++								value = value/reCast<IssmDouble>(numfacevertices);
++								if(!xIsNan<IssmDouble>(value)){
++									constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,
++													iomodel->nodecounter+iomodel->numberofvertices+iomodel->numberofedges+i+1,
+ 													dof,value,analysis_type));
+ 									count++;
+ 								}
+-								xDelete<int>(faceverticesid);
+ 							}
+ 						}
+ 					}
+@@ -178,27 +174,26 @@
+ 					}
+ 				}
+ 				for(i=0;i<iomodel->numberoffaces;i++){
+-					if(iomodel->faces[i*6+5]==2){/*Vertical quads*/
++					if(iomodel->faces[i*iomodel->facescols+2]==2){/*Vertical quads*/
+ 						if(my_faces[i]){
+-							FaceGetVertexIndices(iomodel,&numfacevertices,&faceverticesid,i);
+-							isnan=0;
++							numfacevertices = iomodel->faces[i*iomodel->facescols+3];
++							value=0.;
+ 							for(j=0;j<numfacevertices;j++){
+-								if(xIsNan<IssmDouble>(spcdata[faceverticesid[j]-1])) isnan=1;
++								value += spcdata[iomodel->faces[i*iomodel->facescols+4+j] -1];
+ 							}
+-							if(isnan==0){
+-								value=0;
+-								for(j=0;j<numfacevertices;j++){
+-									value=value+spcdata[faceverticesid[j]-1]/numfacevertices;
+-								}
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+1,
++							value = value/reCast<IssmDouble>(numfacevertices);
++							if(!xIsNan<IssmDouble>(value)){
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+1,
++												iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+1,
+ 												dof,value,analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+2,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+2,
++												iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+2,
+ 												dof,value,analysis_type));
+-								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+3,
++								constraints->AddObject(new SpcStatic(iomodel->constraintcounter+count+3,
++												iomodel->nodecounter+iomodel->numberofvertices+3*iomodel->numberofedges+3*i+3,
+ 												dof,value,analysis_type));
+ 								count=count+3;
+ 							}
+-							xDelete<int>(faceverticesid);
+ 						}
+ 					}
+ 				}
+Index: ../trunk-jpl/src/c/classes/IoModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.h	(revision 17841)
++++ ../trunk-jpl/src/c/classes/IoModel.h	(revision 17842)
+@@ -37,6 +37,7 @@
+ 		int  numberofelements;
+ 		int  numberoffaces;
+ 		int  numberofedges;
++		int  facescols;
+ 		int *elements;
+ 		int *faces;
+ 		int *edges;
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17841)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17842)
+@@ -36,6 +36,7 @@
+ 	this->numberofelements=-1;
+ 	this->numberoffaces=-1;
+ 	this->numberofedges=-1;
++	this->facescols=-1;
+ 	this->elements=NULL;
+ 	this->faces=NULL;
+ 	this->edges=NULL;
+@@ -82,6 +83,7 @@
+ 	FetchData(&this->numberofvertices,MeshNumberofverticesEnum);
+ 	FetchData(&this->numberofelements,MeshNumberofelementsEnum);
+ 	FetchData(&this->elements,NULL,NULL,MeshElementsEnum);
++	this->facescols                       = -1;
+ 	this->faces                           = NULL;
+ 	this->edges                           = NULL;
+ 	this->elementtofaceconnectivity       = NULL;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17842-17843.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17842-17843.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17842-17843.diff	(revision 17986)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17842)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17843)
+@@ -212,7 +212,7 @@
+ 	IssmDouble      eps_xy[NUMVERTICES];
+ 	IssmDouble		 eps_xz[NUMVERTICES]={0,0,0};
+ 	IssmDouble		 eps_yz[NUMVERTICES]={0,0,0};
+-	GaussPenta*     gauss=NULL;
++	GaussTria*     gauss=NULL;
+ 
+ 	/* Get node coordinates and dof list: */
+ 	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+@@ -222,7 +222,7 @@
+ 	Input* vy_input=inputs->GetInput(VyEnum);             _assert_(vy_input);
+ 
+ 	/* Start looping on the number of vertices: */
+-	gauss=new GaussPenta();
++	gauss=new GaussTria();
+ 	for (int iv=0;iv<NUMVERTICES;iv++){
+ 		gauss->GaussVertex(iv);
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17843-17844.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17843-17844.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17843-17844.diff	(revision 17986)
@@ -0,0 +1,155 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17843)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17844)
+@@ -143,24 +143,92 @@
+ 	iomodel->elementtoedgeconnectivity = element_edge_connectivity;
+ 	iomodel->numberofedges             = nbe;
+ }/*}}}*/
+-void EdgeOnBoundaryFlags(IoModel* iomodel,bool** pflags){
++void EdgeOnBoundaryFlags(bool** pflags,IoModel* iomodel){/*{{{*/
+ 
+-	/*Get faces and edges*/
++	/*Intermediaries*/
++	bool isv1,isv2;
++	int  facenbv,v1,v2;
++	int  id_edge,id_element,id_face;
++	int  elementnbe;
++
++	/*Mesh dependent variables*/
++	switch(iomodel->meshelementtype){
++		case TriaEnum:  elementnbe = 3; break;
++		case TetraEnum: elementnbe = 6; break;
++		case PentaEnum: elementnbe = 9; break;
++		default:        _error_("mesh dimension not supported yet");
++	}
++
++	/*Get edges and allocate output*/
+ 	if(!iomodel->edges) CreateEdges(iomodel);
+-	if(!iomodel->faces) CreateFaces(iomodel);
++	bool* flags = xNewZeroInit<bool>(iomodel->numberofedges);
+ 
+-	/*Allocate output*/
+-	bool* flags = xNew<bool>(iomodel->numberofedges);
++	if(iomodel->domaindim==2){
+ 
+-	/*Now, loop over the faces, whenever it is not connected to a second element, all edges are on boundary*/
+-	for(int i=0;i<iomodel->numberoffaces;i++){
++		/*Count how many times an edge is found in elementtoedgeconnectivity*/
++		int* counter = xNewZeroInit<int>(iomodel->numberofedges);
++		for(int i=0;i<iomodel->numberofelements;i++){
++			for(int j=0;j<elementnbe;j++){
++				counter[iomodel->elementtoedgeconnectivity[elementnbe*i+j]] += 1;
++			}
++		}
+ 
+-		if(iomodel->faces[i*iomodel->facescols+4]==-1){
++		/*Now, loop over the egdes, whenever it is not connected to a second element, the edge is on boundary*/
++		for(int i=0;i<iomodel->numberofedges;i++){
++			if(counter[i]==1) flags[i]=true;
++		}
+ 
+-			/*Get all edges for this face*/
++		/*Clean up*/
++		xDelete<int>(counter);
++	}
++	else if(iomodel->domaindim==3){
++
++		/*Get faces*/
++		if(!iomodel->faces) CreateFaces(iomodel);
++
++		/*Now, loop over the faces, whenever it is not connected to a second element, all edges are on boundary*/
++		for(int id_face=0;id_face<iomodel->numberoffaces;id_face++){
++
++			if(iomodel->faces[id_face*iomodel->facescols+1]==-1){
++
++				/*The face is connected to the element e only*/
++				id_element = iomodel->faces[id_face*iomodel->facescols+0]-1;
++				facenbv    = iomodel->faces[id_face*iomodel->facescols+3];
++
++				/*Get all edges for this element*/
++				for(int edge = 0; edge<elementnbe; edge++){
++
++					id_edge     = iomodel->elementtoedgeconnectivity[elementnbe*id_element+edge];
++					v1          = iomodel->edges[id_edge*3+0];
++					v2          = iomodel->edges[id_edge*3+1];
++
++					/*Test if v1 is in the face*/
++					isv1=false;
++					for(int i=0;i<facenbv;i++){
++						if(iomodel->faces[id_face*iomodel->facescols+4+i] == v1){
++							isv1 = true; break;
++						}
++					}
++					if(!isv1) continue;
++
++					/*test if v2 is in the face*/
++					isv2=false;
++					for(int i=0;i<facenbv;i++){
++						if(iomodel->faces[id_face*iomodel->facescols+4+i] == v2){
++							isv2 = true; break;
++						}
++					}
++
++					/*If v1 and v2 are found, this edge is on boundary*/
++					if(isv2) flags[id_edge] = true;
++				}
++			}
+ 		}
+ 	}
++	else{
++		_error_("dimension not supported");
++	}
+ 
+ 	/*Clean up and return*/
+ 	*pflags = flags;
+-}
++}/*}}}*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 17843)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 17844)
+@@ -32,7 +32,7 @@
+ void CreateEdges(IoModel* iomodel);
+ void CreateFaces(IoModel* iomodel);
+ void CreateFaces3d(IoModel* iomodel);
+-void EdgeOnBoundaryFlags(IoModel* iomodel,bool** pflags);
++void EdgeOnBoundaryFlags(bool** pflags,IoModel* iomodel);
+ 
+ /*Connectivity*/
+ void CreateSingleNodeToElementConnectivity(IoModel* iomodel);
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17843)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17844)
+@@ -43,6 +43,7 @@
+ 	int   v1,v2,v3,v4;
+ 	bool *my_edges = NULL;
+ 	bool *my_faces = NULL;
++	bool *boundaryedge = NULL;
+ 
+ 	switch(finite_element){
+ 		case P1Enum: 
+@@ -73,6 +74,7 @@
+ 	      if(iomodel->meshelementtype==PentaEnum){
+ 				FacesPartitioning(&my_faces,iomodel);
+ 			}
++			EdgeOnBoundaryFlags(&boundaryedge,iomodel);
+ 			break;
+ 		case P2xP4Enum:
+ 			EdgesPartitioning(&my_edges,iomodel);
+@@ -105,7 +107,7 @@
+ 					}
+ 				}
+ 				for(i=0;i<iomodel->numberofedges;i++){
+-					if(my_edges[i]){
++					if(my_edges[i] && boundaryedge[i]){
+ 						v1 = iomodel->edges[3*i+0]-1;
+ 						v2 = iomodel->edges[3*i+1]-1;
+ 						if(!xIsNan<IssmDouble>(spcdata[v1]) && !xIsNan<IssmDouble>(spcdata[v2])){
+@@ -465,4 +467,5 @@
+ 	xDelete<IssmDouble>(values);
+ 	xDelete<bool>(my_edges);
+ 	xDelete<bool>(my_faces);
++	xDelete<bool>(boundaryedge);
+ }
Index: /issm/oecreview/Archive/17802-17983/ISSM-17844-17845.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17844-17845.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17844-17845.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/dev/issmversion.m
+===================================================================
+--- ../trunk-jpl/src/m/dev/issmversion.m	(revision 17844)
++++ ../trunk-jpl/src/m/dev/issmversion.m	(revision 17845)
+@@ -14,7 +14,7 @@
+ disp(['(website: ' IssmConfig('PACKAGE_URL') ' contact:' IssmConfig('PACKAGE_BUGREPORT') ')']);
+ disp([' ']);
+ disp(['Build date: ' IssmConfig('PACKAGE_BUILD_DATE')]);
+-disp(['Copyright (c) 2009-2013 California Institute of Technology']);
++disp(['Copyright (c) 2009-2014 California Institute of Technology']);
+ disp([' ']);
+ disp(['    to get started type: issmdoc']);
+ disp([' ']);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17845-17846.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17845-17846.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17845-17846.diff	(revision 17986)
@@ -0,0 +1,27 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17845)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp	(revision 17846)
+@@ -152,6 +152,22 @@
+ 			elementfaces[cols*3+0] = 4; elementfaces[cols*3+1] = 2;  elementfaces[cols*3+2] = 0; elementfaces[cols*3+3] = 3;  elementfaces[cols*3+4] = 5;
+ 			elementfaces[cols*4+0] = 4; elementfaces[cols*4+1] = 0;  elementfaces[cols*4+2] = 1; elementfaces[cols*4+3] = 4;  elementfaces[cols*4+4] = 3;
+ 			break;
++		case TetraEnum:
++			elementnbv = 4; /*Number of vertices per element*/
++			elementnbf = 4; /*Number of faces per element*/
++			facemaxnbv = 3; /*Maximum number of vertices per face*/
++			cols       = facemaxnbv + 1;
++			elementfaces         = xNew<int>(elementnbf*cols);
++			elementfaces_markers = xNew<int>(elementnbf);
++			/*4 triangles*/
++			elementfaces_markers[0] = 1;
++			elementfaces_markers[1] = 1;
++			elementfaces_markers[2] = 1;
++			elementfaces[cols*0+0] = 3; elementfaces[cols*0+1] = 0;  elementfaces[cols*0+2] = 1; elementfaces[cols*0+3] = 2;
++			elementfaces[cols*1+0] = 3; elementfaces[cols*1+1] = 0;  elementfaces[cols*1+2] = 3; elementfaces[cols*1+3] = 1;
++			elementfaces[cols*2+0] = 3; elementfaces[cols*2+1] = 1;  elementfaces[cols*2+2] = 3; elementfaces[cols*2+3] = 2;
++			elementfaces[cols*3+0] = 3; elementfaces[cols*3+1] = 0;  elementfaces[cols*3+2] = 2; elementfaces[cols*3+3] = 3;
++			break;
+ 		default:
+ 		_error_("mesh "<< EnumToStringx(iomodel->meshelementtype) <<" not supported");
+ 	}
Index: /issm/oecreview/Archive/17802-17983/ISSM-17846-17847.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17846-17847.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17846-17847.diff	(revision 17986)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/m/contrib/bamg/gmsh.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/bamg/gmsh.m	(revision 0)
++++ ../trunk-jpl/src/m/contrib/bamg/gmsh.m	(revision 17847)
+@@ -0,0 +1,48 @@
++function md=gmsh(md,domainfile,h),
++
++%Read domain
++domain=expread(domainfile);
++x   = domain.x(1:end-1);
++y   = domain.y(1:end-1);
++nbv = numel(x);
++
++%write files
++t1=clock; fprintf('%s','      writing initial mesh files...');
++fid=fopen('model.geo','w');
++fprintf(fid,['// Gmsh input file, created by ISSM on ' date '\n']);
++for i=1:nbv,
++	fprintf(fid,'Point(%i) = {%8g, %8g, %8g};\n',i,x(i),y(i),0.);
++end
++for i=1:nbv-1
++	fprintf(fid,'Line(%i) = {%i, %i};\n',i,i,i+1);
++end
++fprintf(fid,'Line(%i) = {%i, %i};\n',nbv,nbv,1);
++fprintf(fid,'Line Loop(5) = {');
++for i=1:nbv-1
++	fprintf(fid,'%i,',i);
++end
++fprintf(fid,'%i};\n',nbv);
++fprintf(fid,'Plane Surface(6) = {5};\n');
++
++%Physical lines and surfaces
++fprintf(fid,'Physical Line(2) = {1};\n');
++fprintf(fid,'Physical Line(4) = {2};\n');
++fprintf(fid,'Physical Line(5) = {3};\n');
++fprintf(fid,'Physical Line(1) = {4};\n');
++fprintf(fid,'Physical Surface(7) = {6};\n');
++
++%resolution
++fprintf(fid,'Mesh.CharacteristicLengthMax = %g;',h);
++
++%fprintf(fid,'Plane Surface(7) = {6, 2};\n');
++fclose(fid);
++
++t2=clock;fprintf('%s\n',[' done (' num2str(etime(t2,t1)) ' seconds)']);
++
++%call gmsh
++fprintf('%s\n','      call gmsh...');
++system([issmdir() '/externalpackages/gmsh/install/gmsh -2 model.geo']);
++
++%plug new mesh
++t1=clock; fprintf('\n%s','      reading final mesh files...');
++md=importgmsh('model.msh',2);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17847-17848.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17847-17848.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17847-17848.diff	(revision 17986)
@@ -0,0 +1,352 @@
+Index: ../trunk-jpl/test/NightlyRun/test1104.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1104.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1104.m	(revision 17848)
+@@ -1,7 +1,8 @@
+ %This test is a test from the ISMP-HOM Intercomparison project.
+ %Pattyn and Payne 2006
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ 
+ for i=1:length(L_list),
+@@ -55,23 +56,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',...
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-08,1e-08,1e-08,...
+-	1e-08,1e-08,1e-08,...
+-	1e-08,1e-08,1e-08,...
+-	1e-08,1e-08,1e-08,...
+ 	1e-08,1e-07,1e-08,...
+-	1e-07,1e-07,1e-07,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test1105.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1105.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1105.m	(revision 17848)
+@@ -2,7 +2,8 @@
+ %Pattyn and Payne 2006
+ printingflag=false;
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ minvx=[];
+ maxvx=[];
+@@ -134,23 +135,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',...
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-08,1e-07,1e-07,...
+-	1e-09,1e-07,1e-07,...
+-	1e-09,1e-09,1e-07,...
+-	1e-09,1e-09,1e-08,...
+ 	1e-09,1e-08,1e-08,...
+-	1e-08,1e-08,1e-08,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test1106.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1106.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1106.m	(revision 17848)
+@@ -1,7 +1,8 @@
+ %This test is a test from the ISMP-HOM Intercomparison project.
+ %Pattyn and Payne 2006
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ 
+ for i=1:length(L_list),
+@@ -53,23 +54,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',...
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-12,1e-12,1e-11,...
+-	1e-12,2e-12,2e-12,...
+-	1e-12,1e-12,1e-12,...
+-	1e-12,2e-12,2e-12,...
+ 	1e-11,2e-12,3e-12,...
+-	1e-11,2e-11,2e-12,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test1107.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1107.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1107.m	(revision 17848)
+@@ -2,7 +2,8 @@
+ %Pattyn and Payne 2006
+ printingflag=false;
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ minvx=[];
+ maxvx=[];
+@@ -123,23 +124,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',...
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-07,1e-08,1e-06,...
+-	1e-08,1e-08,1e-06,...
+ 	1e-08,1e-08,1e-07,...
+-	1e-08,1e-08,1e-07,...
+-	1e-08,1e-08,1e-07,...
+-	1e-07,1e-08,1e-06,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test1108.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1108.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1108.m	(revision 17848)
+@@ -1,7 +1,8 @@
+ %This test is a test from the ISMP-HOM Intercomparison project.
+ %Pattyn and Payne 2006
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ 
+ for i=1:length(L_list),
+@@ -62,23 +63,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',...
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-07,1e-07,1e-07,...
+-	1e-08,2e-08,1e-08,...
+ 	1e-08,1e-07,1e-07,...
+-	1e-08,1e-08,2e-08,...
+-	1e-08,1e-07,1e-07,...
+-	1e-07,1e-06,1e-07,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test1101.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1101.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1101.m	(revision 17848)
+@@ -2,7 +2,8 @@
+ %Pattyn and Payne 2006
+ printingflag=false;
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ minvx=[];
+ maxvx=[];
+@@ -111,23 +112,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',... 
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-09,1e-09,1e-09,...
+-	1e-10,1e-10,1e-09,...
+-	1e-09,1e-09,1e-09,...
+-	1e-09,1e-08,1e-08,...
+ 	1e-08,1e-08,1e-08,...
+-	1e-08,1e-07,1e-08,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test1102.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1102.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1102.m	(revision 17848)
+@@ -2,7 +2,8 @@
+ %Pattyn and Payne 2006
+ printingflag=false;
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ minvx=[];
+ maxvx=[];
+@@ -121,23 +122,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',...
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-12,1e-12,1e-12,...
+-	1e-12,1e-12,1e-12,...
+ 	1e-12,1e-11,1e-12,...
+-	1e-12,1e-11,1e-12,...
+-	1e-12,1e-11,1e-12,...
+-	1e-12,1e-11,1e-12,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/NightlyRun/test1103.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test1103.m	(revision 17847)
++++ ../trunk-jpl/test/NightlyRun/test1103.m	(revision 17848)
+@@ -2,7 +2,8 @@
+ %Pattyn and Payne 2006
+ printingflag=false;
+ 
+-L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++%L_list={5000.,10000.,20000.,40000.,80000.,160000.};
++L_list={80000.};
+ results={};
+ minvx=[];
+ maxvx=[];
+@@ -104,23 +105,13 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={...
+-	'Vx5km','Vy5km','Vz5km',...
+-	'Vx10km','Vy10km','Vz10km',...
+-	'Vx20km','Vy20km','Vz20km',...
+-	'Vx40km','Vy40km','Vz40km',...
+-	'Vx80km','Vy80km','Vz80km',...
+-	'Vx160km','Vy160km','Vz160km'
++	'Vx80km','Vy80km','Vz80km'
+ };
+ field_tolerances={...
+-	1e-09,1e-09,1e-09,...
+-	1e-09,1e-09,1e-09,...
+-	1e-09,1e-09,1e-09,...
+-	1e-08,1e-08,1e-08,...
+ 	1e-08,1e-07,1e-07,...
+-	1e-07,1e-06,1e-07,...
+ };
+ field_values={};
+-for i=1:6,
++for i=1:1,
+ 	result=results{i};
+ 	field_values={field_values{:},...
+ 		(result.Vx),...
+Index: ../trunk-jpl/test/Archives/Archive1107.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive1102.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive1105.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive1108.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive1103.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive1106.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive1101.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive1104.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: /issm/oecreview/Archive/17802-17983/ISSM-17848-17849.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17848-17849.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17848-17849.diff	(revision 17986)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive455.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: /issm/oecreview/Archive/17802-17983/ISSM-17849-17850.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17849-17850.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17849-17850.diff	(revision 17986)
@@ -0,0 +1,637 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17849)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17850)
+@@ -9,6 +9,7 @@
+ 	return 1;
+ }/*}}}*/
+ void BalancethicknessAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++	parameters->AddObject(iomodel->CopyConstantObject(BalancethicknessStabilizationEnum));
+ }/*}}}*/
+ void BalancethicknessAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.h	(revision 17849)
++++ ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.h	(revision 17850)
+@@ -27,7 +27,6 @@
+ 		ElementVector* CreatePVector(Element* element);
+ 		ElementVector* CreatePVectorVolume(Element* element);
+ 		ElementVector* CreatePVectorBoundary(Element* element);
+-		void GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
+ 		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
+ 		void UpdateConstraints(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 17849)
++++ ../trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp	(revision 17850)
+@@ -25,14 +25,14 @@
+ 		}
+ 	}
+ 
++	iomodel->FetchDataToInput(elements,BalancethicknessApparentMassbalanceEnum);
++	iomodel->FetchDataToInput(elements,BalancethicknessNuxEnum);
++	iomodel->FetchDataToInput(elements,BalancethicknessNuyEnum);
++	iomodel->FetchDataToInput(elements,BalancethicknessVxObsEnum);
++	iomodel->FetchDataToInput(elements,BalancethicknessVyObsEnum);
++	iomodel->FetchDataToInput(elements,BalancethicknessThicknessObsEnum);
++	iomodel->FetchDataToInput(elements,MeshVertexonboundaryEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,VxEnum);
+-	iomodel->FetchDataToInput(elements,VyEnum);
+-	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+-	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+-	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+-	iomodel->FetchDataToInput(elements,MeshVertexonboundaryEnum);
+-	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ }/*}}}*/
+ void Balancethickness2Analysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+@@ -41,9 +41,10 @@
+ }/*}}}*/
+ void Balancethickness2Analysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+-	/*Do not add constraints in DG*/
+-	IoModelToConstraintsx(constraints,iomodel,BalancethicknessSpcthicknessEnum,Balancethickness2AnalysisEnum,P1Enum);
+ 
++	int finiteelement = P1Enum;
++	IoModelToConstraintsx(constraints,iomodel,BalancethicknessSpcpotentialEnum,Balancethickness2AnalysisEnum,finiteelement);
++
+ }/*}}}*/
+ void Balancethickness2Analysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
+ 
+@@ -71,8 +72,6 @@
+ 
+ 	/*Initialize Element vector and other vectors*/
+ 	ElementMatrix* Ke  = element->NewElementMatrix();
+-	IssmDouble*    B   = xNew<IssmDouble>(2*numnodes);
+-	IssmDouble     D[2][2];
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -82,33 +81,19 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-
+ 		IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+ 		element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 
+ 		for(int i=0;i<numnodes;i++){
+ 			for(int j=0;j<numnodes;j++){
+ 				Ke->values[i*numnodes+j] += gauss->weight*Jdet*(dbasis[0*numnodes+i]*dbasis[0*numnodes+j] + dbasis[1*numnodes+i]*dbasis[1*numnodes+j]);
+ 			}
+ 		}
+-		//GetB(B,element,xyz_list,gauss);
+-
+-		//D_scalar=gauss->weight*Jdet;
+-
+-		//D[0][0]=D_scalar;
+-		//D[0][1]=0.;
+-		//D[1][0]=0.;
+-		//D[1][1]=D_scalar;
+-		//TripleMultiply(B,2,numnodes,1,
+-		//			&D[0][0],2,2,0,
+-		//			B,2,numnodes,0,
+-		//			&Ke->values[0],1);
+ 	}
+ 
+ 	/*Clean up and return*/
+ 	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(B);
+ 	delete gauss;
+ 	return Ke;
+ }/*}}}*/
+@@ -127,7 +112,7 @@
+ ElementVector* Balancethickness2Analysis::CreatePVectorVolume(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	IssmDouble  dhdt,mb,ms,Jdet;
++	IssmDouble  adot,Jdet;
+ 	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+@@ -139,11 +124,8 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	Input* mb_input   = element->GetInput(BasalforcingsMeltingRateEnum);       _assert_(mb_input);
+-	Input* ms_input   = element->GetInput(SurfaceforcingsMassBalanceEnum);     _assert_(ms_input);
+-	Input* dhdt_input = element->GetInput(BalancethicknessThickeningRateEnum); _assert_(dhdt_input);
++	Input* adot_input   = element->GetInput(BalancethicknessApparentMassbalanceEnum); _assert_(adot_input);
+ 
+-	/*Initialize mb_correction to 0, do not forget!:*/
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+@@ -151,12 +133,9 @@
+ 
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctions(basis,gauss);
++		adot_input->GetInputValue(&adot,gauss);
+ 
+-		ms_input->GetInputValue(&ms,gauss);
+-		mb_input->GetInputValue(&mb,gauss);
+-		dhdt_input->GetInputValue(&dhdt,gauss);
+-
+-		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*(ms-mb-dhdt)*basis[i];
++		for(int i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*adot*basis[i];
+ 	}
+ 
+ 	/*Clean up and return*/
+@@ -184,9 +163,9 @@
+ 	IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+ 
+ 	/*Retrieve all inputs and parameters*/
+-	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* vx_input        = element->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input        = element->GetInput(VyEnum);        _assert_(vy_input);
++	Input* thickness_input = element->GetInput(BalancethicknessThicknessObsEnum); _assert_(thickness_input);
++	Input* vx_input        = element->GetInput(BalancethicknessVxObsEnum);        _assert_(vx_input);
++	Input* vy_input        = element->GetInput(BalancethicknessVyObsEnum);        _assert_(vy_input);
+ 
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->GetIcefrontCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+@@ -203,7 +182,7 @@
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 		element->NodalFunctions(basis,gauss);
+ 
+-		for(int i=0;i<numnodes;i++) pe->values[i] += Jdet*gauss->weight*thickness*(vx*normal[0] + vy*normal[1])*basis[i];
++		for(int i=0;i<numnodes;i++) pe->values[i] += - Jdet*gauss->weight*thickness*(vx*normal[0] + vy*normal[1])*basis[i];
+ 	}
+ 
+ 	/*Clean up and return*/
+@@ -213,41 +192,13 @@
+ 	delete gauss;
+ 	return pe;
+ }/*}}}*/
+-void Balancethickness2Analysis::GetB(IssmDouble* B,Element* element,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+-	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+-	 * For node i, Bi can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi=[ dN/dx ]
+-	 *          [ dN/dy ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = element->GetNumberOfNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	element->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		B[numnodes*0+i] = dbasis[0*numnodes+i];
+-		B[numnodes*1+i] = dbasis[1*numnodes+i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-
+-}/*}}}*/
+ void Balancethickness2Analysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	   _error_("not implemented yet");
+ }/*}}}*/
+ void Balancethickness2Analysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
+ 
+ 	/*Intermediaries */
+-	IssmDouble  vx,vy,vel,h,normdphi,dphi[2];
++	IssmDouble  vx,vy,vbar,nux,nuy,normdphi,dphi[2];
+ 	IssmDouble* xyz_list = NULL;
+ 	int       * doflist  = NULL;
+ 
+@@ -270,13 +221,15 @@
+ 		if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
+ 	}
+ 
+-	element->AddInput(EnthalpyEnum,values,element->GetElementType());//FIXME
++	element->AddInput(PotentialEnum,values,element->GetElementType());
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinates(&xyz_list);
+-	Input* potential_input = element->GetInput(EnthalpyEnum); _assert_(potential_input);
+-	Input* vx_input        = element->GetInput(VxEnum);       _assert_(vx_input);
+-	Input* vy_input        = element->GetInput(VyEnum);       _assert_(vy_input);
++	Input* potential_input = element->GetInput(PotentialEnum);             _assert_(potential_input);
++	Input* vx_input        = element->GetInput(BalancethicknessVxObsEnum); _assert_(vx_input);
++	Input* vy_input        = element->GetInput(BalancethicknessVyObsEnum); _assert_(vy_input);
++	Input* nux_input       = element->GetInput(BalancethicknessNuxEnum);   _assert_(nux_input);
++	Input* nuy_input       = element->GetInput(BalancethicknessNuyEnum);   _assert_(nuy_input);
+ 
+ 	Gauss* gauss=element->NewGauss();
+ 	for (int iv=0;iv<numvertices;iv++){
+@@ -284,14 +237,17 @@
+ 
+ 		vx_input->GetInputValue(&vx,gauss);
+ 		vy_input->GetInputValue(&vy,gauss);
++		nux_input->GetInputValue(&nux,gauss);
++		nuy_input->GetInputValue(&nuy,gauss);
+ 		potential_input->GetInputDerivativeValue(&dphi[0],xyz_list,gauss);
+ 
+-		vel = sqrt(vx*vx + vy*vy) + 1.e-10;
++		vx = vx*nux; vy = vy*nuy;
++		vbar = sqrt(vx*vx + vy*vy) + 1.e-10;
+ 		normdphi = sqrt(dphi[0]*dphi[0] + dphi[1]*dphi[1]);
+ 
+-		thickness_list[iv] = normdphi/vel;
+-		vx_list[iv]        = 1./thickness_list[iv] * dphi[0];
+-		vy_list[iv]        = 1./thickness_list[iv] * dphi[1];
++		thickness_list[iv] = normdphi/vbar;
++		vx_list[iv]        = -1./thickness_list[iv] * dphi[0];
++		vy_list[iv]        = -1./thickness_list[iv] * dphi[1];
+ 	}
+ 	element->AddInput(ThicknessEnum,thickness_list,P1Enum);
+ 	element->AddInput(VxEnum,vx_list,P1Enum);
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17849)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17850)
+@@ -287,9 +287,14 @@
+ 	TransientNumRequestedOutputsEnum,
+ 	TransientRequestedOutputsEnum,
+ 	PotentialEnum,
++	BalancethicknessSpcpotentialEnum,
++	BalancethicknessApparentMassbalanceEnum,
+ 	Balancethickness2MisfitEnum,
+-	NuXEnum,
+-	NuYEnum,
++	BalancethicknessNuxEnum,
++	BalancethicknessNuyEnum,
++	BalancethicknessVxObsEnum,
++	BalancethicknessVyObsEnum,
++	BalancethicknessThicknessObsEnum,
+ 	/*}}}*/
+ 	/*Surfaceforcings{{{*/
+ 	SurfaceforcingsEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17849)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17850)
+@@ -295,9 +295,14 @@
+ 		case TransientNumRequestedOutputsEnum : return "TransientNumRequestedOutputs";
+ 		case TransientRequestedOutputsEnum : return "TransientRequestedOutputs";
+ 		case PotentialEnum : return "Potential";
++		case BalancethicknessSpcpotentialEnum : return "BalancethicknessSpcpotential";
++		case BalancethicknessApparentMassbalanceEnum : return "BalancethicknessApparentMassbalance";
+ 		case Balancethickness2MisfitEnum : return "Balancethickness2Misfit";
+-		case NuXEnum : return "NuX";
+-		case NuYEnum : return "NuY";
++		case BalancethicknessNuxEnum : return "BalancethicknessNux";
++		case BalancethicknessNuyEnum : return "BalancethicknessNuy";
++		case BalancethicknessVxObsEnum : return "BalancethicknessVxObs";
++		case BalancethicknessVyObsEnum : return "BalancethicknessVyObs";
++		case BalancethicknessThicknessObsEnum : return "BalancethicknessThicknessObs";
+ 		case SurfaceforcingsEnum : return "Surfaceforcings";
+ 		case SMBEnum : return "SMB";
+ 		case SurfaceforcingsMassBalanceEnum : return "SurfaceforcingsMassBalance";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17849)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17850)
+@@ -301,9 +301,14 @@
+ 	      else if (strcmp(name,"TransientNumRequestedOutputs")==0) return TransientNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"TransientRequestedOutputs")==0) return TransientRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Potential")==0) return PotentialEnum;
++	      else if (strcmp(name,"BalancethicknessSpcpotential")==0) return BalancethicknessSpcpotentialEnum;
++	      else if (strcmp(name,"BalancethicknessApparentMassbalance")==0) return BalancethicknessApparentMassbalanceEnum;
+ 	      else if (strcmp(name,"Balancethickness2Misfit")==0) return Balancethickness2MisfitEnum;
+-	      else if (strcmp(name,"NuX")==0) return NuXEnum;
+-	      else if (strcmp(name,"NuY")==0) return NuYEnum;
++	      else if (strcmp(name,"BalancethicknessNux")==0) return BalancethicknessNuxEnum;
++	      else if (strcmp(name,"BalancethicknessNuy")==0) return BalancethicknessNuyEnum;
++	      else if (strcmp(name,"BalancethicknessVxObs")==0) return BalancethicknessVxObsEnum;
++	      else if (strcmp(name,"BalancethicknessVyObs")==0) return BalancethicknessVyObsEnum;
++	      else if (strcmp(name,"BalancethicknessThicknessObs")==0) return BalancethicknessThicknessObsEnum;
+ 	      else if (strcmp(name,"Surfaceforcings")==0) return SurfaceforcingsEnum;
+ 	      else if (strcmp(name,"SMB")==0) return SMBEnum;
+ 	      else if (strcmp(name,"SurfaceforcingsMassBalance")==0) return SurfaceforcingsMassBalanceEnum;
+@@ -377,15 +382,15 @@
+ 	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+ 	      else if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
+-	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
++         else stage=4;
++   }
++   if(stage==4){
++	      if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
+ 	      else if (strcmp(name,"LsfReinitializationAnalysis")==0) return LsfReinitializationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+-         else stage=4;
+-   }
+-   if(stage==4){
+-	      if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
++	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+ 	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+ 	      else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
+ 	      else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
+@@ -500,15 +505,15 @@
+ 	      else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
+ 	      else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
+ 	      else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
+-	      else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
++         else stage=5;
++   }
++   if(stage==5){
++	      if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceArea")==0) return SurfaceAreaEnum;
+ 	      else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
+-         else stage=5;
+-   }
+-   if(stage==5){
+-	      if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
++	      else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
+ 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
+@@ -623,15 +628,15 @@
+ 	      else if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
+ 	      else if (strcmp(name,"MinVz")==0) return MinVzEnum;
+ 	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+-	      else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
++         else stage=6;
++   }
++   if(stage==6){
++	      if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
+ 	      else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
+ 	      else if (strcmp(name,"IceVolumeAboveFloatation")==0) return IceVolumeAboveFloatationEnum;
+ 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+-         else stage=6;
+-   }
+-   if(stage==6){
+-	      if (strcmp(name,"Incremental")==0) return IncrementalEnum;
++	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17849)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17850)
+@@ -56,7 +56,6 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(DebugProfilingEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshAverageVertexConnectivityEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ConstantsReferencetemperatureEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(BalancethicknessStabilizationEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(GroundinglineMeltingRateEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(SettingsWaitonlockEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(MeshNumberofelementsEnum));
+@@ -218,7 +217,6 @@
+ 	}
+ 	/*}}}*/
+ 
+-	
+ 	/*Before returning, create parameters in case we are running Qmu or control types runs: */
+ 	CreateParametersControl(parameters,iomodel,solution_type);
+ 
+Index: ../trunk-jpl/src/c/cores/balancethickness2_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 17849)
++++ ../trunk-jpl/src/c/cores/balancethickness2_core.cpp	(revision 17850)
+@@ -25,7 +25,7 @@
+ 
+ 	if(save_results){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+-		int outputs[4] = {ThicknessEnum,EnthalpyEnum,VxEnum,VyEnum};
++		int outputs[4] = {ThicknessEnum,PotentialEnum,VxEnum,VyEnum};
+ 		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],4);
+ 	}
+ 
+Index: ../trunk-jpl/src/m/classes/balancethickness2.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/balancethickness2.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/balancethickness2.m	(revision 17850)
+@@ -0,0 +1,57 @@
++%BALANCETHICKNESS2 class definition
++%
++%   Usage:
++%      balancethickness2=balancethickness2();
++
++classdef balancethickness2
++	properties (SetAccess=public) 
++		spcpotential         = NaN;
++		apparent_massbalance = NaN;
++		nux                  = NaN;
++		nuy                  = NaN;
++		vx_obs               = NaN;
++		vy_obs               = NaN;
++		thickness_obs        = NaN;
++	end
++	methods
++		function obj = balancethickness2(varargin) % {{{
++			switch nargin
++				case 0
++					obj=setdefaultparameters(obj);
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++			%Early return
++			if solution~=Balancethickness2SolutionEnum(), return; end
++
++			md = checkfield(md,'fieldname','balancethickness.spcpotential','size',[md.mesh.numberofvertices 1]);
++			md = checkfield(md,'fieldname','balancethickness.apparent_massbalance','size',[md.mesh.numberofvertices 1],'NaN',1);
++			md = checkfield(md,'fieldname','balancethickness.nux','size',[md.mesh.numberofvertices 1],'NaN',1,'>',0,'<=',1);
++			md = checkfield(md,'fieldname','balancethickness.nuy','size',[md.mesh.numberofvertices 1],'NaN',1,'>',0,'<=',1);
++			md = checkfield(md,'fieldname','balancethickness.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++			md = checkfield(md,'fieldname','balancethickness.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++			md = checkfield(md,'fieldname','balancethickness.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1,'>=',0);
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   balance thickness solution parameters:'));
++
++			fielddisplay(obj,'spcpotential','potential constraints (NaN means no constraint)');
++			fielddisplay(obj,'apparent_massbalance','Apparent mass balance [m/yr]');
++
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++			WriteData(fid,'object',obj,'class','Balancethickness','fieldname','spcpotential','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','Balancethickness','fieldname','apparent_massbalance','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','Balancethickness','fieldname','nux','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','Balancethickness','fieldname','nuy','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','Balancethickness','fieldname','vx_obs','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','Balancethickness','fieldname','vy_obs','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','Balancethickness','fieldname','thickness_obs','format','DoubleMat','mattype',1);
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/enum/NuXEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/NuXEnum.m	(revision 17849)
++++ ../trunk-jpl/src/m/enum/NuXEnum.m	(revision 17850)
+@@ -1,11 +0,0 @@
+-function macro=NuXEnum()
+-%NUXENUM - Enum of NuX
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=NuXEnum()
+-
+-macro=StringToEnum('NuX');
+Index: ../trunk-jpl/src/m/enum/NuYEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/NuYEnum.m	(revision 17849)
++++ ../trunk-jpl/src/m/enum/NuYEnum.m	(revision 17850)
+@@ -1,11 +0,0 @@
+-function macro=NuYEnum()
+-%NUYENUM - Enum of NuY
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=NuYEnum()
+-
+-macro=StringToEnum('NuY');
+Index: ../trunk-jpl/src/m/enum/BalancethicknessSpcpotentialEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BalancethicknessSpcpotentialEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BalancethicknessSpcpotentialEnum.m	(revision 17850)
+@@ -0,0 +1,11 @@
++function macro=BalancethicknessSpcpotentialEnum()
++%BALANCETHICKNESSSPCPOTENTIALENUM - Enum of BalancethicknessSpcpotential
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BalancethicknessSpcpotentialEnum()
++
++macro=StringToEnum('BalancethicknessSpcpotential');
+Index: ../trunk-jpl/src/m/enum/BalancethicknessThicknessObsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BalancethicknessThicknessObsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BalancethicknessThicknessObsEnum.m	(revision 17850)
+@@ -0,0 +1,11 @@
++function macro=BalancethicknessThicknessObsEnum()
++%BALANCETHICKNESSTHICKNESSOBSENUM - Enum of BalancethicknessThicknessObs
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BalancethicknessThicknessObsEnum()
++
++macro=StringToEnum('BalancethicknessThicknessObs');
+Index: ../trunk-jpl/src/m/enum/BalancethicknessNuxEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BalancethicknessNuxEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BalancethicknessNuxEnum.m	(revision 17850)
+@@ -0,0 +1,11 @@
++function macro=BalancethicknessNuxEnum()
++%BALANCETHICKNESSNUXENUM - Enum of BalancethicknessNux
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BalancethicknessNuxEnum()
++
++macro=StringToEnum('BalancethicknessNux');
+Index: ../trunk-jpl/src/m/enum/BalancethicknessVxObsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BalancethicknessVxObsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BalancethicknessVxObsEnum.m	(revision 17850)
+@@ -0,0 +1,11 @@
++function macro=BalancethicknessVxObsEnum()
++%BALANCETHICKNESSVXOBSENUM - Enum of BalancethicknessVxObs
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BalancethicknessVxObsEnum()
++
++macro=StringToEnum('BalancethicknessVxObs');
+Index: ../trunk-jpl/src/m/enum/BalancethicknessNuyEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BalancethicknessNuyEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BalancethicknessNuyEnum.m	(revision 17850)
+@@ -0,0 +1,11 @@
++function macro=BalancethicknessNuyEnum()
++%BALANCETHICKNESSNUYENUM - Enum of BalancethicknessNuy
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BalancethicknessNuyEnum()
++
++macro=StringToEnum('BalancethicknessNuy');
+Index: ../trunk-jpl/src/m/enum/BalancethicknessVyObsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BalancethicknessVyObsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BalancethicknessVyObsEnum.m	(revision 17850)
+@@ -0,0 +1,11 @@
++function macro=BalancethicknessVyObsEnum()
++%BALANCETHICKNESSVYOBSENUM - Enum of BalancethicknessVyObs
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BalancethicknessVyObsEnum()
++
++macro=StringToEnum('BalancethicknessVyObs');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17849)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17850)
+@@ -287,9 +287,14 @@
+ def TransientNumRequestedOutputsEnum(): return StringToEnum("TransientNumRequestedOutputs")[0]
+ def TransientRequestedOutputsEnum(): return StringToEnum("TransientRequestedOutputs")[0]
+ def PotentialEnum(): return StringToEnum("Potential")[0]
++def BalancethicknessSpcpotentialEnum(): return StringToEnum("BalancethicknessSpcpotential")[0]
++def BalancethicknessApparentMassbalanceEnum(): return StringToEnum("BalancethicknessApparentMassbalance")[0]
+ def Balancethickness2MisfitEnum(): return StringToEnum("Balancethickness2Misfit")[0]
+-def NuXEnum(): return StringToEnum("NuX")[0]
+-def NuYEnum(): return StringToEnum("NuY")[0]
++def BalancethicknessNuxEnum(): return StringToEnum("BalancethicknessNux")[0]
++def BalancethicknessNuyEnum(): return StringToEnum("BalancethicknessNuy")[0]
++def BalancethicknessVxObsEnum(): return StringToEnum("BalancethicknessVxObs")[0]
++def BalancethicknessVyObsEnum(): return StringToEnum("BalancethicknessVyObs")[0]
++def BalancethicknessThicknessObsEnum(): return StringToEnum("BalancethicknessThicknessObs")[0]
+ def SurfaceforcingsEnum(): return StringToEnum("Surfaceforcings")[0]
+ def SMBEnum(): return StringToEnum("SMB")[0]
+ def SurfaceforcingsMassBalanceEnum(): return StringToEnum("SurfaceforcingsMassBalance")[0]
+Index: ../trunk-jpl/src/m/enum/BalancethicknessApparentMassbalanceEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/BalancethicknessApparentMassbalanceEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/BalancethicknessApparentMassbalanceEnum.m	(revision 17850)
+@@ -0,0 +1,11 @@
++function macro=BalancethicknessApparentMassbalanceEnum()
++%BALANCETHICKNESSAPPARENTMASSBALANCEENUM - Enum of BalancethicknessApparentMassbalance
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=BalancethicknessApparentMassbalanceEnum()
++
++macro=StringToEnum('BalancethicknessApparentMassbalance');
Index: /issm/oecreview/Archive/17802-17983/ISSM-17850-17851.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17850-17851.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17850-17851.diff	(revision 17986)
@@ -0,0 +1,96 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17850)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17851)
+@@ -516,6 +516,7 @@
+ syn keyword cType AdjointBalancethicknessAnalysis
+ syn keyword cType AdjointHorizAnalysis
+ syn keyword cType Analysis
++syn keyword cType Balancethickness2Analysis
+ syn keyword cType BalancethicknessAnalysis
+ syn keyword cType BalancethicknessSoftAnalysis
+ syn keyword cType BalancevelocityAnalysis
+@@ -636,6 +637,7 @@
+ syn keyword cConstant SedimentHeadEnum
+ syn keyword cConstant SedimentHeadOldEnum
+ syn keyword cConstant SedimentHeadResidualEnum
++syn keyword cConstant EffectivePressureEnum
+ syn keyword cConstant EplHeadEnum
+ syn keyword cConstant EplHeadOldEnum
+ syn keyword cConstant EplHeadSlopeXEnum
+@@ -654,6 +656,7 @@
+ syn keyword cConstant HydrologydcEplCompressibilityEnum
+ syn keyword cConstant HydrologydcEplPorosityEnum
+ syn keyword cConstant HydrologydcEplInitialThicknessEnum
++syn keyword cConstant HydrologydcEplMaxThicknessEnum
+ syn keyword cConstant HydrologydcEplThicknessEnum
+ syn keyword cConstant HydrologydcEplThicknessOldEnum
+ syn keyword cConstant HydrologydcEplConductivityEnum
+@@ -700,6 +703,7 @@
+ syn keyword cConstant MaterialsRheologyBbarEnum
+ syn keyword cConstant MaterialsRheologyLawEnum
+ syn keyword cConstant MaterialsRheologyNEnum
++syn keyword cConstant DamageIsdamageEnum
+ syn keyword cConstant DamageDEnum
+ syn keyword cConstant DamageFEnum
+ syn keyword cConstant QmuDamageDEnum
+@@ -709,6 +713,7 @@
+ syn keyword cConstant DamageC2Enum
+ syn keyword cConstant DamageC3Enum
+ syn keyword cConstant DamageC4Enum
++syn keyword cConstant DamageElementinterpEnum
+ syn keyword cConstant DamageHealingEnum
+ syn keyword cConstant DamageStressThresholdEnum
+ syn keyword cConstant DamageStabilizationEnum
+@@ -746,6 +751,7 @@
+ syn keyword cConstant MeshUpperelementsEnum
+ syn keyword cConstant MeshVertexonbaseEnum
+ syn keyword cConstant MeshVertexonsurfaceEnum
++syn keyword cConstant MeshVertexonboundaryEnum
+ syn keyword cConstant MeshXEnum
+ syn keyword cConstant MeshYEnum
+ syn keyword cConstant MeshZEnum
+@@ -817,8 +823,18 @@
+ syn keyword cConstant TransientIsthermalEnum
+ syn keyword cConstant TransientIsgiaEnum
+ syn keyword cConstant TransientIsdamageevolutionEnum
++syn keyword cConstant TransientIshydrologyEnum
+ syn keyword cConstant TransientNumRequestedOutputsEnum
+ syn keyword cConstant TransientRequestedOutputsEnum
++syn keyword cConstant PotentialEnum
++syn keyword cConstant BalancethicknessSpcpotentialEnum
++syn keyword cConstant BalancethicknessApparentMassbalanceEnum
++syn keyword cConstant Balancethickness2MisfitEnum
++syn keyword cConstant BalancethicknessNuxEnum
++syn keyword cConstant BalancethicknessNuyEnum
++syn keyword cConstant BalancethicknessVxObsEnum
++syn keyword cConstant BalancethicknessVyObsEnum
++syn keyword cConstant BalancethicknessThicknessObsEnum
+ syn keyword cConstant SurfaceforcingsEnum
+ syn keyword cConstant SMBEnum
+ syn keyword cConstant SurfaceforcingsMassBalanceEnum
+@@ -850,6 +866,8 @@
+ syn keyword cConstant DefaultAnalysisEnum
+ syn keyword cConstant BalancethicknessAnalysisEnum
+ syn keyword cConstant BalancethicknessSolutionEnum
++syn keyword cConstant Balancethickness2AnalysisEnum
++syn keyword cConstant Balancethickness2SolutionEnum
+ syn keyword cConstant BalancethicknessSoftAnalysisEnum
+ syn keyword cConstant BalancethicknessSoftSolutionEnum
+ syn keyword cConstant BalancevelocityAnalysisEnum
+@@ -938,6 +956,7 @@
+ syn keyword cConstant IntVecParamEnum
+ syn keyword cConstant TransientParamEnum
+ syn keyword cConstant MaticeEnum
++syn keyword cConstant MatdamageiceEnum
+ syn keyword cConstant MatparEnum
+ syn keyword cConstant NodeEnum
+ syn keyword cConstant NumericalfluxEnum
+@@ -1052,6 +1071,7 @@
+ syn keyword cConstant QmuTemperatureEnum
+ syn keyword cConstant HydrologyWaterVxEnum
+ syn keyword cConstant HydrologyWaterVyEnum
++syn keyword cConstant SigmaNNEnum
+ syn keyword cConstant StressTensorEnum
+ syn keyword cConstant StressTensorxxEnum
+ syn keyword cConstant StressTensorxyEnum
Index: /issm/oecreview/Archive/17802-17983/ISSM-17851-17852.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17851-17852.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17851-17852.diff	(revision 17986)
@@ -0,0 +1,156 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 17851)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp	(revision 17852)
+@@ -28,11 +28,11 @@
+ 	/*Allocate ouput*/
+ 	connectivity=xNewZeroInit<int>(iomodel->numberofvertices);
+ 
+-	/*Get element width (3 or 6)*/
+-	switch(iomodel->domaintype){
+-		case Domain2DhorizontalEnum: elementswidth=3; break;
+-		case Domain2DverticalEnum  : elementswidth=3; break;
+-		case Domain3DEnum          : elementswidth=6; break;
++	/*Get element width*/
++	switch(iomodel->meshelementtype){
++		case TriaEnum:  elementswidth=3; break;
++		case PentaEnum: elementswidth=6; break;
++		case TetraEnum: elementswidth=4; break;
+ 		default:  _error_("mesh type "<<EnumToStringx(iomodel->domaintype)<<" not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17851)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17852)
+@@ -102,6 +102,33 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
++/*FUNCTION Tetra::ElementSizes (THIS ONE){{{*/
++void Tetra::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
++
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble xmin,ymin,zmin;
++	IssmDouble xmax,ymax,zmax;
++
++	/*Get xyz list: */
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	xmin=xyz_list[0][0]; xmax=xyz_list[0][0];
++	ymin=xyz_list[0][1]; ymax=xyz_list[0][1];
++	zmin=xyz_list[0][2]; zmax=xyz_list[0][2];
++
++	for(int i=1;i<NUMVERTICES;i++){
++		if(xyz_list[i][0]<xmin) xmin=xyz_list[i][0];
++		if(xyz_list[i][0]>xmax) xmax=xyz_list[i][0];
++		if(xyz_list[i][1]<ymin) ymin=xyz_list[i][1];
++		if(xyz_list[i][1]>ymax) ymax=xyz_list[i][1];
++		if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];
++		if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];
++	}
++
++	*hx=xmax-xmin;
++	*hy=ymax-ymin;
++	*hz=zmax-zmin;
++}
++/*}}}*/
+ /*FUNCTION Tetra::FaceOnBaseIndices{{{*/
+ void Tetra::FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3){
+ 
+@@ -172,6 +199,32 @@
+ 	return this->element_type;
+ }
+ /*}}}*/
++/*FUNCTION Tetra::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) (THIS ONE??){{{*/
++void Tetra::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
++
++	Input* input=inputs->GetInput(enumtype);
++	if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
++
++	GaussTetra* gauss=new GaussTetra();
++	gauss->GaussVertex(this->GetNodeIndex(node));
++
++	input->GetInputValue(pvalue,gauss);
++	delete gauss;
++}
++/*}}}*/
++/*FUNCTION Tetra::GetNodeIndex (THIS ONE){{{*/
++int Tetra::GetNodeIndex(Node* node){
++
++	_assert_(nodes);
++	int numnodes = this->NumberofNodes();
++
++	for(int i=0;i<numnodes;i++){
++		if(node==nodes[i]) return i;
++	}
++	_error_("Node provided not found among element nodes");
++
++}
++/*}}}*/
+ /*FUNCTION Tetra::GetNumberOfNodes;{{{*/
+ int Tetra::GetNumberOfNodes(void){
+ 	return this->NumberofNodes();
+@@ -916,6 +969,23 @@
+ 	return TetraRef::VelocityInterpolation();
+ }
+ /*}}}*/
++/*FUNCTION Tetra::ViscousHeating (THIS ONE){{{*/
++void Tetra::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++
++	/*Intermediaries*/
++	IssmDouble phi;
++	IssmDouble viscosity;
++	IssmDouble epsilon[6];
++
++	_assert_(gauss->Enum()==GaussTetraEnum);
++	this->StrainRateFS(&epsilon[0],xyz_list,(GaussTetra*)gauss,vx_input,vy_input,vz_input);
++	this->ViscosityFS(&viscosity,3,xyz_list,(GaussTetra*)gauss,vx_input,vy_input,vz_input);
++	GetPhi(&phi,&epsilon[0],viscosity);
++
++	/*Assign output pointer*/
++	*pphi = phi;
++}
++/*}}}*/
+ /*FUNCTION Tetra::PressureInterpolation{{{*/
+ int Tetra::PressureInterpolation(void){
+ 	return TetraRef::PressureInterpolation();
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17851)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17852)
+@@ -61,7 +61,7 @@
+ 		void        Configure(Elements* elements,Loads* loads,Nodes* nodesin,Vertices* verticesin,Materials* materials,Parameters* parameters);
+ 		void        SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Materials* materials,Parameters* parameters);
+ 		void        Delta18oParameterization(void){_error_("not implemented yet");};
+-		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){_error_("not implemented yet");};
++		void        ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz);
+ 		void        FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3);
+ 		void        FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3);
+@@ -71,7 +71,7 @@
+ 	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+ 	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+-		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
++		int         GetNodeIndex(Node* node);
+ 		int         GetNumberOfNodes(void);
+ 		int         GetNumberOfVertices(void);
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+@@ -111,7 +111,7 @@
+ 		int         VelocityInterpolation(void);
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+-		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
++		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+ 		IssmDouble  GetXcoord(Gauss* gauss);
+ 		IssmDouble  GetYcoord(Gauss* gauss);
+@@ -127,7 +127,7 @@
+ 		Gauss*      NewGaussTop(int order);
+ 		int         VertexConnectivity(int vertexindex){_error_("not implemented yet");};
+ 		void        VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+-		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){_error_("not implemented yet");};
++		void        ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+ 		bool        IsZeroLevelset(int levelset_enum){_error_("not implemented");};
+ 		bool		   IsIcefront(void);
+ 		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
Index: /issm/oecreview/Archive/17802-17983/ISSM-17852-17853.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17852-17853.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17852-17853.diff	(revision 17986)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17852)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17853)
+@@ -39,11 +39,11 @@
+ 			elementedges         = xNew<int>(elementnbe*2);
+ 			elementedges_markers = xNew<int>(elementnbe);
+ 			elementedges[2*0+0] = 1; elementedges[2*0+1] = 2; elementedges_markers[0] = 1;
+-			elementedges[2*1+0] = 2; elementedges[2*1+1] = 0; elementedges_markers[1] = 1;
++			elementedges[2*1+0] = 0; elementedges[2*1+1] = 2; elementedges_markers[1] = 1;
+ 			elementedges[2*2+0] = 0; elementedges[2*2+1] = 1; elementedges_markers[2] = 1;
+-			elementedges[2*3+0] = 0; elementedges[2*3+1] = 3; elementedges_markers[3] = 1;
+-			elementedges[2*4+0] = 1; elementedges[2*4+1] = 3; elementedges_markers[4] = 1;
+-			elementedges[2*5+0] = 2; elementedges[2*5+1] = 3; elementedges_markers[5] = 1;
++			elementedges[2*3+0] = 1; elementedges[2*3+1] = 3; elementedges_markers[3] = 1;
++			elementedges[2*4+0] = 2; elementedges[2*4+1] = 3; elementedges_markers[4] = 1;
++			elementedges[2*5+0] = 0; elementedges[2*5+1] = 3; elementedges_markers[5] = 1;
+ 			break;
+ 		case PentaEnum:
+ 			elementnbv = 6;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17853-17854.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17853-17854.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17853-17854.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17853)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17854)
+@@ -70,6 +70,8 @@
+ 	else{
+ 		_error_(index1 <<" "<<index2 <<" "<<index3 <<" Not supported yet");
+ 	}
++
++	for(int i=0;i<numgauss;i++) this->weights[i]=this->weights[i]*0.5/1.732050807568877; //FIXME: double check that
+ }
+ /*}}}*/
+ /*FUNCTION GaussTetra::~GaussTetra(){{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17854-17855.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17854-17855.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17854-17855.diff	(revision 17986)
@@ -0,0 +1,36 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17854)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17855)
+@@ -1664,11 +1664,13 @@
+ void Tria::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
++	int index1,index2;
+ 	IssmDouble vector[2];
+ 	IssmDouble norm;
+ 
+-	vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
+-	vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
++	this->EdgeOnBaseIndices(&index1,&index2);
++	vector[0]=xyz_list[index2*3+0] - xyz_list[index1*3+0];
++	vector[1]=xyz_list[index2*3+1] - xyz_list[index1*3+1];
+ 
+ 	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
+ 
+@@ -1680,11 +1682,13 @@
+ void Tria::NormalTop(IssmDouble* bed_normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
++	int index1,index2;
+ 	IssmDouble vector[2];
+ 	IssmDouble norm;
+ 
+-	vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
+-	vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
++	this->EdgeOnSurfaceIndices(&index1,&index2);
++	vector[0]=xyz_list[index2*3+0] - xyz_list[index1*3+0];
++	vector[1]=xyz_list[index2*3+1] - xyz_list[index1*3+1];
+ 
+ 	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17855-17856.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17855-17856.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17855-17856.diff	(revision 17986)
@@ -0,0 +1,142 @@
+Index: ../trunk-jpl/src/m/plot/checkplotoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/checkplotoptions.py	(revision 17855)
++++ ../trunk-jpl/src/m/plot/checkplotoptions.py	(revision 17856)
+@@ -49,50 +49,69 @@
+ 
+ 	#text
+ 	if options.exist('text'):
+-		#1: textvalue
+-		textvalues=options.getfieldvalue('text')
+-		numtext=len(textvalues)
+ 
+-		#2: textweight
+-		if options.exist('textweight'):
+-			textweightvalues=options.getfieldvalue('textweight')
+-		else:
+-			textweightvalues='n'
+-		textweightvalues=npy.tile(textweightvalues,numtext)
++		# text values (coerce to list for consistent functionality)
++		textlist=[]
++		text=options.getfieldvalue('text','default text')
++		textlist.extend([text] if isinstance(text,str) else text)
++		numtext=len(textlist)
+ 
+-		#3 textsize
++		# text position	
++		textpos=options.getfieldvalue('textposition',[0.5,0.5])
++		if not isinstance(textpos,list):
++			raise Exception('textposition should be passed as a list')
++		textx=[item[0] for item in textpos]
++		texty=[item[1] for item in textpos]
++		if len(textx)!=numtext or len(texty)!=numtext:
++			raise Exception('textposition should contain one list of x,y vertices for every text instance')
++
++		# font size
+ 		if options.exist('textsize'):
+-			textsizevalues=options.getfieldvalue('textsize')
++			textsize=options.getfieldvalue('textsize',12)
++			sizelist=[]
++			sizelist.extend(textsize if isinstance(textsize,list) else [textsize])
+ 		else:
+-			textsizevalues=14
+-		textsizevalues=npy.tile(textsizevalues,numtext)
++			sizelist=[12]
++		if len(sizelist)==1:
++			sizelist=npy.tile(sizelist,numtext)
+ 
+-		#4 textcolor
++		# font color
+ 		if options.exist('textcolor'):
+-			textcolorvalues=options.getfieldvalue('textcolor')
++			textcolor=options.getfieldvalue('textcolor','k')
++			colorlist=[]
++			colorlist.extend(textcolor if isinstance(textcolor,list) else [textcolor])
+ 		else:
+-			textcolorvalues='k'
+-		textcolorvalues=npy.tile(textsizevalues,numtext)
++			colorlist=['k']
++		if len(colorlist)==1:
++			colorlist=npy.tile(colorlist,numtext)
+ 
+-		#5 textposition
+-		if options.exist('textposition'):
+-			options.getfieldvalue('textposition')
++		# textweight
++		if options.exist('textweight'):
++			textweightvalues=options.getfieldvalue('textweight')
++			weightlist=[]
++			weightlist.extend(textweight if isinstance(textwieght,list) else [textweight])
+ 		else:
+-			raise Exception("plotmodel error message: 'textposition' option is missing")
++			weightlist=['normal']
++		if len(weightlist)==1:
++			weightlist=npy.tile(weightlist,numtext)
+ 
+-		#6 textrotation
++		# text rotation
+ 		if options.exist('textrotation'):
+-			textrotationvalues=options.getfieldvalue('textrotation')
++			textrotation=options.getfieldvalue('textrotation',0)
++			rotationlist=[]
++			rotationlist.extend(textrotation if isinstance(textrotation,list) else [textrotation])
+ 		else:
+-			textrotationvalues=0
+-		textrotationvalues=npy.tile(textrotationvalues,numtext)
++			rotationlist=[0]
++		if len(rotationlist)==1:
++				rotationlist=npy.tile(rotationlist,numtext)
+ 
+-		options.changfieldvalue('text',textvalues)
+-		options.changfieldvalue('textsize',textsizevalues)
+-		options.changfieldvalue('textweight',textweightvalues)
+-		options.changfieldvalue('textcolor',textcolorvalues)
+-		options.changfieldvalue('textposition',textpositionvalues)
+-		options.changfieldvalue('textrotation',textrotationvalues)
++		options.changefieldvalue('text',textlist)
++		options.addfield('textx',textx)
++		options.addfield('texty',texty)
++		options.changefieldvalue('textsize',sizelist)
++		options.changefieldvalue('textcolor',colorlist)
++		options.changefieldvalue('textweight',weightlist)
++		options.changefieldvalue('textrotation',rotationlist)
+ 
+ 	#expdisp
+ 	expdispvaluesarray=[0,0]
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17855)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17856)
+@@ -226,7 +226,11 @@
+ 			locs=npy.arange(lims[0],lims[1]+1,options.getfieldvalue('colorbarlines'))
+ 			cb.add_lines(locs,['k' for i in range(len(locs))],npy.ones_like(locs))
+ 		if options.exist('colorbartitle'):
+-			cb.set_label(options.getfieldvalue('colorbartitle'),fontsize=fontsize)
++			if options.exist('colorbartitlepad'):
++				cb.set_label(options.getfieldvalue('colorbartitle'),\
++						labelpad=options.getfieldvalue('colorbartitlepad'),fontsize=fontsize)
++			else:
++				cb.set_label(options.getfieldvalue('colorbartitle'),fontsize=fontsize)
+ 		cb.ax.tick_params(labelsize=fontsize)
+ 	#}}}
+ 
+@@ -234,7 +238,18 @@
+ 
+ 	#expdisp
+ 
+-	#text
++	#text {{{
++	if options.exist('text'):
++		text=options.getfieldvalue('text')
++		textx=options.getfieldvalue('textx')
++		texty=options.getfieldvalue('texty')
++		textsize=options.getfieldvalue('textsize')
++		textcolor=options.getfieldvalue('textcolor')
++		textweight=options.getfieldvalue('textweight')
++		textrotation=options.getfieldvalue('textrotation')
++		for label,x,y,size,color,weight,rotation in zip(text,textx,texty,textsize,textcolor,textweight,textrotation):
++			ax.text(x,y,label,transform=ax.transAxes,fontsize=size,color=color,weight=weight,rotation=rotation)
++	#}}}
+ 
+ 	#north arrow
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17856-17857.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17856-17857.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17856-17857.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17856)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17857)
+@@ -28,7 +28,7 @@
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+ 	5e-08,5e-08,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+-	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
++	1e-07,1e-07,5e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17856)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17857)
+@@ -15,7 +15,7 @@
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+ 	5e-08,5e-08,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+-	1e-07,1e-07,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
++	1e-07,1e-07,5e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17857-17858.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17857-17858.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17857-17858.diff	(revision 17986)
@@ -0,0 +1,64 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17857)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17858)
+@@ -156,6 +156,7 @@
+ 	}
+ 	else{
+ 		IssmDouble* xyz_list=NULL;
++		IssmDouble *xyz_list_base=NULL;
+ 		IssmDouble  pressure,viscosity,sigma_nn;
+ 		IssmDouble  sigma_xx,sigma_xy,sigma_yy;
+ 		IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
+@@ -164,6 +165,7 @@
+ 
+ 		/* Get node coordinates and dof list: */
+ 		GetVerticesCoordinates(&xyz_list);
++	   GetVerticesCoordinatesTop(&xyz_list_base);
+ 
+ 		/*Retrieve all inputs we will be needing: */
+ 		this->FindParam(&domaintype,DomainTypeEnum);
+@@ -187,7 +189,7 @@
+ 		sigma_xy=2*viscosity*epsilon[2];
+ 
+ 		/*Get normal vector to the bed */
+-		NormalBase(&base_normal[0],xyz_list);
++		NormalBase(&base_normal[0],xyz_list_base);
+ 
+ 		/*Compute sigma_nn*/
+ 		sigma_nn=sigma_xx*base_normal[0]*base_normal[0] + sigma_xy*base_normal[0]*base_normal[1] + sigma_yy*base_normal[1]*base_normal[1];
+@@ -197,6 +199,7 @@
+ 
+ 		/*Clean up and return*/
+ 		xDelete<IssmDouble>(xyz_list);
++		xDelete<IssmDouble>(xyz_list_base);
+ 		delete gauss;
+ 	}
+ }
+@@ -1664,13 +1667,11 @@
+ void Tria::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
+-	int index1,index2;
+ 	IssmDouble vector[2];
+ 	IssmDouble norm;
+ 
+-	this->EdgeOnBaseIndices(&index1,&index2);
+-	vector[0]=xyz_list[index2*3+0] - xyz_list[index1*3+0];
+-	vector[1]=xyz_list[index2*3+1] - xyz_list[index1*3+1];
++	vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
++	vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
+ 
+ 	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
+ 
+@@ -1687,8 +1688,8 @@
+ 	IssmDouble norm;
+ 
+ 	this->EdgeOnSurfaceIndices(&index1,&index2);
+-	vector[0]=xyz_list[index2*3+0] - xyz_list[index1*3+0];
+-	vector[1]=xyz_list[index2*3+1] - xyz_list[index1*3+1];
++	vector[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
++	vector[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
+ 
+ 	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17858-17859.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17858-17859.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17858-17859.diff	(revision 17986)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17858)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17859)
+@@ -1449,6 +1449,7 @@
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble* xyz_list = NULL;
++	IssmDouble* xyz_list_base = NULL;
+ 	IssmDouble  pressure,water_pressure,sigma_nn,viscosity,bed,base;
+ 	IssmDouble  bed_normal[2];
+ 	IssmDouble  epsilon[3]; /* epsilon=[exx,eyy,exy];*/
+@@ -1457,6 +1458,7 @@
+ 
+ 	/* Get node coordinates and dof list: */
+ 	GetVerticesCoordinates(&xyz_list);
++	GetVerticesCoordinatesTop(&xyz_list_base);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* pressure_input = inputs->GetInput(PressureEnum); _assert_(pressure_input);
+@@ -1483,7 +1485,7 @@
+ 			IssmDouble sigma_xy=2.*viscosity*epsilon[2];
+ 
+ 			/*Get normal vector to the bed */
+-			NormalBase(&bed_normal[0],xyz_list);
++			NormalBase(&bed_normal[0],xyz_list_base);
+ 
+ 			/*basalforce*/
+ 			sigma_nn = sigma_xx*bed_normal[0]*bed_normal[0] + sigma_yy*bed_normal[1]*bed_normal[1] + 2.*sigma_xy*bed_normal[0]*bed_normal[1];
+@@ -1517,6 +1519,7 @@
+ 	/*clean up*/
+ 	delete gauss;
+ 	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_base);
+ }
+ /*}}}*/
+ /*FUNCTION Tria::IsNodeOnShelfFromFlags {{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17859-17860.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17859-17860.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17859-17860.diff	(revision 17986)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17859)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17860)
+@@ -1680,10 +1680,11 @@
+ 
+ 	bed_normal[0]= + vector[1]/norm;
+ 	bed_normal[1]= - vector[0]/norm;
++	_assert_(bed_normal[1]<0); 
+ }
+ /*}}}*/
+ /*FUNCTION Tria::NormalTop {{{*/
+-void Tria::NormalTop(IssmDouble* bed_normal,IssmDouble* xyz_list){
++void Tria::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){
+ 
+ 	/*Build unit outward pointing vector*/
+ 	int index1,index2;
+@@ -1696,8 +1697,9 @@
+ 
+ 	norm=sqrt(vector[0]*vector[0] + vector[1]*vector[1]);
+ 
+-	bed_normal[0]= + vector[1]/norm;
+-	bed_normal[1]= - vector[0]/norm;
++	top_normal[0]= + vector[1]/norm;
++	top_normal[1]= - vector[0]/norm;
++	_assert_(top_normal[1]<0); 
+ }
+ /*}}}*/
+ /*FUNCTION Tria::VelocityInterpolation{{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17860-17861.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17860-17861.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17860-17861.diff	(revision 17986)
@@ -0,0 +1,41 @@
+Index: ../trunk-jpl/test/NightlyRun/test435.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test435.m	(revision 17860)
++++ ../trunk-jpl/test/NightlyRun/test435.m	(revision 17861)
+@@ -47,8 +47,8 @@
+ 	'Bed2','Surface2','Thickness2','Floatingice2','Vx2','Vy2','Vz2','Pressure2',...
+ 	'Bed3','Surface3','Thickness3','Floatingice3','Vx3','Vy3','Vz3','Pressure3'};
+ field_tolerances={2e-11,5e-12,2e-11,1e-11,4e-10,1e-08,6e-10,1e-13,...
+-	3e-11,3e-11,9e-10,7e-11,1e-09,1e-08,1e-09,1e-10,...
+-	1e-10,3e-11,1e-10,7e-11,1e-09,1e-08,1e-09,1e-10};
++	3e-11,3e-11,9e-10,7e-11,1e-09,5e-08,1e-09,1e-10,...
++	1e-10,3e-11,1e-10,7e-11,1e-09,5e-08,1e-09,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Base),...
+ 	(md.results.TransientSolution(1).Surface),...
+Index: ../trunk-jpl/test/NightlyRun/test322.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.m	(revision 17860)
++++ ../trunk-jpl/test/NightlyRun/test322.m	(revision 17861)
+@@ -22,7 +22,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-05,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,2e-09,2e-09,2e-09};
++field_tolerances={1e-05,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,5e-08,5e-08,5e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test322.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.py	(revision 17860)
++++ ../trunk-jpl/test/NightlyRun/test322.py	(revision 17861)
+@@ -34,7 +34,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-05,1e-08,1e-09,1e-09,2e-09,2e-09,2e-09]
++field_tolerances=[1e-05,1e-08,1e-09,1e-09,5e-08,5e-08,5e-08]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
Index: /issm/oecreview/Archive/17802-17983/ISSM-17861-17862.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17861-17862.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17861-17862.diff	(revision 17986)
@@ -0,0 +1,236 @@
+Index: ../trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.cpp	(revision 0)
++++ ../trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.cpp	(revision 17862)
+@@ -0,0 +1,15 @@
++/*!\file InputExtrudex
++ * \brief: extrude input
++ */
++
++#include "./InputExtrudex.h"
++#include "../../shared/shared.h"
++#include "../../classes/classes.h"
++#include "../../toolkits/toolkits.h"
++
++void InputExtrudex(FemModel* femmodel,int input_enum){
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		element->InputExtrude(input_enum);
++	}
++}
+Index: ../trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.h	(revision 0)
++++ ../trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.h	(revision 17862)
+@@ -0,0 +1,13 @@
++/*!\file:  InputExtrudex.h
++ * \brief header file for field extrusion
++ */ 
++
++#ifndef _INPUTEXTRUDEX_H
++#define _INPUTEXTRUDEX_H
++
++#include "../../classes/classes.h"
++
++/* local prototypes: */
++void InputExtrudex(FemModel* femmodel,int input_enum);
++
++#endif  /* _INPUTDUPLICATEX_H */
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17861)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17862)
+@@ -36,7 +36,9 @@
+ #include "./GroundinglineMigrationx/GroundinglineMigrationx.h"
+ #include "./HoleFillerx/HoleFillerx.h"
+ #include "./InputControlUpdatex/InputControlUpdatex.h"
++#include "./InputDepthAverageAtBasex/InputDepthAverageAtBasex.h"
+ #include "./InputDuplicatex/InputDuplicatex.h"
++#include "./InputExtrudex/InputExtrudex.h"
+ #include "./InputScalex/InputScalex.h"
+ #include "./InterpFromMesh2dx/InterpFromMesh2dx.h"
+ #include "./InterpFromGridToMeshx/InterpFromGridToMeshx.h"
+Index: ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.cpp	(revision 0)
++++ ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.cpp	(revision 17862)
+@@ -0,0 +1,15 @@
++/*!\file InputDepthAverageAtBasex
++ * \brief: extrude input
++ */
++
++#include "./InputDepthAverageAtBasex.h"
++#include "../../shared/shared.h"
++#include "../../classes/classes.h"
++#include "../../toolkits/toolkits.h"
++
++void InputDepthAverageAtBasex(FemModel* femmodel,int original_enum, int new_enum){
++	for(int i=0;i<femmodel->elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		element->InputDepthAverageAtBase(original_enum,new_enum);
++	}
++}
+Index: ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.h	(revision 0)
++++ ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.h	(revision 17862)
+@@ -0,0 +1,13 @@
++/*!\file:  InputDepthAverageAtBasex.h
++ * \brief header file for field extrusion
++ */ 
++
++#ifndef _INPUTDEPTHAVERAGEATBASEX_H
++#define _INPUTDEPTHAVERAGEATBASEX_H
++
++#include "../../classes/classes.h"
++
++/* local prototypes: */
++void InputDepthAverageAtBasex(FemModel* femmodel,int reinitialized_enum, int original_enum);
++
++#endif  /* _INPUTDUPLICATEX_H */
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17861)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17862)
+@@ -283,8 +283,12 @@
+ 					./modules/VertexCoordinatesx/VertexCoordinatesx.cpp\
+ 					./modules/OutputResultsx/OutputResultsx.h\
+ 					./modules/OutputResultsx/OutputResultsx.cpp\
++					./modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.h\
++					./modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.cpp\
+ 					./modules/InputDuplicatex/InputDuplicatex.h\
+ 					./modules/InputDuplicatex/InputDuplicatex.cpp\
++					./modules/InputExtrudex/InputExtrudex.h\
++					./modules/InputExtrudex/InputExtrudex.cpp\
+ 					./modules/InputScalex/InputScalex.h\
+ 					./modules/InputScalex/InputScalex.cpp\
+ 					./modules/SurfaceAreax/SurfaceAreax.h\
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17862)
+@@ -96,6 +96,7 @@
+ 		int        Sid();
+ 		void       InputChangeName(int enum_type,int enum_type_old);
+ 		void       InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code);
++		void       InputDuplicate(int original_enum,int new_enum);
+ 		void       InputUpdateFromConstant(IssmDouble constant, int name);
+ 		void       InputUpdateFromConstant(int constant, int name);
+ 		void       InputUpdateFromConstant(bool constant, int name);
+@@ -207,7 +208,7 @@
+ 		virtual void   ComputeDeviatoricStressTensor(void)=0;
+ 
+ 		virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
+-		virtual void   InputDuplicate(int original_enum,int new_enum)=0;
++		virtual void   InputExtrude(int input_enum)=0;
+ 		virtual void   InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int inputenum)=0;
+ 		virtual void   InputUpdateFromSolutionOneDof(IssmDouble* solution,int inputenum)=0;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17862)
+@@ -1032,15 +1032,6 @@
+ 	this->inputs->AddInput((Input*)newinput);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputDuplicate{{{*/
+-void  Tria::InputDuplicate(int original_enum,int new_enum){
+-
+-	/*Call inputs method*/
+-	if (IsInput(original_enum)) {
+-		inputs->DuplicateInput(original_enum,new_enum);
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION Tria::InputScale{{{*/
+ void  Tria::InputScale(int enum_type,IssmDouble scale_factor){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17862)
+@@ -87,7 +87,7 @@
+ 		void        GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void        GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type);
+-		void        InputDuplicate(int original_enum,int new_enum);
++		void        InputExtrude(int enum_type){_error_("not implemented"); /*For penta only*/};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor);
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17862)
+@@ -1357,14 +1357,6 @@
+ 	this->inputs->AddInput((Input*)depth_averaged_input);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputDuplicate{{{*/
+-void  Penta::InputDuplicate(int original_enum,int new_enum){
+-
+-	/*Call inputs method*/
+-	if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);
+-
+-}
+-/*}}}*/
+ /*FUNCTION Penta::InputExtrude {{{*/
+ void  Penta::InputExtrude(int enum_type){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17862)
+@@ -86,7 +86,6 @@
+ 		void   GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 
+ 		void   InputDepthAverageAtBase(int enum_type,int average_enum_type);
+-		void   InputDuplicate(int original_enum,int new_enum);
+ 		void   InputScale(int enum_type,IssmDouble scale_factor);
+ 		int    NumberofNodesVelocity(void);
+ 		int    NumberofNodesPressure(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17862)
+@@ -132,7 +132,7 @@
+ 
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+-		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
++		void        InputExtrude(int enum_type){_error_("not implemented"); /*For penta only*/};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17862)
+@@ -137,7 +137,7 @@
+ 
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+-		void        InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
++		void        InputExtrude(int enum_type){_error_("not implemented"); /*For penta only*/};
+ 		void        InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");};
+ 		void        MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
+ 		int         NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17861)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17862)
+@@ -657,6 +657,13 @@
+ 		_error_("Cannot add input for vector type " << vector_type << " (not supported)");
+ 	}
+ }/*}}}*/
++void  Element::InputDuplicate(int original_enum,int new_enum){/*{{{*/
++
++	/*Call inputs method*/
++	if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);
++
++}
++/*}}}*/
+ void Element::InputUpdateFromConstant(int constant, int name){/*{{{*/
+ 
+ 	/*Check that name is an element input*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17862-17863.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17862-17863.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17862-17863.diff	(revision 17986)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17862)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17863)
+@@ -165,7 +165,7 @@
+ 
+ 		/* Get node coordinates and dof list: */
+ 		GetVerticesCoordinates(&xyz_list);
+-	   GetVerticesCoordinatesTop(&xyz_list_base);
++	   GetVerticesCoordinatesBase(&xyz_list_base);
+ 
+ 		/*Retrieve all inputs we will be needing: */
+ 		this->FindParam(&domaintype,DomainTypeEnum);
+@@ -192,7 +192,7 @@
+ 		NormalBase(&base_normal[0],xyz_list_base);
+ 
+ 		/*Compute sigma_nn*/
+-		sigma_nn=sigma_xx*base_normal[0]*base_normal[0] + sigma_xy*base_normal[0]*base_normal[1] + sigma_yy*base_normal[1]*base_normal[1];
++		sigma_nn=sigma_xx*base_normal[0]*base_normal[0] + 2*sigma_xy*base_normal[0]*base_normal[1] + sigma_yy*base_normal[1]*base_normal[1];
+ 
+ 		/*Add Stress tensor components into inputs*/
+ 		this->inputs->AddInput(new TriaInput(SigmaNNEnum,&sigma_nn,P0Enum));
+@@ -1449,7 +1449,7 @@
+ 
+ 	/* Get node coordinates and dof list: */
+ 	GetVerticesCoordinates(&xyz_list);
+-	GetVerticesCoordinatesTop(&xyz_list_base);
++	GetVerticesCoordinatesBase(&xyz_list_base);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+ 	Input* pressure_input = inputs->GetInput(PressureEnum); _assert_(pressure_input);
+@@ -1690,7 +1690,7 @@
+ 
+ 	top_normal[0]= + vector[1]/norm;
+ 	top_normal[1]= - vector[0]/norm;
+-	_assert_(top_normal[1]<0); 
++	_assert_(top_normal[1]>0); 
+ }
+ /*}}}*/
+ /*FUNCTION Tria::VelocityInterpolation{{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17863-17864.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17863-17864.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17863-17864.diff	(revision 17986)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/materials/paterson.py
+===================================================================
+--- ../trunk-jpl/src/m/materials/paterson.py	(revision 17863)
++++ ../trunk-jpl/src/m/materials/paterson.py	(revision 17864)
+@@ -15,9 +15,12 @@
+ 		raise RuntimeError("input temperature should be in Kelvin (positive)")
+ 
+ 	if numpy.ndim(temperature)==2:
+-		T = temperature.reshape(-1,)-273.15
++		#T = temperature.reshape(-1,)-273.15
++		T = temperature.flatten()-273.15
++	elif isinstance(temperature,float) or isinstance(temperature,int):
++		T = numpy.array([temperature])-273.15
+ 	else:
+-		T = numpy.array([temperature])-273.15
++		T = temperature-273.15
+ 
+ 	#The routine below is equivalent to:
+ 
+@@ -70,7 +73,7 @@
+ 	#Now make sure that rigidity is positive
+ 	pos=numpy.nonzero(rigidity<0)[0]
+ 	if len(pos):
+-		rigidity[pos]=1**6 
++		rigidity[pos]=1.e6 
+ 
+ 	return rigidity
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17864-17865.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17864-17865.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17864-17865.diff	(revision 17986)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17864)
++++ ../trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 17865)
+@@ -1424,7 +1424,7 @@
+ 			(*pl2 )[i]=l2p [iord-1][i];
+ 			(*pl3 )[i]=l3p [iord-1][i];
+ 			(*pl4 )[i]=l4p [iord-1][i];
+-			(*pwgt)[i]=wgtp[iord-1][i]*2./3.*SQRT2;
++			(*pwgt)[i]=wgtp[iord-1][i];
+ 		}
+ 	}
+ 	else {
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17864)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17865)
+@@ -32,10 +32,24 @@
+ /*}}}*/
+ /*FUNCTION GaussTetra::GaussTetra(int order) {{{*/
+ GaussTetra::GaussTetra(int order){
++
+ 	/*Get gauss points*/
+ 	GaussLegendreTetra(&numgauss,&coords1,&coords2,&coords3,&coords4,&weights,order);
+-	for(int i=0;i<numgauss;i++) this->weights[i]=this->weights[i]/6.; //FIXME: double check that
+ 
++	/*Rescale weights if necessary*/
++	IssmDouble sumweights = 0.;
++	for(int i=0;i<numgauss;i++) sumweights += this->weights[i];
++	if(sumweights==1.){
++		for(int i=0;i<numgauss;i++) this->weights[i] = this->weights[i]/6.; /*rescale volume to 1/6*/
++	}
++
++	/*Check final weights in debugging mode*/
++	#ifdef _ISSM_DEBUG_
++	sumweights = 0.; for(int i=0;i<numgauss;i++) sumweights += this->weights[i];
++	_assert_(sumweights>1./6.-1e-10);
++	_assert_(sumweights<1./6.+1e-10);
++	#endif
++
+ 	/*Initialize static fields as undefinite*/
+ 	weight=UNDEF;
+ 	coord1=UNDEF;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17865-17866.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17865-17866.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17865-17866.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17865)
++++ ../trunk-jpl/src/c/classes/gauss/GaussTetra.cpp	(revision 17866)
+@@ -84,8 +84,6 @@
+ 	else{
+ 		_error_(index1 <<" "<<index2 <<" "<<index3 <<" Not supported yet");
+ 	}
+-
+-	for(int i=0;i<numgauss;i++) this->weights[i]=this->weights[i]*0.5/1.732050807568877; //FIXME: double check that
+ }
+ /*}}}*/
+ /*FUNCTION GaussTetra::~GaussTetra(){{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17866-17867.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17866-17867.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17866-17867.diff	(revision 17986)
@@ -0,0 +1,48 @@
+Index: ../trunk-jpl/src/m/interp/holefiller.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/holefiller.py	(revision 17866)
++++ ../trunk-jpl/src/m/interp/holefiller.py	(revision 17867)
+@@ -1,11 +1,12 @@
+ import numpy as npy
+ from scipy.spatial import cKDTree
+ 
+-def nearestneighbors(md,data,goodids,badids,knn):
++def nearestneighbors(x,y,data,goodids,badids,knn):
+ 	'''
+ 	fill holes using nearest neigbors.  Arguments include:
+ 
+-	md:		the model
++
++	x,y:		the coordinates of data to be filled 
+ 	data:		the data field to be filled (full field, including holes)
+ 	goodids:	id's into the vertices that have good data
+ 	badids:	id's into the vertices with missing/bad data
+@@ -14,22 +15,22 @@
+ 				then used to fill the hole.
+ 
+ 	Usage:
+-		filleddata=nearestneighbors(md,goodids,badids,knn)
++		filleddata=nearestneighbors(x,y,data,goodids,badids,knn)
+ 
+ 	Example:
+-		filledthickness=nearestneighbors(md,goodids,badids,5)
++		filledthickness=nearestneighbors(x,y,data,goodids,badids,5)
+ 	'''
+ 
+ 	if type(knn) != int or knn<1:
+ 		raise TypeError('nearestneighbors error: knn should be an integer>1')
+ 
+-	if len(data) != md.mesh.numberofvertices:
+-		raise StandardError('nearestneighbors error: "data" should have length md.mesh.numberofvertices')
++	if len(x) != len(data) or len(y) != len(data):
++		raise StandardError('nearestneighbors error: x and y should have the same length as "data"')
+ 
+ 	filled=data
+ 	
+-	XYGood=npy.dstack([md.mesh.x[goodids],md.mesh.y[goodids]])[0]
+-	XYBad=npy.dstack([md.mesh.x[badids],md.mesh.y[badids]])[0]
++	XYGood=npy.dstack([x[goodids],y[goodids]])[0]
++	XYBad=npy.dstack([x[badids],y[badids]])[0]
+ 	tree=cKDTree(XYGood)
+ 	nearest=tree.query(XYBad,k=knn)[1]
+ 	
Index: /issm/oecreview/Archive/17802-17983/ISSM-17867-17868.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17867-17868.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17867-17868.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/parameterization/setmask.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17867)
++++ ../trunk-jpl/src/m/parameterization/setmask.py	(revision 17868)
+@@ -54,11 +54,11 @@
+ 	#}}}
+ 
+ 	#level sets
+-	md.mask.groundedice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
++	md.mask.groundedice_levelset = -1.*numpy.ones(md.mesh.numberofvertices)
+ 	md.mask.groundedice_levelset[md.mesh.elements[numpy.nonzero(elementongroundedice),:]-1]=1.
+ 
+ 	if(len(args)):
+-		md.mask.ice_levelset = 1.*numpy.ones((md.mesh.numberofvertices,1))
++		md.mask.ice_levelset = 1.*numpy.ones(md.mesh.numberofvertices)
+ 		icedomainfile = options.getfieldvalue('icedomain','none')
+ 		if not os.path.exists(icedomainfile):
+ 			raise IOError("setmask error message: ice domain file '%s' not found." % icedomainfile)
+@@ -66,6 +66,6 @@
+ 		[vertexinsideicedomain,elementinsideicedomain]=ContourToMesh(elements,x,y,icedomainfile,'node',1)
+ 		md.mask.ice_levelset[numpy.nonzero(vertexinsideicedomain)[0]] = -1.
+ 	else:
+-		md.mask.ice_levelset = -1.*numpy.ones((md.mesh.numberofvertices,1))
++		md.mask.ice_levelset = -1.*numpy.ones(md.mesh.numberofvertices)
+ 
+ 	return md
Index: /issm/oecreview/Archive/17802-17983/ISSM-17868-17869.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17868-17869.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17868-17869.diff	(revision 17986)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17868)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17869)
+@@ -232,6 +232,7 @@
+ 			else:
+ 				cb.set_label(options.getfieldvalue('colorbartitle'),fontsize=fontsize)
+ 		cb.ax.tick_params(labelsize=fontsize)
++		plt.sca(ax) # return to original axes control
+ 	#}}}
+ 
+ 	#area
Index: /issm/oecreview/Archive/17802-17983/ISSM-17869-17870.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17869-17870.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17869-17870.diff	(revision 17986)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17869)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17870)
+@@ -41,9 +41,9 @@
+ 	if not numpy.size(pos):
+ 		print "SetMarineIceSheetBC warning: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually."
+ 
+-	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+ 	md.stressbalance.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6))
+ 	md.stressbalance.loadingforce=0*numpy.ones((md.mesh.numberofvertices,3))
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17870-17871.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17870-17871.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17870-17871.diff	(revision 17986)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17870)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17871)
+@@ -27,8 +27,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	5e-08,5e-08,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,\
+-	1e-07,1e-07,5e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06]
++	5e-07,5e-07,1e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,\
++	1e-07,1e-07,5e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17870)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17871)
+@@ -14,8 +14,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	5e-08,5e-08,1e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06,...
+-	1e-07,1e-07,5e-05,5e-08,1e-08,1e-08,1e-08,1e-08,2e-08,2e-06};
++	5e-07,5e-07,1e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,...
++	1e-07,1e-07,5e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17871-17872.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17871-17872.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17871-17872.diff	(revision 17986)
@@ -0,0 +1,63 @@
+Index: ../trunk-jpl/externalpackages/m1qn3/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/m1qn3/install.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/m1qn3/install.sh	(revision 17872)
+@@ -0,0 +1,18 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup 
++rm -rf install src m1qn3-3.3-distrib
++mkdir install
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/m1qn3-3.3-distrib.tgz' 'm1qn3-3.3-distrib.tgz'
++
++#Untar 
++tar -xzf m1qn3-3.3-distrib.tgz
++mv m1qn3-3.3-distrib src
++
++#Compile m1qn3
++cd src/src/
++cp ../../Makefile .
++make
+
+Property changes on: ../trunk-jpl/externalpackages/m1qn3/install.sh
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
+Index: ../trunk-jpl/externalpackages/m1qn3/Makefile
+===================================================================
+--- ../trunk-jpl/externalpackages/m1qn3/Makefile	(revision 0)
++++ ../trunk-jpl/externalpackages/m1qn3/Makefile	(revision 17872)
+@@ -0,0 +1,21 @@
++#Makefile for m1qn3 library. 
++
++#preliminary: 
++LIB_EXT=a
++FC=gfortran
++
++install: libm1qn3.$(LIB_EXT)
++	cp libm1qn3.$(LIB_EXT) ../../install/
++
++
++OBJECTS= m1qn3.o
++
++libm1qn3.$(LIB_EXT): $(OBJECTS)
++	ar -r libm1qn3.$(LIB_EXT) $(OBJECTS) 
++	ranlib libm1qn3.$(LIB_EXT) 
++
++%.o: %.f
++	$(FC) $(FFLAGS) -c $< -o $@
++
++clean: 
++	rm -rf *.o *.$(LIB_EXT)
+
+Property changes on: ../trunk-jpl/externalpackages/m1qn3/Makefile
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
Index: /issm/oecreview/Archive/17802-17983/ISSM-17872-17873.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17872-17873.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17872-17873.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/parameterization/setflowequation.py
+===================================================================
+--- ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17872)
++++ ../trunk-jpl/src/m/parameterization/setflowequation.py	(revision 17873)
+@@ -88,7 +88,7 @@
+ 		fullspcnodes=numpy.logical_or(numpy.logical_not(numpy.isnan(md.stressbalance.spcvx)).astype(int)+ \
+ 		                              numpy.logical_not(numpy.isnan(md.stressbalance.spcvy)).astype(int)+ \
+ 		                              numpy.logical_not(numpy.isnan(md.stressbalance.spcvz)).astype(int)==3, \
+-		                              numpy.logical_and(nodeonHO,nodeonFS).reshape(-1,1)).astype(int)    #find all the nodes on the boundary of the domain without icefront
++		                              numpy.logical_and(nodeonHO,nodeonFS)).astype(int)    #find all the nodes on the boundary of the domain without icefront
+ #		fullspcelems=double(sum(fullspcnodes(md.mesh.elements),2)==6);         %find all the nodes on the boundary of the domain without icefront
+ 		fullspcelems=(numpy.sum(fullspcnodes[md.mesh.elements-1],axis=1)==6).astype(int)    #find all the nodes on the boundary of the domain without icefront
+ 		FSflag[numpy.nonzero(fullspcelems.reshape(-1))]=False
Index: /issm/oecreview/Archive/17802-17983/ISSM-17873-17874.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17873-17874.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17873-17874.diff	(revision 17986)
@@ -0,0 +1,854 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17874)
+@@ -241,6 +241,7 @@
+ 
+ 		virtual int    VelocityInterpolation()=0;
+ 		virtual int    PressureInterpolation()=0;
++		virtual int    TensorInterpolation()=0;
+ 		virtual bool   IsZeroLevelset(int levelset_enum)=0;
+ 		virtual bool   IsIcefront(void)=0;
+ 		virtual bool   IsFaceOnBoundary(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17874)
+@@ -1596,7 +1596,7 @@
+ void Tria::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+-	this->GetNodalFunctionsDerivativesVelocity(dbasis,xyz_list,(GaussTria*)gauss);
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -1604,7 +1604,7 @@
+ void Tria::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+-	this->GetNodalFunctionsVelocity(basis,(GaussTria*)gauss);
++	this->GetNodalFunctions(basis,(GaussTria*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -1612,7 +1612,7 @@
+ void Tria::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+-	this->GetNodalFunctionsPressure(basis,(GaussTria*)gauss);
++	this->GetNodalFunctions(basis,(GaussTria*)gauss,this->PressureInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -1620,7 +1620,7 @@
+ void Tria::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+-	this->GetNodalFunctionsTensor(basis,(GaussTria*)gauss);
++	this->GetNodalFunctions(basis,(GaussTria*)gauss,this->TensorInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -1703,6 +1703,11 @@
+ 	return TriaRef::PressureInterpolation();
+ }
+ /*}}}*/
++/*FUNCTION Tria::TensorInterpolation{{{*/
++int Tria::TensorInterpolation(void){
++	return TriaRef::TensorInterpolation();
++}
++/*}}}*/
+ /*FUNCTION Tria::NumberofNodesPressure{{{*/
+ int Tria::NumberofNodesPressure(void){
+ 	return TriaRef::NumberofNodesPressure();
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17874)
+@@ -28,16 +28,11 @@
+ 		void GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,Gauss* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,Gauss* gauss,int finiteelement);
+-		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
+-		void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
+-		void GetNodalFunctionsTensor(IssmDouble* basis, Gauss* gauss);
+ 		void GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss, int index1,int index2);
+ 		void GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2);
+ 		void GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement);
+-		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement);
+ 		void GetInputValue(IssmDouble* pp, IssmDouble* plist, Gauss* gauss);
+@@ -51,5 +46,6 @@
+ 		int  NumberofNodesPressure(void);
+ 		int  VelocityInterpolation(void);
+ 		int  PressureInterpolation(void);
++		int  TensorInterpolation(void);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17874)
+@@ -99,6 +99,7 @@
+ 		Element*    SpawnTopElement(void);
+ 		int         VelocityInterpolation();
+ 		int         PressureInterpolation();
++		int         TensorInterpolation();
+ 		IssmDouble  SurfaceArea(void);
+ 		void        Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finitelement);
+ 		IssmDouble  TimeAdapt();
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17874)
+@@ -327,56 +327,28 @@
+ 			basis[11]=-(27.)/(16.)*gauss->coord3*(zeta-1)*(zeta+1./3.)*(zeta+1.);
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsVelocity{{{*/
+-void PentaRef::GetNodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	int save = this->element_type;
+-	this->element_type = VelocityInterpolation();
+-	this->GetNodalFunctions(basis,gauss);
+-	this->element_type = save;
+-
++/*FUNCTION PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){{{*/
++void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
++	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsPressure{{{*/
+-void PentaRef::GetNodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++/*FUNCTION PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){{{*/
++void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){
+ 
+-	int save = this->element_type;
+-	this->element_type = PressureInterpolation();
+-	this->GetNodalFunctions(basis,gauss);
+-	this->element_type = save;
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsTensor{{{*/
+-void PentaRef::GetNodalFunctionsTensor(IssmDouble* basis,Gauss* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	int save = this->element_type;
+-	this->element_type = TensorInterpolation();
+-	this->GetNodalFunctions(basis,gauss);
+-	this->element_type = save;
+-
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivatives{{{*/
+-void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+-
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+ 	IssmDouble    Jinv[3][3];
+ 
+ 	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
++	int numnodes = this->NumberofNodes(finiteelement);
+ 
+ 	/*Get nodal functions derivatives in reference triangle*/
+ 	IssmDouble* dbasis_ref=xNew<IssmDouble>(3*numnodes);
+-	GetNodalFunctionsDerivativesReference(dbasis_ref,gauss); 
++	GetNodalFunctionsDerivativesReference(dbasis_ref,gauss,finiteelement);
+ 
+ 	/*Get Jacobian invert: */
+ 	GetJacobianInvert(&Jinv[0][0], xyz_list, gauss);
+@@ -396,31 +368,16 @@
+ 
+ 	/*Clean up*/
+ 	xDelete<IssmDouble>(dbasis_ref);
+-
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivativesVelocity{{{*/
+-void PentaRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+-
+-	int save = this->element_type;
+-	this->element_type = VelocityInterpolation();
+-	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-	this->element_type = save;
+-
++/*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){{{*/
++void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){
++	GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivativesPressure{{{*/
+-void PentaRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
++/*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){{{*/
++void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){
+ 
+-	int save = this->element_type;
+-	this->element_type = PressureInterpolation();
+-	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-	this->element_type = save;
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference{{{*/
+-void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){
+-
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -433,7 +390,7 @@
+ 	/*Get current coordinates in reference element*/
+ 	IssmDouble zeta=gauss->coord4;
+ 
+-	switch(this->element_type){
++	switch(finiteelement){
+ 		case P0Enum: 
+ 			/*Zero derivative*/
+ 			dbasis[NUMNODESP0*0+0]   = 0.;
+@@ -836,7 +793,7 @@
+ 			dbasis[NUMNODESP1xP3*2+11] = -gauss->coord3 *(27./16.)*( 2.* zeta *( zeta + (1./3.)) + ( zeta - 1. )*( zeta + 1. ));
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ 
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17874)
+@@ -466,9 +466,10 @@
+ /*}}}*/
+ /*FUNCTION Penta::Delta18oParameterization{{{*/
+ void  Penta::Delta18oParameterization(void){
+-        /*Are we on the base? If not, return*/
+-        if(!IsOnBase()) return;
+ 
++	/*Are we on the base? If not, return*/
++	if(!IsOnBase()) return;
++
+ 	int        i;
+ 	IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
+ 	IssmDouble TemperaturesPresentday[NUMVERTICES][12],TemperaturesLgm[NUMVERTICES][12];
+@@ -1849,7 +1850,7 @@
+ void Penta::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+-	this->GetNodalFunctionsDerivativesVelocity(dbasis,xyz_list,(GaussPenta*)gauss);
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -1857,7 +1858,7 @@
+ void Penta::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+-	this->GetNodalFunctionsVelocity(basis,(GaussPenta*)gauss);
++	this->GetNodalFunctions(basis,(GaussPenta*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -1865,7 +1866,7 @@
+ void Penta::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+-	this->GetNodalFunctionsPressure(basis,(GaussPenta*)gauss);
++	this->GetNodalFunctions(basis,(GaussPenta*)gauss,this->PressureInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -1873,7 +1874,7 @@
+ void Penta::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+-	this->GetNodalFunctionsTensor(basis,(GaussPenta*)gauss);
++	this->GetNodalFunctions(basis,(GaussPenta*)gauss,this->TensorInterpolation());
+ 
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17874)
+@@ -23,13 +23,10 @@
+ 		/*Numerics*/
+ 		void GetNodalFunctions(IssmDouble* basis, Gauss* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis, Gauss* gauss,int finiteelement);
+-		void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
+-		void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
+-		void GetNodalFunctionsTensor(IssmDouble* basis, Gauss* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
+-		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss);
++		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss,int finiteelement);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss);
++		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement);
+ 		void GetNodalFunctionsP1(IssmDouble* l1l6, Gauss* gauss);
+ 		void GetNodalFunctionsMINI(IssmDouble* l1l7, Gauss* gauss);
+ 		void GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17874)
+@@ -90,7 +90,7 @@
+ 
+ 	_assert_(basis);
+ 
+-	switch(element_type){
++	switch(finiteelement){
+ 		case P0Enum:
+ 			basis[0]=1.;
+ 			return;
+@@ -104,7 +104,7 @@
+ 			basis[2]=(1.-gauss->coord1)*(1.+gauss->coord1);
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ }
+ /*}}}*/
+@@ -178,7 +178,7 @@
+ 			dbasis[2] = -2.*gauss->coord1;
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ 
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17874)
+@@ -97,95 +97,10 @@
+ 			basis[9]=4.*gauss->coord1*gauss->coord4;
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsVelocity{{{*/
+-void TetraRef::GetNodalFunctionsVelocity(IssmDouble* basis,GaussTetra* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P2Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsPressure{{{*/
+-void TetraRef::GetNodalFunctionsPressure(IssmDouble* basis,GaussTetra* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsTensor{{{*/
+-void TetraRef::GetNodalFunctionsTensor(IssmDouble* basis,GaussTetra* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	switch(this->element_type){
+-		case XTaylorHoodEnum:
+-			this->element_type = P1DGEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = XTaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){{{*/
+ void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+@@ -225,72 +140,6 @@
+ 	xDelete<IssmDouble>(dbasis_ref);
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsDerivativesPressure         (THIS ONE and following ones){{{*/
+-void TetraRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsDerivativesVelocity{{{*/
+-void TetraRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P2Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){{{*/
+ void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+@@ -394,7 +243,7 @@
+ 			dbasis[NUMNODESP2*2+9] = 4.*(gauss->coord1-gauss->coord4);
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ 
+ }
+@@ -628,5 +477,14 @@
+ 	}
+ 
+ 	return -1;
++}/*}}}*/
++/*FUNCTION TetraRef::TensorInterpolation{{{*/
++int TetraRef::TensorInterpolation(void){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	switch(this->element_type){
++		case XTaylorHoodEnum: return P1DGEnum;
++		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17874)
+@@ -91,6 +91,7 @@
+ 		int    NumberofNodesPressure(void);
+ 		int    VelocityInterpolation();
+ 		int    PressureInterpolation();
++		int    TensorInterpolation(){_error_("not implemented yet");};
+ 		bool   IsZeroLevelset(int levelset_enum);
+ 		bool   IsIcefront(void);
+ 		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17874)
+@@ -589,7 +589,7 @@
+ void Tetra::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+-	this->GetNodalFunctionsVelocity(basis,(GaussTetra*)gauss);
++	this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -597,7 +597,7 @@
+ void Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+-	this->GetNodalFunctionsPressure(basis,(GaussTetra*)gauss);
++	this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->PressureInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -605,7 +605,7 @@
+ void Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+-	this->GetNodalFunctionsTensor(basis,(GaussTetra*)gauss);
++	this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->TensorInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -621,7 +621,7 @@
+ void Tetra::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+-	this->GetNodalFunctionsDerivativesVelocity(dbasis,xyz_list,(GaussTetra*)gauss);
++	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+@@ -991,6 +991,11 @@
+ 	return TetraRef::PressureInterpolation();
+ }
+ /*}}}*/
++/*FUNCTION Tetra::TensorInterpolation{{{*/
++int Tetra::TensorInterpolation(void){
++	return TetraRef::TensorInterpolation();
++}
++/*}}}*/
+ /*FUNCTION Tetra::ZeroLevelsetCoordinates{{{*/
+ void Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
+ 	/*Compute portion of the element that is grounded*/ 
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17874)
+@@ -28,13 +28,8 @@
+ 		void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss);
+ 		void GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement);
+-		void GetNodalFunctionsVelocity(IssmDouble* basis, GaussTetra* gauss);
+-		void GetNodalFunctionsPressure(IssmDouble* basis, GaussTetra* gauss);
+-		void GetNodalFunctionsTensor(IssmDouble* basis, GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement);
+-		void GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,GaussTetra* gauss);
+-		void GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement);
+ 		void GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss);
+@@ -47,5 +42,6 @@
+ 		int  NumberofNodesPressure(void);
+ 		int  VelocityInterpolation(void);
+ 		int  PressureInterpolation(void);
++		int  TensorInterpolation(void);
+ };
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17874)
+@@ -104,6 +104,7 @@
+ 		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
+ 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void){_error_("not implemented yet");};
++		int         TensorInterpolation(void){_error_("not implemented yet");};
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17874)
+@@ -109,6 +109,7 @@
+ 		void        ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){_error_("not implemented yet");};
+ 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
+ 		int         VelocityInterpolation(void);
++		int         TensorInterpolation(void);
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17873)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17874)
+@@ -211,105 +211,10 @@
+ 			basis[5]=4.*gauss->coord1*gauss->coord2;
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsVelocity{{{*/
+-void TriaRef::GetNodalFunctionsVelocity(IssmDouble* basis,Gauss* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P2Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		case XTaylorHoodEnum:
+-			this->element_type = P2Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = XTaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsPressure{{{*/
+-void TriaRef::GetNodalFunctionsPressure(IssmDouble* basis,Gauss* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		case XTaylorHoodEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = XTaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsTensor{{{*/
+-void TriaRef::GetNodalFunctionsTensor(IssmDouble* basis,Gauss* gauss){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	switch(this->element_type){
+-		case XTaylorHoodEnum:
+-			this->element_type = P1DGEnum;
+-			this->GetNodalFunctions(basis,gauss);
+-			this->element_type = XTaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION TriaRef::GetSegmentNodalFunctions{{{*/
+ void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss,int index1,int index2){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+@@ -388,73 +293,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivativesPressure{{{*/
+-void TriaRef::GetNodalFunctionsDerivativesPressure(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = TaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivativesVelocity{{{*/
+-void TriaRef::GetNodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
+-	switch(this->element_type){
+-		case P1P1Enum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1Enum;
+-			return;
+-		case P1P1GLSEnum:
+-			this->element_type = P1Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = P1P1GLSEnum;
+-			return;
+-		case MINIcondensedEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIcondensedEnum;
+-			return;
+-		case MINIEnum:
+-			this->element_type = P1bubbleEnum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = MINIEnum;
+-			return;
+-		case TaylorHoodEnum:
+-		case XTaylorHoodEnum:
+-			this->element_type = P2Enum;
+-			this->GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-			this->element_type = XTaylorHoodEnum;
+-			return;
+-		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-}
+-/*}}}*/
+ /*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){{{*/
+ void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+@@ -527,7 +365,7 @@
+ 			dbasis[NUMNODESP2*1+5] = -2.*SQRT3/3.*(gauss->coord1+gauss->coord2);
+ 			return;
+ 		default:
+-			_error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++			_error_("Element type "<<EnumToStringx(finiteelement)<<" not supported yet");
+ 	}
+ 
+ }
+@@ -684,6 +522,16 @@
+ 	return -1;
+ }
+ /*}}}*/
++/*FUNCTION TriaRef::TensorInterpolation{{{*/
++int TriaRef::TensorInterpolation(void){
++	/*This routine returns the values of the nodal functions  at the gaussian point.*/
++
++	switch(this->element_type){
++		case XTaylorHoodEnum: return P1DGEnum;
++		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
++	}
++}
++/*}}}*/
+ /*FUNCTION TriaRef::NodeOnEdgeIndices{{{*/
+ void TriaRef::NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement){
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17874-17875.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17874-17875.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17874-17875.diff	(revision 17986)
@@ -0,0 +1,223 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17875)
+@@ -1710,12 +1710,12 @@
+ /*}}}*/
+ /*FUNCTION Tria::NumberofNodesPressure{{{*/
+ int Tria::NumberofNodesPressure(void){
+-	return TriaRef::NumberofNodesPressure();
++	return TriaRef::NumberofNodes(this->PressureInterpolation());
+ }
+ /*}}}*/
+ /*FUNCTION Tria::NumberofNodesVelocity{{{*/
+ int Tria::NumberofNodesVelocity(void){
+-	return TriaRef::NumberofNodesVelocity();
++	return TriaRef::NumberofNodes(this->VelocityInterpolation());
+ }
+ /*}}}*/
+ /*FUNCTION Tria::PositiveDegreeDay{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.h	(revision 17875)
+@@ -42,8 +42,6 @@
+ 		void NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement);
+ 		int  NumberofNodes(void);
+ 		int  NumberofNodes(int finiteelement);
+-		int  NumberofNodesVelocity(void);
+-		int  NumberofNodesPressure(void);
+ 		int  VelocityInterpolation(void);
+ 		int  PressureInterpolation(void);
+ 		int  TensorInterpolation(void);
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17875)
+@@ -1095,38 +1095,6 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::NumberofNodesPressure{{{*/
+-int PentaRef::NumberofNodesPressure(void){
+-
+-	switch(this->element_type){
+-		case P1P1Enum:          return NUMNODESP1;
+-		case P1P1GLSEnum:       return NUMNODESP1;
+-		case MINIcondensedEnum: return NUMNODESP1;
+-		case MINIEnum:          return NUMNODESP1;
+-		case TaylorHoodEnum:    return NUMNODESP1;
+-		case OneLayerP4zEnum:   return NUMNODESP1;
+-		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-
+-	return -1;
+-}
+-/*}}}*/
+-/*FUNCTION PentaRef::NumberofNodesVelocity{{{*/
+-int PentaRef::NumberofNodesVelocity(void){
+-
+-	switch(this->element_type){
+-		case P1P1Enum:          return NUMNODESP1;
+-		case P1P1GLSEnum:       return NUMNODESP1;
+-		case MINIcondensedEnum: return NUMNODESP1b;
+-		case MINIEnum:          return NUMNODESP1b;
+-		case TaylorHoodEnum:    return NUMNODESP2;
+-		case OneLayerP4zEnum:   return NUMNODESP2xP4;
+-		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-
+-	return -1;
+-}
+-/*}}}*/
+ /*FUNCTION PentaRef::VelocityInterpolation{{{*/
+ int PentaRef::VelocityInterpolation(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17875)
+@@ -1926,12 +1926,12 @@
+ /*}}}*/
+ /*FUNCTION Penta::NumberofNodesPressure{{{*/
+ int Penta::NumberofNodesPressure(void){
+-	return PentaRef::NumberofNodesPressure();
++	return PentaRef::NumberofNodes(this->PressureInterpolation());
+ }
+ /*}}}*/
+ /*FUNCTION Penta::NumberofNodesVelocity{{{*/
+ int Penta::NumberofNodesVelocity(void){
+-	return PentaRef::NumberofNodesVelocity();
++	return PentaRef::NumberofNodes(this->VelocityInterpolation());
+ }
+ /*}}}*/
+ /*FUNCTION Penta::PositiveDegreeDay{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17875)
+@@ -48,8 +48,6 @@
+ 		void SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement);
+ 		int  NumberofNodes(void);
+ 		int  NumberofNodes(int finiteelement);
+-		int  NumberofNodesVelocity(void);
+-		int  NumberofNodesPressure(void);
+ 		int  VelocityInterpolation(void);
+ 		int  PressureInterpolation(void);
+ 		int  TensorInterpolation(void);
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17875)
+@@ -419,36 +419,6 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::NumberofNodesPressure{{{*/
+-int TetraRef::NumberofNodesPressure(void){
+-
+-	switch(this->element_type){
+-		case P1P1Enum:          return NUMNODESP1;
+-		case P1P1GLSEnum:       return NUMNODESP1;
+-		case MINIcondensedEnum: return NUMNODESP1;
+-		case MINIEnum:          return NUMNODESP1;
+-		case TaylorHoodEnum:    return NUMNODESP1;
+-		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-
+-	return -1;
+-}
+-/*}}}*/
+-/*FUNCTION TetraRef::NumberofNodesVelocity{{{*/
+-int TetraRef::NumberofNodesVelocity(void){
+-
+-	switch(this->element_type){
+-		case P1P1Enum:          return NUMNODESP1;
+-		case P1P1GLSEnum:       return NUMNODESP1;
+-		case MINIcondensedEnum: return NUMNODESP1b;
+-		case MINIEnum:          return NUMNODESP1b;
+-		case TaylorHoodEnum:    return NUMNODESP2;
+-		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-
+-	return -1;
+-}
+-/*}}}*/
+ /*FUNCTION TetraRef::VelocityInterpolation{{{*/
+ int TetraRef::VelocityInterpolation(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17875)
+@@ -693,12 +693,12 @@
+ /*}}}*/
+ /*FUNCTION Tetra::NumberofNodesPressure{{{*/
+ int Tetra::NumberofNodesPressure(void){
+-	return TetraRef::NumberofNodesPressure();
++	return TetraRef::NumberofNodes(this->PressureInterpolation());
+ }
+ /*}}}*/
+ /*FUNCTION Tetra::NumberofNodesVelocity{{{*/
+ int Tetra::NumberofNodesVelocity(void){
+-	return TetraRef::NumberofNodesVelocity();
++	return TetraRef::NumberofNodes(this->VelocityInterpolation());
+ }
+ /*}}}*/
+ /*FUNCTION Tetra::ReduceMatrices{{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17875)
+@@ -38,8 +38,6 @@
+ 
+ 		int  NumberofNodes(void);
+ 		int  NumberofNodes(int finiteelement);
+-		int  NumberofNodesVelocity(void);
+-		int  NumberofNodesPressure(void);
+ 		int  VelocityInterpolation(void);
+ 		int  PressureInterpolation(void);
+ 		int  TensorInterpolation(void);
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17874)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17875)
+@@ -458,38 +458,6 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::NumberofNodesPressure{{{*/
+-int TriaRef::NumberofNodesPressure(void){
+-
+-	switch(this->element_type){
+-		case P1P1Enum:          return NUMNODESP1;
+-		case P1P1GLSEnum:       return NUMNODESP1;
+-		case MINIcondensedEnum: return NUMNODESP1;
+-		case MINIEnum:          return NUMNODESP1;
+-		case TaylorHoodEnum:    return NUMNODESP1;
+-		case XTaylorHoodEnum:   return NUMNODESP1;
+-		default: _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-
+-	return -1;
+-}
+-/*}}}*/
+-/*FUNCTION TriaRef::NumberofNodesVelocity{{{*/
+-int TriaRef::NumberofNodesVelocity(void){
+-
+-	switch(this->element_type){
+-		case P1P1Enum:          return NUMNODESP1;
+-		case P1P1GLSEnum:       return NUMNODESP1;
+-		case MINIcondensedEnum: return NUMNODESP1b;
+-		case MINIEnum:          return NUMNODESP1b;
+-		case TaylorHoodEnum:    return NUMNODESP2;
+-		case XTaylorHoodEnum:   return NUMNODESP2;
+-		default:       _error_("Element type "<<EnumToStringx(this->element_type)<<" not supported yet");
+-	}
+-
+-	return -1;
+-}
+-/*}}}*/
+ /*FUNCTION TriaRef::VelocityInterpolation{{{*/
+ int TriaRef::VelocityInterpolation(void){
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17875-17876.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17875-17876.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17875-17876.diff	(revision 17986)
@@ -0,0 +1,77 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17875)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17876)
+@@ -14,9 +14,9 @@
+ 
+ 	#node on Dirichlet
+ 	pos=numpy.nonzero(md.mesh.vertexonboundary)
+-	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.stressbalance.spcvx=float('nan')*numpy.ones(md.mesh.numberofvertices))
++	md.stressbalance.spcvy=float('nan')*numpy.ones(md.mesh.numberofvertices))
++	md.stressbalance.spcvz=float('nan')*numpy.ones(md.mesh.numberofvertices))
+ 	md.stressbalance.spcvx[pos]=0
+ 	md.stressbalance.spcvy[pos]=0
+ 	md.stressbalance.spcvz[pos]=0
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17875)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py	(revision 17876)
+@@ -32,9 +32,9 @@
+ 
+ #	pos=find(md.mesh.vertexonboundary & ~nodeonicefront);
+ 	pos=numpy.nonzero(numpy.logical_and(md.mesh.vertexonboundary,numpy.logical_not(nodeonicefront)))[0]
+-	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
+-	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,1))
++	md.stressbalance.spcvx=float('nan')*numpy.ones(md.mesh.numberofvertices)
++	md.stressbalance.spcvy=float('nan')*numpy.ones(md.mesh.numberofvertices)
++	md.stressbalance.spcvz=float('nan')*numpy.ones(md.mesh.numberofvertices)
+ 	md.stressbalance.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6))
+ 	md.stressbalance.loadingforce=0*numpy.ones((md.mesh.numberofvertices,3))
+ 
+@@ -58,9 +58,9 @@
+ 		pos=md.mesh.segments[segments,0:-1]-1
+ 	else:
+ 		pos=numpy.nonzero(md.mesh.vertexonboundary)[0]
+-	md.stressbalance.spcvx[pos[:]]=0
+-	md.stressbalance.spcvy[pos[:]]=0
+-	md.stressbalance.spcvz[pos[:]]=0
++	md.stressbalance.spcvx[pos]=0
++	md.stressbalance.spcvy[pos]=0
++	md.stressbalance.spcvz[pos]=0
+ 																													   
+ 	#Dirichlet Values
+ 	if isinstance(md.inversion.vx_obs,numpy.ndarray) and numpy.size(md.inversion.vx_obs,axis=0)==md.mesh.numberofvertices and isinstance(md.inversion.vy_obs,numpy.ndarray) and numpy.size(md.inversion.vy_obs,axis=0)==md.mesh.numberofvertices:
+Index: ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17875)
++++ ../trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py	(revision 17876)
+@@ -41,9 +41,9 @@
+ 	if not numpy.size(pos):
+ 		print "SetMarineIceSheetBC warning: ice front all around the glacier, no dirichlet found. Dirichlet must be added manually."
+ 
+-	md.stressbalance.spcvx=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+-	md.stressbalance.spcvy=float('nan')*numpy.ones((md.mesh.numberofvertices,))
+-	md.stressbalance.spcvz=float('nan')*numpy.ones((md.mesh.numberofvertices,))
++	md.stressbalance.spcvx=float('nan')*numpy.ones(md.mesh.numberofvertices)
++	md.stressbalance.spcvy=float('nan')*numpy.ones(md.mesh.numberofvertices)
++	md.stressbalance.spcvz=float('nan')*numpy.ones(md.mesh.numberofvertices)
+ 	md.stressbalance.referential=float('nan')*numpy.ones((md.mesh.numberofvertices,6))
+ 	md.stressbalance.loadingforce=0*numpy.ones((md.mesh.numberofvertices,3))
+ 
+@@ -67,9 +67,9 @@
+ 		pos=md.mesh.segments[segments,0:-1]-1
+ 	else:
+ 		pos=numpy.nonzero(md.mesh.vertexonboundary)[0]
+-	md.stressbalance.spcvx[pos[:]]=0
+-	md.stressbalance.spcvy[pos[:]]=0
+-	md.stressbalance.spcvz[pos[:]]=0
++	md.stressbalance.spcvx[pos]=0
++	md.stressbalance.spcvy[pos]=0
++	md.stressbalance.spcvz[pos]=0
+ 
+ 	#Dirichlet Values
+ 	if isinstance(md.inversion.vx_obs,numpy.ndarray) and numpy.size(md.inversion.vx_obs,axis=0)==md.mesh.numberofvertices and isinstance(md.inversion.vy_obs,numpy.ndarray) and numpy.size(md.inversion.vy_obs,axis=0)==md.mesh.numberofvertices:
Index: /issm/oecreview/Archive/17802-17983/ISSM-17876-17877.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17876-17877.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17876-17877.diff	(revision 17986)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py
+===================================================================
+--- ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17876)
++++ ../trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py	(revision 17877)
+@@ -14,9 +14,9 @@
+ 
+ 	#node on Dirichlet
+ 	pos=numpy.nonzero(md.mesh.vertexonboundary)
+-	md.stressbalance.spcvx=float('nan')*numpy.ones(md.mesh.numberofvertices))
+-	md.stressbalance.spcvy=float('nan')*numpy.ones(md.mesh.numberofvertices))
+-	md.stressbalance.spcvz=float('nan')*numpy.ones(md.mesh.numberofvertices))
++	md.stressbalance.spcvx=float('nan')*numpy.ones(md.mesh.numberofvertices)
++	md.stressbalance.spcvy=float('nan')*numpy.ones(md.mesh.numberofvertices)
++	md.stressbalance.spcvz=float('nan')*numpy.ones(md.mesh.numberofvertices)
+ 	md.stressbalance.spcvx[pos]=0
+ 	md.stressbalance.spcvy[pos]=0
+ 	md.stressbalance.spcvz[pos]=0
Index: /issm/oecreview/Archive/17802-17983/ISSM-17877-17878.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17877-17878.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17877-17878.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/test/NightlyRun/test271.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test271.py	(revision 17877)
++++ ../trunk-jpl/test/NightlyRun/test271.py	(revision 17878)
+@@ -21,7 +21,7 @@
+ md.damage.law='pralong'
+ md.damage.stabilization=1;
+ 
+-pos=numpy.nonzero(numpy.logical_and(md.mask.ice_levelset[:,0]!=0,md.mesh.vertexonboundary==1))
++pos=numpy.nonzero(numpy.logical_and(md.mask.ice_levelset!=0,md.mesh.vertexonboundary==1))
+ md.damage.spcdamage[pos]=0.5;
+ 
+ md.damage.requested_outputs=['default','DamageF']
Index: /issm/oecreview/Archive/17802-17983/ISSM-17878-17879.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17878-17879.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17878-17879.diff	(revision 17986)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17878)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17879)
+@@ -267,22 +267,22 @@
+ 					if len(fieldsize):
+ 						#size = number of nodes * n
+ 						if   fieldsize[0]==numberofvertices1:
+-							setattr(getattr(md2,fieldi),fieldj,field[pos_node,:])
++							setattr(getattr(md2,fieldi),fieldj,field[pos_node])
+ 						elif fieldsize[0]==numberofvertices1+1:
+-							setattr(getattr(md2,fieldi),fieldj,numpy.vstack((field[pos_node,:],field[-1,:])))
++							setattr(getattr(md2,fieldi),fieldj,numpy.vstack((field[pos_node],field[-1,:])))
+ 						#size = number of elements * n
+ 						elif fieldsize[0]==numberofelements1:
+-							setattr(getattr(md2,fieldi),fieldj,field[pos_elem,:])
++							setattr(getattr(md2,fieldi),fieldj,field[pos_elem])
+ 			else:
+ 				if len(fieldsize):
+ 					#size = number of nodes * n
+ 					if   fieldsize[0]==numberofvertices1:
+-						setattr(md2,fieldi,field[pos_node,:])
++						setattr(md2,fieldi,field[pos_node])
+ 					elif fieldsize[0]==numberofvertices1+1:
+-						setattr(md2,fieldi,numpy.hstack((field[pos_node,:],field[-1,:])))
++						setattr(md2,fieldi,numpy.hstack((field[pos_node],field[-1,:])))
+ 					#size = number of elements * n
+ 					elif fieldsize[0]==numberofelements1:
+-						setattr(md2,fieldi,field[pos_elem,:])
++						setattr(md2,fieldi,field[pos_elem])
+ 
+ 		#modify some specific fields
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17879-17880.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17879-17880.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17879-17880.diff	(revision 17986)
@@ -0,0 +1,53 @@
+Index: ../trunk-jpl/src/m/plot/plot_manager.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17879)
++++ ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17880)
+@@ -56,6 +56,8 @@
+ 		# convert string to lower case for a case-insensitive comparison
+ 		if data.lower()=='mesh': 
+ 			plot_mesh(md,options,ax)
++			applyoptions(md,[],options,fig,ax)
++			fig.delaxes(fig.axes[1]) # hack to remove colorbar after the fact
+ 			return
+ 		elif data.lower()=='none':
+ 			print 'no data provided to plot (TODO: write plot_none.py)'
+Index: ../trunk-jpl/src/m/plot/plot_mesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 17879)
++++ ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 17880)
+@@ -6,7 +6,7 @@
+ from processmesh import processmesh
+ from applyoptions import applyoptions
+ 
+-def plot_mesh(md,options,nlines,ncols,i):
++def plot_mesh(md,options,ax):
+ 	'''
+ 	PLOT_MESH - plot model mesh
+ 
+@@ -19,12 +19,10 @@
+ 	x,y,z,elements,is2d,isplanet=processmesh(md,[],options)
+ 
+ 	if is2d:
+-		p.subplot(nlines,ncols,i,aspect='equal')
+-		p.triplot(x,y,elements)
++		ax.triplot(x,y,elements)
+ 	else:
+ 		print 'WARNING: only 2D mesh plot is currently implemented'
+ 	
+ 	#apply options
+ 	options.addfielddefault('title','Mesh')
+ 	options.addfielddefault('colorbar','off')
+-	applyoptions(md,[],options)
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17879)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17880)
+@@ -58,7 +58,7 @@
+ 		titlefont=font.copy()
+ 		titlefont['size']=titlefontsize
+ 		titlefont['weight']=titlefontweight
+-		fig.set_title(title,**titlefont)
++		ax.set_title(title,**titlefont)
+ 	#}}}
+ 		
+ 	#xlabel, ylabel, zlabel {{{
Index: /issm/oecreview/Archive/17802-17983/ISSM-17880-17881.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17880-17881.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17880-17881.diff	(revision 17986)
@@ -0,0 +1,120 @@
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17880)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.py	(revision 17881)
+@@ -13,11 +13,6 @@
+ 
+ 	def __init__(self): # {{{
+ 		self.spcwatercolumn = float('NaN')
+-		self.n              = 0
+-		self.CR             = 0
+-		self.p              = 0
+-		self.q              = 0
+-		self.kn             = 0
+ 		self.stabilization  = 0
+ 
+ 		#set defaults
+@@ -28,23 +23,11 @@
+ 		
+ 		string='   hydrologyshreve solution parameters:'
+ 		string="%s\n%s"%(string,fielddisplay(self,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]'))
+-		string="%s\n%s"%(string,fielddisplay(self,'n','Manning roughness coefficient'))
+-		string="%s\n%s"%(string,fielddisplay(self,'CR','tortuosity parameter'))
+-		string="%s\n%s"%(string,fielddisplay(self,'p','dimensionless exponent in Manning velocity formula'))
+-		string="%s\n%s"%(string,fielddisplay(self,'q','dimensionless exponent in Manning velocity formula'))
+-		string="%s\n%s"%(string,fielddisplay(self,'kn','parameter in effective pressure formula'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.'))
+ 		return string
+ 		#}}}
+ 	def setdefaultparameters(self): # {{{
+ 		
+-		#Parameters from Johnson's 2002 thesis, section 3.5.4			 
+-		self.n=.02			
+-		self.CR=.01
+-		self.p=2
+-		self.q=1
+-		self.kn=0
+-
+ 		#Type of stabilization to use 0:nothing 1:artificial_diffusivity
+ 		self.stabilization=1
+ 
+@@ -64,10 +47,5 @@
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'enum',HydrologyModelEnum(),'data',HydrologyshreveEnum(),'format','Integer');
+ 		WriteData(fid,'object',self,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1)
+-		WriteData(fid,'object',self,'fieldname','n','format','Double')
+-		WriteData(fid,'object',self,'fieldname','CR','format','Double')
+-		WriteData(fid,'object',self,'fieldname','p','format','Double')
+-		WriteData(fid,'object',self,'fieldname','q','format','Double')
+-		WriteData(fid,'object',self,'fieldname','kn','format','Double')
+ 		WriteData(fid,'object',self,'fieldname','stabilization','format','Double')
+ 	# }}}
+Index: ../trunk-jpl/src/m/classes/hydrologyshreve.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/hydrologyshreve.m	(revision 17880)
++++ ../trunk-jpl/src/m/classes/hydrologyshreve.m	(revision 17881)
+@@ -6,11 +6,6 @@
+ classdef hydrologyshreve
+ 	properties (SetAccess=public) 
+ 		spcwatercolumn = NaN;
+-		n              = 0;
+-		CR             = 0;
+-		p              = 0;
+-		q              = 0;
+-		kn             = 0;
+ 		stabilization  = 0;
+ 	end
+ 	methods
+@@ -22,11 +17,6 @@
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Hydrologyshreve solution parameters">','<section name="hydrologyshreve" />');                    
+             
+ 			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcwatercolumn" type="',      class(obj.spcwatercolumn),'" default="',        convert2str(obj.spcwatercolumn),'">',	'     <section name="hydrologyshreve" />','     <help> water thickness constraints (NaN means no constraint) [m] </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="n" type="',          class(obj.n),'" default="',            convert2str(obj.n),'">',     '     <section name="hydrologyshreve" />','     <help> Manning roughness coefficient </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="CR" type="',        class(obj.CR),'" default="',          convert2str(obj.CR),'">',	'     <section name="hydrologyshreve" />','     <help> tortuosity parameter </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="p" type="',          class(obj.p),'" default="',            convert2str(obj.p),'">',	'     <section name="hydrologyshreve" />','     <help> dimensionless exponent in Manning velocity formula </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="q" type="',  	class(obj.q),'" default="',       convert2str(obj.q),'">',     '     <section name="hydrologyshreve" />','     <help> dimensionless exponent in Manning velocity formula </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="kn" type="',         class(obj.kn),'" default="',           convert2str(obj.kn),'">',	'     <section name="hydrologyshreve" />','     <help> parameter in effective pressure formula </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="stabilization" type="',         class(obj.stabilization),'" default="',           convert2str(obj.stabilization),'">',	'     <section name="hydrologyshreve" />','     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>','</parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');
+         end % }}}
+@@ -42,13 +32,6 @@
+ 		end % }}}
+ 		function obj = setdefaultparameters(obj) % {{{
+ 
+-			%Parameters from Johnson's 2002 thesis, section 3.5.4			 
+-			obj.n  = .02;
+-			obj.CR = .01;
+-			obj.p  = 2;
+-			obj.q  = 1;
+-			obj.kn = 0;
+-
+ 			%Type of stabilization to use 0:nothing 1:artificial_diffusivity
+ 			obj.stabilization=1;
+ 		end % }}}
+@@ -64,25 +47,15 @@
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   hydrologyshreve solution parameters:'));
+-
+ 			fielddisplay(obj,'spcwatercolumn','water thickness constraints (NaN means no constraint) [m]');
+-			fielddisplay(obj,'n','Manning roughness coefficient');
+-			fielddisplay(obj,'CR','tortuosity parameter');
+-			fielddisplay(obj,'p','dimensionless exponent in Manning velocity formula');
+-			fielddisplay(obj,'q','dimensionless exponent in Manning velocity formula');
+-			fielddisplay(obj,'kn','parameter in effective pressure formula');
+ 			fielddisplay(obj,'stabilization','artificial diffusivity (default is 1). can be more than 1 to increase diffusivity.');
+ 
+ 		end % }}}
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',HydrologyModelEnum(),'data',HydrologyshreveEnum(),'format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','spcwatercolumn','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+-			WriteData(fid,'object',obj,'fieldname','n','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','CR','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','p','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','q','format','Double');
+-			WriteData(fid,'object',obj,'fieldname','kn','format','Double');
+ 			WriteData(fid,'object',obj,'fieldname','stabilization','format','Double');
+ 		end % }}}
+ 	end
+ end
++
Index: /issm/oecreview/Archive/17802-17983/ISSM-17881-17882.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17881-17882.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17881-17882.diff	(revision 17986)
@@ -0,0 +1,84 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17881)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17882)
+@@ -330,8 +330,6 @@
+ 	IssmDouble  rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
+ 	IssmDouble  g         = element->GetMaterialParameter(ConstantsGEnum);
+-	IssmDouble  CR        = element->GetMaterialParameter(HydrologyshreveCREnum);
+-	IssmDouble  n_man     = element->GetMaterialParameter(HydrologyshreveNEnum);
+ 	IssmDouble  mu_water  = element->GetMaterialParameter(MaterialsMuWaterEnum);
+ 	Input* surfaceslopex_input = element->GetInput(SurfaceSlopeXEnum); _assert_(surfaceslopex_input);
+ 	Input* surfaceslopey_input = element->GetInput(SurfaceSlopeYEnum); _assert_(surfaceslopey_input);
+@@ -339,9 +337,6 @@
+ 	Input* bedslopey_input     = element->GetInput(BedSlopeYEnum);     _assert_(bedslopey_input);
+ 	Input* watercolumn_input   = element->GetInput(WatercolumnEnum);   _assert_(watercolumn_input);
+ 
+-	/* compute VelocityFactor */
+-	IssmDouble VelocityFactor = n_man*CR*CR*rho_water*g/mu_water;
+-
+ 	/*Fetch number of vertices and allocate output*/
+ 	int numvertices = element->GetNumberOfVertices();
+ 	IssmDouble* vx  = xNew<IssmDouble>(numvertices);
+@@ -357,10 +352,8 @@
+ 		watercolumn_input->GetInputValue(&w,gauss);
+ 
+ 		/* Water velocity x and y components */
+-	//	vx[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdx+(rho_water-rho_ice)*g*dbdx);
+-	//	vy[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdy+(rho_water-rho_ice)*g*dbdy);
+-		vx[iv]= - w*w/(VelocityFactor* mu_water)*(rho_ice*g*dsdx+(rho_water-rho_ice)*g*dbdx);
+-		vy[iv]= - w*w/(VelocityFactor* mu_water)*(rho_ice*g*dsdy+(rho_water-rho_ice)*g*dbdy);
++		vx[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdx+(rho_water-rho_ice)*g*dbdx);
++		vy[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdy+(rho_water-rho_ice)*g*dbdy);
+ 	}
+ 
+ 	/*clean-up*/
+@@ -372,3 +365,26 @@
+ 	xDelete<IssmDouble>(vx);
+ 	xDelete<IssmDouble>(vy);
+ }/*}}}*/
++
++
++
++/*Needed changes to switch to the Johnson formulation*//*{{{*/
++/*All the changes are to be done in the velocity computation.
++	The new velocity needs some new parameter that should be introduce in the hydrologyshreve class:
++	'p' and 'q' which are the exponent of the Manning formula for laminar (p=2,q=1) or turbulent (p=2/3,q=1/2) flow
++	'R' the hydraulic radius
++	'n' the manning roughness coeficient
++
++	With these, the velocity reads ;
++
++	v= - (1/n)* pow(R,p)*pow((grad phi(rho_water*g)),q)
++
++	you should also redefine the water pressure potential 'phi' with respect to the effective pressure deffinition given in Johson:
++	phi=(rho_ice*g*( surface + ((rho_water/rho_ice)-1)*base - k_n*((thickness* grad(base))/omega) )
++
++	where 
++	'omega' is the fractional area of the base occupied by the water film
++	'k_n' is a parameter
++	This last equation derives from the effective pressure definition developped in Alley 1989
++*/
++/*}}}*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17881)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17882)
+@@ -59,15 +59,7 @@
+ 		default:
+ 			_error_("Surface mass balance model "<<EnumToStringx(smb_model)<<" not supported yet");
+ 	}
+-
+-	if(hydrology_model==HydrologyshreveEnum){
+-		iomodel->Constant(&this->hydro_CR,HydrologyshreveCREnum);
+-		iomodel->Constant(&this->hydro_kn,HydrologyshreveKnEnum);
+-		iomodel->Constant(&this->hydro_n,HydrologyshreveNEnum);
+-		iomodel->Constant(&this->hydro_p,HydrologyshrevePEnum);
+-		iomodel->Constant(&this->hydro_q,HydrologyshreveQEnum);
+-	}
+-	else if(hydrology_model==HydrologydcEnum){
++	if(hydrology_model==HydrologydcEnum){
+ 		iomodel->Constant(&this->sediment_compressibility,HydrologydcSedimentCompressibilityEnum);
+ 		iomodel->Constant(&this->sediment_porosity,HydrologydcSedimentPorosityEnum);
+ 		iomodel->Constant(&this->sediment_thickness,HydrologydcSedimentThicknessEnum);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17882-17883.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17882-17883.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17882-17883.diff	(revision 17986)
@@ -0,0 +1,249 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17882)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17883)
+@@ -86,11 +86,6 @@
+ 	GeometryHydrostaticRatioEnum,
+ 	HydrologyModelEnum,
+ 	HydrologyshreveEnum,
+-	HydrologyshreveCREnum,
+-	HydrologyshreveKnEnum,
+-	HydrologyshreveNEnum,
+-	HydrologyshrevePEnum,
+-	HydrologyshreveQEnum,
+ 	HydrologyshreveSpcwatercolumnEnum,
+ 	HydrologyshreveStabilizationEnum,
+ 	HydrologydcEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17882)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17883)
+@@ -94,11 +94,6 @@
+ 		case GeometryHydrostaticRatioEnum : return "GeometryHydrostaticRatio";
+ 		case HydrologyModelEnum : return "HydrologyModel";
+ 		case HydrologyshreveEnum : return "Hydrologyshreve";
+-		case HydrologyshreveCREnum : return "HydrologyshreveCR";
+-		case HydrologyshreveKnEnum : return "HydrologyshreveKn";
+-		case HydrologyshreveNEnum : return "HydrologyshreveN";
+-		case HydrologyshrevePEnum : return "HydrologyshreveP";
+-		case HydrologyshreveQEnum : return "HydrologyshreveQ";
+ 		case HydrologyshreveSpcwatercolumnEnum : return "HydrologyshreveSpcwatercolumn";
+ 		case HydrologyshreveStabilizationEnum : return "HydrologyshreveStabilization";
+ 		case HydrologydcEnum : return "Hydrologydc";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17882)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17883)
+@@ -94,11 +94,6 @@
+ 	      else if (strcmp(name,"GeometryHydrostaticRatio")==0) return GeometryHydrostaticRatioEnum;
+ 	      else if (strcmp(name,"HydrologyModel")==0) return HydrologyModelEnum;
+ 	      else if (strcmp(name,"Hydrologyshreve")==0) return HydrologyshreveEnum;
+-	      else if (strcmp(name,"HydrologyshreveCR")==0) return HydrologyshreveCREnum;
+-	      else if (strcmp(name,"HydrologyshreveKn")==0) return HydrologyshreveKnEnum;
+-	      else if (strcmp(name,"HydrologyshreveN")==0) return HydrologyshreveNEnum;
+-	      else if (strcmp(name,"HydrologyshreveP")==0) return HydrologyshrevePEnum;
+-	      else if (strcmp(name,"HydrologyshreveQ")==0) return HydrologyshreveQEnum;
+ 	      else if (strcmp(name,"HydrologyshreveSpcwatercolumn")==0) return HydrologyshreveSpcwatercolumnEnum;
+ 	      else if (strcmp(name,"HydrologyshreveStabilization")==0) return HydrologyshreveStabilizationEnum;
+ 	      else if (strcmp(name,"Hydrologydc")==0) return HydrologydcEnum;
+@@ -136,15 +131,15 @@
+ 	      else if (strcmp(name,"HydrologydcPenaltyFactor")==0) return HydrologydcPenaltyFactorEnum;
+ 	      else if (strcmp(name,"HydrologydcPenaltyLock")==0) return HydrologydcPenaltyLockEnum;
+ 	      else if (strcmp(name,"HydrologydcBasalMoulinInput")==0) return HydrologydcBasalMoulinInputEnum;
+-         else stage=2;
+-   }
+-   if(stage==2){
+-	      if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
++	      else if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
+ 	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+ 	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+ 	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+ 	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+-	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
++         else stage=2;
++   }
++   if(stage==2){
++	      if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
+ 	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
+@@ -259,15 +254,15 @@
+ 	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
+ 	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+-         else stage=3;
+-   }
+-   if(stage==3){
+-	      if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
++	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+-	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
++         else stage=3;
++   }
++   if(stage==3){
++	      if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+@@ -382,15 +377,15 @@
+ 	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+ 	      else if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
+-         else stage=4;
+-   }
+-   if(stage==4){
+-	      if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
++	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
+ 	      else if (strcmp(name,"LsfReinitializationAnalysis")==0) return LsfReinitializationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+-	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
++         else stage=4;
++   }
++   if(stage==4){
++	      if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+ 	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+ 	      else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
+ 	      else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
+@@ -505,15 +500,15 @@
+ 	      else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
+ 	      else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
+ 	      else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
+-         else stage=5;
+-   }
+-   if(stage==5){
+-	      if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
++	      else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceArea")==0) return SurfaceAreaEnum;
+ 	      else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
+-	      else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
++         else stage=5;
++   }
++   if(stage==5){
++	      if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
+ 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
+@@ -628,15 +623,15 @@
+ 	      else if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
+ 	      else if (strcmp(name,"MinVz")==0) return MinVzEnum;
+ 	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+-         else stage=6;
+-   }
+-   if(stage==6){
+-	      if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
++	      else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
+ 	      else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
+ 	      else if (strcmp(name,"IceVolumeAboveFloatation")==0) return IceVolumeAboveFloatationEnum;
+ 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+-	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
++         else stage=6;
++   }
++   if(stage==6){
++	      if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+Index: ../trunk-jpl/src/m/enum/HydrologyshrevePEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologyshrevePEnum.m	(revision 17882)
++++ ../trunk-jpl/src/m/enum/HydrologyshrevePEnum.m	(revision 17883)
+@@ -1,11 +0,0 @@
+-function macro=HydrologyshrevePEnum()
+-%HYDROLOGYSHREVEPENUM - Enum of HydrologyshreveP
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=HydrologyshrevePEnum()
+-
+-macro=StringToEnum('HydrologyshreveP');
+Index: ../trunk-jpl/src/m/enum/HydrologyshreveQEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologyshreveQEnum.m	(revision 17882)
++++ ../trunk-jpl/src/m/enum/HydrologyshreveQEnum.m	(revision 17883)
+@@ -1,11 +0,0 @@
+-function macro=HydrologyshreveQEnum()
+-%HYDROLOGYSHREVEQENUM - Enum of HydrologyshreveQ
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=HydrologyshreveQEnum()
+-
+-macro=StringToEnum('HydrologyshreveQ');
+Index: ../trunk-jpl/src/m/enum/HydrologyshreveCREnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologyshreveCREnum.m	(revision 17882)
++++ ../trunk-jpl/src/m/enum/HydrologyshreveCREnum.m	(revision 17883)
+@@ -1,11 +0,0 @@
+-function macro=HydrologyshreveCREnum()
+-%HYDROLOGYSHREVECRENUM - Enum of HydrologyshreveCR
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=HydrologyshreveCREnum()
+-
+-macro=StringToEnum('HydrologyshreveCR');
+Index: ../trunk-jpl/src/m/enum/HydrologyshreveKnEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologyshreveKnEnum.m	(revision 17882)
++++ ../trunk-jpl/src/m/enum/HydrologyshreveKnEnum.m	(revision 17883)
+@@ -1,11 +0,0 @@
+-function macro=HydrologyshreveKnEnum()
+-%HYDROLOGYSHREVEKNENUM - Enum of HydrologyshreveKn
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=HydrologyshreveKnEnum()
+-
+-macro=StringToEnum('HydrologyshreveKn');
+Index: ../trunk-jpl/src/m/enum/HydrologyshreveNEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/HydrologyshreveNEnum.m	(revision 17882)
++++ ../trunk-jpl/src/m/enum/HydrologyshreveNEnum.m	(revision 17883)
+@@ -1,11 +0,0 @@
+-function macro=HydrologyshreveNEnum()
+-%HYDROLOGYSHREVENENUM - Enum of HydrologyshreveN
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=HydrologyshreveNEnum()
+-
+-macro=StringToEnum('HydrologyshreveN');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17882)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17883)
+@@ -86,11 +86,6 @@
+ def GeometryHydrostaticRatioEnum(): return StringToEnum("GeometryHydrostaticRatio")[0]
+ def HydrologyModelEnum(): return StringToEnum("HydrologyModel")[0]
+ def HydrologyshreveEnum(): return StringToEnum("Hydrologyshreve")[0]
+-def HydrologyshreveCREnum(): return StringToEnum("HydrologyshreveCR")[0]
+-def HydrologyshreveKnEnum(): return StringToEnum("HydrologyshreveKn")[0]
+-def HydrologyshreveNEnum(): return StringToEnum("HydrologyshreveN")[0]
+-def HydrologyshrevePEnum(): return StringToEnum("HydrologyshreveP")[0]
+-def HydrologyshreveQEnum(): return StringToEnum("HydrologyshreveQ")[0]
+ def HydrologyshreveSpcwatercolumnEnum(): return StringToEnum("HydrologyshreveSpcwatercolumn")[0]
+ def HydrologyshreveStabilizationEnum(): return StringToEnum("HydrologyshreveStabilization")[0]
+ def HydrologydcEnum(): return StringToEnum("Hydrologydc")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17883-17884.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17883-17884.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17883-17884.diff	(revision 17986)
@@ -0,0 +1,166 @@
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17883)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17884)
+@@ -74,6 +74,9 @@
+ 				iomodel->Constant(&this->epl_conductivity,HydrologydcEplConductivityEnum);
+ 		}
+ 	}
++	else if(hydrology_model==HydrologyshreveEnum){
++		/*Nothing to add*/
++	}
+ 	else{
+ 		_error_("Hydrology model "<<EnumToStringx(hydrology_model)<<" not supported yet");
+ 	}
+@@ -257,11 +260,6 @@
+ 		case HydrologydcEplInitialThicknessEnum:     return this->epl_init_thickness;
+ 		case HydrologydcEplMaxThicknessEnum:         return this->epl_max_thickness;
+ 		case HydrologydcWaterCompressibilityEnum:    return this->water_compressibility;
+-		case HydrologyshreveCREnum:                  return this->hydro_CR;
+-		case HydrologyshreveKnEnum:                  return this->hydro_kn;
+-		case HydrologyshreveNEnum:                   return this->hydro_n;
+-		case HydrologyshrevePEnum:                   return this->hydro_p;
+-		case HydrologyshreveQEnum:                   return this->hydro_q;
+ 		case ConstantsGEnum:                         return this->g;
+ 		default: _error_("Enum "<<EnumToStringx(enum_in)<<" not supported yet");
+ 	}
+@@ -349,31 +347,6 @@
+ 	return thermal_exchange_velocity;
+ }
+ /*}}}*/
+-/*FUNCTION Matpar::GetHydrologyKn {{{*/
+-IssmDouble Matpar::GetHydrologyKn(){
+-	return hydro_kn;		 
+-}		 
+-/*}}}*/			 
+-/*FUNCTION Matpar::GetHydrologyP {{{*/			 
+-IssmDouble Matpar::GetHydrologyP(){		 
+-	return hydro_p;			 
+-}		 
+-/*}}}*/			 
+-/*FUNCTION Matqar::GetHydrologyQ {{{*/			 
+-IssmDouble Matpar::GetHydrologyQ(){		 
+-	return hydro_q;			 
+-}		 
+-/*}}}*/			 
+-/*FUNCTION Matpar::GetHydrologyCR {{{*/		 
+-IssmDouble Matpar::GetHydrologyCR(){		 
+-	return hydro_CR;		 
+-}		 
+-/*}}}*/			 
+-/*FUNCTION Matpar::GetHydrologyN {{{*/			 
+-IssmDouble Matpar::GetHydrologyN(){		 
+-	return hydro_n;			 
+-}		 
+-/*}}}*/ 
+ /*FUNCTION Matpar::GetSedimentStoring {{{*/
+ IssmDouble Matpar::GetSedimentStoring(){
+ 	return this->rho_freshwater * this->g * this->sediment_porosity * this->sediment_thickness *
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17883)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17884)
+@@ -32,13 +32,6 @@
+ 		IssmDouble  desfac;
+ 		IssmDouble  s0p;
+ 
+-		/*hydrology Shreve: */	 
+-		IssmDouble  hydro_kn;			 
+-		IssmDouble  hydro_p;		 
+-		IssmDouble  hydro_q;		 
+-		IssmDouble  hydro_CR;			 
+-		IssmDouble  hydro_n; 
+-
+ 		/*hydrology Dual Porous Continuum: */	 
+ 		IssmDouble  sediment_compressibility;
+ 		IssmDouble  sediment_porosity;	 
+@@ -112,11 +105,6 @@
+ 		IssmDouble GetBeta();
+ 		IssmDouble GetMeltingPoint();
+ 		IssmDouble GetReferenceTemperature();
+-		IssmDouble GetHydrologyKn();
+-		IssmDouble GetHydrologyP();
+-		IssmDouble GetHydrologyQ();
+-		IssmDouble GetHydrologyCR();
+-		IssmDouble GetHydrologyN();
+ 		IssmDouble GetSedimentStoring();
+ 		IssmDouble GetEplSpecificStoring();
+ 		IssmDouble GetSedimentThickness();
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17883)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17884)
+@@ -4243,60 +4243,6 @@
+ 	((ControlInput*)input)->SetInput(new_input);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CreateHydrologyWaterVelocityInput {{{*/
+-void Tria::CreateHydrologyWaterVelocityInput(void){
+-
+-	/*material parameters: */
+-	IssmDouble mu_water;
+-	IssmDouble VelocityFactor;  // This factor represents the number 12 in laminar flow velocity which can vary by differnt hydrology.CR
+-	IssmDouble n_man,CR;
+-	IssmDouble w;
+-	IssmDouble rho_ice, rho_water, g;
+-	IssmDouble dsdx,dsdy,dbdx,dbdy;
+-	IssmDouble vx[NUMVERTICES];
+-	IssmDouble vy[NUMVERTICES];
+-	GaussTria *gauss = NULL;
+-
+-	/*Retrieve all inputs and parameters*/
+-	rho_ice=matpar->GetRhoIce();
+-	rho_water=matpar->GetRhoWater();
+-	g=matpar->GetG();
+-	CR=matpar->GetHydrologyCR(); // To have Lebrocq equavalent equation: CR=0.01,n_man=0.02
+-	n_man=matpar->GetHydrologyN(); 
+-	mu_water=matpar->GetMuWater();
+-	Input* surfaceslopex_input=inputs->GetInput(SurfaceSlopeXEnum); _assert_(surfaceslopex_input);
+-	Input* surfaceslopey_input=inputs->GetInput(SurfaceSlopeYEnum); _assert_(surfaceslopey_input);
+-	Input* bedslopex_input=inputs->GetInput(BedSlopeXEnum);         _assert_(bedslopex_input);
+-	Input* bedslopey_input=inputs->GetInput(BedSlopeYEnum);         _assert_(bedslopey_input);
+-	Input* watercolumn_input=inputs->GetInput(WatercolumnEnum);     _assert_(watercolumn_input);
+-
+-	/* compute VelocityFactor */
+-	VelocityFactor= n_man*CR*CR*rho_water*g/mu_water;
+-
+-	gauss=new GaussTria();
+-	for(int iv=0;iv<NUMVERTICES;iv++){
+-		gauss->GaussVertex(iv);
+-		surfaceslopex_input->GetInputValue(&dsdx,gauss);
+-		surfaceslopey_input->GetInputValue(&dsdy,gauss);
+-		bedslopex_input->GetInputValue(&dbdx,gauss);
+-		bedslopey_input->GetInputValue(&dbdy,gauss);
+-		watercolumn_input->GetInputValue(&w,gauss);
+-
+-		/* Water velocity x and y components */
+-	//	vx[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdx+(rho_water-rho_ice)*g*dbdx);
+-	//	vy[iv]= - w*w/(12 * mu_water)*(rho_ice*g*dsdy+(rho_water-rho_ice)*g*dbdy);
+-		vx[iv]= - w*w/(VelocityFactor* mu_water)*(rho_ice*g*dsdx+(rho_water-rho_ice)*g*dbdx);
+-		vy[iv]= - w*w/(VelocityFactor* mu_water)*(rho_ice*g*dsdy+(rho_water-rho_ice)*g*dbdy);
+-	}
+-
+-	/*clean-up*/
+-	delete gauss;
+-
+-	/*Add to inputs*/
+-	this->inputs->AddInput(new TriaInput(HydrologyWaterVxEnum,vx,P1Enum));
+-	this->inputs->AddInput(new TriaInput(HydrologyWaterVyEnum,vy,P1Enum));
+-}
+-/*}}}*/
+ /*FUNCTION Tria::GetSolutionFromInputsOneDof{{{*/
+ void  Tria::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17883)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17884)
+@@ -225,8 +225,6 @@
+ 
+ 		void UpdateConstraintsExtrudeFromBase(void);
+ 		void UpdateConstraintsExtrudeFromTop(void);
+-
+-		void           CreateHydrologyWaterVelocityInput(void);
+ 		/*}}}*/
+ 
+ };
Index: /issm/oecreview/Archive/17802-17983/ISSM-17884-17885.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17884-17885.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17884-17885.diff	(revision 17986)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/interp/SectionValues.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.py	(revision 17884)
++++ ../trunk-jpl/src/m/interp/SectionValues.py	(revision 17885)
+@@ -102,7 +102,6 @@
+ 	
+ 		#Some useful parameters
+ 		layers=int(npy.ceil(npy.mean(md.geometry.thickness)/res_v))
+-		print 'layers=', layers
+ 		nodesperlayer=int(numberofnodes)
+ 		nodestot=int(nodesperlayer*layers)
+ 		elementsperlayer=int(nodesperlayer-1)
Index: /issm/oecreview/Archive/17802-17983/ISSM-17885-17886.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17885-17886.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17885-17886.diff	(revision 17986)
@@ -0,0 +1,667 @@
+Index: ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp	(revision 17886)
+@@ -44,9 +44,9 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+-	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ }/*}}}*/
+ void BalancethicknessAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17886)
+@@ -56,9 +56,10 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplMaxThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcEplThicknessEnum);
+-	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-	
+-	//	elements->InputDuplicate(HydrologydcEplInitialThicknessEnum,HydrologydcEplThicknessEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 
+ }/*}}}*/
+ void HydrologyDCEfficientAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp	(revision 17886)
+@@ -33,11 +33,10 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->meshelementtype==PentaEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+-	iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum,0.);
+ 	iomodel->FetchDataToInput(elements,VyEnum,0.);
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17886)
+@@ -33,8 +33,10 @@
+ 	iomodel->FetchDataToInput(elements,FrictionPEnum);
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 	iomodel->FetchDataToInput(elements,FlowequationElementEquationEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp	(revision 17886)
+@@ -35,8 +35,9 @@
+ 
+ 	iomodel->FetchDataToInput(elements,EplHeadEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ }/*}}}*/
+ void L2ProjectionEPLAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17886)
+@@ -82,15 +82,13 @@
+ 		if(isgroundingline) elements->InputDuplicate(MaskGroundediceLevelsetEnum,QmuMaskGroundediceLevelsetEnum);
+ 	}
+ 
+-	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ 
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->domaintype!=Domain2DhorizontalEnum)
+-			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+ 	switch(smb_model){
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp	(revision 17886)
+@@ -25,12 +25,9 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+-	}
+-	if(iomodel->domaintype==Domain2DverticalEnum){
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeXAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17886)
+@@ -25,12 +25,9 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+-	}
+-	if(iomodel->domaintype==Domain2DverticalEnum){
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ }/*}}}*/
+ void SmoothedSurfaceSlopeYAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17886)
+@@ -43,8 +43,10 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+Index: ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp	(revision 17886)
+@@ -32,9 +32,9 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceforcingsMassBalanceEnum);
+ 	iomodel->FetchDataToInput(elements,BalancethicknessThickeningRateEnum);
+ 
+-	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ }/*}}}*/
+ void BalancevelocityAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+Index: ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp	(revision 17886)
+@@ -25,16 +25,10 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+-	if(iomodel->domaintype==Domain3DEnum){
+-		if(iomodel->meshelementtype==PentaEnum){
+-			iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-			iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+-		}
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+-	if(iomodel->domaintype==Domain2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+-	}
+ }/*}}}*/
+ void L2ProjectionBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp	(revision 17886)
+@@ -34,11 +34,12 @@
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+-	if(iomodel->domaintype!=Domain2DhorizontalEnum) iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+-	if(iomodel->domaintype==Domain3DEnum){
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++	}
++	if(iomodel->domaindim==3){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
+ 	switch(smb_model){
+ 		case SMBEnum:
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17886)
+@@ -219,29 +219,23 @@
+ 	iomodel->FetchDataToInput(elements,LoadingforceYEnum);
+ 	if(isdamage)iomodel->FetchDataToInput(elements,DamageDEnum);
+ 
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 	if(iomodel->domaintype==Domain3DEnum){
+-		if(iomodel->meshelementtype==PentaEnum){
+-			iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-			iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+-		}
+ 		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 		iomodel->FetchDataToInput(elements,FlowequationBorderFSEnum);
+ 		iomodel->FetchDataToInput(elements,LoadingforceZEnum);
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(VzEnum,QmuVzEnum);
+ 	}
+-	if(iomodel->domaintype==Domain2DverticalEnum){
+-		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+-	}
+ 	if(isFS){
+-		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+ 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(PressureEnum,QmuPressureEnum);
+ 	}
+ 	if(islevelset){
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+-		if(iomodel->domaintype!=Domain2DhorizontalEnum)
+-			iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+ 
+ #ifdef _HAVE_ANDROID_
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17886)
+@@ -87,7 +87,10 @@
+ 	iomodel->FetchDataToInput(elements,HydrologydcBasalMoulinInputEnum);
+ 	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+ 	iomodel->FetchDataToInput(elements,HydrologydcSedimentTransmitivityEnum);
+-	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 
+ 	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveNodeEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17886)
+@@ -54,8 +54,10 @@
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 	iomodel->FetchDataToInput(elements,FlowequationElementEquationEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17886)
+@@ -58,8 +58,10 @@
+ 	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ 	iomodel->FetchDataToInput(elements,FlowequationElementEquationEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+Index: ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp	(revision 17886)
+@@ -34,11 +34,13 @@
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateCorrectionEnum,0.);
+ 	iomodel->FetchDataToInput(elements,VxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum);
+-	if(iomodel->domaintype==Domain3DEnum){
++	if(iomodel->domaindim==3){
+ 		iomodel->FetchDataToInput(elements,VzEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+ 	}
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
++	}
+ }/*}}}*/
+ void FreeSurfaceBaseAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp	(revision 17886)
+@@ -29,9 +29,9 @@
+ 			counter++;
+ 		}
+ 	}
+-	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,MeshElementonbaseEnum);
+-		iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
++	if(iomodel->domaintype!=Domain2DhorizontalEnum){
++		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ }
+ /*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17885)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17886)
+@@ -193,8 +193,6 @@
+ 	MaterialsMantleShearModulusEnum,
+ 	MaterialsMantleDensityEnum,
+ 	MeshAverageVertexConnectivityEnum,
+-	MeshElementonbaseEnum,
+-	MeshElementonsurfaceEnum,
+ 	MeshElements2dEnum,
+ 	MeshElementsEnum,
+ 	MeshLowerelementsEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17886)
+@@ -201,8 +201,6 @@
+ 		case MaterialsMantleShearModulusEnum : return "MaterialsMantleShearModulus";
+ 		case MaterialsMantleDensityEnum : return "MaterialsMantleDensity";
+ 		case MeshAverageVertexConnectivityEnum : return "MeshAverageVertexConnectivity";
+-		case MeshElementonbaseEnum : return "MeshElementonbase";
+-		case MeshElementonsurfaceEnum : return "MeshElementonsurface";
+ 		case MeshElements2dEnum : return "MeshElements2d";
+ 		case MeshElementsEnum : return "MeshElements";
+ 		case MeshLowerelementsEnum : return "MeshLowerelements";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17886)
+@@ -204,8 +204,6 @@
+ 	      else if (strcmp(name,"MaterialsMantleShearModulus")==0) return MaterialsMantleShearModulusEnum;
+ 	      else if (strcmp(name,"MaterialsMantleDensity")==0) return MaterialsMantleDensityEnum;
+ 	      else if (strcmp(name,"MeshAverageVertexConnectivity")==0) return MeshAverageVertexConnectivityEnum;
+-	      else if (strcmp(name,"MeshElementonbase")==0) return MeshElementonbaseEnum;
+-	      else if (strcmp(name,"MeshElementonsurface")==0) return MeshElementonsurfaceEnum;
+ 	      else if (strcmp(name,"MeshElements2d")==0) return MeshElements2dEnum;
+ 	      else if (strcmp(name,"MeshElements")==0) return MeshElementsEnum;
+ 	      else if (strcmp(name,"MeshLowerelements")==0) return MeshLowerelementsEnum;
+@@ -259,12 +257,12 @@
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
++	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
++	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+-	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+-	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
++	      if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+@@ -382,12 +380,12 @@
+ 	      else if (strcmp(name,"LsfReinitializationAnalysis")==0) return LsfReinitializationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
++	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
++	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+-	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+-	      else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
++	      if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
+ 	      else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
+ 	      else if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
+ 	      else if (strcmp(name,"HOApproximation")==0) return HOApproximationEnum;
+@@ -505,12 +503,12 @@
+ 	      else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
++	      else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
++	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
+-	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+-	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
++	      if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
+ 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
+ 	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
+@@ -628,12 +626,12 @@
+ 	      else if (strcmp(name,"IceVolumeAboveFloatation")==0) return IceVolumeAboveFloatationEnum;
+ 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
++	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
++	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+-	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+-	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
++	      if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+ 	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+Index: ../trunk-jpl/src/c/modules/InputExtrudex
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputExtrudex	(revision 17885)
++++ ../trunk-jpl/src/c/modules/InputExtrudex	(revision 17886)
+
+Property changes on: ../trunk-jpl/src/c/modules/InputExtrudex
+___________________________________________________________________
+Added: svn:ignore
+## -0,0 +1,2 ##
++.deps
++.dirstamp
+Index: ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex
+===================================================================
+--- ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex	(revision 17885)
++++ ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex	(revision 17886)
+
+Property changes on: ../trunk-jpl/src/c/modules/InputDepthAverageAtBasex
+___________________________________________________________________
+Added: svn:ignore
+## -0,0 +1,2 ##
++.deps
++.dirstamp
+Index: ../trunk-jpl/src/c/cores/extrudefrombase_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/extrudefrombase_core.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/cores/extrudefrombase_core.cpp	(revision 17886)
+@@ -11,11 +11,21 @@
+ 
+ void extrudefrombase_core(FemModel* femmodel){
+ 
++	/*Intermediaries*/
++	int elementtype;
++
+ 	if(VerboseSolution()) _printf0_("extruding solution from base...\n");
+ 
+-	/*Call on core computations: */
+-	femmodel->SetCurrentConfiguration(ExtrudeFromBaseAnalysisEnum);
+-	femmodel->UpdateConstraintsExtrudeFromBasex();
+-	solutionsequence_linear(femmodel);
++	 femmodel->parameters->FindParam(&elementtype,MeshElementtypeEnum);
++	 if(elementtype==PentaEnum){
++		 int inputenum; femmodel->parameters->FindParam(&inputenum,InputToExtrudeEnum);
++		 InputExtrudex(femmodel,inputenum);
++	 }
++	 else{
++		 /*Call on core computations: */
++		 femmodel->SetCurrentConfiguration(ExtrudeFromBaseAnalysisEnum);
++		 femmodel->UpdateConstraintsExtrudeFromBasex();
++		 solutionsequence_linear(femmodel);
++	 }
+ 
+ }
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17886)
+@@ -1649,17 +1649,39 @@
+ /*FUNCTION Penta::IsOnBase{{{*/
+ bool Penta::IsOnBase(void){
+ 
+-	bool onbase;
+-	inputs->GetInputValue(&onbase,MeshElementonbaseEnum);
+-	return onbase;
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonbaseEnum);
++	sum = values[0]+values[1]+values[2]+values[3]+values[4]+values[5];
++	_assert_(sum==0. || sum==3.);
++
++	if(sum==3){
++		return true;
++	}
++	else{
++		return false;
++	}
+ }
+ /*}}}*/
+ /*FUNCTION Penta::IsOnSurface{{{*/
+ bool Penta::IsOnSurface(void){
+ 
+-	bool onsurface;
+-	inputs->GetInputValue(&onsurface,MeshElementonsurfaceEnum);
+-	return onsurface;
++	IssmDouble values[NUMVERTICES];
++	IssmDouble sum;
++
++	/*Retrieve all inputs and parameters*/
++	GetInputListOnVertices(&values[0],MeshVertexonsurfaceEnum);
++	sum = values[0]+values[1]+values[2]+values[3]+values[4]+values[5];
++	_assert_(sum==0. || sum==3.);
++
++	if(sum==3){
++		return true;
++	}
++	else{
++		return false;
++	}
+ }
+ /*}}}*/
+ /*FUNCTION Penta::IsNodeOnShelfFromFlags {{{*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17885)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17886)
+@@ -667,6 +667,8 @@
+ 	bed_normal[0]=-normal[0]/normal_norm;
+ 	bed_normal[1]=-normal[1]/normal_norm;
+ 	bed_normal[2]=-normal[2]/normal_norm;
++
++	_assert_(bed_normal[2]<0.);
+ }
+ /*}}}*/
+ /*FUNCTION Tetra::NormalTop (THIS ONE){{{*/
+@@ -689,6 +691,7 @@
+ 	top_normal[0]=normal[0]/normal_norm;
+ 	top_normal[1]=normal[1]/normal_norm;
+ 	top_normal[2]=normal[2]/normal_norm;
++	_assert_(top_normal[2]>0.);
+ }
+ /*}}}*/
+ /*FUNCTION Tetra::NumberofNodesPressure{{{*/
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17885)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.py	(revision 17886)
+@@ -120,8 +120,6 @@
+ 		md = checkfield(md,'fieldname','mesh.numberofelements','>',0)
+ 		md = checkfield(md,'fieldname','mesh.numberofvertices','>',0)
+ 		#no checks for numberofedges lat long and hemisphere
+-		md = checkfield(md,'fieldname','mesh.elementonbase','size',[md.mesh.numberofelements],'values',[0,1])
+-		md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements],'values',[0,1])
+ 		md = checkfield(md,'fieldname','mesh.vertexonbase','size',[md.mesh.numberofvertices],'values',[0,1])
+ 		md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices],'values',[0,1])
+ 		md = checkfield(md,'fieldname','mesh.average_vertex_connectivity','>=',24,'message',"'mesh.average_vertex_connectivity' should be at least 24 in 3d")
+@@ -148,8 +146,6 @@
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','numberoflayers','format','Integer')
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','numberofelements','format','Integer')
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','numberofvertices','format','Integer')
+-		WriteData(fid,'object',self,'class','mesh','fieldname','elementonbase','format','BooleanMat','mattype',2)
+-		WriteData(fid,'object',self,'class','mesh','fieldname','elementonsurface','format','BooleanMat','mattype',2)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','vertexonbase','format','BooleanMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2)
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17885)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17886)
+@@ -82,8 +82,6 @@
+ 			md = checkfield(md,'fieldname','mesh.numberofelements','>',0);
+ 			md = checkfield(md,'fieldname','mesh.numberofvertices','>',0);
+ 			%no checks for numberofedges lat long and hemisphere
+-			md = checkfield(md,'fieldname','mesh.elementonbase','size',[md.mesh.numberofelements 1],'values',[0 1]);
+-			md = checkfield(md,'fieldname','mesh.elementonsurface','size',[md.mesh.numberofelements 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonbase','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.vertexonsurface','size',[md.mesh.numberofvertices 1],'values',[0 1]);
+ 			md = checkfield(md,'fieldname','mesh.z','>=',md.geometry.base-10^-10,'message','''mesh.z'' lower than bedrock');
+@@ -144,8 +142,6 @@
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberoflayers','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofelements','format','Integer');
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','numberofvertices','format','Integer');
+-			WriteData(fid,'object',obj,'class','mesh','fieldname','elementonbase','format','BooleanMat','mattype',2);
+-			WriteData(fid,'object',obj,'class','mesh','fieldname','elementonsurface','format','BooleanMat','mattype',2);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonbase','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','vertexonsurface','format','BooleanMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','mesh','fieldname','lowerelements','format','DoubleMat','mattype',2);
+Index: ../trunk-jpl/src/m/enum/MeshElementonsurfaceEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshElementonsurfaceEnum.m	(revision 17885)
++++ ../trunk-jpl/src/m/enum/MeshElementonsurfaceEnum.m	(revision 17886)
+@@ -1,11 +0,0 @@
+-function macro=MeshElementonsurfaceEnum()
+-%MESHELEMENTONSURFACEENUM - Enum of MeshElementonsurface
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MeshElementonsurfaceEnum()
+-
+-macro=StringToEnum('MeshElementonsurface');
+Index: ../trunk-jpl/src/m/enum/MeshElementonbaseEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MeshElementonbaseEnum.m	(revision 17885)
++++ ../trunk-jpl/src/m/enum/MeshElementonbaseEnum.m	(revision 17886)
+@@ -1,11 +0,0 @@
+-function macro=MeshElementonbaseEnum()
+-%MESHELEMENTONBASEENUM - Enum of MeshElementonbase
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MeshElementonbaseEnum()
+-
+-macro=StringToEnum('MeshElementonbase');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17885)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17886)
+@@ -193,8 +193,6 @@
+ def MaterialsMantleShearModulusEnum(): return StringToEnum("MaterialsMantleShearModulus")[0]
+ def MaterialsMantleDensityEnum(): return StringToEnum("MaterialsMantleDensity")[0]
+ def MeshAverageVertexConnectivityEnum(): return StringToEnum("MeshAverageVertexConnectivity")[0]
+-def MeshElementonbaseEnum(): return StringToEnum("MeshElementonbase")[0]
+-def MeshElementonsurfaceEnum(): return StringToEnum("MeshElementonsurface")[0]
+ def MeshElements2dEnum(): return StringToEnum("MeshElements2d")[0]
+ def MeshElementsEnum(): return StringToEnum("MeshElements")[0]
+ def MeshLowerelementsEnum(): return StringToEnum("MeshLowerelements")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17886-17887.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17886-17887.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17886-17887.diff	(revision 17986)
@@ -0,0 +1,167 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17886)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17887)
+@@ -347,7 +347,7 @@
+ 		if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
+ 	}
+ 	/*Add input to the element: */
+-	element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
++	element->AddInput(EplHeadEnum,eplHeads,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(eplHeads);
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17886)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17887)
+@@ -734,9 +734,9 @@
+ 	}
+ 
+ 	/*Add input to the element: */
+-	element->AddBasalInput(ThicknessEnum,newthickness,P1Enum);
+-	element->AddBasalInput(SurfaceEnum,newsurface,P1Enum);
+-	element->AddBasalInput(BaseEnum,newbed,P1Enum);
++	element->AddInput(ThicknessEnum,newthickness,P1Enum);
++	element->AddInput(SurfaceEnum,newsurface,P1Enum);
++	element->AddInput(BaseEnum,newbed,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(newthickness);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17886)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17887)
+@@ -459,9 +459,9 @@
+ 	}
+ 
+ 	/*Add input to the element: */
+-	element->AddBasalInput(SedimentHeadEnum,values,P1Enum);
+-	element->AddBasalInput(SedimentHeadResidualEnum,residual,P1Enum);
+-	element->AddBasalInput(EffectivePressureEnum,pressure,P1Enum);
++	element->AddInput(SedimentHeadEnum,values,P1Enum);
++	element->AddInput(SedimentHeadResidualEnum,residual,P1Enum);
++	element->AddInput(EffectivePressureEnum,pressure,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17886)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17887)
+@@ -419,7 +419,7 @@
+ 		basalelement->AddInput(DamageDbarEnum,newdamage,element->GetElementType());
+ 	}
+ 	else{
+-		basalelement->AddBasalInput(DamageDEnum,newdamage,element->GetElementType());
++		basalelement->AddInput(DamageDEnum,newdamage,element->GetElementType());
+ 	}
+ 
+ 	/*Free ressources:*/
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17886)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17887)
+@@ -47,28 +47,23 @@
+ 		if(VerboseSolution()) _printf0_("   call free surface computational core\n");
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceBaseAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(domaintype!=Domain2DhorizontalEnum){
+-			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+-			extrudefrombase_core(femmodel);
+-		}
++		femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
++		extrudefrombase_core(femmodel);
++
+ 		femmodel->SetCurrentConfiguration(FreeSurfaceTopAnalysisEnum);
+ 		solutionsequence_linear(femmodel);
+-		if(domaintype!=Domain2DhorizontalEnum){
+-			femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
+-			extrudefromtop_core(femmodel);
+-		}
++		femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
++		extrudefromtop_core(femmodel);
+ 	}
+ 	else{
+ 		if(VerboseSolution()) _printf0_("   call computational core\n");
+ 		solutionsequence_linear(femmodel);
+-		if(domaintype==Domain2DverticalEnum){
+-			femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
+-			extrudefrombase_core(femmodel);
+-			femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
+-			extrudefrombase_core(femmodel);
+-			femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
+-			extrudefrombase_core(femmodel);
+-		}
++		femmodel->parameters->SetParam(ThicknessEnum,InputToExtrudeEnum);
++		extrudefrombase_core(femmodel);
++		femmodel->parameters->SetParam(BaseEnum,InputToExtrudeEnum);
++		extrudefrombase_core(femmodel);
++		femmodel->parameters->SetParam(SurfaceEnum,InputToExtrudeEnum);
++		extrudefrombase_core(femmodel);
+ 	}
+ 
+ 	if(save_results){
+Index: ../trunk-jpl/src/c/cores/hydrology_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17886)
++++ ../trunk-jpl/src/c/cores/hydrology_core.cpp	(revision 17887)
+@@ -34,7 +34,6 @@
+ 		solutionsequence_nonlinear(femmodel,modify_loads);
+ 		
+ 		/*transfer water column thickness to old water column thickness: */
+-		
+ 		InputDuplicatex(femmodel,WatercolumnEnum,WaterColumnOldEnum);
+ 		
+ 		if(save_results){
+@@ -60,6 +59,7 @@
+ 		/*Proceed now to heads computations*/
+ 		if(VerboseSolution()) _printf0_("   computing water head\n");
+ 		solutionsequence_hydro_nonlinear(femmodel);
++
+ 		if(save_results){
+ 			if(VerboseSolution()) _printf0_("   saving results \n");
+ 			if(isefficientlayer){
+Index: ../trunk-jpl/src/c/cores/extrudefrombase_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/extrudefrombase_core.cpp	(revision 17886)
++++ ../trunk-jpl/src/c/cores/extrudefrombase_core.cpp	(revision 17887)
+@@ -12,20 +12,26 @@
+ void extrudefrombase_core(FemModel* femmodel){
+ 
+ 	/*Intermediaries*/
+-	int elementtype;
++	int elementtype,domaintype;
+ 
+ 	if(VerboseSolution()) _printf0_("extruding solution from base...\n");
+ 
+-	 femmodel->parameters->FindParam(&elementtype,MeshElementtypeEnum);
+-	 if(elementtype==PentaEnum){
+-		 int inputenum; femmodel->parameters->FindParam(&inputenum,InputToExtrudeEnum);
+-		 InputExtrudex(femmodel,inputenum);
+-	 }
+-	 else{
+-		 /*Call on core computations: */
+-		 femmodel->SetCurrentConfiguration(ExtrudeFromBaseAnalysisEnum);
+-		 femmodel->UpdateConstraintsExtrudeFromBasex();
+-		 solutionsequence_linear(femmodel);
+-	 }
++	/*Get parameters*/
++	femmodel->parameters->FindParam(&domaintype,DomainTypeEnum);
++	femmodel->parameters->FindParam(&elementtype,MeshElementtypeEnum);
+ 
++	/*If this is a 2D horizontal domain, return (no need to extrude)*/
++	if(domaintype==Domain2DhorizontalEnum) return;
++
++	/*Special method for Penta, otherwise call solution sequence*/
++	if(elementtype==PentaEnum){
++		int inputenum; femmodel->parameters->FindParam(&inputenum,InputToExtrudeEnum);
++		InputExtrudex(femmodel,inputenum);
++	}
++	else{
++		/*Call on core computations: */
++		femmodel->SetCurrentConfiguration(ExtrudeFromBaseAnalysisEnum);
++		femmodel->UpdateConstraintsExtrudeFromBasex();
++		solutionsequence_linear(femmodel);
++	}
+ }
Index: /issm/oecreview/Archive/17802-17983/ISSM-17887-17888.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17887-17888.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17887-17888.diff	(revision 17986)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17887)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17888)
+@@ -347,7 +347,7 @@
+ 		if(xIsNan<IssmDouble>(eplHeads[i])) _error_("NaN found in solution vector");
+ 	}
+ 	/*Add input to the element: */
+-	element->AddInput(EplHeadEnum,eplHeads,P1Enum);
++	element->AddBasalInput(EplHeadEnum,eplHeads,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(eplHeads);
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17887)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17888)
+@@ -459,9 +459,9 @@
+ 	}
+ 
+ 	/*Add input to the element: */
+-	element->AddInput(SedimentHeadEnum,values,P1Enum);
+-	element->AddInput(SedimentHeadResidualEnum,residual,P1Enum);
+-	element->AddInput(EffectivePressureEnum,pressure,P1Enum);
++	element->AddBasalInput(SedimentHeadEnum,values,P1Enum);
++	element->AddBasalInput(SedimentHeadResidualEnum,residual,P1Enum);
++	element->AddBasalInput(EffectivePressureEnum,pressure,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(values);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17888-17889.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17888-17889.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17888-17889.diff	(revision 17986)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17888)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17889)
+@@ -734,9 +734,9 @@
+ 	}
+ 
+ 	/*Add input to the element: */
+-	element->AddInput(ThicknessEnum,newthickness,P1Enum);
+-	element->AddInput(SurfaceEnum,newsurface,P1Enum);
+-	element->AddInput(BaseEnum,newbed,P1Enum);
++	element->AddBasalInput(ThicknessEnum,newthickness,P1Enum);
++	element->AddBasalInput(SurfaceEnum,newsurface,P1Enum);
++	element->AddBasalInput(BaseEnum,newbed,P1Enum);
+ 
+ 	/*Free ressources:*/
+ 	xDelete<IssmDouble>(newthickness);
+Index: ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17888)
++++ ../trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp	(revision 17889)
+@@ -419,7 +419,7 @@
+ 		basalelement->AddInput(DamageDbarEnum,newdamage,element->GetElementType());
+ 	}
+ 	else{
+-		basalelement->AddInput(DamageDEnum,newdamage,element->GetElementType());
++		basalelement->AddBasalInput(DamageDEnum,newdamage,element->GetElementType());
+ 	}
+ 
+ 	/*Free ressources:*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17889-17890.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17889-17890.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17889-17890.diff	(revision 17986)
@@ -0,0 +1,10 @@
+Index: ../trunk-jpl/externalpackages/valgrind/README
+===================================================================
+--- ../trunk-jpl/externalpackages/valgrind/README	(revision 17889)
++++ ../trunk-jpl/externalpackages/valgrind/README	(revision 17890)
+@@ -1,5 +0,0 @@
+-How to use valgrind to debug memory leaks. 
+-Install valgrind (jut type valgrind.sh). 
+-Compile the parallel code using -g -O0 as optoins (edit src/c/Makefile if necessary).
+-Then set md.mem_debug=1, and run in parallel. Voila!
+-The errlog will contain all the info spit out by valgrind.
Index: /issm/oecreview/Archive/17802-17983/ISSM-17890-17891.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17890-17891.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17890-17891.diff	(revision 17986)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17890)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17891)
+@@ -186,20 +186,19 @@
+ 
+ 	x,y:			data point coordinates
+ 	data:			data to be interpolated (same length as x,y)
+-
+-		function: form of radial basis function for interpolation:
+-			'multiquadric': sqrt((r/self.epsilon)**2 + 1) (default)
+-			'inverse': 1.0/sqrt((r/self.epsilon)**2 + 1)
+-			'gaussian': exp(-(r/self.epsilon)**2)
+-			'linear': r
+-			'cubic': r**3
+-			'quintic': r**5
+-			'thin_plate': r**2 * log(r)
+-		epsilon: adjustable constant for scaling radial distance.  Defaults to 
++	function:	form of radial basis function for interpolation:
++					'multiquadric': sqrt((r/self.epsilon)**2 + 1) (default)
++					'inverse': 1.0/sqrt((r/self.epsilon)**2 + 1)
++					'gaussian': exp(-(r/self.epsilon)**2)
++					'linear': r
++					'cubic': r**3
++					'quintic': r**5
++					'thin_plate': r**2 * log(r)
++	epsilon:		adjustable constant for scaling radial distance.  Defaults to 
+ 					approximate average distance between nodes.
+-		smooth: float>0, adjusts the amount of smoothing applied.  Defaults to 0,
++	smooth:		float>0, adjusts the amount of smoothing applied.  Defaults to 0,
+ 					such that the function always passes through nodal points.
+-		z:	coordinate array if interpolating in 3 dimensions
++	z:				coordinate array if interpolating in 3 dimensions
+ 
+ 	Usage:
+ 		interpdata=RadialInterp(x,y,data,**kwargs)
+@@ -210,7 +209,7 @@
+ 	'''
+ 
+ 	# unpack kwargs
+-	function=kwargs.pop('function','multiquadric')
++	function=kwargs.pop('function','gaussian')
+ 	if 'function' in kwargs: del kwargs['function']
+ 	epsilon=kwargs.pop('epsilon',None)
+ 	if 'epsilon' in kwargs: del kwargs['epsilon']
Index: /issm/oecreview/Archive/17802-17983/ISSM-17891-17892.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17891-17892.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17891-17892.diff	(revision 17986)
@@ -0,0 +1,45 @@
+Index: ../trunk-jpl/src/m/interp/interp.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/interp.py	(revision 17891)
++++ ../trunk-jpl/src/m/interp/interp.py	(revision 17892)
+@@ -177,7 +177,7 @@
+ 
+ 	return interpdata
+ #}}}
+-def RadialInterp(x,y,data,**kwargs):#{{{
++def RadialInterp(x,y,data,xi,yi,**kwargs):#{{{
+ 	'''
+ 	Interpolation using a radial basis function in 2 or 3 dimensions.
+ 	Useful for smoothing input data after interpolation.
+@@ -186,6 +186,7 @@
+ 
+ 	x,y:			data point coordinates
+ 	data:			data to be interpolated (same length as x,y)
++	xi,yi:		coordinates to interpolate onto
+ 	function:	form of radial basis function for interpolation:
+ 					'multiquadric': sqrt((r/self.epsilon)**2 + 1) (default)
+ 					'inverse': 1.0/sqrt((r/self.epsilon)**2 + 1)
+@@ -199,6 +200,7 @@
+ 	smooth:		float>0, adjusts the amount of smoothing applied.  Defaults to 0,
+ 					such that the function always passes through nodal points.
+ 	z:				coordinate array if interpolating in 3 dimensions
++	zi:			coordinate array if interpolating in 3 dimensions
+ 
+ 	Usage:
+ 		interpdata=RadialInterp(x,y,data,**kwargs)
+@@ -224,13 +226,13 @@
+ 			rbfi=Rbf(x,y,z,data,function=function,smooth=smooth,epsilon=epsilon)
+ 		else:
+ 			rbfi=Rbf(x,y,z,data,function=function,smooth=smooth)
+-		interpdata=rbfi(x,y,z)
++		interpdata=rbfi(xi,yi,zi)
+ 	else:
+ 		if epsilon:
+ 			rbfi=Rbf(x,y,data,function=function,smooth=smooth,epsilon=epsilon)
+ 		else:
+ 			rbfi=Rbf(x,y,data,function=function,smooth=smooth)
+-		interpdata=rbfi(x,y)
++		interpdata=rbfi(xi,yi)
+ 	
+ 	return interpdata
+ #}}}
Index: /issm/oecreview/Archive/17802-17983/ISSM-17892-17893.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17892-17893.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17892-17893.diff	(revision 17986)
@@ -0,0 +1,34 @@
+Index: ../trunk-jpl/src/m/plot/processdata.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.py	(revision 17892)
++++ ../trunk-jpl/src/m/plot/processdata.py	(revision 17893)
+@@ -46,7 +46,7 @@
+ 	if npy.any(npy.isnan(procdata)):
+ 		procdata[npy.isnan(procdata)]=nanfill
+ 		options.addfielddefault('cmap_set_under','1')
+-		options.addfielddefault('clim',[min(data),max(data)])
++		options.addfielddefault('clim',[npy.min(data[~npy.isnan(data)]),npy.max(data[~npy.isnan(data)])])
+ 		print "WARNING: nan's treated as -9999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
+ 
+ 	#non-patch processing 
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17892)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17893)
+@@ -66,14 +66,14 @@
+ 
+ 		# options needed to define plot grid
+ 		direction=options.list[0].getfieldvalue('direction','row') # row,column
+-		axes_pad=options.list[0].getfieldvalue('axes_pad',0.05)
++		axes_pad=options.list[0].getfieldvalue('axes_pad',0.25)
+ 		add_all=options.list[0].getfieldvalue('add_all',True) # True,False
+ 		share_all=options.list[0].getfieldvalue('share_all',True) # True,False
+ 		label_mode=options.list[0].getfieldvalue('label_mode','1') # 1,L,all
+ 		cbar_mode=options.list[0].getfieldvalue('cbar_mode','each') # none,single,each
+ 		cbar_location=options.list[0].getfieldvalue('cbar_location','right') # right,top
+ 		cbar_size=options.list[0].getfieldvalue('cbar_size','5%')
+-		cbar_pad=options.list[0].getfieldvalue('cbar_pad','5%') # None or %
++		cbar_pad=options.list[0].getfieldvalue('cbar_pad','2.5%') # None or %
+ 		
+ 		axgrid=ImageGrid(fig, 111,
+ 				nrows_ncols=(nrows,ncols),
Index: /issm/oecreview/Archive/17802-17983/ISSM-17893-17894.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17893-17894.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17893-17894.diff	(revision 17986)
@@ -0,0 +1,72 @@
+Index: ../trunk-jpl/externalpackages/m1qn3/Makefile
+===================================================================
+--- ../trunk-jpl/externalpackages/m1qn3/Makefile	(revision 17893)
++++ ../trunk-jpl/externalpackages/m1qn3/Makefile	(revision 17894)
+@@ -1,21 +0,0 @@
+-#Makefile for m1qn3 library. 
+-
+-#preliminary: 
+-LIB_EXT=a
+-FC=gfortran
+-
+-install: libm1qn3.$(LIB_EXT)
+-	cp libm1qn3.$(LIB_EXT) ../../install/
+-
+-
+-OBJECTS= m1qn3.o
+-
+-libm1qn3.$(LIB_EXT): $(OBJECTS)
+-	ar -r libm1qn3.$(LIB_EXT) $(OBJECTS) 
+-	ranlib libm1qn3.$(LIB_EXT) 
+-
+-%.o: %.f
+-	$(FC) $(FFLAGS) -c $< -o $@
+-
+-clean: 
+-	rm -rf *.o *.$(LIB_EXT)
+Index: ../trunk-jpl/externalpackages/m1qn3/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/m1qn3/install.sh	(revision 17893)
++++ ../trunk-jpl/externalpackages/m1qn3/install.sh	(revision 17894)
+@@ -14,5 +14,40 @@
+ 
+ #Compile m1qn3
+ cd src/src/
+-cp ../../Makefile .
++(
++cat << EOF
++LIB_EXT=a
++FC=gfortran
++install: libm1qn3.\$(LIB_EXT)
++	cp libm1qn3.\$(LIB_EXT) ../../install/
++OBJECTS= m1qn3.o
++libm1qn3.\$(LIB_EXT): \$(OBJECTS)
++	ar -r libm1qn3.\$(LIB_EXT) \$(OBJECTS) 
++	ranlib libm1qn3.\$(LIB_EXT) 
++%.o: %.f
++	\$(FC) \$(FFLAGS) -c $< -o \$@
++clean: 
++	rm -rf *.o *.\$(LIB_EXT)
++EOF
++) > Makefile
+ make
++
++#compile ddot
++cd ../blas
++(
++cat << EOF
++LIB_EXT=a
++FC=gfortran
++install: libddot.\$(LIB_EXT)
++	cp libddot.\$(LIB_EXT) ../../install/
++OBJECTS= ddot.o
++libddot.\$(LIB_EXT): \$(OBJECTS)
++	ar -r libddot.\$(LIB_EXT) \$(OBJECTS) 
++	ranlib libddot.\$(LIB_EXT) 
++%.o: %.f
++	\$(FC) \$(FFLAGS) -c $< -o \$@
++clean: 
++	rm -rf *.o *.\$(LIB_EXT)
++EOF
++) > Makefile
++make
Index: /issm/oecreview/Archive/17802-17983/ISSM-17894-17895.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17894-17895.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17894-17895.diff	(revision 17986)
@@ -0,0 +1,645 @@
+Index: ../trunk-jpl/m4/issm_options.m4
+===================================================================
+--- ../trunk-jpl/m4/issm_options.m4	(revision 17894)
++++ ../trunk-jpl/m4/issm_options.m4	(revision 17895)
+@@ -939,6 +939,30 @@
+ 	  AC_SUBST([TAOLIB])
+ 	fi
+ 	dnl }}}
++	dnl m1qn3{{{
++	AC_ARG_WITH([m1qn3-dir],
++		AS_HELP_STRING([--with-m1qn3-dir=DIR], [m1qn3 root directory.]),
++		[M1QN3_ROOT=$withval],[M1QN3_ROOT="no"]) 
++
++	dnl Check whether m1qn3 is enabled
++	AC_MSG_CHECKING([for m1qn3])
++	if test "x$M1QN3_ROOT" = "xno" ; then
++		HAVE_M1QN3=no
++	else
++		HAVE_M1QN3=yes
++		if ! test -d "$M1QN3_ROOT"; then
++			AC_MSG_ERROR([m1qn3 directory provided ($M1QN3_ROOT) does not exist]);
++		fi
++	fi
++	AC_MSG_RESULT($HAVE_M1QN3)
++	
++	dnl m1qn3 headers and libraries
++	if test "x$HAVE_M1QN3" == "xyes"; then
++	  M1QN3LIB="$M1QN3_ROOT/libm1qn3.a $M1QN3_ROOT//libddot.a"
++	  AC_DEFINE([_HAVE_M1QN3_],[1],[with M1QN3I in ISSM src])
++	  AC_SUBST([M1QN3LIB])
++	fi
++	dnl }}}
+ 	dnl slepc{{{
+ 	AC_ARG_WITH([slepc-dir],
+ 	  AS_HELP_STRING([--with-slepc-dir=DIR],[slepc root directory]),
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17894)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17895)
+@@ -134,7 +134,7 @@
+ 	InversionCostFunctionsEnum,
+ 	InversionGradientScalingEnum,
+ 	InversionIscontrolEnum,
+-	InversionTaoEnum,
++	InversionTypeEnum,
+ 	InversionIncompleteAdjointEnum,
+ 	InversionMaxParametersEnum,
+ 	InversionMaxiterPerStepEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17894)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17895)
+@@ -142,7 +142,7 @@
+ 		case InversionCostFunctionsEnum : return "InversionCostFunctions";
+ 		case InversionGradientScalingEnum : return "InversionGradientScaling";
+ 		case InversionIscontrolEnum : return "InversionIscontrol";
+-		case InversionTaoEnum : return "InversionTao";
++		case InversionTypeEnum : return "InversionType";
+ 		case InversionIncompleteAdjointEnum : return "InversionIncompleteAdjoint";
+ 		case InversionMaxParametersEnum : return "InversionMaxParameters";
+ 		case InversionMaxiterPerStepEnum : return "InversionMaxiterPerStep";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17894)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17895)
+@@ -145,7 +145,7 @@
+ 	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
+ 	      else if (strcmp(name,"InversionGradientScaling")==0) return InversionGradientScalingEnum;
+ 	      else if (strcmp(name,"InversionIscontrol")==0) return InversionIscontrolEnum;
+-	      else if (strcmp(name,"InversionTao")==0) return InversionTaoEnum;
++	      else if (strcmp(name,"InversionType")==0) return InversionTypeEnum;
+ 	      else if (strcmp(name,"InversionIncompleteAdjoint")==0) return InversionIncompleteAdjointEnum;
+ 	      else if (strcmp(name,"InversionMaxParameters")==0) return InversionMaxParametersEnum;
+ 	      else if (strcmp(name,"InversionMaxiterPerStep")==0) return InversionMaxiterPerStepEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp	(revision 17894)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp	(revision 17895)
+@@ -9,7 +9,8 @@
+ 
+ void CreateParametersControl(Parameters* parameters,IoModel* iomodel,int solution_type){
+ 
+-	bool        control_analysis,tao_analysis;
++	bool        control_analysis;
++	int         inversiontype;
+ 	int         nsteps;
+ 	int         num_control_type;
+ 	int         num_cm_responses;
+@@ -21,7 +22,7 @@
+ 
+ 	/*retrieve some parameters: */
+ 	iomodel->Constant(&control_analysis,InversionIscontrolEnum);
+-	iomodel->Constant(&tao_analysis,InversionTaoEnum);
++	iomodel->Constant(&inversiontype,InversionTypeEnum);
+ 
+ 	if(control_analysis){
+ 
+@@ -30,7 +31,7 @@
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionNumCostFunctionsEnum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionNstepsEnum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionIncompleteAdjointEnum));
+-		if(!tao_analysis){
++		if(inversiontype==0){
+ 			parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum));
+ 		}
+ 
+@@ -45,13 +46,13 @@
+ 		/*Now, recover fit, optscal and maxiter as vectors: */
+ 		iomodel->FetchData(&control_type,NULL,&num_control_type,InversionControlParametersEnum);
+ 		iomodel->FetchData(&cm_responses,NULL,&num_cm_responses,InversionCostFunctionsEnum);
+-		if(!tao_analysis){
++		if(inversiontype==0){
+ 			iomodel->FetchData(&cm_jump,&nsteps,NULL,InversionStepThresholdEnum);
+ 			iomodel->FetchData(&optscal,NULL,NULL,InversionGradientScalingEnum);
+ 			iomodel->FetchData(&maxiter,NULL,NULL,InversionMaxiterPerStepEnum);
+ 		}
+ 
+-		if(tao_analysis){
++		if(inversiontype!=0){
+ 			parameters->AddObject(new IntVecParam(InversionControlParametersEnum,control_type,num_control_type));
+ 			parameters->AddObject(new IntVecParam(InversionCostFunctionsEnum,cm_responses,num_cm_responses));
+ 		}
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17894)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17895)
+@@ -75,7 +75,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(AutodiffIsautodiffEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(QmuIsdakotaEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(InversionIscontrolEnum));
+-	parameters->AddObject(iomodel->CopyConstantObject(InversionTaoEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(InversionTypeEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(GiaCrossSectionShapeEnum));
+ 
+ 	/*For stress balance only*/
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17894)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17895)
+@@ -422,6 +422,7 @@
+ 					./shared/Numerics/OptimalSearch.cpp \
+ 					./cores/control_core.cpp\
+ 					./cores/controltao_core.cpp\
++					./cores/controlm1qn3_core.cpp\
+ 					./cores/objectivefunction.cpp\
+ 					./cores/gradient_core.cpp\
+ 					./cores/adjointstressbalance_core.cpp\
+@@ -873,7 +874,7 @@
+ libISSM_la_LIBADD = libISSMCore.la libISSMOverload.la
+ 
+ libISSMCore_la_SOURCES  = $(issm_sources)
+-libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)   $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) 
++libISSMCore_la_LIBADD = $(PETSCLIB) $(TAOLIB) $(M1QN3LIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB) $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB)   $(ADOLCLIB) $(AMPILIB) $(METEOIOLIB) $(SNOWPACKLIB) 
+ libISSMCore_la_FFLAGS = $(AM_FFLAGS)
+ endif
+ 
+@@ -920,7 +921,7 @@
+ LDADD = ./libISSMCore.a ./libISSMOverload.a
+ 
+ #External packages
+-LDADD += $(PETSCLIB) $(TAOLIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB)  $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB)
++LDADD += $(PETSCLIB) $(TAOLIB) $(M1QN3LIB) $(PLAPACKLIB) $(MUMPSLIB) $(SUPERLULIB) $(SPOOLESLIB) $(SCALAPACKLIB) $(BLACSLIB) $(HYPRELIB) $(SPAILIB) $(PROMETHEUSLIB) $(PASTIXLIB) $(MLLIB) $(DAKOTALIB) $(METISLIB) $(CHACOLIB) $(SCOTCHLIB) $(BLASLAPACKLIB) $(MKLLIB) $(MPILIB)  $(MATHLIB) $(GRAPHICSLIB) $(MULTITHREADINGLIB) $(OSLIBS) $(GSLLIB) $(AMPILIB) $(ADOLCLIB) $(MPILIB) $(METEOIOLIB) $(SNOWPACKLIB)
+ 
+ if FORTRAN
+ LDADD += $(FLIBS) $(FORTRANLIB)
+Index: ../trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp	(revision 17894)
++++ ../trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp	(revision 17895)
+@@ -20,16 +20,16 @@
+ 	void (*solutioncore)(FemModel*)=NULL;
+ 
+ 	/*parameters: */
+-	bool control_analysis=false;
+-	bool tao_analysis=false;
+-	bool dakota_analysis=false;
++	bool control_analysis;
++	bool dakota_analysis;
++	int  inversiontype;
+ 
+ 	/* retrieve some parameters that tell us whether wrappers are allowed, or whether we return 
+ 	 * a pure core. Wrappers can be dakota_core (which samples many solution_cores) or control_core (which 
+ 	 * carries out adjoint based inversion on a certain core: */
+ 	parameters->FindParam(&dakota_analysis,QmuIsdakotaEnum);
+ 	parameters->FindParam(&control_analysis,InversionIscontrolEnum);
+-	parameters->FindParam(&tao_analysis,InversionTaoEnum);
++	parameters->FindParam(&inversiontype,InversionTypeEnum);
+ 
+ 	if(nodakotacore)dakota_analysis=false;
+ 
+@@ -41,8 +41,12 @@
+ 		#endif
+ 	}
+ 	else if(control_analysis){
+-		if(tao_analysis) solutioncore=controltao_core;
+-		else solutioncore=control_core;
++		switch(inversiontype){
++			case 0: solutioncore=control_core; break;
++			case 1: solutioncore=controltao_core; break;
++			case 2: solutioncore=controlm1qn3_core; break;
++			default: _error_("control type not supported");
++		}
+ 	}
+ 	else CorePointerFromSolutionEnum(&solutioncore,parameters,solutiontype);  /*This means we retrieve a core solution that is not a wrapper*/
+ 
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 0)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17895)
+@@ -0,0 +1,105 @@
++/*!\file: controlm1qn3_core.cpp
++ * \brief: core of the control solution 
++ */ 
++
++#include "./cores.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
++
++#if defined (_HAVE_M1QN3_)
++/*m1qn3 prototypes*/
++extern "C" void *ctonbe_; // DIS mode : Conversion
++extern "C" void *ctcabe_; // DIS mode : Conversion
++extern "C" void *euclid_; // Scalar product
++typedef void (*SimulFunc) (long*, long *, double [], double *, double [], long [], float [], double []);
++extern "C" void m1qn3_ (void f(long*, long *, double [], double *, double [], long [], float [], double []),
++			void **, void **, void **,
++			long *, double [], double *, double [], double*, double *,
++			double *, char [], long *, long *, long *, long *, long *, long *, long [], double [], long *,
++			long *, long *, long [], float [], double []
++			);
++
++void simul(long* indic,long* n,double x[2],double* f,double g[2],long izs[1],float rzs[1],double dzs[1]){
++	/*minimization of x^2+cy^4 where c>0 is a parameter*/
++	double c=dzs[0];
++	*f=x[0]*x[0]+c*x[1]*x[1]*x[1]*x[1];
++	g[0]=2.*x[0];
++	g[1]=4.*c*x[1]*x[1]*x[1];
++}
++
++void controlm1qn3_core(FemModel* femmodel){
++	if(VerboseControl())_printf0_("   Initialize M1QN3 parameters\n");
++
++	const int pbdim = 2;
++
++	/*Solution parameters*/
++	double c = 10.;
++
++	/*output*/
++	long omode;
++
++	/*Function evaluation and gradient*/
++	double f;
++	double g[2]; /**/
++
++	/*m1qn3 parameters*/
++	SimulFunc costfuncion  = &simul;    /*Cost function address*/
++	void**    prosca       = &euclid_;  /*Dot product function (euclid is the default)*/
++	char      normtype[3];              /*Norm type: dfn = scalar product defined by prosca*/
++	strcpy(normtype, "dfn");
++	long      impres       = 0;         /*verbosity level*/
++	long      imode[3]     = {0};
++	long      indic        = 4;         /*compute f and g*/
++	long      reverse      = 0;
++	long      ndz          = 20000; /*Dimension of the working area*/
++	double    dz[20000];            /*Working array*/
++	long      iz[5];
++	double    dxmin        = 1.e-10; /*Resolution for the solution x*/
++	double    epsrel       = 1.e-5;  /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
++	long      niter        = 200;    /*Maximum number of iterations*/
++	long      nsim         = 200;    /*Maximum number of function calls*/
++	long      io           = 6;      /*Channel number for the output*/
++	/*Arrayes used by m1qn3 subroutines*/
++	double    dzs[1];
++	long      izs[5];
++	float     rzs[1];
++
++
++	/*Prepare initial guess*/
++	long      n = pbdim;
++	double    x[pbdim];
++	for(int i=0;i<n;i++) x[i]=5.;
++	dzs[0] = c;
++
++	if(VerboseControl())_printf0_("   Computing initial solution\n");
++	simul(&indic,&n,x,&f,g,izs,rzs,&dzs[0]);
++	double f1=f;
++
++	m1qn3_(costfuncion,prosca,&ctonbe_,&ctcabe_,
++				&n,x,&f,g,&dxmin,&f1,
++				&epsrel,normtype,&impres,&io,imode,&omode,&niter,&nsim,iz,dz,&ndz,
++				&reverse,&indic,izs,rzs,dzs);
++
++	switch(int(omode)){
++		case 0:  _printf0_("Stop requiered \n"); break;
++		case 1:  _printf0_("Stop on epsg (gradient too small)\n"); break;
++		case 2:  _printf0_("Bad initialization\n"); break;
++		case 3:  _printf0_("Line search failure\n"); break;
++		case 4:  _printf0_("Maximum number of iterations exceeded\n");break;
++		case 5:  _printf0_("Maximum number of function calls exceeded\n"); break;
++		case 6:  _printf0_("stoped on dxmin during line search\n"); break;
++		case 7:  _printf0_("<g,d> > 0  or  <y,s> <0\n"); break;
++		default: _printf0_("Unknown end condition\n");
++	}
++
++	_printf0_(" == Final cost function = "<< f <<"\n");
++	_printf0_(" == Final x = ["<<x[0]<<" "<<x[1]<<"]\n");
++}
++#else
++void controlm1qn3_core(FemModel* femmodel){
++	_error_("M1QN3 not installed");
++}
++#endif //_HAVE_TAO_ 
+Index: ../trunk-jpl/src/c/cores/cores.h
+===================================================================
+--- ../trunk-jpl/src/c/cores/cores.h	(revision 17894)
++++ ../trunk-jpl/src/c/cores/cores.h	(revision 17895)
+@@ -28,6 +28,7 @@
+ void meshdeformation_core(FemModel* femmodel);
+ void control_core(FemModel* femmodel);
+ void controltao_core(FemModel* femmodel);
++void controlm1qn3_core(FemModel* femmodel);
+ void masstransport_core(FemModel* femmodel);
+ void depthaverage_core(FemModel* femmodel);
+ void extrudefrombase_core(FemModel* femmodel);
+Index: ../trunk-jpl/src/m/classes/inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.m	(revision 17894)
++++ ../trunk-jpl/src/m/classes/inversion.m	(revision 17895)
+@@ -6,7 +6,6 @@
+ classdef inversion
+ 	properties (SetAccess=public) 
+ 		iscontrol                   = 0
+-		tao                         = 0
+ 		incomplete_adjoint          = 0
+ 		control_parameters          = NaN
+ 		nsteps                      = 0
+@@ -79,7 +78,6 @@
+ 						in=varargin{1};
+ 						obj=inversion();
+ 						obj.iscontrol                   = in.iscontrol;
+-						obj.tao                         = 1;rsion to inve
+ 						obj.incomplete_adjoint          = in.incomplete_adjoint;
+ 						obj.control_parameters          = in.control_parameters;
+ 						obj.nsteps                      = in.nsteps;
+@@ -151,7 +149,6 @@
+ 			num_costfunc=size(md.inversion.cost_functions,2);
+ 
+ 			md = checkfield(md,'fieldname','inversion.iscontrol','values',[0 1]);
+-			md = checkfield(md,'fieldname','inversion.tao','values',[0 1]);
+ 			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
+ 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
+ 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'DamageDbar' 'Vx' 'Vy' 'Thickness'});
+@@ -213,8 +210,8 @@
+ 
+ 			yts=365.0*24.0*3600.0;
+ 
++			WriteData(fid,'enum',InversionTypeEnum(),'data',0,'format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','iscontrol','format','Boolean');
+-			WriteData(fid,'object',obj,'fieldname','tao','format','Boolean');
+ 			WriteData(fid,'object',obj,'fieldname','incomplete_adjoint','format','Boolean');
+ 			if ~obj.iscontrol, return; end
+ 			WriteData(fid,'object',obj,'fieldname','nsteps','format','Integer');
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17895)
+@@ -0,0 +1,166 @@
++%M1QN3INVERSION class definition
++%
++%   Usage:
++%      m1qn3inversion=m1qn3inversion();
++
++classdef m1qn3inversion
++	properties (SetAccess=public) 
++		iscontrol                   = 0
++		incomplete_adjoint          = 0
++		control_parameters          = NaN
++		nsteps                      = 0
++		cost_functions              = NaN
++		cost_functions_coefficients = NaN
++		min_parameters              = NaN
++		max_parameters              = NaN
++		vx_obs                      = NaN
++		vy_obs                      = NaN
++		vz_obs                      = NaN
++		vel_obs                     = NaN
++		thickness_obs               = NaN
++	end
++	methods
++		function obj = m1qn3inversion(varargin) % {{{
++			switch nargin
++				case 0
++					obj=setdefaultparameters(obj);
++				case 1
++					if isa(varargin{1},'inversion'),
++						disp('converting inversion to m1qn3inversion');
++						in=varargin{1};
++						obj.iscontrol                   = in.iscontrol;
++						obj.incomplete_adjoint          = in.incomplete_adjoint;
++						obj.control_parameters          = in.control_parameters;
++						obj.nsteps                      = in.nsteps;
++						obj.cost_functions              = in.cost_functions(1,:); %Keep first line only
++						obj.cost_functions_coefficients = in.cost_functions_coefficients;
++						obj.min_parameters              = in.min_parameters;
++						obj.max_parameters              = in.max_parameters;
++						obj.vx_obs                      = in.vx_obs;
++						obj.vy_obs                      = in.vy_obs;
++						obj.vz_obs                      = in.vz_obs;
++						obj.vel_obs                     = in.vel_obs;
++						obj.thickness_obs               = in.thickness_obs;
++					end
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++			%default is incomplete adjoint for now
++			obj.incomplete_adjoint=1;
++
++			%parameter to be inferred by control methods (only
++			%drag and B are supported yet)
++			obj.control_parameters={'FrictionCoefficient'};
++
++			%number of steps in the control methods
++			obj.nsteps=20;
++
++			%several responses can be used:
++			obj.cost_functions=101*ones(obj.nsteps,1);
++
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			%Early return
++			if ~obj.iscontrol, return; end
++
++			if ~IssmConfig('_HAVE_TAO_'),
++				md = checkmessage(md,['TAO has not been installed, ISSM needs to be reconfigured and recompiled with TAO']);
++			end
++
++			num_controls=numel(md.inversion.control_parameters);
++			num_costfunc=size(md.inversion.cost_functions,2);
++
++			md = checkfield(md,'fieldname','inversion.iscontrol','values',[0 1]);
++			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
++			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
++				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'MaterialsRheologyZbar' 'Vx' 'Vy' 'Thickness'});
++			md = checkfield(md,'fieldname','inversion.nsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
++			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
++			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
++			md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices num_controls]);
++
++			if solution==BalancethicknessSolutionEnum()
++				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++			elseif solution==BalancethicknessSoftSolutionEnum()
++				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++			else
++				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++			end
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('   m1qn3inversion parameters:'));
++			fielddisplay(obj,'iscontrol','is inversion activated?');
++			fielddisplay(obj,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity');
++			fielddisplay(obj,'control_parameters','ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}');
++			fielddisplay(obj,'nsteps','number of optimization searches');
++			fielddisplay(obj,'cost_functions','indicate the type of response for each optimization step');
++			fielddisplay(obj,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter');
++			fielddisplay(obj,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex');
++			fielddisplay(obj,'max_parameters','absolute maximum acceptable value of the inversed parameter on each vertex');
++			fielddisplay(obj,'vx_obs','observed velocity x component [m/yr]');
++			fielddisplay(obj,'vy_obs','observed velocity y component [m/yr]');
++			fielddisplay(obj,'vel_obs','observed velocity magnitude [m/yr]');
++			fielddisplay(obj,'thickness_obs','observed thickness [m]');
++			disp('Available cost functions:');
++			disp('   101: SurfaceAbsVelMisfit');
++			disp('   102: SurfaceRelVelMisfit');
++			disp('   103: SurfaceLogVelMisfit');
++			disp('   104: SurfaceLogVxVyMisfit');
++			disp('   105: SurfaceAverageVelMisfit');
++			disp('   201: ThicknessAbsMisfit');
++			disp('   501: DragCoefficientAbsGradient');
++			disp('   502: RheologyBbarAbsGradient');
++			disp('   503: ThicknessAbsGradient');
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++
++			yts=365.0*24.0*3600.0;
++
++			WriteData(fid,'object',obj,'class','inversion','fieldname','iscontrol','format','Boolean');
++			WriteData(fid,'enum',InversionTypeEnum(),'data',2,'format','Integer');
++			if ~obj.iscontrol, return; end
++			WriteData(fid,'object',obj,'class','inversion','fieldname','incomplete_adjoint','format','Boolean');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','nsteps','format','Integer');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1);
++			WriteData(fid,'object',obj,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3);
++			WriteData(fid,'object',obj,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3);
++			WriteData(fid,'object',obj,'class','inversion','fieldname','vx_obs','format','DoubleMat','mattype',1,'scale',1./yts);
++			WriteData(fid,'object',obj,'class','inversion','fieldname','vy_obs','format','DoubleMat','mattype',1,'scale',1./yts);
++			WriteData(fid,'object',obj,'class','inversion','fieldname','vz_obs','format','DoubleMat','mattype',1,'scale',1./yts);
++			WriteData(fid,'object',obj,'class','inversion','fieldname','thickness_obs','format','DoubleMat','mattype',1);
++
++			%process control parameters
++			num_control_parameters=numel(obj.control_parameters);
++			data=zeros(1,num_control_parameters);
++			for i=1:num_control_parameters,
++				data(i)=StringToEnum(obj.control_parameters{i});
++			end
++			WriteData(fid,'data',data,'enum',InversionControlParametersEnum(),'format','DoubleMat','mattype',3);
++			WriteData(fid,'data',num_control_parameters,'enum',InversionNumControlParametersEnum(),'format','Integer');
++
++			%process cost functions
++			num_cost_functions=size(obj.cost_functions,2);
++			data=obj.cost_functions;
++			pos=find(data==101); data(pos)=SurfaceAbsVelMisfitEnum();
++			pos=find(data==102); data(pos)=SurfaceRelVelMisfitEnum();
++			pos=find(data==103); data(pos)=SurfaceLogVelMisfitEnum();
++			pos=find(data==104); data(pos)=SurfaceLogVxVyMisfitEnum();
++			pos=find(data==105); data(pos)=SurfaceAverageVelMisfitEnum();
++			pos=find(data==201); data(pos)=ThicknessAbsMisfitEnum();
++			pos=find(data==501); data(pos)=DragCoefficientAbsGradientEnum();
++			pos=find(data==502); data(pos)=RheologyBbarAbsGradientEnum();
++			pos=find(data==503); data(pos)=ThicknessAbsGradientEnum();
++			pos=find(data==504); data(pos)=ThicknessAlongGradientEnum();
++			pos=find(data==505); data(pos)=ThicknessAcrossGradientEnum();
++			pos=find(data==506); data(pos)=BalancethicknessMisfitEnum();
++			WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
++			WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/classes/inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.py	(revision 17894)
++++ ../trunk-jpl/src/m/classes/inversion.py	(revision 17895)
+@@ -16,7 +16,6 @@
+ 
+ 	def __init__(self): # {{{
+ 		self.iscontrol                   = 0
+-		self.tao                         = 0
+ 		self.incomplete_adjoint          = 0
+ 		self.control_parameters          = float('NaN')
+ 		self.nsteps                      = 0
+@@ -116,7 +115,6 @@
+ 		num_costfunc=numpy.size(md.inversion.cost_functions)
+ 
+ 		md = checkfield(md,'fieldname','inversion.iscontrol','values',[0,1])
+-		md = checkfield(md,'fieldname','inversion.tao','values',[0,1])
+ 		md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1])
+ 		md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy'])
+ 		md = checkfield(md,'fieldname','inversion.nsteps','numel',[1],'>=',0)
+@@ -145,8 +143,8 @@
+ 
+ 		yts=365.0*24.0*3600.0
+ 
++		WriteData(fid,'enum',InversionTypeEnum(),'data',0,'format','Integer')
+ 		WriteData(fid,'object',self,'fieldname','iscontrol','format','Boolean')
+-		WriteData(fid,'object',self,'fieldname','tao','format','Boolean')
+ 		WriteData(fid,'object',self,'fieldname','incomplete_adjoint','format','Boolean')
+ 		if not self.iscontrol:
+ 			return
+Index: ../trunk-jpl/src/m/classes/taoinversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17894)
++++ ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17895)
+@@ -123,7 +123,7 @@
+ 			yts=365.0*24.0*3600.0;
+ 
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','iscontrol','format','Boolean');
+-			WriteData(fid,'enum',InversionTaoEnum(),'data',true,'format','Boolean');
++			WriteData(fid,'enum',InversionTypeEnum(),'data',1,'format','Integer');
+ 			if ~obj.iscontrol, return; end
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','incomplete_adjoint','format','Boolean');
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','nsteps','format','Integer');
+Index: ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m
+===================================================================
+--- ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17894)
++++ ../trunk-jpl/src/m/contrib/dassflow/importgmsh.m	(revision 17895)
+@@ -97,6 +97,7 @@
+ 				error('not supported');
+ 			end
+ 		case 15, %point
++			A=fscanf(fid,'%i',1);
+ 			continue;
+ 		otherwise,
+ 			error(['Type ' num2str(ty) ' not supported']);
+@@ -125,7 +126,7 @@
+ fclose(fid);
+ 
+ %Create model
+-if 0, %2d triangles
++if dim==2, %2d triangles
+ 	md=meshconvert(model,index,x,y);
+ 	md.mesh=mesh2dvertical(md.mesh);
+ 	md.mesh.segmentmarkers=segmentmarkers;
+Index: ../trunk-jpl/src/m/enum/InversionTaoEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionTaoEnum.m	(revision 17894)
++++ ../trunk-jpl/src/m/enum/InversionTaoEnum.m	(revision 17895)
+@@ -1,11 +0,0 @@
+-function macro=InversionTaoEnum()
+-%INVERSIONTAOENUM - Enum of InversionTao
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=InversionTaoEnum()
+-
+-macro=StringToEnum('InversionTao');
+Index: ../trunk-jpl/src/m/enum/InversionTypeEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionTypeEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionTypeEnum.m	(revision 17895)
+@@ -0,0 +1,11 @@
++function macro=InversionTypeEnum()
++%INVERSIONTYPEENUM - Enum of InversionType
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionTypeEnum()
++
++macro=StringToEnum('InversionType');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17894)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17895)
+@@ -134,7 +134,7 @@
+ def InversionCostFunctionsEnum(): return StringToEnum("InversionCostFunctions")[0]
+ def InversionGradientScalingEnum(): return StringToEnum("InversionGradientScaling")[0]
+ def InversionIscontrolEnum(): return StringToEnum("InversionIscontrol")[0]
+-def InversionTaoEnum(): return StringToEnum("InversionTao")[0]
++def InversionTypeEnum(): return StringToEnum("InversionType")[0]
+ def InversionIncompleteAdjointEnum(): return StringToEnum("InversionIncompleteAdjoint")[0]
+ def InversionMaxParametersEnum(): return StringToEnum("InversionMaxParameters")[0]
+ def InversionMaxiterPerStepEnum(): return StringToEnum("InversionMaxiterPerStep")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17895-17896.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17895-17896.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17895-17896.diff	(revision 17986)
@@ -0,0 +1,90 @@
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17895)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17896)
+@@ -31,48 +31,39 @@
+ }
+ 
+ void controlm1qn3_core(FemModel* femmodel){
+-	if(VerboseControl())_printf0_("   Initialize M1QN3 parameters\n");
+ 
+-	const int pbdim = 2;
++	/*Intermediaries*/
++	long   omode; /*m1qn3 output flag*/
++	double f;     /*cost function value*/
+ 
+-	/*Solution parameters*/
+-	double c = 10.;
+-
+-	/*output*/
+-	long omode;
+-
+-	/*Function evaluation and gradient*/
+-	double f;
+-	double g[2]; /**/
+-
+-	/*m1qn3 parameters*/
++	if(VerboseControl())_printf0_("   Initialize M1QN3 parameters\n");
+ 	SimulFunc costfuncion  = &simul;    /*Cost function address*/
+ 	void**    prosca       = &euclid_;  /*Dot product function (euclid is the default)*/
+-	char      normtype[3];              /*Norm type: dfn = scalar product defined by prosca*/
+-	strcpy(normtype, "dfn");
++	char      normtype[3];              /*Norm type: dfn = scalar product defined by prosca*/ strcpy(normtype, "dfn");
++	double    dzs[1];                   /*Arrays used by m1qn3 subroutines*/
++	long      izs[5];                   /*Arrays used by m1qn3 subroutines*/
++	float     rzs[1];                   /*Arrays used by m1qn3 subroutines*/
+ 	long      impres       = 0;         /*verbosity level*/
+-	long      imode[3]     = {0};
++	long      imode[3]     = {0};       /*scaling and starting mode, 0 by default*/
+ 	long      indic        = 4;         /*compute f and g*/
+-	long      reverse      = 0;
+-	long      ndz          = 20000; /*Dimension of the working area*/
+-	double    dz[20000];            /*Working array*/
+-	long      iz[5];
+-	double    dxmin        = 1.e-10; /*Resolution for the solution x*/
+-	double    epsrel       = 1.e-5;  /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
+-	long      niter        = 200;    /*Maximum number of iterations*/
+-	long      nsim         = 200;    /*Maximum number of function calls*/
+-	long      io           = 6;      /*Channel number for the output*/
+-	/*Arrayes used by m1qn3 subroutines*/
+-	double    dzs[1];
+-	long      izs[5];
+-	float     rzs[1];
++	long      reverse      = 0;         /*reverse or direct mode*/
++	long      ndz          = 20000;     /*Dimension of the working area*/
++	double    dz[20000];                /*Working array*/
++	long      iz[5];                    /*Integer m1qn3 working array of size 5*/
++	long      niter        = 200;       /*Maximum number of iterations*/
++	long      nsim         = 200;       /*Maximum number of function calls*/
++	long      io           = 6;         /*Channel number for the output*/
+ 
++	/*Optimization criterions*/
++	double    dxmin        = 1.e-10;    /*Resolution for the solution x*/
++	double    epsrel       = 1.e-5;     /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
+ 
+-	/*Prepare initial guess*/
+-	long      n = pbdim;
+-	double    x[pbdim];
++	/*Get problem dimension and initialize gradient and initial guess*/
++	long    n = 2;
++	double* g = xNew<double>(n);
++	double* x = xNew<double>(n);
+ 	for(int i=0;i<n;i++) x[i]=5.;
+-	dzs[0] = c;
++	dzs[0] = 10; //c = 10 function parameter
+ 
+ 	if(VerboseControl())_printf0_("   Computing initial solution\n");
+ 	simul(&indic,&n,x,&f,g,izs,rzs,&dzs[0]);
+@@ -96,7 +87,11 @@
+ 	}
+ 
+ 	_printf0_(" == Final cost function = "<< f <<"\n");
+-	_printf0_(" == Final x = ["<<x[0]<<" "<<x[1]<<"]\n");
++	//_printf0_(" == Final x = ["<<x[0]<<" "<<x[1]<<"]\n");
++
++	/*Clean-up and return*/
++	xDelete<double>(g);
++	xDelete<double>(x);
+ }
+ #else
+ void controlm1qn3_core(FemModel* femmodel){
Index: /issm/oecreview/Archive/17802-17983/ISSM-17896-17897.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17896-17897.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17896-17897.diff	(revision 17986)
@@ -0,0 +1,68 @@
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17896)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17897)
+@@ -47,16 +47,14 @@
+ 	long      imode[3]     = {0};       /*scaling and starting mode, 0 by default*/
+ 	long      indic        = 4;         /*compute f and g*/
+ 	long      reverse      = 0;         /*reverse or direct mode*/
+-	long      ndz          = 20000;     /*Dimension of the working area*/
+-	double    dz[20000];                /*Working array*/
+ 	long      iz[5];                    /*Integer m1qn3 working array of size 5*/
+-	long      niter        = 200;       /*Maximum number of iterations*/
+-	long      nsim         = 200;       /*Maximum number of function calls*/
+ 	long      io           = 6;         /*Channel number for the output*/
+ 
+ 	/*Optimization criterions*/
+ 	double    dxmin        = 1.e-10;    /*Resolution for the solution x*/
+ 	double    epsrel       = 1.e-5;     /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
++	long      niter        = 200;       /*Maximum number of iterations*/
++	long      nsim         = 200;       /*Maximum number of function calls*/
+ 
+ 	/*Get problem dimension and initialize gradient and initial guess*/
+ 	long    n = 2;
+@@ -65,6 +63,11 @@
+ 	for(int i=0;i<n;i++) x[i]=5.;
+ 	dzs[0] = 10; //c = 10 function parameter
+ 
++	/*Allocate m1qn3 working arrays (see doc)*/
++	long      m   = 100;
++	long      ndz = 4*n+m*(2*n+1);
++	double*   dz  = xNew<double>(ndz);
++
+ 	if(VerboseControl())_printf0_("   Computing initial solution\n");
+ 	simul(&indic,&n,x,&f,g,izs,rzs,&dzs[0]);
+ 	double f1=f;
+@@ -75,15 +78,15 @@
+ 				&reverse,&indic,izs,rzs,dzs);
+ 
+ 	switch(int(omode)){
+-		case 0:  _printf0_("Stop requiered \n"); break;
+-		case 1:  _printf0_("Stop on epsg (gradient too small)\n"); break;
+-		case 2:  _printf0_("Bad initialization\n"); break;
+-		case 3:  _printf0_("Line search failure\n"); break;
+-		case 4:  _printf0_("Maximum number of iterations exceeded\n");break;
+-		case 5:  _printf0_("Maximum number of function calls exceeded\n"); break;
+-		case 6:  _printf0_("stoped on dxmin during line search\n"); break;
+-		case 7:  _printf0_("<g,d> > 0  or  <y,s> <0\n"); break;
+-		default: _printf0_("Unknown end condition\n");
++		case 0:  _printf0_("   Stop requested (indic = 0)\n"); break;
++		case 1:  _printf0_("   Convergence reached (gradient satisfies stopping criterion)\n"); break;
++		case 2:  _printf0_("   Bad initialization\n"); break;
++		case 3:  _printf0_("   Line search failure\n"); break;
++		case 4:  _printf0_("   Maximum number of iterations exceeded\n");break;
++		case 5:  _printf0_("   Maximum number of function calls exceeded\n"); break;
++		case 6:  _printf0_("   stopped on dxmin during line search\n"); break;
++		case 7:  _printf0_("   <g,d> > 0  or  <y,s> <0\n"); break;
++		default: _printf0_("   Unknown end condition\n");
+ 	}
+ 
+ 	_printf0_(" == Final cost function = "<< f <<"\n");
+@@ -92,6 +95,7 @@
+ 	/*Clean-up and return*/
+ 	xDelete<double>(g);
+ 	xDelete<double>(x);
++	xDelete<double>(dz);
+ }
+ #else
+ void controlm1qn3_core(FemModel* femmodel){
Index: /issm/oecreview/Archive/17802-17983/ISSM-17897-17898.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17897-17898.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17897-17898.diff	(revision 17986)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/src/m/exp/expwrite.py
+===================================================================
+--- ../trunk-jpl/src/m/exp/expwrite.py	(revision 17897)
++++ ../trunk-jpl/src/m/exp/expwrite.py	(revision 17898)
+@@ -4,10 +4,10 @@
+ 	"""
+ 	EXPWRITE - write an Argus file from a structure given in input
+ 
+-	   This routine write an Argus file form a structure containing the fields:
++	   This routine writes an Argus file from a list of dict's containing the fields:
+ 	   x and y of the coordinates of the points.
+-	   The first argument is the structure containing the points coordinates 
+-	   and the second one the file to be write.
++	   The first argument is the list containing the points coordinates 
++	   and the second one the file to be written.
+ 
+ 	   Usage:
+ 	      expwrite(contours,filename)
Index: /issm/oecreview/Archive/17802-17983/ISSM-17898-17899.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17898-17899.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17898-17899.diff	(revision 17986)
@@ -0,0 +1,245 @@
+Index: ../trunk-jpl/src/c/modules/Gradjx/Gradjx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/Gradjx/Gradjx.cpp	(revision 17898)
++++ ../trunk-jpl/src/c/modules/Gradjx/Gradjx.cpp	(revision 17899)
+@@ -65,3 +65,20 @@
+ 	xDelete<Vector<IssmDouble>*>(gradient_list);
+ 	xDelete<int>(control_type);
+ }
++void Gradjx(IssmDouble** pgradient,IssmDouble** pnorm_list, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters){
++
++	/*output: */
++	IssmDouble* gradient=NULL;
++
++	/*intermediary: */
++	Vector<IssmDouble>* vec_gradient=NULL;
++
++	Gradjx(&vec_gradient,pnorm_list,elements,nodes, vertices,loads,materials,parameters);
++	gradient=vec_gradient->ToMPISerial();
++
++	/*Free ressources:*/
++	delete vec_gradient;
++
++	/*Assign output pointers:*/
++	*pgradient=gradient;
++}
+Index: ../trunk-jpl/src/c/modules/Gradjx/Gradjx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/Gradjx/Gradjx.h	(revision 17898)
++++ ../trunk-jpl/src/c/modules/Gradjx/Gradjx.h	(revision 17899)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void Gradjx(Vector<IssmDouble>** pgrad_g,IssmDouble** pgrad_norm,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters);
++void Gradjx(IssmDouble** pgrad_g,IssmDouble** pgrad_norm,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters);
+ 
+ #endif  /* _GRADJX_H */
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17898)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17899)
+@@ -2,6 +2,7 @@
+  * \brief: core of the control solution 
+  */ 
+ 
++#include <config.h>
+ #include "./cores.h"
+ #include "../toolkits/toolkits.h"
+ #include "../classes/classes.h"
+@@ -14,54 +15,65 @@
+ extern "C" void *ctonbe_; // DIS mode : Conversion
+ extern "C" void *ctcabe_; // DIS mode : Conversion
+ extern "C" void *euclid_; // Scalar product
+-typedef void (*SimulFunc) (long*, long *, double [], double *, double [], long [], float [], double []);
+-extern "C" void m1qn3_ (void f(long*, long *, double [], double *, double [], long [], float [], double []),
++typedef void (*SimulFunc) (long* indic,long* n, double* x, double* pf,double* g,long [],float [],void* dzs);
++extern "C" void m1qn3_ (void f(long* indic,long* n, double* x, double* pf,double* g,long [],float [],void* dzs),
+ 			void **, void **, void **,
+ 			long *, double [], double *, double [], double*, double *,
+ 			double *, char [], long *, long *, long *, long *, long *, long *, long [], double [], long *,
+-			long *, long *, long [], float [], double []
+-			);
++			long *, long *, long [], float [],void* );
+ 
+-void simul(long* indic,long* n,double x[2],double* f,double g[2],long izs[1],float rzs[1],double dzs[1]){
+-	/*minimization of x^2+cy^4 where c>0 is a parameter*/
+-	double c=dzs[0];
+-	*f=x[0]*x[0]+c*x[1]*x[1]*x[1]*x[1];
+-	g[0]=2.*x[0];
+-	g[1]=4.*c*x[1]*x[1]*x[1];
+-}
++/*Cost function prototype*/
++void simul(long* indic,long* n,double* X,double* pf,double* G,long izs[1],float rzs[1],void* dzs);
+ 
+ void controlm1qn3_core(FemModel* femmodel){
+ 
+ 	/*Intermediaries*/
+-	long   omode; /*m1qn3 output flag*/
+-	double f;     /*cost function value*/
++	long         omode;
++	double       f; 
++	int          nsteps,maxiter;
++	int          intn,num_controls,solution_type;
++	IssmDouble  *X  = NULL;
++	IssmDouble  *G  = NULL;
++	IssmDouble  *XL = NULL;
++	IssmDouble  *XU = NULL;
+ 
++	/*Recover some parameters*/
++	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
++	femmodel->parameters->FindParam(&num_controls,InversionNumControlParametersEnum);
++	femmodel->parameters->FindParam(&nsteps,InversionNstepsEnum);
++	femmodel->parameters->SetParam(false,SaveResultsEnum);
++	maxiter=nsteps*10;
++
++	/*Initialize M1QN3 parameters*/
+ 	if(VerboseControl())_printf0_("   Initialize M1QN3 parameters\n");
+ 	SimulFunc costfuncion  = &simul;    /*Cost function address*/
+ 	void**    prosca       = &euclid_;  /*Dot product function (euclid is the default)*/
+ 	char      normtype[3];              /*Norm type: dfn = scalar product defined by prosca*/ strcpy(normtype, "dfn");
+-	double    dzs[1];                   /*Arrays used by m1qn3 subroutines*/
+ 	long      izs[5];                   /*Arrays used by m1qn3 subroutines*/
++	long      iz[5];                    /*Integer m1qn3 working array of size 5*/
+ 	float     rzs[1];                   /*Arrays used by m1qn3 subroutines*/
+ 	long      impres       = 0;         /*verbosity level*/
+ 	long      imode[3]     = {0};       /*scaling and starting mode, 0 by default*/
+ 	long      indic        = 4;         /*compute f and g*/
+ 	long      reverse      = 0;         /*reverse or direct mode*/
+-	long      iz[5];                    /*Integer m1qn3 working array of size 5*/
+ 	long      io           = 6;         /*Channel number for the output*/
+ 
+ 	/*Optimization criterions*/
+-	double    dxmin        = 1.e-10;    /*Resolution for the solution x*/
+-	double    epsrel       = 1.e-5;     /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
+-	long      niter        = 200;       /*Maximum number of iterations*/
+-	long      nsim         = 200;       /*Maximum number of function calls*/
++	double    dxmin        = 1.e-1;    /*Resolution for the solution x*/
++	double    epsrel       = 1.e-4;     /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
++	long      niter        = long(nsteps); /*Maximum number of iterations*/
++	long      nsim         = long(maxiter);/*Maximum number of function calls*/
+ 
++	/*Get initial guess*/
++	Vector<IssmDouble> *Xpetsc = NULL;
++	GetVectorFromControlInputsx(&Xpetsc,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"value");
++	X = Xpetsc->ToMPISerial();
++	Xpetsc->GetSize(&intn);
++	delete Xpetsc;
++
+ 	/*Get problem dimension and initialize gradient and initial guess*/
+-	long    n = 2;
+-	double* g = xNew<double>(n);
+-	double* x = xNew<double>(n);
+-	for(int i=0;i<n;i++) x[i]=5.;
+-	dzs[0] = 10; //c = 10 function parameter
++	long n = long(intn);
++	G = xNew<double>(n);
+ 
+ 	/*Allocate m1qn3 working arrays (see doc)*/
+ 	long      m   = 100;
+@@ -69,13 +81,18 @@
+ 	double*   dz  = xNew<double>(ndz);
+ 
+ 	if(VerboseControl())_printf0_("   Computing initial solution\n");
+-	simul(&indic,&n,x,&f,g,izs,rzs,&dzs[0]);
++	_printf0_("\n");
++	_printf0_("Cost function f(x)   |  List of contributions\n");
++	_printf0_("_____________________________________________\n");
++	indic = 0; //no adjoint required
++	simul(&indic,&n,X,&f,G,izs,rzs,(void*)femmodel);
+ 	double f1=f;
+ 
++	indic = 4; //adjoint and gradient required
+ 	m1qn3_(costfuncion,prosca,&ctonbe_,&ctcabe_,
+-				&n,x,&f,g,&dxmin,&f1,
++				&n,X,&f,G,&dxmin,&f1,
+ 				&epsrel,normtype,&impres,&io,imode,&omode,&niter,&nsim,iz,dz,&ndz,
+-				&reverse,&indic,izs,rzs,dzs);
++				&reverse,&indic,izs,rzs,(void*)femmodel);
+ 
+ 	switch(int(omode)){
+ 		case 0:  _printf0_("   Stop requested (indic = 0)\n"); break;
+@@ -89,16 +106,79 @@
+ 		default: _printf0_("   Unknown end condition\n");
+ 	}
+ 
+-	_printf0_(" == Final cost function = "<< f <<"\n");
+-	//_printf0_(" == Final x = ["<<x[0]<<" "<<x[1]<<"]\n");
++	/*Get solution*/
++	SetControlInputsFromVectorx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,X);
++	ControlInputSetGradientx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,G);
++	femmodel->OutputControlsx(&femmodel->results);
++	femmodel->results->AddObject(new GenericExternalResult<double>(JEnum,f,1,0));
+ 
++	/*Finalize*/
++	if(VerboseControl()) _printf0_("   preparing final solution\n");
++	femmodel->parameters->SetParam(true,SaveResultsEnum);
++	void (*solutioncore)(FemModel*)=NULL;
++	CorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type);
++	solutioncore(femmodel);
++
+ 	/*Clean-up and return*/
+-	xDelete<double>(g);
+-	xDelete<double>(x);
++	xDelete<double>(G);
++	xDelete<double>(X);
+ 	xDelete<double>(dz);
+ }
++
++/*Cost function definition*/
++void simul(long* indic,long* n,double* X,double* pf,double* G,long izs[1],float rzs[1],void* dzs){
++
++	/*Recover Femmodel*/
++	double      f;
++	int         intn,solution_type;
++	FemModel   *femmodel  = (FemModel*)dzs;
++
++	/*Recover responses*/
++	int         num_responses;
++	int        *responses = NULL;
++	femmodel->parameters->FindParam(&responses,&num_responses,InversionCostFunctionsEnum);
++
++	/*Update control input*/
++	SetControlInputsFromVectorx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,X);
++
++	/*Recover some parameters*/
++	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
++
++	/*Compute solution and adjoint*/
++	void (*solutioncore)(FemModel*)=NULL;
++	void (*adjointcore)(FemModel*)=NULL;
++	CorePointerFromSolutionEnum(&solutioncore,femmodel->parameters,solution_type);
++	solutioncore(femmodel);
++
++	/*Compute objective function*/
++	femmodel->CostFunctionx(pf);
++	_printf0_("f(x) = "<<setw(12)<<setprecision(7)<<*pf<<"  |  ");
++
++	/*Retrieve objective functions independently*/
++	for(int i=0;i<num_responses;i++){
++		femmodel->Responsex(&f,EnumToStringx(responses[i]));
++		_printf0_(" "<<setw(12)<<setprecision(7)<<f);
++	}
++	_printf0_("\n");
++
++	if(indic==0) return; /*dry run, no gradient required*/
++
++	/*Compute Adjoint*/
++	AdjointCorePointerFromSolutionEnum(&adjointcore,solution_type);
++	adjointcore(femmodel);
++
++	/*Compute gradient*/
++	IssmDouble* G2 = NULL;
++	Gradjx(&G2,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
++	for(long i=0;i<*n;i++) G[i] = -G2[i];
++
++	/*Clean-up and return*/
++	xDelete<int>(responses);
++	xDelete<IssmDouble>(G2);
++}
++
+ #else
+ void controlm1qn3_core(FemModel* femmodel){
+ 	_error_("M1QN3 not installed");
+ }
+-#endif //_HAVE_TAO_ 
++#endif //_HAVE_M1QN3_
Index: /issm/oecreview/Archive/17802-17983/ISSM-17899-17900.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17899-17900.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17899-17900.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17899)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17900)
+@@ -28,7 +28,7 @@
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+ 	5e-07,5e-07,1e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,\
+-	1e-07,1e-07,5e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06]
++	1e-06,1e-06,5e-05,1e-06,1e-07,1e-07,1e-07,1e-07,5e-07,1e-05]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17899)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17900)
+@@ -15,7 +15,7 @@
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+ 	5e-07,5e-07,1e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,...
+-	1e-07,1e-07,5e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06};
++	1e-06,1e-06,5e-05,1e-06,1e-07,1e-07,1e-07,1e-07,5e-07,1e-05};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17900-17901.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17900-17901.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17900-17901.diff	(revision 17986)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/externalpackages/m1qn3/install.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/m1qn3/install.sh	(revision 17900)
++++ ../trunk-jpl/externalpackages/m1qn3/install.sh	(revision 17901)
+@@ -12,12 +12,18 @@
+ tar -xzf m1qn3-3.3-distrib.tgz
+ mv m1qn3-3.3-distrib src
+ 
++if which ifort >/dev/null; then
++	FC="ifort"
++else
++	FC="gfortran"
++fi
++
+ #Compile m1qn3
+ cd src/src/
+ (
+ cat << EOF
+ LIB_EXT=a
+-FC=gfortran
++FC=$FC
+ install: libm1qn3.\$(LIB_EXT)
+ 	cp libm1qn3.\$(LIB_EXT) ../../install/
+ OBJECTS= m1qn3.o
+@@ -37,7 +43,7 @@
+ (
+ cat << EOF
+ LIB_EXT=a
+-FC=gfortran
++FC=$FC
+ install: libddot.\$(LIB_EXT)
+ 	cp libddot.\$(LIB_EXT) ../../install/
+ OBJECTS= ddot.o
Index: /issm/oecreview/Archive/17802-17983/ISSM-17901-17902.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17901-17902.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17901-17902.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17901)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17902)
+@@ -48,7 +48,7 @@
+ 	if(VerboseControl())_printf0_("   Initialize M1QN3 parameters\n");
+ 	SimulFunc costfuncion  = &simul;    /*Cost function address*/
+ 	void**    prosca       = &euclid_;  /*Dot product function (euclid is the default)*/
+-	char      normtype[3];              /*Norm type: dfn = scalar product defined by prosca*/ strcpy(normtype, "dfn");
++	char      normtype[]   = "dfn";     /*Norm type: dfn = scalar product defined by prosca*/
+ 	long      izs[5];                   /*Arrays used by m1qn3 subroutines*/
+ 	long      iz[5];                    /*Integer m1qn3 working array of size 5*/
+ 	float     rzs[1];                   /*Arrays used by m1qn3 subroutines*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17902-17903.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17902-17903.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17902-17903.diff	(revision 17986)
@@ -0,0 +1,35 @@
+Index: ../trunk-jpl/src/m/mech/thomasparams.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/thomasparams.py	(revision 17902)
++++ ../trunk-jpl/src/m/mech/thomasparams.py	(revision 17903)
+@@ -133,7 +133,7 @@
+ 		a=npy.zeros((md.mesh.numberofvertices,))
+ 	elif eq=='Weertman2D':
+ 		theta=1./9
+-		a=npy.ones((md.mesh.numberofvertices,1))
++		a=npy.ones((md.mesh.numberofvertices,))
+ 	elif eq=='Thomas':
+ 		theta=((1.+a+a**2+b**2)**((n-1.)/2.))/(npy.abs(2.+a)**n)
+ 	else:
+Index: ../trunk-jpl/src/m/mech/analyticaldamage.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/analyticaldamage.py	(revision 17902)
++++ ../trunk-jpl/src/m/mech/analyticaldamage.py	(revision 17903)
+@@ -52,7 +52,7 @@
+ 	if 'sigmab' in kwargs: del kwargs['sigmab']
+ 	assert len(kwargs)==0, 'error, unexpected or misspelled kwargs'
+ 
+-	if len(sigmab)==1:
++	if isinstance(sigmab,(int,float)):
+ 		sigmab=sigmab*npy.ones((md.mesh.numberofvertices,))
+ 
+ 	# check inputs
+@@ -82,7 +82,7 @@
+ 	D[pos]=0
+ 	
+ 	backstress=npy.zeros((md.mesh.numberofvertices,))
+-	
++
+ 	# backstress to bring D down to one 
+ 	backstress[pos]=T[pos]-(1.-D[pos])*B[pos]*npy.sign(ex[pos])*(2.+a[pos])*npy.abs(ex[pos])**(1./n[pos])/(1.+a[pos]+a[pos]**2)**((n[pos]-1.)/2./n[pos])
+ 	
Index: /issm/oecreview/Archive/17802-17983/ISSM-17903-17904.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17903-17904.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17903-17904.diff	(revision 17986)
@@ -0,0 +1,70 @@
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17903)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17904)
+@@ -147,18 +147,18 @@
+ 			%process cost functions
+ 			num_cost_functions=size(obj.cost_functions,2);
+ 			data=obj.cost_functions;
+-			pos=find(data==101); data(pos)=SurfaceAbsVelMisfitEnum();
+-			pos=find(data==102); data(pos)=SurfaceRelVelMisfitEnum();
+-			pos=find(data==103); data(pos)=SurfaceLogVelMisfitEnum();
+-			pos=find(data==104); data(pos)=SurfaceLogVxVyMisfitEnum();
+-			pos=find(data==105); data(pos)=SurfaceAverageVelMisfitEnum();
+-			pos=find(data==201); data(pos)=ThicknessAbsMisfitEnum();
+-			pos=find(data==501); data(pos)=DragCoefficientAbsGradientEnum();
+-			pos=find(data==502); data(pos)=RheologyBbarAbsGradientEnum();
+-			pos=find(data==503); data(pos)=ThicknessAbsGradientEnum();
+-			pos=find(data==504); data(pos)=ThicknessAlongGradientEnum();
+-			pos=find(data==505); data(pos)=ThicknessAcrossGradientEnum();
+-			pos=find(data==506); data(pos)=BalancethicknessMisfitEnum();
++			pos=find(obj.cost_functions==101); data(pos)=SurfaceAbsVelMisfitEnum();
++			pos=find(obj.cost_functions==102); data(pos)=SurfaceRelVelMisfitEnum();
++			pos=find(obj.cost_functions==103); data(pos)=SurfaceLogVelMisfitEnum();
++			pos=find(obj.cost_functions==104); data(pos)=SurfaceLogVxVyMisfitEnum();
++			pos=find(obj.cost_functions==105); data(pos)=SurfaceAverageVelMisfitEnum();
++			pos=find(obj.cost_functions==201); data(pos)=ThicknessAbsMisfitEnum();
++			pos=find(obj.cost_functions==501); data(pos)=DragCoefficientAbsGradientEnum();
++			pos=find(obj.cost_functions==502); data(pos)=RheologyBbarAbsGradientEnum();
++			pos=find(obj.cost_functions==503); data(pos)=ThicknessAbsGradientEnum();
++			pos=find(obj.cost_functions==504); data(pos)=ThicknessAlongGradientEnum();
++			pos=find(obj.cost_functions==505); data(pos)=ThicknessAcrossGradientEnum();
++			pos=find(obj.cost_functions==506); data(pos)=BalancethicknessMisfitEnum();
+ 			WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
+ 			WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/taoinversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17903)
++++ ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17904)
+@@ -147,18 +147,18 @@
+ 			%process cost functions
+ 			num_cost_functions=size(obj.cost_functions,2);
+ 			data=obj.cost_functions;
+-			pos=find(data==101); data(pos)=SurfaceAbsVelMisfitEnum();
+-			pos=find(data==102); data(pos)=SurfaceRelVelMisfitEnum();
+-			pos=find(data==103); data(pos)=SurfaceLogVelMisfitEnum();
+-			pos=find(data==104); data(pos)=SurfaceLogVxVyMisfitEnum();
+-			pos=find(data==105); data(pos)=SurfaceAverageVelMisfitEnum();
+-			pos=find(data==201); data(pos)=ThicknessAbsMisfitEnum();
+-			pos=find(data==501); data(pos)=DragCoefficientAbsGradientEnum();
+-			pos=find(data==502); data(pos)=RheologyBbarAbsGradientEnum();
+-			pos=find(data==503); data(pos)=ThicknessAbsGradientEnum();
+-			pos=find(data==504); data(pos)=ThicknessAlongGradientEnum();
+-			pos=find(data==505); data(pos)=ThicknessAcrossGradientEnum();
+-			pos=find(data==506); data(pos)=BalancethicknessMisfitEnum();
++			pos=find(obj.cost_functions==101); data(pos)=SurfaceAbsVelMisfitEnum();
++			pos=find(obj.cost_functions==102); data(pos)=SurfaceRelVelMisfitEnum();
++			pos=find(obj.cost_functions==103); data(pos)=SurfaceLogVelMisfitEnum();
++			pos=find(obj.cost_functions==104); data(pos)=SurfaceLogVxVyMisfitEnum();
++			pos=find(obj.cost_functions==105); data(pos)=SurfaceAverageVelMisfitEnum();
++			pos=find(obj.cost_functions==201); data(pos)=ThicknessAbsMisfitEnum();
++			pos=find(obj.cost_functions==501); data(pos)=DragCoefficientAbsGradientEnum();
++			pos=find(obj.cost_functions==502); data(pos)=RheologyBbarAbsGradientEnum();
++			pos=find(obj.cost_functions==503); data(pos)=ThicknessAbsGradientEnum();
++			pos=find(obj.cost_functions==504); data(pos)=ThicknessAlongGradientEnum();
++			pos=find(obj.cost_functions==505); data(pos)=ThicknessAcrossGradientEnum();
++			pos=find(obj.cost_functions==506); data(pos)=BalancethicknessMisfitEnum();
+ 			WriteData(fid,'data',data,'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3);
+ 			WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer');
+ 		end % }}}
Index: /issm/oecreview/Archive/17802-17983/ISSM-17904-17905.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17904-17905.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17904-17905.diff	(revision 17986)
@@ -0,0 +1,65 @@
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17904)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17905)
+@@ -34,8 +34,6 @@
+ 	int          intn,num_controls,solution_type;
+ 	IssmDouble  *X  = NULL;
+ 	IssmDouble  *G  = NULL;
+-	IssmDouble  *XL = NULL;
+-	IssmDouble  *XU = NULL;
+ 
+ 	/*Recover some parameters*/
+ 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+@@ -138,6 +136,16 @@
+ 	int        *responses = NULL;
+ 	femmodel->parameters->FindParam(&responses,&num_responses,InversionCostFunctionsEnum);
+ 
++	/*Constrain input vector*/
++	IssmDouble  *XL = NULL;
++	IssmDouble  *XU = NULL;
++	GetVectorFromControlInputsx(&XL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound");
++	GetVectorFromControlInputsx(&XU,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"upperbound");
++	for(long i=0;i<*n;i++){
++		if(X[i]>XU[i]) X[i]=XU[i];
++		if(X[i]<XL[i]) X[i]=XL[i];
++	}
++
+ 	/*Update control input*/
+ 	SetControlInputsFromVectorx(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,X);
+ 
+@@ -161,7 +169,13 @@
+ 	}
+ 	_printf0_("\n");
+ 
+-	if(indic==0) return; /*dry run, no gradient required*/
++	if(indic==0){
++		/*dry run, no gradient required*/
++		xDelete<int>(responses);
++		xDelete<IssmDouble>(XU);
++		xDelete<IssmDouble>(XL);
++		return;
++	}
+ 
+ 	/*Compute Adjoint*/
+ 	AdjointCorePointerFromSolutionEnum(&adjointcore,solution_type);
+@@ -171,10 +185,18 @@
+ 	IssmDouble* G2 = NULL;
+ 	Gradjx(&G2,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+ 	for(long i=0;i<*n;i++) G[i] = -G2[i];
++	xDelete<IssmDouble>(G2);
+ 
++	/*Constrain Gradient*/
++	for(long i=0;i<*n;i++){
++		if(X[i]>=XU[i]) G[i]=0.;
++		if(X[i]<=XL[i]) G[i]=0.;
++	}
++
+ 	/*Clean-up and return*/
+ 	xDelete<int>(responses);
+-	xDelete<IssmDouble>(G2);
++	xDelete<IssmDouble>(XU);
++	xDelete<IssmDouble>(XL);
+ }
+ 
+ #else
Index: /issm/oecreview/Archive/17802-17983/ISSM-17905-17906.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17905-17906.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17905-17906.diff	(revision 17986)
@@ -0,0 +1,206 @@
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 17906)
+@@ -0,0 +1,176 @@
++import numpy
++import copy
++from fielddisplay import fielddisplay
++from EnumDefinitions import *
++from StringToEnum import StringToEnum
++from checkfield import checkfield
++from WriteData import WriteData
++
++class m1qn3inversion(object):
++	'''
++	M1QN3 class definition
++
++   Usage:
++      m1qn3inversion=m1qn3inversion()
++	'''
++
++	def __init__(self,*args): # {{{
++
++		if not len(args):
++			print 'empty init'
++			self.iscontrol                   = 0
++			self.incomplete_adjoint          = 0
++			self.control_parameters          = float('NaN')
++			self.nsteps                      = 0
++			self.cost_functions              = float('NaN')
++			self.cost_functions_coefficients = float('NaN')
++			self.min_parameters              = float('NaN')
++			self.max_parameters              = float('NaN')
++			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')
++
++			#set defaults
++			self.setdefaultparameters()
++		elif len(args)==1 and args[0].__module__=='inversion':
++			print 'converting inversion to m1qn3inversion'
++			inv=args[0]
++			self.iscontrol                   = inv.iscontrol
++			self.incomplete_adjoint          = inv.incomplete_adjoint
++			self.control_parameters          = inv.control_parameters
++			self.nsteps                      = inv.nsteps
++			self.cost_functions              = inv.cost_functions
++			self.cost_functions_coefficients = inv.cost_functions_coefficients
++			self.min_parameters              = inv.min_parameters
++			self.max_parameters              = inv.max_parameters
++			self.vx_obs                      = inv.vx_obs
++			self.vy_obs                      = inv.vy_obs
++			self.vz_obs                      = inv.vz_obs
++			self.vel_obs                     = inv.vel_obs
++			self.thickness_obs               = inv.thickness_obs
++		else:
++			raise Exception('constructor not supported')
++		#}}}
++	def __repr__(self): # {{{
++		string='   m1qn3inversion parameters:'
++		string="%s\n%s"%(string,fielddisplay(self,'iscontrol','is inversion activated?'))
++		string="%s\n%s"%(string,fielddisplay(self,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity'))
++		string="%s\n%s"%(string,fielddisplay(self,'control_parameters','ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}'))
++		string="%s\n%s"%(string,fielddisplay(self,'nsteps','number of optimization searches'))
++		string="%s\n%s"%(string,fielddisplay(self,'cost_functions','indicate the type of response for each optimization step'))
++		string="%s\n%s"%(string,fielddisplay(self,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter'))
++		string="%s\n%s"%(string,fielddisplay(self,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex'))
++		string="%s\n%s"%(string,fielddisplay(self,'max_parameters','absolute maximum acceptable value of the inversed parameter on each vertex'))
++		string="%s\n%s"%(string,fielddisplay(self,'vx_obs','observed velocity x component [m/yr]'))
++		string="%s\n%s"%(string,fielddisplay(self,'vy_obs','observed velocity y component [m/yr]'))
++		string="%s\n%s"%(string,fielddisplay(self,'vel_obs','observed velocity magnitude [m/yr]'))
++		string="%s\n%s"%(string,fielddisplay(self,'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
++		#}}}
++	def setdefaultparameters(self): # {{{
++		
++		#default is incomplete adjoint for now
++		self.incomplete_adjoint=1
++
++		#parameter to be inferred by control methods (only
++		#drag and B are supported yet)
++		self.control_parameters='FrictionCoefficient'
++
++		#number of steps in the control methods
++		self.nsteps=20
++
++		#several responses can be used:
++		self.cost_functions=101
++
++		return self
++	#}}}
++	def checkconsistency(self,md,solution,analyses):    # {{{
++
++		#Early return
++		if not self.iscontrol:
++			return md
++
++		num_controls=numpy.size(md.inversion.control_parameters)
++		num_costfunc=numpy.size(md.inversion.cost_functions)
++
++		md = checkfield(md,'fieldname','inversion.iscontrol','values',[0,1])
++		md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1])
++		md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy','Thickness'])
++		md = checkfield(md,'fieldname','inversion.nsteps','numel',[1],'>=',0)
++		md = checkfield(md,'fieldname','inversion.cost_functions','size',[num_costfunc],'values',[101,102,103,104,105,201,501,502,503,504,505])
++		md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices,num_costfunc],'>=',0)
++		md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices,num_controls])
++		md = checkfield(md,'fieldname','inversion.max_parameters','size',[md.mesh.numberofvertices,num_controls])
++
++		if solution==BalancethicknessSolutionEnum():
++			md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices],'NaN',1)
++		else:
++			md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices],'NaN',1)
++			md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices],'NaN',1)
++
++		return md
++	# }}}
++	def marshall(self,md,fid):    # {{{
++
++		yts=365.0*24.0*3600.0
++
++		WriteData(fid,'object',self,'class','inversion','fieldname','iscontrol','format','Boolean')
++		WriteData(fid,'enum',InversionTypeEnum(),'data',2,'format','Integer')
++		if not self.iscontrol:
++			return
++		WriteData(fid,'object',self,'class','inversion','fieldname','incomplete_adjoint','format','Boolean')
++		WriteData(fid,'object',self,'class','inversion','fieldname','nsteps','format','Integer')
++		WriteData(fid,'object',self,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1)
++		WriteData(fid,'object',self,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3)
++		WriteData(fid,'object',self,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3)
++		WriteData(fid,'object',self,'class','inversion','fieldname','vx_obs','format','DoubleMat','mattype',1,'scale',1./yts)
++		WriteData(fid,'object',self,'class','inversion','fieldname','vy_obs','format','DoubleMat','mattype',1,'scale',1./yts)
++		WriteData(fid,'object',self,'class','inversion','fieldname','vz_obs','format','DoubleMat','mattype',1,'scale',1./yts)
++		WriteData(fid,'object',self,'class','inversion','fieldname','thickness_obs','format','DoubleMat','mattype',1)
++
++		#process control parameters
++		num_control_parameters=len(self.control_parameters)
++		data=numpy.array([StringToEnum(control_parameter)[0] for control_parameter in self.control_parameters]).reshape(1,-1)
++		WriteData(fid,'data',data,'enum',InversionControlParametersEnum(),'format','DoubleMat','mattype',3)
++		WriteData(fid,'data',num_control_parameters,'enum',InversionNumControlParametersEnum(),'format','Integer')
++
++		#process cost functions
++		num_cost_functions=numpy.size(self.cost_functions)
++		data=copy.deepcopy(self.cost_functions)
++		pos=[i for i,x in enumerate(self.cost_functions) if x==101];
++		for i in pos: data[i]=SurfaceAbsVelMisfitEnum()        
++		pos=[i for i,x in enumerate(self.cost_functions) if x==102];
++		for i in pos: data[i]=SurfaceRelVelMisfitEnum()        
++		pos=[i for i,x in enumerate(self.cost_functions) if x==103];
++		for i in pos: data[i]=SurfaceLogVelMisfitEnum()        
++		pos=[i for i,x in enumerate(self.cost_functions) if x==104];
++		for i in pos: data[i]=SurfaceLogVxVyMisfitEnum()       
++		pos=[i for i,x in enumerate(self.cost_functions) if x==105];
++		for i in pos: data[i]=SurfaceAverageVelMisfitEnum()    
++		pos=[i for i,x in enumerate(self.cost_functions) if x==201];
++		for i in pos: data[i]=ThicknessAbsMisfitEnum()         
++		pos=[i for i,x in enumerate(self.cost_functions) if x==501];
++		for i in pos: data[i]=DragCoefficientAbsGradientEnum() 
++		pos=[i for i,x in enumerate(self.cost_functions) if x==502];
++		for i in pos: data[i]=RheologyBbarAbsGradientEnum()    
++		pos=[i for i,x in enumerate(self.cost_functions) if x==503];
++		for i in pos: data[i]=ThicknessAbsGradientEnum()       
++		pos=[i for i,x in enumerate(self.cost_functions) if x==504];
++		for i in pos: data[i]=ThicknessAlongGradientEnum()     
++		pos=[i for i,x in enumerate(self.cost_functions) if x==505];
++		for i in pos: data[i]=ThicknessAcrossGradientEnum()    
++		WriteData(fid,'data',numpy.array(data).reshape(1,-1),'enum',InversionCostFunctionsEnum(),'format','DoubleMat','mattype',3)
++		WriteData(fid,'data',num_cost_functions,'enum',InversionNumCostFunctionsEnum(),'format','Integer')
++	# }}}
+Index: ../trunk-jpl/src/m/classes/inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.py	(revision 17905)
++++ ../trunk-jpl/src/m/classes/inversion.py	(revision 17906)
+@@ -11,7 +11,7 @@
+ 	INVERSION class definition
+ 
+ 	   Usage:
+-	      inversion=inversion();
++	      inversion=inversion()
+ 	"""
+ 
+ 	def __init__(self): # {{{
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17905)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17906)
+@@ -145,7 +145,6 @@
+ 				md = checkfield(md,'fieldname','damage.D','>=',0,'<=',obj.max_damage,'size',[md.mesh.numberofvertices 1]);
+ 				md = checkfield(md,'fieldname','damage.spcdamage','forcing',1);
+ 				md = checkfield(md,'fieldname','damage.max_damage','<',1,'>=',0);
+-				
+ 				md = checkfield(md,'fieldname','damage.stabilization','numel',[1],'values',[0 1 2]);
+ 				md = checkfield(md,'fieldname','damage.maxiter','>=0',0);
+ 				md = checkfield(md,'fieldname','damage.elementinterp','values',{'P1','P2'});
Index: /issm/oecreview/Archive/17802-17983/ISSM-17906-17907.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17906-17907.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17906-17907.diff	(revision 17986)
@@ -0,0 +1,492 @@
+Index: ../trunk-jpl/src/c/analyses/Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17906)
++++ ../trunk-jpl/src/c/analyses/Analysis.h	(revision 17907)
+@@ -16,6 +16,7 @@
+ class ElementVector;
+ class ElementMatrix;
+ class Gauss;
++class FemModel;
+ 
+ class Analysis{
+ 
+Index: ../trunk-jpl/src/c/shared/Numerics/OptArgs.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/OptArgs.h	(revision 17906)
++++ ../trunk-jpl/src/c/shared/Numerics/OptArgs.h	(revision 17907)
+@@ -1,14 +0,0 @@
+-/*!\file:  OptArgs.h
+- * \brief place holder for optimization function arguments
+- */ 
+-
+-#ifndef _OPTARGS_H_
+-#define _OPTARGS_H_
+-
+-class FemModel;
+-
+-struct OptArgs{
+-	FemModel* femmodel;
+-};
+-
+-#endif
+Index: ../trunk-jpl/src/c/shared/Numerics/OptimalSearch.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/OptimalSearch.cpp	(revision 17906)
++++ ../trunk-jpl/src/c/shared/Numerics/OptimalSearch.cpp	(revision 17907)
+@@ -1,97 +0,0 @@
+-/*!\file:  OptimalSearch.cpp
+- * \brief optimization algorithm
+- */ 
+-
+-#ifdef HAVE_CONFIG_H
+-	#include <config.h>
+-#else
+-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+-#endif
+-
+-#include <float.h>
+-
+-#include "../Exceptions/exceptions.h"
+-#include "../io/io.h"
+-#include "../MemOps/MemOps.h"
+-#include "./Verbosity.h"
+-#include "./OptPars.h"
+-#include "./OptArgs.h"
+-#include "./types.h"
+-#include "./isnan.h"
+-
+-void OptimalSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){
+-
+-	/* This routine is optimizing a given function*/
+-
+-	/*function values: */
+-	IssmDouble fx1,fx2,fxbest;
+-	IssmDouble x1,x2,xmin,xbest;
+-
+-	/*tolerances: */
+-	IssmDouble seps;
+-	IssmDouble tolerance=1.e-4;
+-	int    maxiter;
+-
+-	/*counters: */
+-	int  iter=0;
+-	bool loop;
+-
+-	/*Recover parameters:*/
+-	xmin     =optpars->xmin;
+-	x1       =optpars->xmin;
+-	x2       =optpars->xmax;
+-	maxiter  =optpars->maxiter;
+-
+-	//get the value of the function at the first boundary
+-	fx1= (*f)(x1,optargs);
+-	if (xIsNan<IssmDouble>(fx1)) _error_("Function evaluation returned NaN");
+-	cout<<setprecision(5);
+-	if(VerboseControl()) _printf0_("\n");
+-	if(VerboseControl()) _printf0_("       Iteration         x           f(x)       Tolerance\n");
+-	if(VerboseControl()) _printf0_("\n");
+-	if(VerboseControl()) _printf0_("           N/A    "<<setw(12)<<x1<<"  "<<setw(12)<<fx1<<"           N/A\n");
+-
+-	//update tolerances
+-	seps=sqrt(DBL_EPSILON);
+-
+-	loop=true;
+-	while(loop){
+-
+-		/*get f(x2)*/
+-		iter++;
+-		fx2 = (*f)(x2,optargs);
+-		if (xIsNan<IssmDouble>(fx2)) _error_("Function evaluation returned NaN");
+-		if(VerboseControl())
+-		 _printf0_("         "<<setw(5)<<iter<<"    "<<setw(12)<<x2<<"  "<<setw(12)<<fx2<<"  "<<(fabs(x2-x1)>fabs(fx2-fx1)?fabs(fx2-fx1):fabs(x2-x1)) << "\n");
+-
+-		//Stop the optimization?
+-		if ((fabs(x2-x1)+seps)<tolerance || (fabs(fx2-fx1)+seps)<tolerance){
+-			if(VerboseControl()) _printf0_("      " << "optimization terminated: the current x satisfies the termination criteria using 'tolx' of "  << tolerance << "\n");
+-			loop=false;
+-		}
+-		else if (iter>=maxiter){
+-			if(VerboseControl()) _printf0_("      " << "exiting: Maximum number of iterations has been exceeded  - increase 'maxiter'\n");
+-			loop=false;
+-		}
+-		else{
+-			//continue
+-			loop=true;
+-		}
+-
+-		/*Compute x2*/
+-		if(fx2<fx1){
+-			xbest=x2; fxbest=fx2;
+-			x1=x2;
+-			x2=xmin+1.1*(x2-xmin); 
+-			fx1=fx2;
+-		}
+-		else{
+-			xbest=x1; fxbest=fx1;
+-			x2=xmin+0.5*(x2-xmin);
+-		}
+-	}//end while
+-
+-	/*Assign output pointers: */
+-	*psearch_scalar=xbest;
+-	*pJ=fxbest;
+-}
+Index: ../trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp	(revision 17906)
++++ ../trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp	(revision 17907)
+@@ -16,11 +16,10 @@
+ #include "../MemOps/MemOps.h"
+ #include "./Verbosity.h"
+ #include "./OptPars.h"
+-#include "./OptArgs.h"
+ #include "./types.h"
+ #include "./isnan.h"
+ 
+-void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs* optargs){
++void BrentSearch(IssmDouble* psearch_scalar,IssmDouble* pJ,OptPars* optpars,IssmDouble (*f)(IssmDouble,void*),void* optargs){
+ 
+ 	/* This routine is optimizing a given function using Brent's method
+ 	 * (Golden or parabolic procedure)*/
+Index: ../trunk-jpl/src/c/shared/Numerics/numerics.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 17906)
++++ ../trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 17907)
+@@ -17,7 +17,6 @@
+ #include "./recast.h"
+ #include "./types.h"
+ #include "./constants.h"
+-#include "./OptArgs.h"
+ #include "./OptPars.h"
+ 
+ IssmDouble  min(IssmDouble a,IssmDouble b);
+@@ -30,9 +29,7 @@
+ 
+ int         min(int a,int b);
+ int         max(int a,int b);
+-IssmDouble  OptFunc(IssmDouble scalar, OptArgs *optargs);
+-void        BrentSearch(IssmDouble *psearch_scalar,IssmDouble*pJ,OptPars*optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs*optargs);
+-void        OptimalSearch(IssmDouble *psearch_scalar,IssmDouble*pJ,OptPars*optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs*optargs);
++void        BrentSearch(IssmDouble *psearch_scalar,IssmDouble*pJ,OptPars*optpars,IssmDouble (*f)(IssmDouble,void*),void* optargs);
+ void        cross(IssmDouble *result,IssmDouble*vector1,IssmDouble*vector2);
+ void        XZvectorsToCoordinateSystem(IssmDouble *T,IssmDouble*xzvectors);
+ int         cubic(IssmDouble a, IssmDouble b, IssmDouble c, IssmDouble d, double X[3], int *num);
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17906)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17907)
+@@ -208,7 +208,6 @@
+ 					./shared/Numerics/NewtonSolveDnorm.cpp\
+ 					./shared/Numerics/extrema.cpp\
+ 					./shared/Numerics/XZvectorsToCoordinateSystem.cpp\
+-					./shared/Numerics/OptArgs.h\
+ 					./shared/Numerics/OptPars.h\
+ 					./shared/Exceptions/exceptions.h\
+ 					./shared/Exceptions/Exceptions.cpp\
+@@ -419,11 +418,9 @@
+ 					./classes/Inputs/ControlInput.h\
+ 					./classes/Inputs/ControlInput.cpp\
+ 					./shared/Numerics/BrentSearch.cpp\
+-					./shared/Numerics/OptimalSearch.cpp \
+ 					./cores/control_core.cpp\
+ 					./cores/controltao_core.cpp\
+ 					./cores/controlm1qn3_core.cpp\
+-					./cores/objectivefunction.cpp\
+ 					./cores/gradient_core.cpp\
+ 					./cores/adjointstressbalance_core.cpp\
+ 					./cores/adjointbalancethickness_core.cpp\
+Index: ../trunk-jpl/src/c/cores/objectivefunction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/objectivefunction.cpp	(revision 17906)
++++ ../trunk-jpl/src/c/cores/objectivefunction.cpp	(revision 17907)
+@@ -1,77 +0,0 @@
+-/*!\file:  objectivefunction
+- * \brief  objective function that returns a misfit, for a certain parameter.
+- */ 
+-
+-/*include files: {{{*/
+-#ifdef HAVE_CONFIG_H
+-	#include <config.h>
+-#else
+-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+-#endif
+-#include "./cores.h"
+-#include "../toolkits/toolkits.h"
+-#include "../classes/classes.h"
+-#include "../shared/shared.h"
+-#include "../solutionsequences/solutionsequences.h"
+-#include "../modules/modules.h"
+-/*}}}*/
+-
+-IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs){
+-
+-	/*output: */
+-	IssmDouble J;
+-
+-	/*parameters: */
+-	int        solution_type,analysis_type;
+-	bool       isFS       = false;
+-	bool       conserve_loads = true;
+-	FemModel  *femmodel       = NULL;
+-
+-	/*Recover finite element model: */
+-	femmodel=optargs->femmodel;
+-
+-	/*Recover parameters: */
+-	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
+-	femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+-
+-	/*set analysis type to compute velocity: */
+-	if (solution_type==SteadystateSolutionEnum || solution_type==StressbalanceSolutionEnum){
+-		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
+-	}
+-	else if (solution_type==BalancethicknessSolutionEnum){
+-		femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
+-	}
+-	else if (solution_type==BalancethicknessSoftSolutionEnum){
+-		femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
+-	}
+-	else{
+-		_error_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
+-	}
+-
+-	/*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 stressbalance with updated inputs: */
+-	if (solution_type==SteadystateSolutionEnum){
+-		stressbalance_core(femmodel);	//We need a 3D velocity!! (vz is required for the next thermal run)
+-	}
+-	else if (solution_type==StressbalanceSolutionEnum){
+-		solutionsequence_nonlinear(femmodel,conserve_loads); 
+-	}
+-	else if (solution_type==BalancethicknessSolutionEnum){
+-		solutionsequence_linear(femmodel); 
+-	}
+-	else if (solution_type==BalancethicknessSoftSolutionEnum){
+-		/*Don't do anything*/
+-	}
+-	else{
+-		_error_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
+-	}
+-
+-	/*Compute misfit for this velocity field.*/
+-	femmodel->CostFunctionx(&J);
+-
+-	/*Free ressources:*/
+-	return J;
+-}
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17906)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17907)
+@@ -159,15 +159,14 @@
+ 	solutioncore(femmodel);
+ 
+ 	/*Compute objective function*/
+-	femmodel->CostFunctionx(pf);
++	IssmDouble* Jlist = NULL;
++	femmodel->CostFunctionx(pf,&Jlist,NULL);
+ 	_printf0_("f(x) = "<<setw(12)<<setprecision(7)<<*pf<<"  |  ");
+ 
+ 	/*Retrieve objective functions independently*/
+-	for(int i=0;i<num_responses;i++){
+-		femmodel->Responsex(&f,EnumToStringx(responses[i]));
+-		_printf0_(" "<<setw(12)<<setprecision(7)<<f);
+-	}
++	for(int i=0;i<num_responses;i++) _printf0_(" "<<setw(12)<<setprecision(7)<<Jlist[i]);
+ 	_printf0_("\n");
++	xDelete<IssmDouble>(Jlist);
+ 
+ 	if(indic==0){
+ 		/*dry run, no gradient required*/
+Index: ../trunk-jpl/src/c/cores/cores.h
+===================================================================
+--- ../trunk-jpl/src/c/cores/cores.h	(revision 17906)
++++ ../trunk-jpl/src/c/cores/cores.h	(revision 17907)
+@@ -6,7 +6,6 @@
+ #define _CORES_H_
+ 
+ /*forward declarations: */
+-struct OptArgs;
+ class FemModel;
+ class Parameters;
+ template <class doubletype> class Matrix;
+@@ -44,7 +43,7 @@
+ void dummy_core(FemModel* femmodel);
+ void gia_core(FemModel* femmodel);
+ void damage_core(FemModel* femmodel);
+-IssmDouble objectivefunction(IssmDouble search_scalar,OptArgs* optargs);
++IssmDouble objectivefunction(IssmDouble search_scalar,FemModel* femmodel);
+ 
+ //optimization
+ int GradJSearch(IssmDouble* search_vector,FemModel* femmodel,int step);
+Index: ../trunk-jpl/src/c/cores/control_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/control_core.cpp	(revision 17906)
++++ ../trunk-jpl/src/c/cores/control_core.cpp	(revision 17907)
+@@ -11,6 +11,7 @@
+ 
+ /*Local prototypes*/
+ bool controlconvergence(IssmDouble J, IssmDouble tol_cm);
++IssmDouble objectivefunction(IssmDouble search_scalar,void* optargs);
+ 
+ void control_core(FemModel* femmodel){
+ 
+@@ -30,7 +31,6 @@
+ 
+ 	/*intermediary: */
+ 	IssmDouble search_scalar = 1.;
+-	OptArgs    optargs;
+ 	OptPars    optpars;
+ 
+ 	/*Solution and Adjoint core pointer*/
+@@ -64,7 +64,6 @@
+ 	J=xNew<IssmDouble>(nsteps);
+ 
+ 	/*Initialize some of the BrentSearch arguments: */
+-	optargs.femmodel=femmodel;
+ 	optpars.xmin=0; optpars.xmax=1;
+ 
+ 	/*Start looping: */
+@@ -83,7 +82,7 @@
+ 
+ 		if(VerboseControl()) _printf0_("   optimizing along gradient direction\n");
+ 		optpars.maxiter=reCast<int,IssmDouble>(maxiter[n]); optpars.cm_jump=cm_jump[n];
+-		BrentSearch(&search_scalar,J+n,&optpars,&objectivefunction,&optargs);
++		BrentSearch(&search_scalar,J+n,&optpars,&objectivefunction,(void*)femmodel);
+ 
+ 		if(VerboseControl()) _printf0_("   updating parameter using optimized search scalar\n"); //true means update save controls
+ 		InputControlUpdatex(femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,search_scalar,true);
+@@ -127,3 +126,60 @@
+ 
+ 	return converged;
+ }
++
++IssmDouble objectivefunction(IssmDouble search_scalar,void* optargs){
++
++	/*output: */
++	IssmDouble J;
++
++	/*parameters: */
++	int        solution_type,analysis_type;
++	bool       isFS       = false;
++	bool       conserve_loads = true;
++	FemModel  *femmodel       = (FemModel*)optargs;
++
++	/*Recover parameters: */
++	femmodel->parameters->FindParam(&isFS,FlowequationIsFSEnum);
++	femmodel->parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
++
++	/*set analysis type to compute velocity: */
++	if (solution_type==SteadystateSolutionEnum || solution_type==StressbalanceSolutionEnum){
++		femmodel->SetCurrentConfiguration(StressbalanceAnalysisEnum);
++	}
++	else if (solution_type==BalancethicknessSolutionEnum){
++		femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
++	}
++	else if (solution_type==BalancethicknessSoftSolutionEnum){
++		femmodel->SetCurrentConfiguration(BalancethicknessAnalysisEnum);
++	}
++	else{
++		_error_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
++	}
++
++	/*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 stressbalance with updated inputs: */
++	if (solution_type==SteadystateSolutionEnum){
++		stressbalance_core(femmodel);	//We need a 3D velocity!! (vz is required for the next thermal run)
++	}
++	else if (solution_type==StressbalanceSolutionEnum){
++		solutionsequence_nonlinear(femmodel,conserve_loads); 
++	}
++	else if (solution_type==BalancethicknessSolutionEnum){
++		solutionsequence_linear(femmodel); 
++	}
++	else if (solution_type==BalancethicknessSoftSolutionEnum){
++		/*Don't do anything*/
++	}
++	else{
++		_error_("Solution " << EnumToStringx(solution_type) << " not implemented yet");
++	}
++
++	/*Compute misfit for this velocity field.*/
++	femmodel->CostFunctionx(&J,NULL,NULL);
++
++	/*Free ressources:*/
++	return J;
++}
+Index: ../trunk-jpl/src/c/cores/controltao_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controltao_core.cpp	(revision 17906)
++++ ../trunk-jpl/src/c/cores/controltao_core.cpp	(revision 17907)
+@@ -134,7 +134,7 @@
+ 	adjointcore(femmodel);
+ 
+ 	/*Compute objective function*/
+-	femmodel->CostFunctionx(fcn);
++	femmodel->CostFunctionx(fcn,NULL,NULL);
+ 
+ 	/*Compute gradient*/
+ 	Gradjx(&gradient,NULL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters);
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17906)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17907)
+@@ -1173,7 +1173,7 @@
+ 	*pJ=J;
+ }
+ /*}}}*/
+-void FemModel::CostFunctionx(IssmDouble* pJ){/*{{{*/
++void FemModel::CostFunctionx(IssmDouble* pJ,IssmDouble** pJlist,int* pn){/*{{{*/
+ 
+ 	/*Intermediary*/
+ 	int      num_responses;
+@@ -1187,21 +1187,23 @@
+ 	/*Get the value of all cost functions*/
+ 	this->RequestedOutputsx(&cost_functions,responses,num_responses);
+ 
+-	/*Add all contributions one by one*/
+-	IssmDouble J=0;
+-	//_printf0_("list of misfits: ");
++	/*Get and add all contributions one by one*/
++	IssmDouble  J=0;
++	IssmDouble* Jlist = xNew<IssmDouble>(num_responses);
+ 	for(int i=0;i<num_responses;i++){
+ 		ExternalResult* result=(ExternalResult*)cost_functions->GetObjectByOffset(i);
+-		J += reCast<IssmDouble>(result->GetValue());
+-		//_printf0_(J<<" ");
++		Jlist[i] = reCast<IssmDouble>(result->GetValue());
++		J       += Jlist[i];
+ 	}
+-	//_printf0_(" \n");
+ 	_assert_(cost_functions->Size()==num_responses);
+ 
+ 	/*Assign output pointers: */
+ 	delete cost_functions;
+ 	xDelete<int>(responses);
+-	*pJ=J;
++	if(pJ)     *pJ     = J;
++	if(pJlist) *pJlist = Jlist;
++	else        xDelete<IssmDouble>(Jlist);
++	if(pn)     *pn     = num_responses;
+ }
+ /*}}}*/
+ void FemModel::OutputControlsx(Results **presults){/*{{{*/
+Index: ../trunk-jpl/src/c/classes/FemModel.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.h	(revision 17906)
++++ ../trunk-jpl/src/c/classes/FemModel.h	(revision 17907)
+@@ -85,7 +85,7 @@
+ 		void Responsex(IssmDouble* presponse,int response_descriptor_enum);
+ 		void Responsex(IssmDouble* presponse,const char* response_descriptor);
+ 		void OutputControlsx(Results **presults);
+-		void CostFunctionx( IssmDouble* pJ);
++		void CostFunctionx(IssmDouble* pJ,IssmDouble** pJlist,int* pn);
+ 		void ThicknessAbsGradientx( IssmDouble* pJ);
+ 		#ifdef _HAVE_GIA_
+ 		void Deflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt, IssmDouble* x, IssmDouble* y);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17907-17908.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17907-17908.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17907-17908.diff	(revision 17986)
@@ -0,0 +1,108 @@
+Index: ../trunk-jpl/src/m/classes/matdamageice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matdamageice.m	(revision 17907)
++++ ../trunk-jpl/src/m/classes/matdamageice.m	(revision 17908)
+@@ -29,40 +29,40 @@
+ 
+ 	end
+ 	methods
+-        function createxml(obj,fid) % {{{
+-            fprintf(fid, '\n\n');
+-            fprintf(fid, '<!-- materials -->\n');
+-			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(obj.rho_ice),'" default="',convert2str(obj.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(obj.rho_water),'" default="',convert2str(obj.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(obj.rho_freshwater),'" default="',convert2str(obj.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
+-             
+-  
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(obj.mu_water),'" default="',convert2str(obj.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(obj.heatcapacity),'" default="',convert2str(obj.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(obj.latentheat),'" default="',convert2str(obj.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
+-             
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(obj.thermalconductivity),'" default="',convert2str(obj.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(obj.temperateiceconductivity),'" default="',convert2str(obj.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(obj.meltingpoint),'" default="',convert2str(obj.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
+-             
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(obj.beta),'" default="',convert2str(obj.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(obj.mixed_layer_capacity),'" default="',convert2str(obj.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(obj.thermal_exchange_velocity),'" default="',convert2str(obj.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
+-             
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(obj.rheology_B),'" default="',convert2str(obj.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(obj.rheology_n),'" default="',convert2str(obj.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="',class(obj.rheology_law),'" default="',convert2str(obj.rheology_law),'">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>','</parameter>');
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(obj.lithosphere_shear_modulus),'" default="',convert2str(obj.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(obj.lithosphere_density),'" default="',convert2str(obj.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(obj.mantle_shear_modulus),'" default="',convert2str(obj.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(obj.mantle_density),'" default="',convert2str(obj.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
+-        
+-         
+-        end % }}}
++		function createxml(obj,fid) % {{{
++			fprintf(fid, '\n\n');
++			fprintf(fid, '<!-- materials -->\n');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(obj.rho_ice),'" default="',convert2str(obj.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(obj.rho_water),'" default="',convert2str(obj.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(obj.rho_freshwater),'" default="',convert2str(obj.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(obj.mu_water),'" default="',convert2str(obj.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(obj.heatcapacity),'" default="',convert2str(obj.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(obj.latentheat),'" default="',convert2str(obj.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(obj.thermalconductivity),'" default="',convert2str(obj.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(obj.temperateiceconductivity),'" default="',convert2str(obj.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(obj.meltingpoint),'" default="',convert2str(obj.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(obj.beta),'" default="',convert2str(obj.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(obj.mixed_layer_capacity),'" default="',convert2str(obj.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(obj.thermal_exchange_velocity),'" default="',convert2str(obj.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(obj.rheology_B),'" default="',convert2str(obj.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(obj.rheology_n),'" default="',convert2str(obj.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="',class(obj.rheology_law),'" default="',convert2str(obj.rheology_law),'">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>','</parameter>');
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(obj.lithosphere_shear_modulus),'" default="',convert2str(obj.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(obj.lithosphere_density),'" default="',convert2str(obj.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(obj.mantle_shear_modulus),'" default="',convert2str(obj.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(obj.mantle_density),'" default="',convert2str(obj.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
++
++
++		end % }}}
+ 		function obj = matdamageice(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17907)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17908)
+@@ -25,23 +25,7 @@
+ 				case 0
+ 					obj=setdefaultparameters(obj);
+ 				case 1
+-					if isa(varargin{1},'inversion'),
+-						disp('converting inversion to m1qn3inversion');
+-						in=varargin{1};
+-						obj.iscontrol                   = in.iscontrol;
+-						obj.incomplete_adjoint          = in.incomplete_adjoint;
+-						obj.control_parameters          = in.control_parameters;
+-						obj.nsteps                      = in.nsteps;
+-						obj.cost_functions              = in.cost_functions(1,:); %Keep first line only
+-						obj.cost_functions_coefficients = in.cost_functions_coefficients;
+-						obj.min_parameters              = in.min_parameters;
+-						obj.max_parameters              = in.max_parameters;
+-						obj.vx_obs                      = in.vx_obs;
+-						obj.vy_obs                      = in.vy_obs;
+-						obj.vz_obs                      = in.vz_obs;
+-						obj.vel_obs                     = in.vel_obs;
+-						obj.thickness_obs               = in.thickness_obs;
+-					end
++					obj=structtoobj(obj,varargin{1});
+ 				otherwise
+ 					error('constructor not supported');
+ 			end
Index: /issm/oecreview/Archive/17802-17983/ISSM-17908-17909.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17908-17909.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17908-17909.diff	(revision 17986)
@@ -0,0 +1,140 @@
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 17908)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 17909)
+@@ -22,6 +22,8 @@
+ 			self.incomplete_adjoint          = 0
+ 			self.control_parameters          = float('NaN')
+ 			self.nsteps                      = 0
++			self.dxmin                       = 0.
++			self.epsrel                      = 0.
+ 			self.cost_functions              = float('NaN')
+ 			self.cost_functions_coefficients = float('NaN')
+ 			self.min_parameters              = float('NaN')
+@@ -59,6 +61,8 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'control_parameters','ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'nsteps','number of optimization searches'))
++		string="%s\n%s"%(string,fielddisplay(self,'dxmin','convergence criterion: two points less than dxmin from eachother (sup-norm) are considered identical'))
++		string="%s\n%s"%(string,fielddisplay(self,'epsrel','convergence criterion: ratio between current gradient and initial gradient'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'cost_functions','indicate the type of response for each optimization step'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex'))
+@@ -94,6 +98,10 @@
+ 		#several responses can be used:
+ 		self.cost_functions=101
+ 
++		#m1qn3 parameters
++		self.dxmin  = 0.1
++		self.epsrel = 1e-4
++
+ 		return self
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+@@ -109,6 +117,8 @@
+ 		md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1])
+ 		md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy','Thickness'])
+ 		md = checkfield(md,'fieldname','inversion.nsteps','numel',[1],'>=',0)
++		md = checkfield(md,'fieldname','inversion.dxmin','numel',1,'>',0.)
++		md = checkfield(md,'fieldname','inversion.epsrel','numel',1,'>',0.)
+ 		md = checkfield(md,'fieldname','inversion.cost_functions','size',[num_costfunc],'values',[101,102,103,104,105,201,501,502,503,504,505])
+ 		md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices,num_costfunc],'>=',0)
+ 		md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices,num_controls])
+@@ -132,6 +142,8 @@
+ 			return
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','incomplete_adjoint','format','Boolean')
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','nsteps','format','Integer')
++		WriteData(fid,'object',obj,'class','inversion','fieldname','dxmin','format','Double')
++		WriteData(fid,'object',obj,'class','inversion','fieldname','epsrel','format','Double')
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3)
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3)
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17908)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17909)
+@@ -9,6 +9,8 @@
+ 		incomplete_adjoint          = 0
+ 		control_parameters          = NaN
+ 		nsteps                      = 0
++		dxmin                       = 0;
++		epsrel                      = 0;
+ 		cost_functions              = NaN
+ 		cost_functions_coefficients = NaN
+ 		min_parameters              = NaN
+@@ -18,6 +20,7 @@
+ 		vz_obs                      = NaN
+ 		vel_obs                     = NaN
+ 		thickness_obs               = NaN
++
+ 	end
+ 	methods
+ 		function obj = m1qn3inversion(varargin) % {{{
+@@ -30,29 +33,33 @@
+ 					error('constructor not supported');
+ 			end
+ 		end % }}}
+-		function obj = setdefaultparameters(obj) % {{{
++		function self = setdefaultparameters(self) % {{{
+ 
+ 			%default is incomplete adjoint for now
+-			obj.incomplete_adjoint=1;
++			self.incomplete_adjoint=1;
+ 
+ 			%parameter to be inferred by control methods (only
+ 			%drag and B are supported yet)
+-			obj.control_parameters={'FrictionCoefficient'};
++			self.control_parameters={'FrictionCoefficient'};
+ 
+ 			%number of steps in the control methods
+-			obj.nsteps=20;
++			self.nsteps=20;
+ 
+ 			%several responses can be used:
+-			obj.cost_functions=101*ones(obj.nsteps,1);
++			self.cost_functions=101*ones(self.nsteps,1);
+ 
++			%m1qn3 parameters
++			self.dxmin  = 0.1;
++			self.epsrel = 1e-4;
++
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+ 			%Early return
+ 			if ~obj.iscontrol, return; end
+ 
+-			if ~IssmConfig('_HAVE_TAO_'),
+-				md = checkmessage(md,['TAO has not been installed, ISSM needs to be reconfigured and recompiled with TAO']);
++			if ~IssmConfig('_HAVE_M1QN3_'),
++				md = checkmessage(md,['M1QN3 has not been installed, ISSM needs to be reconfigured and recompiled with M1QN3']);
+ 			end
+ 
+ 			num_controls=numel(md.inversion.control_parameters);
+@@ -63,6 +70,8 @@
+ 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
+ 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'MaterialsRheologyZbar' 'Vx' 'Vy' 'Thickness'});
+ 			md = checkfield(md,'fieldname','inversion.nsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.dxmin','numel',1,'>',0);
++			md = checkfield(md,'fieldname','inversion.epsrel','numel',1,'>',0);
+ 			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
+ 			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
+ 			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
+@@ -83,6 +92,8 @@
+ 			fielddisplay(obj,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity');
+ 			fielddisplay(obj,'control_parameters','ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}');
+ 			fielddisplay(obj,'nsteps','number of optimization searches');
++			fielddisplay(obj,'dxmin','convergence criterion: two points less than dxmin from eachother (sup-norm) are considered identical');
++			fielddisplay(obj,'epsrel','convergence criterion: ratio between current gradient and initial gradient');
+ 			fielddisplay(obj,'cost_functions','indicate the type of response for each optimization step');
+ 			fielddisplay(obj,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter');
+ 			fielddisplay(obj,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex');
+@@ -111,6 +122,8 @@
+ 			if ~obj.iscontrol, return; end
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','incomplete_adjoint','format','Boolean');
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','nsteps','format','Integer');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','dxmin','format','Double');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','epsrel','format','Double');
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3);
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17909-17910.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17909-17910.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17909-17910.diff	(revision 17986)
@@ -0,0 +1,201 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17909)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17910)
+@@ -140,6 +140,8 @@
+ 	InversionMaxiterPerStepEnum,
+ 	InversionMinParametersEnum,
+ 	InversionNstepsEnum,
++	InversionDxminEnum,
++	InversionEpsrelEnum,
+ 	InversionNumControlParametersEnum,
+ 	InversionNumCostFunctionsEnum,
+ 	InversionStepThresholdEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17909)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17910)
+@@ -148,6 +148,8 @@
+ 		case InversionMaxiterPerStepEnum : return "InversionMaxiterPerStep";
+ 		case InversionMinParametersEnum : return "InversionMinParameters";
+ 		case InversionNstepsEnum : return "InversionNsteps";
++		case InversionDxminEnum : return "InversionDxmin";
++		case InversionEpsrelEnum : return "InversionEpsrel";
+ 		case InversionNumControlParametersEnum : return "InversionNumControlParameters";
+ 		case InversionNumCostFunctionsEnum : return "InversionNumCostFunctions";
+ 		case InversionStepThresholdEnum : return "InversionStepThreshold";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17909)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17910)
+@@ -151,6 +151,8 @@
+ 	      else if (strcmp(name,"InversionMaxiterPerStep")==0) return InversionMaxiterPerStepEnum;
+ 	      else if (strcmp(name,"InversionMinParameters")==0) return InversionMinParametersEnum;
+ 	      else if (strcmp(name,"InversionNsteps")==0) return InversionNstepsEnum;
++	      else if (strcmp(name,"InversionDxmin")==0) return InversionDxminEnum;
++	      else if (strcmp(name,"InversionEpsrel")==0) return InversionEpsrelEnum;
+ 	      else if (strcmp(name,"InversionNumControlParameters")==0) return InversionNumControlParametersEnum;
+ 	      else if (strcmp(name,"InversionNumCostFunctions")==0) return InversionNumCostFunctionsEnum;
+ 	      else if (strcmp(name,"InversionStepThreshold")==0) return InversionStepThresholdEnum;
+@@ -257,12 +259,12 @@
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+-	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+-	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
++	      if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
++	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
++	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+ 	      else if (strcmp(name,"SteadystateRequestedOutputs")==0) return SteadystateRequestedOutputsEnum;
+ 	      else if (strcmp(name,"Surface")==0) return SurfaceEnum;
+@@ -380,12 +382,12 @@
+ 	      else if (strcmp(name,"LsfReinitializationAnalysis")==0) return LsfReinitializationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+-	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+-	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
++	      if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
++	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
++	      else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
+ 	      else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
+ 	      else if (strcmp(name,"L1L2Approximation")==0) return L1L2ApproximationEnum;
+ 	      else if (strcmp(name,"HOApproximation")==0) return HOApproximationEnum;
+@@ -503,12 +505,12 @@
+ 	      else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
+-	      else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
+-	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
++	      if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
++	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
++	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
+ 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
+ 	      else if (strcmp(name,"TemperaturePicard")==0) return TemperaturePicardEnum;
+ 	      else if (strcmp(name,"ThicknessAbsMisfit")==0) return ThicknessAbsMisfitEnum;
+@@ -626,12 +628,12 @@
+ 	      else if (strcmp(name,"IceVolumeAboveFloatation")==0) return IceVolumeAboveFloatationEnum;
+ 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+-	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+-	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
++	      if (strcmp(name,"Incremental")==0) return IncrementalEnum;
++	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
++	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+ 	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+Index: ../trunk-jpl/src/wrappers/IssmConfig/IssmConfig.cpp
+===================================================================
+--- ../trunk-jpl/src/wrappers/IssmConfig/IssmConfig.cpp	(revision 17909)
++++ ../trunk-jpl/src/wrappers/IssmConfig/IssmConfig.cpp	(revision 17910)
+@@ -36,43 +36,36 @@
+ 	if(strcmp(name,"_HAVE_MPI_")==0){
+ 		#ifdef _HAVE_MPI_
+ 		value = 1.;
+-		#else
+-		value = 0.;
+ 		#endif
+ 	}
+ 	else if(strcmp(name,"_HAVE_DAKOTA_")==0){
+ 		#ifdef _HAVE_DAKOTA_
+ 		value = 1.;
+-		#else
+-		value = 0.;
+ 		#endif
+ 	}
+ 	else if(strcmp(name,"_HAVE_MUMPS_")==0){
+ 		#ifdef _HAVE_MUMPS_
+ 		value = 1.;
+-		#else
+-		value = 0.;
+ 		#endif
+ 	}
+ 	else if(strcmp(name,"_HAVE_GSL_")==0){
+ 		#ifdef _HAVE_GSL_
+ 		value = 1.;
+-		#else
+-		value = 0.;
+ 		#endif
+ 	}
+ 	else if(strcmp(name,"_HAVE_TAO_")==0){
+ 		#ifdef _HAVE_TAO_
+ 		value = 1.;
+-		#else
+-		value = 0.;
+ 		#endif
+ 	}
++	else if(strcmp(name,"_HAVE_M1QN3_")==0){
++		#ifdef _HAVE_M1QN3_
++		value = 1.;
++		#endif
++	}
+ 	else if(strcmp(name,"_HAVE_PETSC_")==0){
+ 		#ifdef _HAVE_PETSC_
+ 		value = 1.;
+-		#else
+-		value = 0.;
+ 		#endif
+ 	}
+ 	else if(strcmp(name,"_PETSC_MAJOR_")==0){
+Index: ../trunk-jpl/src/m/enum/InversionDxminEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionDxminEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionDxminEnum.m	(revision 17910)
+@@ -0,0 +1,11 @@
++function macro=InversionDxminEnum()
++%INVERSIONDXMINENUM - Enum of InversionDxmin
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionDxminEnum()
++
++macro=StringToEnum('InversionDxmin');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17909)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17910)
+@@ -140,6 +140,8 @@
+ def InversionMaxiterPerStepEnum(): return StringToEnum("InversionMaxiterPerStep")[0]
+ def InversionMinParametersEnum(): return StringToEnum("InversionMinParameters")[0]
+ def InversionNstepsEnum(): return StringToEnum("InversionNsteps")[0]
++def InversionDxminEnum(): return StringToEnum("InversionDxmin")[0]
++def InversionEpsrelEnum(): return StringToEnum("InversionEpsrel")[0]
+ def InversionNumControlParametersEnum(): return StringToEnum("InversionNumControlParameters")[0]
+ def InversionNumCostFunctionsEnum(): return StringToEnum("InversionNumCostFunctions")[0]
+ def InversionStepThresholdEnum(): return StringToEnum("InversionStepThreshold")[0]
+Index: ../trunk-jpl/src/m/enum/InversionEpsrelEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionEpsrelEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionEpsrelEnum.m	(revision 17910)
+@@ -0,0 +1,11 @@
++function macro=InversionEpsrelEnum()
++%INVERSIONEPSRELENUM - Enum of InversionEpsrel
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionEpsrelEnum()
++
++macro=StringToEnum('InversionEpsrel');
Index: /issm/oecreview/Archive/17802-17983/ISSM-17910-17911.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17910-17911.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17910-17911.diff	(revision 17986)
@@ -0,0 +1,91 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp	(revision 17910)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp	(revision 17911)
+@@ -31,9 +31,6 @@
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionNumCostFunctionsEnum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionNstepsEnum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionIncompleteAdjointEnum));
+-		if(inversiontype==0){
+-			parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum));
+-		}
+ 
+ 		/*What solution type?*/
+ 		if(solution_type==SteadystateSolutionEnum){
+@@ -46,23 +43,30 @@
+ 		/*Now, recover fit, optscal and maxiter as vectors: */
+ 		iomodel->FetchData(&control_type,NULL,&num_control_type,InversionControlParametersEnum);
+ 		iomodel->FetchData(&cm_responses,NULL,&num_cm_responses,InversionCostFunctionsEnum);
+-		if(inversiontype==0){
+-			iomodel->FetchData(&cm_jump,&nsteps,NULL,InversionStepThresholdEnum);
+-			iomodel->FetchData(&optscal,NULL,NULL,InversionGradientScalingEnum);
+-			iomodel->FetchData(&maxiter,NULL,NULL,InversionMaxiterPerStepEnum);
+-		}
++		parameters->AddObject(new IntVecParam(InversionControlParametersEnum,control_type,num_control_type));
++		parameters->AddObject(new IntVecParam(InversionCostFunctionsEnum,cm_responses,num_cm_responses));
+ 
+-		if(inversiontype!=0){
+-			parameters->AddObject(new IntVecParam(InversionControlParametersEnum,control_type,num_control_type));
+-			parameters->AddObject(new IntVecParam(InversionCostFunctionsEnum,cm_responses,num_cm_responses));
++		/*Inversion type specifics*/
++		switch(inversiontype){
++			case 0:/*Brent Search*/
++				parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum));
++				iomodel->FetchData(&cm_jump,&nsteps,NULL,InversionStepThresholdEnum);
++				iomodel->FetchData(&optscal,NULL,NULL,InversionGradientScalingEnum);
++				iomodel->FetchData(&maxiter,NULL,NULL,InversionMaxiterPerStepEnum);
++				parameters->AddObject(new DoubleMatParam(InversionGradientScalingEnum,optscal,nsteps,num_control_type));
++				parameters->AddObject(new DoubleVecParam(InversionStepThresholdEnum,cm_jump,nsteps));
++				parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps));
++				break;
++			case 1:/*TAO*/
++				break;
++			case 2:/*M1QN3*/
++				parameters->AddObject(iomodel->CopyConstantObject(InversionDxminEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionEpsrelEnum));
++				break;
++			default:
++				_error_("not supported");
++
+ 		}
+-		else{
+-			parameters->AddObject(new IntVecParam(InversionControlParametersEnum,control_type,num_control_type));
+-			parameters->AddObject(new IntVecParam(InversionCostFunctionsEnum,cm_responses,num_cm_responses));
+-			parameters->AddObject(new DoubleMatParam(InversionGradientScalingEnum,optscal,nsteps,num_control_type));
+-			parameters->AddObject(new DoubleVecParam(InversionStepThresholdEnum,cm_jump,nsteps));
+-			parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps));
+-		}
+ 
+ 		xDelete<int>(control_type);
+ 		xDelete<int>(cm_responses);
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17910)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17911)
+@@ -29,7 +29,7 @@
+ 
+ 	/*Intermediaries*/
+ 	long         omode;
+-	double       f; 
++	double       f,dxmin,epsrel; 
+ 	int          nsteps,maxiter;
+ 	int          intn,num_controls,solution_type;
+ 	IssmDouble  *X  = NULL;
+@@ -39,6 +39,8 @@
+ 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+ 	femmodel->parameters->FindParam(&num_controls,InversionNumControlParametersEnum);
+ 	femmodel->parameters->FindParam(&nsteps,InversionNstepsEnum);
++	femmodel->parameters->FindParam(&dxmin,InversionDxminEnum);
++	femmodel->parameters->FindParam(&epsrel,InversionEpsrelEnum);
+ 	femmodel->parameters->SetParam(false,SaveResultsEnum);
+ 	maxiter=nsteps*10;
+ 
+@@ -57,8 +59,6 @@
+ 	long      io           = 6;         /*Channel number for the output*/
+ 
+ 	/*Optimization criterions*/
+-	double    dxmin        = 1.e-1;    /*Resolution for the solution x*/
+-	double    epsrel       = 1.e-4;     /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
+ 	long      niter        = long(nsteps); /*Maximum number of iterations*/
+ 	long      nsim         = long(maxiter);/*Maximum number of function calls*/
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17911-17912.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17911-17912.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17911-17912.diff	(revision 17986)
@@ -0,0 +1,17469 @@
+Index: ../trunk-jpl/src/dox/issm.dox
+===================================================================
+--- ../trunk-jpl/src/dox/issm.dox	(revision 17911)
++++ ../trunk-jpl/src/dox/issm.dox	(revision 17912)
+@@ -46,38 +46,44 @@
+ <th  bgcolor=#7AA9DD style="text-align:left;">Language</th><th  bgcolor=#7AA9DD style="text-align:right;">files</th><th  bgcolor=#7AA9DD style="text-align:right;">blank</th><th  bgcolor=#7AA9DD style="text-align:right;">comment</th><th  bgcolor=#7AA9DD style="text-align:right;">code</th><th  bgcolor=#7AA9DD style="text-align:right;">Total</th>
+ </th>
+ <tr>
+-<th  bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td  bgcolor=#FFFFFF style="text-align:right;">492</td><td  bgcolor=#FFFFFF style="text-align:right;">15134</td><td  bgcolor=#FFFFFF style="text-align:right;">17851</td><td  bgcolor=#FFFFFF style="text-align:right;">63296</td><td  bgcolor=#FFFFFF style="text-align:right;">96281</td>
++<th  bgcolor=#FFFFFF style="text-align:left;"> C++ </th><td  bgcolor=#FFFFFF style="text-align:right;">453</td><td  bgcolor=#FFFFFF style="text-align:right;">15861</td><td  bgcolor=#FFFFFF style="text-align:right;">18188</td><td  bgcolor=#FFFFFF style="text-align:right;">68849</td><td  bgcolor=#FFFFFF style="text-align:right;">102898</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td  bgcolor=#C6E2FF style="text-align:right;">1057</td><td  bgcolor=#C6E2FF style="text-align:right;">7147</td><td  bgcolor=#C6E2FF style="text-align:right;">14649</td><td  bgcolor=#C6E2FF style="text-align:right;">33842</td><td  bgcolor=#C6E2FF style="text-align:right;">55638</td>
++<th  bgcolor=#C6E2FF style="text-align:left;"> MATLAB </th><td  bgcolor=#C6E2FF style="text-align:right;">1378</td><td  bgcolor=#C6E2FF style="text-align:right;">8341</td><td  bgcolor=#C6E2FF style="text-align:right;">16259</td><td  bgcolor=#C6E2FF style="text-align:right;">38645</td><td  bgcolor=#C6E2FF style="text-align:right;">63245</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#FFFFFF style="text-align:left;"> C/C++  Header </th><td  bgcolor=#FFFFFF style="text-align:right;">383</td><td  bgcolor=#FFFFFF style="text-align:right;">3169</td><td  bgcolor=#FFFFFF style="text-align:right;">3340</td><td  bgcolor=#FFFFFF style="text-align:right;">13334</td><td  bgcolor=#FFFFFF style="text-align:right;">19843</td>
++<th  bgcolor=#FFFFFF style="text-align:left;"> C/C++  Header </th><td  bgcolor=#FFFFFF style="text-align:right;">421</td><td  bgcolor=#FFFFFF style="text-align:right;">3504</td><td  bgcolor=#FFFFFF style="text-align:right;">3753</td><td  bgcolor=#FFFFFF style="text-align:right;">15489</td><td  bgcolor=#FFFFFF style="text-align:right;">22746</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#C6E2FF style="text-align:left;"> Python </th><td  bgcolor=#C6E2FF style="text-align:right;">119</td><td  bgcolor=#C6E2FF style="text-align:right;">1911</td><td  bgcolor=#C6E2FF style="text-align:right;">2296</td><td  bgcolor=#C6E2FF style="text-align:right;">7443</td><td  bgcolor=#C6E2FF style="text-align:right;">11650</td>
++<th  bgcolor=#C6E2FF style="text-align:left;"> m4 </th><td  bgcolor=#C6E2FF style="text-align:right;">9</td><td  bgcolor=#C6E2FF style="text-align:right;">1588</td><td  bgcolor=#C6E2FF style="text-align:right;">151</td><td  bgcolor=#C6E2FF style="text-align:right;">11565</td><td  bgcolor=#C6E2FF style="text-align:right;">13304</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#FFFFFF style="text-align:left;"> m4 </th><td  bgcolor=#FFFFFF style="text-align:right;">2</td><td  bgcolor=#FFFFFF style="text-align:right;">184</td><td  bgcolor=#FFFFFF style="text-align:right;">6</td><td  bgcolor=#FFFFFF style="text-align:right;">1845</td><td  bgcolor=#FFFFFF style="text-align:right;">2035</td>
++<th  bgcolor=#FFFFFF style="text-align:left;"> Python </th><td  bgcolor=#FFFFFF style="text-align:right;">144</td><td  bgcolor=#FFFFFF style="text-align:right;">2330</td><td  bgcolor=#FFFFFF style="text-align:right;">2559</td><td  bgcolor=#FFFFFF style="text-align:right;">9348</td><td  bgcolor=#FFFFFF style="text-align:right;">14237</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#C6E2FF style="text-align:left;"> CMake </th><td  bgcolor=#C6E2FF style="text-align:right;">2</td><td  bgcolor=#C6E2FF style="text-align:right;">31</td><td  bgcolor=#C6E2FF style="text-align:right;">84</td><td  bgcolor=#C6E2FF style="text-align:right;">637</td><td  bgcolor=#C6E2FF style="text-align:right;">752</td>
++<th  bgcolor=#C6E2FF style="text-align:left;"> XML </th><td  bgcolor=#C6E2FF style="text-align:right;">4</td><td  bgcolor=#C6E2FF style="text-align:right;">160</td><td  bgcolor=#C6E2FF style="text-align:right;">92</td><td  bgcolor=#C6E2FF style="text-align:right;">3075</td><td  bgcolor=#C6E2FF style="text-align:right;">3327</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#FFFFFF style="text-align:left;"> Objective  C </th><td  bgcolor=#FFFFFF style="text-align:right;">9</td><td  bgcolor=#FFFFFF style="text-align:right;">96</td><td  bgcolor=#FFFFFF style="text-align:right;">0</td><td  bgcolor=#FFFFFF style="text-align:right;">370</td><td  bgcolor=#FFFFFF style="text-align:right;">466</td>
++<th  bgcolor=#FFFFFF style="text-align:left;"> Java </th><td  bgcolor=#FFFFFF style="text-align:right;">18</td><td  bgcolor=#FFFFFF style="text-align:right;">719</td><td  bgcolor=#FFFFFF style="text-align:right;">891</td><td  bgcolor=#FFFFFF style="text-align:right;">2321</td><td  bgcolor=#FFFFFF style="text-align:right;">3931</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#C6E2FF style="text-align:left;"> Fortran </th><td  bgcolor=#C6E2FF style="text-align:right;">77</td><td  bgcolor=#C6E2FF style="text-align:right;">7</td><td  bgcolor=#C6E2FF style="text-align:right;">4</td><td  bgcolor=#C6E2FF style="text-align:right;">302</td><td  bgcolor=#C6E2FF style="text-align:right;">365</td><td  bgcolor=#C6E2FF style="text-align:right;">678</td>
++<th  bgcolor=#C6E2FF style="text-align:left;"> Fortran  77 </th><td  bgcolor=#C6E2FF style="text-align:right;">7</td><td  bgcolor=#C6E2FF style="text-align:right;">4</td><td  bgcolor=#C6E2FF style="text-align:right;">302</td><td  bgcolor=#C6E2FF style="text-align:right;">365</td><td  bgcolor=#C6E2FF style="text-align:right;">671</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#FFFFFF style="text-align:left;"> Bourne  Shell </th><td  bgcolor=#FFFFFF style="text-align:right;">2</td><td  bgcolor=#FFFFFF style="text-align:right;">48</td><td  bgcolor=#FFFFFF style="text-align:right;">66</td><td  bgcolor=#FFFFFF style="text-align:right;">213</td><td  bgcolor=#FFFFFF style="text-align:right;">327</td>
++<th  bgcolor=#FFFFFF style="text-align:left;"> Bourne  Shell </th><td  bgcolor=#FFFFFF style="text-align:right;">3</td><td  bgcolor=#FFFFFF style="text-align:right;">61</td><td  bgcolor=#FFFFFF style="text-align:right;">88</td><td  bgcolor=#FFFFFF style="text-align:right;">266</td><td  bgcolor=#FFFFFF style="text-align:right;">415</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#C6E2FF style="text-align:left;"> Perl </th><td  bgcolor=#C6E2FF style="text-align:right;">1</td><td  bgcolor=#C6E2FF style="text-align:right;">6</td><td  bgcolor=#C6E2FF style="text-align:right;">9</td><td  bgcolor=#C6E2FF style="text-align:right;">196</td><td  bgcolor=#C6E2FF style="text-align:right;">211</td>
++<th  bgcolor=#C6E2FF style="text-align:left;"> XSD </th><td  bgcolor=#C6E2FF style="text-align:right;">2</td><td  bgcolor=#C6E2FF style="text-align:right;">30</td><td  bgcolor=#C6E2FF style="text-align:right;">36</td><td  bgcolor=#C6E2FF style="text-align:right;">229</td><td  bgcolor=#C6E2FF style="text-align:right;">295</td>
+ </tr>
+ <tr>
+-<th  bgcolor=#FFFFFF style="text-align:left;"> SUM: </th><td  bgcolor=#FFFFFF style="text-align:right;">2074</td><td  bgcolor=#FFFFFF style="text-align:right;">27730</td><td  bgcolor=#FFFFFF style="text-align:right;">38603</td><td  bgcolor=#FFFFFF style="text-align:right;">121541</td><td  bgcolor=#FFFFFF style="text-align:right;">187874</td>
++<th  bgcolor=#FFFFFF style="text-align:left;"> Perl </th><td  bgcolor=#FFFFFF style="text-align:right;">1</td><td  bgcolor=#FFFFFF style="text-align:right;">6</td><td  bgcolor=#FFFFFF style="text-align:right;">9</td><td  bgcolor=#FFFFFF style="text-align:right;">196</td><td  bgcolor=#FFFFFF style="text-align:right;">211</td>
+ </tr>
++<tr>
++<th  bgcolor=#C6E2FF style="text-align:left;"> Ant </th><td  bgcolor=#C6E2FF style="text-align:right;">1</td><td  bgcolor=#C6E2FF style="text-align:right;">16</td><td  bgcolor=#C6E2FF style="text-align:right;">7</td><td  bgcolor=#C6E2FF style="text-align:right;">103</td><td  bgcolor=#C6E2FF style="text-align:right;">126</td>
++</tr>
++<tr>
++<th  bgcolor=#FFFFFF style="text-align:left;"> SUM: </th><td  bgcolor=#FFFFFF style="text-align:right;">2441</td><td  bgcolor=#FFFFFF style="text-align:right;">32620</td><td  bgcolor=#FFFFFF style="text-align:right;">42335</td><td  bgcolor=#FFFFFF style="text-align:right;">150451</td><td  bgcolor=#FFFFFF style="text-align:right;">225406</td>
++</tr>
+ </table>
+ 
+ 	<I> Copyright (C) 2013 </I>
+Index: ../trunk-jpl/scripts/cloc-1.55.pl
+===================================================================
+--- ../trunk-jpl/scripts/cloc-1.55.pl	(revision 17911)
++++ ../trunk-jpl/scripts/cloc-1.55.pl	(revision 17912)
+@@ -1,8264 +0,0 @@
+-#!/usr/bin/env perl
+-# cloc -- Count Lines of Code {{{1
+-# Copyright (C) 2006-2011 Northrop Grumman Corporation
+-# Author:  Al Danial <al.danial@gmail.com>
+-#          First release August 2006
+-#
+-# Includes code from:
+-#   - SLOCCount v2.26 
+-#     http://www.dwheeler.com/sloccount/
+-#     by David Wheeler.
+-#   - Regexp::Common v2.120
+-#     http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common.pm
+-#     by Damian Conway and Abigail.
+-#   - Win32::Autoglob 
+-#     http://search.cpan.org/~sburke/Win32-Autoglob-1.01/Autoglob.pm
+-#     by Sean M. Burke.
+-#   - Algorithm::Diff
+-#     http://search.cpan.org/~tyemq/Algorithm-Diff-1.1902/lib/Algorithm/Diff.pm
+-#     by Tye McQueen.
+-#
+-# 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:
+-# http://www.gnu.org/licenses/gpl.txt
+-#
+-# 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
+-# 1}}}
+-my $VERSION = sprintf("%.2f", 1.55);
+-my $URL     = "http://cloc.sourceforge.net";
+-require 5.006;
+-# use modules                                  {{{1
+-use warnings;
+-use strict;
+-use Getopt::Long;
+-use File::Basename;
+-use File::Temp qw { tempfile tempdir };
+-use File::Find;
+-use File::Path;
+-use File::Spec;
+-use IO::File;
+-use POSIX "strftime";
+-
+-# Digest::MD5 isn't in the standard distribution. Use it only if installed.
+-my $HAVE_Digest_MD5 = 0;
+-eval "use Digest::MD5;";
+-if (defined $Digest::MD5::VERSION) {
+-    $HAVE_Digest_MD5 = 1;
+-} else {
+-    warn "Digest::MD5 not installed; will skip file uniqueness checks.\n";
+-}
+-
+-my $HAVE_Rexexp_Common;
+-# Regexp::Common isn't in the standard distribution.  It will
+-# be installed in a temp directory if necessary.
+-BEGIN {
+-    if (eval "use Regexp::Common;") {
+-        $HAVE_Rexexp_Common = 1;
+-    } else {
+-        $HAVE_Rexexp_Common = 0;
+-    }
+-}
+-
+-my $HAVE_Algorith_Diff = 0;
+-# Algorithm::Diff isn't in the standard distribution.  It will
+-# be installed in a temp directory if necessary.
+-eval "use Algorithm::Diff qw ( sdiff ) ";
+-if (defined $Algorithm::Diff::VERSION) {
+-    $HAVE_Algorith_Diff = 1;
+-} else {
+-    Install_Algorithm_Diff();
+-}
+-# print "2 HAVE_Algorith_Diff = $HAVE_Algorith_Diff\n";
+-# test_alg_diff($ARGV[$#ARGV - 1], $ARGV[$#ARGV]); die;
+-
+-# Uncomment next two lines when building Windows executable with perl2exe
+-# or if running on a system that already has Regexp::Common.
+-#use Regexp::Common;
+-#$HAVE_Rexexp_Common = 1;
+-
+-#perl2exe_include "Regexp/Common/whitespace.pm"
+-#perl2exe_include "Regexp/Common/URI.pm"
+-#perl2exe_include "Regexp/Common/URI/fax.pm"
+-#perl2exe_include "Regexp/Common/URI/file.pm"
+-#perl2exe_include "Regexp/Common/URI/ftp.pm"
+-#perl2exe_include "Regexp/Common/URI/gopher.pm"
+-#perl2exe_include "Regexp/Common/URI/http.pm"
+-#perl2exe_include "Regexp/Common/URI/pop.pm"
+-#perl2exe_include "Regexp/Common/URI/prospero.pm"
+-#perl2exe_include "Regexp/Common/URI/news.pm"
+-#perl2exe_include "Regexp/Common/URI/tel.pm"
+-#perl2exe_include "Regexp/Common/URI/telnet.pm"
+-#perl2exe_include "Regexp/Common/URI/tv.pm"
+-#perl2exe_include "Regexp/Common/URI/wais.pm"
+-#perl2exe_include "Regexp/Common/CC.pm"
+-#perl2exe_include "Regexp/Common/SEN.pm"
+-#perl2exe_include "Regexp/Common/number.pm"
+-#perl2exe_include "Regexp/Common/delimited.pm"
+-#perl2exe_include "Regexp/Common/profanity.pm"
+-#perl2exe_include "Regexp/Common/net.pm"
+-#perl2exe_include "Regexp/Common/zip.pm"
+-#perl2exe_include "Regexp/Common/comment.pm"
+-#perl2exe_include "Regexp/Common/balanced.pm"
+-#perl2exe_include "Regexp/Common/lingua.pm"
+-#perl2exe_include "Regexp/Common/list.pm"
+-#perl2exe_include "File/Glob.pm"
+-
+-use Text::Tabs qw { expand };
+-use Cwd qw { cwd };
+-# 1}}}
+-# Usage information, options processing.       {{{1
+-my $ON_WINDOWS = 0;
+-   $ON_WINDOWS = 1 if ($^O =~ /^MSWin/) or ($^O eq "Windows_NT");
+-if ($ON_WINDOWS and $ENV{'SHELL'}) {
+-    if ($ENV{'SHELL'} =~ m{^/}) {
+-        $ON_WINDOWS = 1;  # make Cygwin look like Unix
+-    } else {
+-        $ON_WINDOWS = 0;  # MKS defines $SHELL but still acts like Windows
+-    }
+-}
+-
+-my $NN     = chr(27) . "[0m";  # normal
+-   $NN     = "" if $ON_WINDOWS;
+-my $BB     = chr(27) . "[1m";  # bold
+-   $BB     = "" if $ON_WINDOWS;
+-my $script = basename $0;
+-my $usage  = "
+-Usage: $script [options] <file(s)/dir(s)> | <set 1> <set 2> | <report files>
+-
+- Count, or compute differences of, physical lines of source code in the 
+- given files (may be archives such as compressed tarballs or zip files) 
+- and/or recursively below the given directories.
+-
+- ${BB}Input Options${NN}
+-   --extract-with=<cmd>      This option is only needed if cloc is unable
+-                             to figure out how to extract the contents of
+-                             the input file(s) by itself.
+-                             Use <cmd> to extract binary archive files (e.g.:
+-                             .tar.gz, .zip, .Z).  Use the literal '>FILE<' as 
+-                             a stand-in for the actual file(s) to be
+-                             extracted.  For example, to count lines of code
+-                             in the input files 
+-                                gcc-4.2.tar.gz  perl-5.8.8.tar.gz  
+-                             on Unix use  
+-                               --extract-with='gzip -dc >FILE< | tar xf -'
+-                             or, if you have GNU tar,
+-                               --extract-with='tar zxf >FILE<' 
+-                             and on Windows use: 
+-                               --extract-with=\"\\\"c:\\Program Files\\WinZip\\WinZip32.exe\\\" -e -o >FILE< .\"
+-                             (if WinZip is installed there).
+-   --list-file=<file>        Take the list of file and/or directory names to 
+-                             process from <file> which has one file/directory 
+-                             name per line.  See also --exclude-list-file.
+-   --unicode                 Check binary files to see if they contain Unicode
+-                             expanded ASCII text.  This causes performance to
+-                             drop noticably.
+-
+- ${BB}Processing Options${NN}
+-   --autoconf                Count .in files (as processed by GNU autoconf) of 
+-                             recognized languages.
+-   --by-file                 Report results for every source file encountered.
+-   --by-file-by-lang         Report results for every source file encountered
+-                             in addition to reporting by language.
+-   --diff <set1> <set2>      Compute differences in code and comments between
+-                             source file(s) of <set1> and <set2>.  The inputs
+-                             may be pairs of files, directories, or archives.
+-                             Use --diff-alignment to generate a list showing
+-                             which file pairs where compared.  See also
+-                             --ignore-case, --ignore-whitespace.
+-   --follow-links            [Unix only] Follow symbolic links to directories
+-                             (sym links to files are always followed).
+-   --force-lang=<lang>[,<ext>]
+-                             Process all files that have a <ext> extension 
+-                             with the counter for language <lang>.  For 
+-                             example, to count all .f files with the 
+-                             Fortran 90 counter (which expects files to 
+-                             end with .f90) instead of the default Fortran 77 
+-                             counter, use
+-                               --force-lang=\"Fortran 90\",f
+-                             If <ext> is omitted, every file will be counted
+-                             with the <lang> counter.  This option can be 
+-                             specified multiple times (but that is only
+-                             useful when <ext> is given each time).  
+-                             See also --script-lang, --lang-no-ext.
+-   --ignore-whitespace       Ignore horizontal white space when comparing files
+-                             with --diff.  See also --ignore-case.
+-   --ignore-case             Ignore changes in case; consider upper- and lower-
+-                             case letters equivalent when comparing files with
+-                             --diff.  See also --ignore-whitespace.
+-   --lang-no-ext=<lang>      Count files without extensions using the <lang> 
+-                             counter.  This option overrides internal logic 
+-                             for files without extensions (where such files 
+-                             are checked against known scripting languages
+-                             by examining the first line for #!).  See also 
+-                             --force-lang, --script-lang.
+-   --read-binary-files       Process binary files in addition to text files.
+-                             This is usually a bad idea and should only be
+-                             attempted with text files that have embedded 
+-                             binary data.
+-   --read-lang-def=<file>    Load from <file> the language processing filters.
+-                             (see also --write-lang-def) then use these filters
+-                             instead of the built-in filters.
+-   --script-lang=<lang>,<s>  Process all files that invoke <s> as a #!
+-                             scripting language with the counter for language
+-                             <lang>.  For example, files that begin with
+-                                #!/usr/local/bin/perl5.8.8
+-                             will be counted with the Perl counter by using
+-                                --script-lang=Perl,perl5.8.8
+-                             The language name is case insensitive but the
+-                             name of the script language executable, <s>,
+-                             must have the right case.  This option can be 
+-                             specified multiple times.  See also --force-lang,
+-                             --lang-no-ext.
+-   --sdir=<dir>              Use <dir> as the scratch directory instead of
+-                             letting File::Temp chose the location.  Files
+-                             written to this location are not removed at
+-                             the end of the run (as they are with File::Temp).
+-   --skip-uniqueness         Skip the file uniqueness check.  This will give
+-                             a performance boost at the expense of counting
+-                             files with identical contents multiple times
+-                             (if such duplicates exist).
+-   --strip-comments=<ext>    For each file processed, write to the current
+-                             directory a version of the file which has blank
+-                             lines and comments removed.  The name of each
+-                             stripped file is the original file name with 
+-                             .<ext> appended to it.  It is written to the
+-                             current directory unless --original-dir is on.
+-   --original-dir            [Only effective in combination with 
+-                             --strip-comments]  Write the stripped files 
+-                             to the same directory as the original files.
+-   --sum-reports             Input arguments are report files previously
+-                             created with the --report-file option.  Makes
+-                             a cumulative set of results containing the
+-                             sum of data from the individual report files.
+-
+- ${BB}Filter Options${NN}
+-   --exclude-dir=<D1>[,D2,]  Exclude the given comma separated directories
+-                             D1, D2, D3, et cetera, from being scanned.  For
+-                             example  --exclude-dir=.cache,test  will skip
+-                             all files that have /.cache/ or /test/ as part
+-                             of their path.
+-                             Directories named .cvs and .svn are always
+-                             excluded.
+-   --exclude-ext=<ext1>[,<ext2>[...]]
+-                             Do not count files having the given file name 
+-                             extensions.
+-   --exclude-lang=<L1>[,L2,] Exclude the given comma separated languages
+-                             L1, L2, L3, et cetera, from being counted.
+-   --exclude-list-file=<file>  Ignore files and/or directories whose names 
+-                             appear in <file>.  <file> should have one entry 
+-                             per line.  Relative path names will be resolved 
+-                             starting from the directory where cloc is 
+-                             invoked.  See also --list-file.
+-   --match-f=<regex>         Only count files whose basenames match the Perl 
+-                             regex.  For example
+-                               --match-f=^[Ww]idget
+-                             only counts files that start with Widget or widget.
+-   --not-match-f=<regex>     Count all files except those whose basenames
+-                             match the Perl regex.
+-   --match-d=<regex>         Only count files in directories matching the Perl 
+-                             regex.  For example
+-                               --match-d=/src/
+-                             only counts files in directories containing
+-                             /src/
+-   --not-match-d=<regex>     Count all files except those in directories
+-                             matching the Perl regex.
+-   --skip-win-hidden         On Windows, ignore hidden files.
+-
+- ${BB}Debug Options${NN}
+-   --categorized=<file>      Save names of categorized files to <file>.
+-   --counted=<file>          Save names of processed source files to <file>.
+-   --diff-alignment=<file>   Write to <file> a list of files and file pairs 
+-                             showing which files were added, removed, and/or
+-                             compared during a run with --diff.  This switch
+-                             forces the --diff mode on.
+-   --help                    Print this usage information and exit.
+-   --found=<file>            Save names of every file found to <file>.
+-   --ignored=<file>          Save names of ignored files and the reason they
+-                             were ignored to <file>.
+-   --print-filter-stages     Print to STDOUT processed source code before and 
+-                             after each filter is applied.
+-   --show-ext[=<ext>]        Print information about all known (or just the
+-                             given) file extensions and exit.
+-   --show-lang[=<lang>]      Print information about all known (or just the
+-                             given) languages and exit.
+-   -v[=<n>]                  Verbose switch (optional numeric value).
+-   --version                 Print the version of this program and exit.
+-
+-   --write-lang-def=<file>   Writes to <file> the language processing filters
+-                             then exits.  Useful as a first step to creating
+-                             custom language definitions (see --read-lang-def).
+-
+- ${BB}Output Options${NN}
+-   --3                       Print third-generation language output.
+-                             (This option can cause report summation to fail
+-                             if some reports were produced with this option
+-                             while others were produced without it.)
+-   --progress-rate=<n>       Show progress update after every <n> files are
+-                             processed (default <n>=100).  Set <n> to 0 to
+-                             suppress progress output (useful when redirecting
+-                             output to STDOUT).
+-   --quiet                   Suppress all information messages except for
+-                             the final report.
+-   --report-file=<file>      Write the results to <file> instead of STDOUT.
+-   --out=<file>              Synonym for --report-file=<file>.
+-   --csv                     Write the results as comma separated values.
+-   --sql=<file>              Write results as SQL create and insert statements
+-                             which can be read by a database program such as
+-                             SQLite.  If <file> is 1, output is sent to STDOUT.
+-   --sql-project=<name>      Use <name> as the project identifier for the 
+-                             current run.  Only valid with the --sql option.
+-   --sql-append              Append SQL insert statements to the file specified
+-                             by --sql and do not generate table creation 
+-                             statements.  Only valid with the --sql option.
+-   --sum-one                 For plain text reports, show the SUM: output line 
+-                             even if only one input file is processed.
+-   --xml                     Write the results in XML.
+-   --xsl=<file>              Reference <file> as an XSL stylesheet within
+-                             the XML output.  If <file> is 1 (numeric one), 
+-                             writes a default stylesheet, cloc.xsl (or 
+-                             cloc-diff.xsl if --diff is also given).  
+-                             This switch forces --xml on.
+-   --yaml                    Write the results in YAML.
+-
+-";
+-#  Help information for options not yet implemented:
+-#  --inline                  Process comments that appear at the end
+-#                            of lines containing code.
+-#  --html                    Create HTML files of each input file showing
+-#                            comment and code lines in different colors.
+-
+-$| = 1;  # flush STDOUT
+-my $start_time = time();
+-my (
+-    $opt_categorized          ,
+-    $opt_found                ,
+-    @opt_force_lang           ,
+-    $opt_lang_no_ext          ,
+-    @opt_script_lang          ,
+-    $opt_diff                 ,
+-    $opt_diff_alignment       ,
+-    $opt_html                 ,
+-    $opt_ignored              ,
+-    $opt_counted              ,
+-    $opt_show_ext             ,
+-    $opt_show_lang            ,
+-    $opt_progress_rate        ,
+-    $opt_print_filter_stages  ,
+-    $opt_v                    ,
+-    $opt_version              ,
+-    $opt_exclude_lang         ,
+-    $opt_exclude_list_file    ,
+-    $opt_exclude_dir          ,
+-    $opt_read_lang_def        ,
+-    $opt_write_lang_def       ,
+-    $opt_strip_comments       ,
+-    $opt_original_dir         ,
+-    $opt_quiet                ,
+-    $opt_report_file          ,
+-    $opt_sdir                 ,
+-    $opt_sum_reports          ,
+-    $opt_unicode              ,
+-    $opt_no3                  ,   # accept it but don't use it
+-    $opt_3                    ,
+-    $opt_extract_with         ,
+-    $opt_by_file              ,
+-    $opt_by_file_by_lang      ,
+-    $opt_xml                  ,
+-    $opt_xsl                  ,
+-    $opt_yaml                 ,
+-    $opt_csv                  ,
+-	$opt_match_f              ,
+-	$opt_not_match_f          ,
+-	$opt_match_d              ,
+-	$opt_not_match_d          ,
+-	$opt_skip_uniqueness      ,
+-	$opt_list_file            ,
+-	$opt_help                 ,
+-	$opt_skip_win_hidden      ,
+-	$opt_read_binary_files    ,
+-	$opt_sql                  ,
+-	$opt_sql_append           ,
+-	$opt_sql_project          ,
+-	$opt_inline               ,
+-    $opt_exclude_ext          ,
+-    $opt_ignore_whitespace    ,
+-    $opt_ignore_case          ,
+-    $opt_follow_links         ,
+-    $opt_autoconf             ,
+-    $opt_sum_one              ,
+-   );
+-my $getopt_success = GetOptions(
+-   "by_file|by-file"                         => \$opt_by_file             ,
+-   "by_file_by_lang|by-file-by-lang"         => \$opt_by_file_by_lang     ,
+-   "categorized=s"                           => \$opt_categorized         ,
+-   "counted=s"                               => \$opt_counted             ,
+-   "exclude_lang|exclude-lang=s"             => \$opt_exclude_lang        ,
+-   "exclude_dir|exclude-dir=s"               => \$opt_exclude_dir         ,
+-   "exclude_list_file|exclude-list-file=s"   => \$opt_exclude_list_file   ,
+-   "extract_with|extract-with=s"             => \$opt_extract_with        , 
+-   "found=s"                                 => \$opt_found               ,
+-   "diff"                                    => \$opt_diff                ,
+-   "diff-alignment|diff_alignment=s"         => \$opt_diff_alignment      ,
+-   "html"                                    => \$opt_html                ,
+-   "ignored=s"                               => \$opt_ignored             ,
+-   "quiet"                                   => \$opt_quiet               ,
+-   "read_lang_def|read-lang-def=s"           => \$opt_read_lang_def       ,
+-   "show_ext|show-ext:s"                     => \$opt_show_ext            ,
+-   "show_lang|show-lang:s"                   => \$opt_show_lang           ,
+-   "progress_rate|progress-rate=i"           => \$opt_progress_rate       ,
+-   "print_filter_stages|print-filter-stages" => \$opt_print_filter_stages ,
+-   "report_file|report-file=s"               => \$opt_report_file         ,
+-   "out=s"                                   => \$opt_report_file         ,
+-   "script_lang|script-lang=s"               => \@opt_script_lang         ,
+-   "sdir=s"                                  => \$opt_sdir                ,
+-   "skip_uniqueness|skip-uniqueness"         => \$opt_skip_uniqueness     ,
+-   "strip_comments|strip-comments=s"         => \$opt_strip_comments      ,
+-   "original_dir|original-dir"               => \$opt_original_dir        ,
+-   "sum_reports|sum-reports"                 => \$opt_sum_reports         ,
+-   "unicode"                                 => \$opt_unicode             ,
+-   "no3"                                     => \$opt_no3                 ,  # ignored
+-   "3"                                       => \$opt_3                   ,
+-   "v:i"                                     => \$opt_v                   ,
+-   "version"                                 => \$opt_version             ,
+-   "write_lang_def|write-lang-def=s"         => \$opt_write_lang_def      ,
+-   "xml"                                     => \$opt_xml                 ,
+-   "xsl=s"                                   => \$opt_xsl                 ,
+-   "force_lang|force-lang=s"                 => \@opt_force_lang          ,
+-   "lang_no_ext|lang-no-ext=s"               => \$opt_lang_no_ext         ,
+-   "yaml"                                    => \$opt_yaml                ,
+-   "csv"                                     => \$opt_csv                 ,
+-   "match_f|match-f=s"                       => \$opt_match_f             ,
+-   "not_match_f|not-match-f=s"               => \$opt_not_match_f         ,
+-   "match_d|match-d=s"                       => \$opt_match_d             ,
+-   "not_match_d|not-match-d=s"               => \$opt_not_match_d         ,
+-   "list_file|list-file=s"                   => \$opt_list_file           ,
+-   "help"                                    => \$opt_help                ,
+-   "skip_win_hidden|skip-win-hidden"         => \$opt_skip_win_hidden     ,
+-   "read_binary_files|read-binary-files"     => \$opt_read_binary_files   ,
+-   "sql=s"                                   => \$opt_sql                 ,
+-   "sql_project|sql-project=s"               => \$opt_sql_project         ,
+-   "sql_append|sql-append"                   => \$opt_sql_append          ,
+-   "inline"                                  => \$opt_inline              ,
+-   "exclude_ext|exclude-ext=s"               => \$opt_exclude_ext         ,
+-   "ignore_whitespace|ignore-whitespace"     => \$opt_ignore_whitespace   ,
+-   "ignore_case|ignore-case"                 => \$opt_ignore_case         ,
+-   "follow_links|follow-links"               => \$opt_follow_links        ,
+-   "autoconf"                                => \$opt_autoconf            ,
+-   "sum_one|sum-one"                         => \$opt_sum_one             ,
+-  );
+-$opt_by_file  = 1 if defined  $opt_by_file_by_lang;
+-my $CLOC_XSL = "cloc.xsl"; # created with --xsl
+-   $CLOC_XSL = "cloc-diff.xsl" if $opt_diff;
+-die "\n" unless $getopt_success;
+-die $usage if $opt_help;
+-my %Exclude_Language = ();
+-   %Exclude_Language = map { $_ => 1 } split(/,/, $opt_exclude_lang) 
+-        if $opt_exclude_lang;
+-my %Exclude_Dir      = ();
+-   %Exclude_Dir      = map { $_ => 1 } split(/,/, $opt_exclude_dir ) 
+-        if $opt_exclude_dir ;
+-# Forcibly exclude .svn, .cvs, .hg directories.  The contents of these
+-# directories often conflict with files of interest.
+-$opt_exclude_dir       = 1;
+-$Exclude_Dir{".svn"}   = 1;
+-$Exclude_Dir{".cvs"}   = 1;
+-$Exclude_Dir{".hg"}    = 1;
+-$opt_diff              = 1 if $opt_diff_alignment;
+-$opt_exclude_ext       = "" unless $opt_exclude_ext;
+-$opt_ignore_whitespace = 0  unless $opt_ignore_whitespace;
+-$opt_ignore_case       = 0  unless $opt_ignore_case;       
+-$opt_lang_no_ext       = 0  unless $opt_lang_no_ext;
+-$opt_follow_links      = 0  unless $opt_follow_links;
+-
+-# Options defaults:
+-$opt_progress_rate = 100 unless defined $opt_progress_rate;
+-if (!defined $opt_v) {
+-    $opt_v  = 0;
+-} elsif (!$opt_v) {
+-    $opt_v  = 1;
+-}
+-if (defined $opt_xsl) {
+-    $opt_xsl = $CLOC_XSL if $opt_xsl eq "1";
+-    $opt_xml = 1;
+-}
+-my $skip_generate_report = 0;
+-$opt_sql = 0 unless defined $opt_sql;
+-if ($opt_sql eq "1") { # stream SQL output to STDOUT
+-    $opt_quiet            = 1;
+-    $skip_generate_report = 1;
+-    $opt_by_file          = 1;
+-    $opt_sum_reports      = 0;
+-    $opt_progress_rate    = 0;
+-} elsif ($opt_sql)  { # write SQL output to a file
+-    $opt_by_file          = 1;
+-    $skip_generate_report = 1;
+-    $opt_sum_reports      = 0;
+-}
+-die $usage unless defined $opt_version         or
+-                  defined $opt_show_lang       or
+-                  defined $opt_show_ext        or
+-                  defined $opt_write_lang_def  or
+-                  defined $opt_list_file       or
+-                  defined $opt_xsl             or
+-                  scalar @ARGV >= 1;
+-die "--diff requires at least two arguments\n" 
+-    if $opt_diff and scalar @ARGV < 2;
+-if ($opt_version) {
+-    printf "$VERSION\n";
+-    exit;
+-}
+-# 1}}}
+-# Step 1:  Initialize global constants.        {{{1
+-#
+-my $nFiles_Found = 0;  # updated in make_file_list
+-my (%Language_by_Extension, %Language_by_Script,
+-    %Filters_by_Language, %Not_Code_Extension, %Not_Code_Filename,
+-    %Language_by_File, %Scale_Factor, %Known_Binary_Archives,
+-    %EOL_Continuation_re,
+-   );
+-my $ALREADY_SHOWED_HEADER = 0;
+-my $ALREADY_SHOWED_XML_SECTION = 0;
+-my %Error_Codes = ( 'Unable to read'                => -1,
+-                    'Neither file nor directory'    => -2, 
+-                    'Diff error (quoted comments?)' => -3, 
+-                  );
+-if ($opt_read_lang_def) {
+-    read_lang_def(
+-        $opt_read_lang_def     , #        Sample values:
+-        \%Language_by_Extension, # Language_by_Extension{f}    = 'Fortran 77' 
+-        \%Language_by_Script   , # Language_by_Script{sh}      = 'Bourne Shell'
+-        \%Language_by_File     , # Language_by_File{makefile}  = 'make'
+-        \%Filters_by_Language  , # Filters_by_Language{Bourne Shell}[0] = 
+-                                 #      [ 'remove_matches' , '^\s*#'  ]
+-        \%Not_Code_Extension   , # Not_Code_Extension{jpg}     = 1
+-        \%Not_Code_Filename    , # Not_Code_Filename{README}   = 1
+-        \%Scale_Factor         , # Scale_Factor{Perl}          = 4.0
+-        \%EOL_Continuation_re  , # EOL_Continuation_re{C++}    = '\\$'
+-        );
+-} else {
+-    set_constants(               #
+-        \%Language_by_Extension, # Language_by_Extension{f}    = 'Fortran 77' 
+-        \%Language_by_Script   , # Language_by_Script{sh}      = 'Bourne Shell'
+-        \%Language_by_File     , # Language_by_File{makefile}  = 'make'
+-        \%Filters_by_Language  , # Filters_by_Language{Bourne Shell}[0] = 
+-                                 #      [ 'remove_matches' , '^\s*#'  ]
+-        \%Not_Code_Extension   , # Not_Code_Extension{jpg}     = 1
+-        \%Not_Code_Filename    , # Not_Code_Filename{README}   = 1
+-        \%Scale_Factor         , # Scale_Factor{Perl}          = 4.0
+-        \%Known_Binary_Archives, # Known_Binary_Archives{.tar} = 1
+-        \%EOL_Continuation_re  , # EOL_Continuation_re{C++}    = '\\$'
+-        );
+-}
+-if ($opt_lang_no_ext and !defined $Filters_by_Language{$opt_lang_no_ext}) {
+-    die_unknown_lang($opt_lang_no_ext, "--lang-no-ext")
+-}
+-
+-# Process command line provided extention-to-language mapping overrides.
+-# Make a hash of known languages in lower case for easier matching.
+-my %Recognized_Language_lc = (); # key = language name in lc, value = true name
+-foreach my $language (keys %Filters_by_Language) {
+-    my $lang_lc = lc $language;
+-    $Recognized_Language_lc{$lang_lc} = $language;
+-}
+-my %Forced_Extension = (); # file name extensions which user wants to count
+-my $All_One_Language = 0;  # set to !0 if --force-lang's <ext> is missing
+-foreach my $pair (@opt_force_lang) {
+-    my ($lang, $extension) = split(',', $pair);
+-    my $lang_lc = lc $lang;
+-    if (defined $extension) {
+-        $Forced_Extension{$extension} = $lang;
+-
+-        die_unknown_lang($lang, "--force-lang")
+-            unless $Recognized_Language_lc{$lang_lc}; 
+-
+-        $Language_by_Extension{$extension} = $Recognized_Language_lc{$lang_lc};
+-    } else {
+-        # the scary case--count everything as this language
+-        $All_One_Language = $Recognized_Language_lc{$lang_lc};
+-    }
+-}
+-
+-foreach my $pair (@opt_script_lang) {
+-    my ($lang, $script_name) = split(',', $pair);
+-    my $lang_lc = lc $lang;
+-    if (!defined $script_name) {
+-        die "The --script-lang option requires a comma separated pair of ".
+-            "strings.\n";
+-    }
+-
+-    die_unknown_lang($lang, "--script-lang")
+-        unless $Recognized_Language_lc{$lang_lc}; 
+-
+-    $Language_by_Script{$script_name} = $Recognized_Language_lc{$lang_lc};
+-}
+-
+-# If user provided file extensions to ignore, add these to
+-# the exclusion list.
+-foreach my $ext (map { $_ => 1 } split(/,/, $opt_exclude_ext ) ) {
+-    $ext = lc $ext if $ON_WINDOWS;
+-    $Not_Code_Extension{$ext} = 1;
+-}
+-
+-# If SQL output is requested, keep track of directory names generated by 
+-# File::Temp::tempdir and used to temporarily hold the results of compressed
+-# archives.  Contents of the SQL table 't' will be much cleaner if these
+-# meaningless directory names are stripped from the front of files pulled
+-# from the archives.
+-my %TEMP_DIR = ();
+-
+-# invert %Language_by_Script hash to get an easy-to-look-up list of known
+-# scripting languages
+-my %Script_Language = map { $_ => 1 } values %Language_by_Script ;
+-# 1}}}
+-# Step 2:  Early exits for display, summation. {{{1
+-#
+-print_extension_info($opt_show_ext ) if defined $opt_show_ext ;
+-print_language_info( $opt_show_lang) if defined $opt_show_lang;
+-exit if (defined $opt_show_ext) or (defined $opt_show_lang);
+-
+-#print "Before glob have [", join(",", @ARGV), "]\n";
+-@ARGV = windows_glob(@ARGV) if $ON_WINDOWS;
+-#print "after  glob have [", join(",", @ARGV), "]\n";
+-
+-if ($opt_sum_reports and $opt_diff) {
+-    my @results = ();
+-    if ($opt_list_file) { # read inputs from the list file
+-        my @list = read_list_file($opt_list_file);
+-        @results = combine_diffs(\@list);
+-    } else { # get inputs from the command line
+-        @results = combine_diffs(\@ARGV);
+-    }
+-    if ($opt_report_file) {
+-        write_file($opt_report_file, @results);
+-    } else {
+-        print "\n", join("\n", @results), "\n";
+-    }
+-    exit;
+-}
+-if ($opt_sum_reports) {
+-    my %Results = ();
+-    foreach my $type( "by language", "by report file" ) {
+-        my $found_lang = undef; 
+-        if ($opt_list_file) { # read inputs from the list file
+-            my @list = read_list_file($opt_list_file);
+-            $found_lang = combine_results(\@list, 
+-                                           $type, 
+-                                          \%{$Results{ $type }}, 
+-                                          \%Filters_by_Language );
+-        } else { # get inputs from the command line
+-            $found_lang = combine_results(\@ARGV, 
+-                                           $type, 
+-                                          \%{$Results{ $type }}, 
+-                                          \%Filters_by_Language );
+-        }
+-        next unless %Results;
+-        my $end_time = time();
+-        my @results  = generate_report($VERSION, $end_time - $start_time,
+-                                       $type,
+-                                      \%{$Results{ $type }}, \%Scale_Factor);
+-        if ($opt_report_file) {
+-            my $ext  = ".lang";
+-               $ext  = ".file" unless $type eq "by language";
+-            next if !$found_lang and  $ext  eq ".lang";
+-            write_file($opt_report_file . $ext, @results);
+-        } else {
+-            print "\n", join("\n", @results), "\n";
+-        }
+-    }
+-    exit;
+-}
+-if ($opt_write_lang_def) {
+-    write_lang_def($opt_write_lang_def   ,
+-                  \%Language_by_Extension,
+-                  \%Language_by_Script   ,
+-                  \%Language_by_File     ,
+-                  \%Filters_by_Language  ,
+-                  \%Not_Code_Extension   ,
+-                  \%Not_Code_Filename    ,
+-                  \%Scale_Factor         ,
+-                  \%EOL_Continuation_re  ,
+-                  );
+-    exit;
+-}
+-# 1}}}
+-# Step 3:  Create a list of files to consider. {{{1
+-#  a) If inputs are binary archives, first cd to a temp
+-#     directory, expand the archive with the user-given
+-#     extraction tool, then add the temp directory to
+-#     the list of dirs to process.
+-#  b) Create a list of every file that might contain source
+-#     code.  Ignore binary files, zero-sized files, and
+-#     any file in a directory the user says to exclude.
+-#  c) Determine the language for each file in the list.
+-#
+-my @binary_archive = ();
+-my $cwd            = cwd();
+-if ($opt_extract_with) {
+-#print "cwd main = [$cwd]\n";
+-    my @extract_location = ();
+-    foreach my $bin_file (@ARGV) {
+-        my $extract_dir = tempdir( CLEANUP => 1 );  # 1 = delete on exit
+-        $TEMP_DIR{ $extract_dir } = 1 if $opt_sql;
+-        print "mkdir $extract_dir\n" if $opt_v;
+-        print "cd    $extract_dir\n" if $opt_v;
+-        chdir $extract_dir;
+-        my $bin_file_full_path = "";
+-        if (File::Spec->file_name_is_absolute( $bin_file )) {
+-            $bin_file_full_path = $bin_file;
+-#print "bin_file_full_path (was ful) = [$bin_file_full_path]\n";
+-        } else {
+-            $bin_file_full_path = File::Spec->catfile( $cwd, $bin_file );
+-#print "bin_file_full_path (was rel) = [$bin_file_full_path]\n";
+-        }
+-        my     $extract_cmd = uncompress_archive_cmd($bin_file_full_path);
+-        print  $extract_cmd, "\n" if $opt_v;
+-        system $extract_cmd;
+-        push @extract_location, $extract_dir;
+-        chdir $cwd;
+-    }
+-    # It is possible that the binary archive itself contains additional
+-    # files compressed the same way (true for Java .ear files).  Go
+-    # through all the files that were extracted, see if they are binary
+-    # archives and try to extract them.  Lather, rinse, repeat.
+-    my $binary_archives_exist = 1;
+-    my $count_binary_archives = 0;
+-    my $previous_count        = 0;
+-    while ($binary_archives_exist) {
+-        @binary_archive = ();
+-        foreach my $dir (@extract_location) {
+-            find(\&archive_files, $dir);  # populates global @binary_archive
+-        }
+-        foreach my $archive (@binary_archive) {
+-            my     $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit
+-            $TEMP_DIR{ $extract_dir } = 1 if $opt_sql;
+-            print "mkdir $extract_dir\n" if $opt_v;
+-            print "cd    $extract_dir\n" if $opt_v;
+-            chdir  $extract_dir;
+-
+-            my     $extract_cmd = uncompress_archive_cmd($archive);
+-            print  $extract_cmd, "\n" if $opt_v;
+-            system $extract_cmd;
+-            push @extract_location, $extract_dir;
+-            unlink $archive;  # otherwise will be extracting it forever 
+-        }
+-        $count_binary_archives = scalar @binary_archive;
+-        if ($count_binary_archives == $previous_count) {
+-            $binary_archives_exist = 0;
+-        }
+-        $previous_count = $count_binary_archives;
+-    }
+-    chdir $cwd;
+-
+-    @ARGV = @extract_location;
+-} else {
+-    # see if any of the inputs need to be auto-uncompressed &/or expanded
+-    my @updated_ARGS = ();
+-    foreach my $Arg (@ARGV) {
+-        if (is_dir($Arg)) {
+-            push @updated_ARGS, $Arg;
+-            next;
+-        }
+-        my $full_path = "";
+-        if (File::Spec->file_name_is_absolute( $Arg )) {
+-            $full_path = $Arg;
+-        } else {
+-            $full_path = File::Spec->catfile( $cwd, $Arg );
+-        }
+-#print "full_path = [$full_path]\n";
+-        my $extract_cmd = uncompress_archive_cmd($full_path);
+-        if ($extract_cmd) {
+-            my     $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit
+-            $TEMP_DIR{ $extract_dir } = 1 if $opt_sql;
+-            print "mkdir $extract_dir\n" if $opt_v;
+-            print "cd    $extract_dir\n" if $opt_v;
+-            chdir  $extract_dir;
+-            print  $extract_cmd, "\n" if $opt_v;
+-            system $extract_cmd;
+-            push @updated_ARGS, $extract_dir;
+-            chdir $cwd;
+-        } else {
+-            # this is a conventional, uncompressed, unarchived file
+-            # or a directory; keep as-is
+-            push @updated_ARGS, $Arg;
+-        }
+-    }
+-    @ARGV = @updated_ARGS;
+-}
+-# 1}}}
+-my @Errors    = ();
+-my @file_list = ();  # global variable updated in files()
+-my %Ignored   = ();  # files that are not counted (language not recognized or
+-                     # problems reading the file)
+-my @Lines_Out = ();
+-if ($opt_diff) {
+-# Step 4:  Separate code from non-code files. {{{1
+-my @fh            = ();
+-my @files_for_set = ();
+-# make file lists for each separate argument
+-if ($opt_exclude_list_file) {
+-    process_exclude_list_file($opt_exclude_list_file, 
+-                             \%Exclude_Dir,
+-                             \%Ignored);
+-}
+-for (my $i = 0; $i < scalar @ARGV; $i++) {
+-    push @fh, 
+-         make_file_list([ $ARGV[$i] ], \%Error_Codes, \@Errors, \%Ignored);
+-    @{$files_for_set[$i]} = @file_list;
+-    @file_list = ();
+-}
+-# 1}}}
+-# Step 5:  Remove duplicate files.             {{{1
+-#
+-my %Language           = ();
+-my %unique_source_file = ();
+-my $n_set = 0;
+-foreach my $FH (@fh) {  # loop over each pair of file sets
+-    ++$n_set;
+-    remove_duplicate_files($FH, 
+-                               \%{$Language{$FH}}               , 
+-                               \%{$unique_source_file{$FH}}     , 
+-                          \%Error_Codes                         , 
+-                               \@Errors                         , 
+-                               \%Ignored                        );
+-    printf "%2d: %8d unique file%s.                          \r", 
+-        $n_set,
+-        plural_form(scalar keys %unique_source_file) 
+-        unless $opt_quiet;
+-}
+-# 1}}}
+-# Step 6:  Count code, comments, blank lines.  {{{1
+-#
+-my %Results_by_Language = ();
+-my %Results_by_File     = ();
+-my %Delta_by_Language   = ();
+-my %Delta_by_File       = ();
+-my $nFiles_added        = 0;
+-my $nFiles_removed      = 0;
+-my $nFiles_modified     = 0;
+-my $nFiles_same         = 0;
+-
+-foreach (my $F = 0; $F < scalar @fh - 1; $F++) { 
+-    # loop over file sets; do diff between set $F to $F+1
+-
+-    my $nCounted = 0;
+-
+-    my @file_pairs    = ();
+-    my @files_added   = ();
+-    my @files_removed = ();
+-
+-    align_by_pairs(\%{$unique_source_file{$fh[$F  ]}}    , # in
+-                   \%{$unique_source_file{$fh[$F+1]}}    , # in
+-                   \@files_added                         , # out
+-                   \@files_removed                       , # out
+-                   \@file_pairs                          , # out
+-                   );
+-    if (!@file_pairs) {
+-        # Special case where all files were either added or deleted.
+-        # In this case, one of these arrays will be empty: 
+-        #   @files_added, @files_removed
+-        # so loop over both to cover both cases.
+-        my $status = @files_added ? 'added' : 'removed';
+-        my $offset = @files_added ? 1       : 0        ;
+-        foreach my $file (@files_added, @files_removed) {
+-            my $Lang = $Language{$fh[$F+$offset]}{$file};
+-            my ($all_line_count,
+-                $blank_count   ,
+-                $comment_count ,
+-               ) = call_counter($file, $Lang, \@Errors);
+-            my $code_count = $all_line_count-$blank_count-$comment_count;
+-            if ($opt_by_file) {
+-                $Delta_by_File{$file}{'code'   }{$status} += $code_count   ;
+-                $Delta_by_File{$file}{'blank'  }{$status} += $blank_count  ;
+-                $Delta_by_File{$file}{'comment'}{$status} += $comment_count;
+-                $Delta_by_File{$file}{'lang'   }{$status}  = $Lang         ;
+-                $Delta_by_File{$file}{'nFiles' }{$status} += 1             ;
+-            }
+-            $Delta_by_Language{$Lang}{'code'   }{$status} += $code_count   ;
+-            $Delta_by_Language{$Lang}{'blank'  }{$status} += $blank_count  ;
+-            $Delta_by_Language{$Lang}{'comment'}{$status} += $comment_count;
+-        }
+-    }
+-   #use Data::Dumper::Simple;
+-   #use Data::Dumper;
+-   #print Dumper(\@files_added, \@files_removed, \@file_pairs);
+-    my @alignment = (); # only  used if --diff-alignment
+-#print "after align_by_pairs:\n";
+-
+-#print "added:\n";
+-    push @alignment, sprintf "Files added: %d\n", scalar @files_added
+-        if $opt_diff_alignment;
+-    foreach my $f (@files_added) {
+-#printf "%10s -> %s\n", $f, $Language{$fh[$F+1]}{$f};
+-        # Don't proceed unless the file (both L and R versions)
+-        # is in a known language.
+-        next if $Language{$fh[$F+1]}{$f} eq "(unknown)";
+-        next if $Exclude_Language{$Language{$fh[$F+1]}{$f}};
+-        push @alignment, sprintf "  + %s ; %s\n", $f, $Language{$fh[$F+1]}{$f}
+-            if $opt_diff_alignment;
+-        ++$Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'nFiles'}{'added'};
+-        # Additionally, add contents of file $f to 
+-        #        Delta_by_File{$f}{comment/blank/code}{'added'}
+-        #        Delta_by_Language{$lang}{comment/blank/code}{'added'}
+-        my ($all_line_count,
+-            $blank_count   ,
+-            $comment_count ,
+-           ) = call_counter($f, $Language{$fh[$F+1]}{$f}, \@Errors);
+-        $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'comment'}{'added'} +=
+-            $comment_count;
+-        $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'blank'}{'added'}   +=
+-            $blank_count;
+-        $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'code'}{'added'}    +=
+-            $all_line_count - $blank_count - $comment_count;
+-        $Delta_by_File{ $f }{'comment'}{'added'} = $comment_count;
+-        $Delta_by_File{ $f }{'blank'}{'added'}   = $blank_count;
+-        $Delta_by_File{ $f }{'code'}{'added'}    = 
+-            $all_line_count - $blank_count - $comment_count;
+-    }
+-    push @alignment, "\n";
+-
+-#print "removed:\n";
+-    push @alignment, sprintf "Files removed: %d\n", scalar @files_removed
+-        if $opt_diff_alignment;
+-    foreach my $f (@files_removed) {
+-        # Don't proceed unless the file (both L and R versions)
+-        # is in a known language.
+-        next if $Language{$fh[$F  ]}{$f} eq "(unknown)";
+-        next if $Exclude_Language{$Language{$fh[$F  ]}{$f}};
+-        ++$Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'nFiles'}{'removed'};
+-        push @alignment, sprintf "  - %s ; %s\n", $f, $Language{$fh[$F]}{$f}
+-            if $opt_diff_alignment;
+-#printf "%10s -> %s\n", $f, $Language{$fh[$F  ]}{$f};
+-        # Additionally, add contents of file $f to 
+-        #        Delta_by_File{$f}{comment/blank/code}{'removed'}
+-        #        Delta_by_Language{$lang}{comment/blank/code}{'removed'}
+-        my ($all_line_count,
+-            $blank_count   ,
+-            $comment_count ,
+-           ) = call_counter($f, $Language{$fh[$F  ]}{$f}, \@Errors);
+-        $Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'comment'}{'removed'} +=
+-            $comment_count;
+-        $Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'blank'}{'removed'}   +=
+-            $blank_count;
+-        $Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'code'}{'removed'}    +=
+-            $all_line_count - $blank_count - $comment_count;
+-        $Delta_by_File{ $f }{'comment'}{'removed'} = $comment_count;
+-        $Delta_by_File{ $f }{'blank'}{'removed'}   = $blank_count;
+-        $Delta_by_File{ $f }{'code'}{'removed'}    = 
+-            $all_line_count - $blank_count - $comment_count;
+-    }
+-    push @alignment, "\n";
+-
+-    push @alignment, sprintf "File pairs compared: %d\n", scalar @file_pairs
+-        if $opt_diff_alignment;
+-#print "Language=\n", Dumper(\%Language);
+-    foreach my $pair (@file_pairs) {
+-        my $file_L = $pair->[0];
+-        my $file_R = $pair->[1];
+-        my $Lang_L = $Language{$fh[$F  ]}{$file_L};
+-        my $Lang_R = $Language{$fh[$F+1]}{$file_R};
+-#print "main step 6 file_L=$file_L    file_R=$file_R\n";
+-        ++$nCounted;
+-        printf "Counting:  %d\r", $nCounted 
+-            unless (!$opt_progress_rate or ($nCounted % $opt_progress_rate));
+-        next if $Ignored{$file_L};
+-
+-        # filter out excluded or unrecognized languages
+-        if ($Exclude_Language{$Lang_L} or $Exclude_Language{$Lang_R}) {
+-            $Ignored{$file_L} = "--exclude-lang=$Lang_L}";
+-            $Ignored{$file_R} = "--exclude-lang=$Lang_R}";
+-            next;
+-        }
+-        if (!defined @{$Filters_by_Language{$Lang_L} } or
+-            !defined @{$Filters_by_Language{$Lang_R} }
+-           ) {
+-            if (($Lang_L eq "(unknown)") or ($Lang_R eq "(unknown)")) {
+-                $Ignored{$fh[$F  ]}{$file_L} = "language unknown (#1)";
+-                $Ignored{$fh[$F+1]}{$file_R} = "language unknown (#1)";
+-            } else {
+-                $Ignored{$fh[$F  ]}{$file_L} = "missing Filters_by_Language{$Lang_L}";
+-                $Ignored{$fh[$F+1]}{$file_R} = "missing Filters_by_Language{$Lang_R}";
+-            }
+-            next;
+-        }
+-
+-#print "DIFF($file_L, $file_R)\n";
+-        # step 0: compare the two files' contents 
+-        chomp ( my @lines_L = read_file($file_L) );
+-        chomp ( my @lines_R = read_file($file_R) );
+-        my $language_file_L = "";
+-        if (defined $Language{$fh[$F]}{$file_L}) {
+-            $language_file_L = $Language{$fh[$F]}{$file_L};
+-        } else {
+-            # files $file_L and $file_R do not contain known language
+-            next;
+-        }
+-        my $contents_are_same = 1;
+-        if (scalar @lines_L == scalar @lines_R) {
+-            # same size, must compare line-by-line
+-            for (my $i = 0; $i < scalar @lines_L; $i++) {
+-                if ($lines_L[$i] ne $lines_R[$i]) {
+-                    $contents_are_same = 0;
+-                    last;
+-                }
+-            }
+-            if ($contents_are_same) {
+-                ++$Delta_by_Language{$language_file_L}{'nFiles'}{'same'};
+-            } else {
+-                ++$Delta_by_Language{$language_file_L}{'nFiles'}{'modified'};
+-            }
+-        } else {
+-            $contents_are_same = 0;
+-            # different sizes, contents have changed
+-            ++$Delta_by_Language{$language_file_L}{'nFiles'}{'modified'};
+-        }
+-        if ($opt_diff_alignment) {
+-            my $str =  "$file_L | $file_R ; $language_file_L";
+-            if ($contents_are_same) {
+-                push @alignment, "  == $str";
+-            } else {
+-                push @alignment, "  != $str";
+-            }
+-        }
+-
+-        # step 1: identify comments in both files
+-#print "Diff blank removal L language= $Lang_L";
+-#print " scalar(lines_L)=", scalar @lines_L, "\n";
+-        my @original_minus_blanks_L 
+-                    = rm_blanks(  \@lines_L, $Lang_L, \%EOL_Continuation_re);
+-#print "1: scalar(original_minus_blanks_L)=", scalar @original_minus_blanks_L, "\n";
+-        @lines_L    = @original_minus_blanks_L;
+-#print "2: scalar(lines_L)=", scalar @lines_L, "\n";
+-        @lines_L    = add_newlines(\@lines_L); # compensate for rm_comments()
+-        @lines_L    = rm_comments( \@lines_L, $Lang_L, $file_L,
+-                                   \%EOL_Continuation_re);
+-#print "3: scalar(lines_L)=", scalar @lines_L, "\n";
+-
+-#print "Diff blank removal R language= $Lang_R\n";
+-        my @original_minus_blanks_R 
+-                    = rm_blanks(  \@lines_R, $Lang_R, \%EOL_Continuation_re);
+-        @lines_R    = @original_minus_blanks_R;
+-        @lines_R    = add_newlines(\@lines_R); # taken away by rm_comments()
+-        @lines_R    = rm_comments( \@lines_R, $Lang_R, $file_R,
+-                                   \%EOL_Continuation_re);
+-
+-        my (@diff_LL, @diff_LR, );
+-        array_diff( $file_L                  ,   # in
+-                   \@original_minus_blanks_L ,   # in
+-                   \@lines_L                 ,   # in
+-                   "comment"                 ,   # in
+-                   \@diff_LL, \@diff_LR      ,   # out
+-                   \@Errors);                    # in/out
+-
+-        my (@diff_RL, @diff_RR, );
+-        array_diff( $file_R                  ,   # in
+-                   \@original_minus_blanks_R ,   # in
+-                   \@lines_R                 ,   # in
+-                   "comment"                 ,   # in
+-                   \@diff_RL, \@diff_RR      ,   # out
+-                   \@Errors);                    # in/out
+-        # each line of each file is now classified as
+-        # code or comment
+-
+-#use Data::Dumper; 
+-#print Dumper("diff_LL", \@diff_LL, "diff_LR", \@diff_LR, );
+-#print Dumper("diff_RL", \@diff_RL, "diff_RR", \@diff_RR, );
+-#die;
+-        # step 2: separate code from comments for L and R files
+-        my @code_L = ();
+-        my @code_R = ();
+-        my @comm_L = ();
+-        my @comm_R = ();
+-        foreach my $line_info (@diff_LL) {
+-            if      ($line_info->{'type'} eq "code"   ) {
+-                push @code_L, $line_info->{char};
+-            } elsif ($line_info->{'type'} eq "comment") {
+-                push @comm_L, $line_info->{char};
+-            } else {
+-                die "Diff unexpected line type ",
+-                    $line_info->{'type'}, "for $file_L line ",
+-                    $line_info->{'lnum'};
+-            }
+-        }
+-        foreach my $line_info (@diff_RL) {
+-            if      ($line_info->{type} eq "code"   ) {
+-                push @code_R, $line_info->{'char'};
+-            } elsif ($line_info->{type} eq "comment") {
+-                push @comm_R, $line_info->{'char'};
+-            } else {
+-                die "Diff unexpected line type ",
+-                    $line_info->{'type'}, "for $file_R line ",
+-                    $line_info->{'lnum'};
+-            }
+-        }
+-
+-        if ($opt_ignore_whitespace) {
+-            # strip all whitespace from each line of source code
+-            # and comments then use these stripped arrays in diffs
+-            foreach (@code_L) { s/\s+//g }
+-            foreach (@code_R) { s/\s+//g }
+-            foreach (@comm_L) { s/\s+//g }
+-            foreach (@comm_R) { s/\s+//g }
+-        }
+-        if ($opt_ignore_case) {
+-            # change all text to lowercase in diffs
+-            foreach (@code_L) { $_ = lc }
+-            foreach (@code_R) { $_ = lc }
+-            foreach (@comm_L) { $_ = lc }
+-            foreach (@comm_R) { $_ = lc }
+-        }
+-        # step 3: compute code diffs
+-        array_diff("$file_L v. $file_R"   ,   # in
+-                   \@code_L               ,   # in
+-                   \@code_R               ,   # in
+-                   "revision"             ,   # in
+-                   \@diff_LL, \@diff_LR   ,   # out
+-                   \@Errors);                 # in/out
+-#print Dumper("diff_LL", \@diff_LL, "diff_LR", \@diff_LR, );
+-#print Dumper("diff_LR", \@diff_LR);
+-        foreach my $line_info (@diff_LR) {
+-            my $status = $line_info->{'desc'}; # same|added|removed|modified
+-            ++$Delta_by_Language{$Lang_L}{'code'}{$status};
+-            if ($opt_by_file) {
+-                ++$Delta_by_File{$file_L}{'code'}{$status};
+-            }
+-        }
+-#use Data::Dumper;
+-#print Dumper("code diffs:", \@diff_LL, \@diff_LR);
+-
+-        # step 4: compute comment diffs
+-        array_diff("$file_L v. $file_R"   ,   # in
+-                   \@comm_L               ,   # in
+-                   \@comm_R               ,   # in
+-                   "revision"             ,   # in
+-                   \@diff_LL, \@diff_LR   ,   # out
+-                   \@Errors);                 # in/out
+-#print Dumper("comment diff_LR", \@diff_LR);
+-        foreach my $line_info (@diff_LR) {
+-            my $status = $line_info->{'desc'}; # same|added|removed|modified
+-            ++$Delta_by_Language{$Lang_L}{'comment'}{$status};
+-            if ($opt_by_file) {
+-                ++$Delta_by_File{$file_L}{'comment'}{$status};
+-            }
+-        }
+-#print Dumper("comment diffs:", \@diff_LL, \@diff_LR);
+-#die; here=  need to save original line number in diff result for html display
+-
+-        # step 5: compute difference in blank lines (kind of pointless)
+-        my ($all_line_count_L,
+-            $blank_count_L   ,
+-            $comment_count_L ,
+-           ) = call_counter($file_L, $Lang_L, \@Errors);
+-
+-        my ($all_line_count_R,
+-            $blank_count_R   ,
+-            $comment_count_R ,
+-           ) = call_counter($file_R, $Lang_R, \@Errors);
+-
+-        if ($blank_count_L <  $blank_count_R) {
+-            my $D = $blank_count_R - $blank_count_L;
+-            $Delta_by_Language{$Lang_L}{'blank'}{'added'}   += $D;
+-        } else {
+-            my $D = $blank_count_L - $blank_count_R;
+-            $Delta_by_Language{$Lang_L}{'blank'}{'removed'} += $D;
+-        }
+-        if ($opt_by_file) {
+-            if ($blank_count_L <  $blank_count_R) {
+-                my $D = $blank_count_R - $blank_count_L;
+-                $Delta_by_File{$file_L}{'blank'}{'added'}   += $D;
+-            } else {
+-                my $D = $blank_count_L - $blank_count_R;
+-                $Delta_by_File{$file_L}{'blank'}{'removed'} += $D;
+-            }
+-        }
+-
+-        my $code_count_L = $all_line_count_L-$blank_count_L-$comment_count_L;
+-        if ($opt_by_file) {
+-            $Results_by_File{$file_L}{'code'   } = $code_count_L    ;
+-            $Results_by_File{$file_L}{'blank'  } = $blank_count_L   ;
+-            $Results_by_File{$file_L}{'comment'} = $comment_count_L ;
+-            $Results_by_File{$file_L}{'lang'   } = $Lang_L          ;
+-            $Results_by_File{$file_L}{'nFiles' } = 1                ;
+-        } else {
+-            $Results_by_File{$file_L} = 1;  # just keep track of counted files
+-        }
+-   
+-        $Results_by_Language{$Lang_L}{'nFiles'}++;
+-        $Results_by_Language{$Lang_L}{'code'}    += $code_count_L   ;
+-        $Results_by_Language{$Lang_L}{'blank'}   += $blank_count_L  ;
+-        $Results_by_Language{$Lang_L}{'comment'} += $comment_count_L;
+-    }
+-    write_file($opt_diff_alignment, @alignment) if $opt_diff_alignment;
+-
+-}
+-#use Data::Dumper;
+-#print Dumper("Delta_by_Language:"  , \%Delta_by_Language);
+-#print Dumper("Results_by_Language:", \%Results_by_Language);
+-#print Dumper("Delta_by_File:"      , \%Delta_by_File);
+-#print Dumper("Results_by_File:"    , \%Results_by_File);
+-#die;
+-my @ignored_reasons = map { "$_: $Ignored{$_}" } sort keys %Ignored;
+-write_file($opt_ignored, @ignored_reasons   ) if $opt_ignored;
+-write_file($opt_counted, sort keys %Results_by_File) if $opt_counted;
+-# 1}}}
+-# Step 7:  Assemble results.                      {{{1
+-#
+-my $end_time = time();
+-printf "%8d file%s ignored.                           \n", 
+-    plural_form(scalar keys %Ignored) unless $opt_quiet;
+-print_errors(\%Error_Codes, \@Errors) if @Errors;
+-if (!%Delta_by_Language) {
+-    print "Nothing to count.\n";
+-    exit;
+-}
+-
+-if ($opt_by_file) {
+-    @Lines_Out = diff_report($VERSION, time() - $start_time,
+-                            "by file",
+-                            \%Delta_by_File, \%Scale_Factor);
+-} else {
+-    @Lines_Out = diff_report($VERSION, time() - $start_time,
+-                            "by language",
+-                            \%Delta_by_Language, \%Scale_Factor);
+-}
+-
+-# 1}}}
+-} else {
+-# Step 4:  Separate code from non-code files. {{{1
+-my $fh = 0;
+-if ($opt_list_file) {
+-    my @list = read_list_file($opt_list_file);
+-    $fh = make_file_list(\@list, \%Error_Codes, \@Errors, \%Ignored);
+-} else {
+-    $fh = make_file_list(\@ARGV, \%Error_Codes, \@Errors, \%Ignored);
+-    #     make_file_list populates global variable @file_list via call to 
+-    #     File::Find's find() which in turn calls files()
+-}
+-if ($opt_exclude_list_file) {
+-    process_exclude_list_file($opt_exclude_list_file, 
+-                             \%Exclude_Dir,
+-                             \%Ignored);
+-}
+-if ($opt_skip_win_hidden and $ON_WINDOWS) {
+-    my @file_list_minus_hidded = ();
+-    # eval code to run on Unix without 'missing Win32::File module' error.
+-    my $win32_file_invocation = '
+-        use Win32::File;
+-        foreach my $F (@file_list) {
+-            my $attr = undef;
+-            Win32::File::GetAttributes($F, $attr);
+-            if ($attr & HIDDEN) {
+-                $Ignored{$F} = "Windows hidden file";
+-                print "Ignoring $F since it is a Windows hidden file\n" 
+-                    if $opt_v > 1;
+-            } else {
+-                push @file_list_minus_hidded, $F;
+-            }
+-        }';
+-    eval $win32_file_invocation;
+-    @file_list = @file_list_minus_hidded;
+-}
+-#printf "%8d file%s excluded.                     \n", 
+-#   plural_form(scalar keys %Ignored) 
+-#   unless $opt_quiet;
+-# die print ": ", join("\n: ", @file_list), "\n";
+-# 1}}}
+-# Step 5:  Remove duplicate files.             {{{1
+-#
+-my %Language           = ();
+-my %unique_source_file = ();
+-remove_duplicate_files($fh                          ,   # in 
+-                           \%Language               ,   # out
+-                           \%unique_source_file     ,   # out
+-                      \%Error_Codes                 ,   # in
+-                           \@Errors                 ,   # out
+-                           \%Ignored                );  # out
+-printf "%8d unique file%s.                              \n", 
+-    plural_form(scalar keys %unique_source_file) 
+-    unless $opt_quiet;
+-# 1}}}
+-# Step 6:  Count code, comments, blank lines.  {{{1
+-#
+-
+-my %Results_by_Language = ();
+-my %Results_by_File     = ();
+-my $nCounted = 0;
+-foreach my $file (sort keys %unique_source_file) {
+-    ++$nCounted;
+-    printf "Counting:  %d\r", $nCounted 
+-        unless (!$opt_progress_rate or ($nCounted % $opt_progress_rate));
+-    next if $Ignored{$file};
+-    if ($Exclude_Language{$Language{$file}}) {
+-        $Ignored{$file} = "--exclude-lang=$Language{$file}";
+-        next;
+-    }
+-    if (!defined @{$Filters_by_Language{$Language{$file}} }) {
+-        if ($Language{$file} eq "(unknown)") {
+-            $Ignored{$file} = "language unknown (#1)";
+-        } else {
+-            $Ignored{$file} = "missing Filters_by_Language{$Language{$file}}";
+-        }
+-        next;
+-    }
+-
+-    my ($all_line_count,
+-        $blank_count   ,
+-        $comment_count ,
+-       ) = call_counter($file, $Language{$file}, \@Errors);
+-    my $code_count = $all_line_count - $blank_count - $comment_count;
+-    if ($opt_by_file) {
+-        $Results_by_File{$file}{'code'   } = $code_count     ;
+-        $Results_by_File{$file}{'blank'  } = $blank_count    ;
+-        $Results_by_File{$file}{'comment'} = $comment_count  ;
+-        $Results_by_File{$file}{'lang'   } = $Language{$file};
+-        $Results_by_File{$file}{'nFiles' } = 1;
+-    } else {
+-        $Results_by_File{$file} = 1;  # just keep track of counted files
+-    }
+-
+-    $Results_by_Language{$Language{$file}}{'nFiles'}++;
+-    $Results_by_Language{$Language{$file}}{'code'}    += $code_count   ;
+-    $Results_by_Language{$Language{$file}}{'blank'}   += $blank_count  ;
+-    $Results_by_Language{$Language{$file}}{'comment'} += $comment_count;
+-}
+-my @ignored_reasons = map { "$_: $Ignored{$_}" } sort keys %Ignored;
+-write_file($opt_ignored, @ignored_reasons   ) if $opt_ignored;
+-write_file($opt_counted, sort keys %Results_by_File) if $opt_counted;
+-# 1}}}
+-# Step 7:  Assemble results.                      {{{1
+-#
+-my $end_time = time();
+-printf "%8d file%s ignored.\n", plural_form(scalar keys %Ignored) 
+-    unless $opt_quiet;
+-print_errors(\%Error_Codes, \@Errors) if @Errors;
+-exit unless %Results_by_Language;
+-
+-generate_sql($end_time - $start_time,
+-            \%Results_by_File, \%Scale_Factor) if $opt_sql;
+-
+-exit if $skip_generate_report;
+-if      ($opt_by_file_by_lang) {
+-    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
+-                                      "by file",
+-                                      \%Results_by_File,    \%Scale_Factor);
+-    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
+-                                      "by language",
+-                                      \%Results_by_Language, \%Scale_Factor);
+-} elsif ($opt_by_file) {
+-    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
+-                                      "by file",
+-                                      \%Results_by_File,    \%Scale_Factor);
+-} else {
+-    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
+-                                      "by language",
+-                                      \%Results_by_Language, \%Scale_Factor);
+-}
+-# 1}}}
+-}
+-if ($opt_report_file) { write_file($opt_report_file, @Lines_Out); } 
+-else                  { print "\n", join("\n", @Lines_Out), "\n"; }
+-
+-sub process_exclude_list_file {              # {{{1
+-    my ($list_file      , # in
+-        $rh_exclude_dir , # out
+-        $rh_ignored     , # out
+-       ) = @_;
+-    print "-> process_exclude_list_file($list_file)\n" if $opt_v > 2;
+-    # reject a specific set of files and/or directories
+-    my @reject_list   = read_list_file($list_file);
+-    my @file_reject_list = ();
+-    foreach my $F_or_D (@reject_list) {
+-        if (is_dir($F_or_D)) {
+-            $rh_exclude_dir->{$F_or_D} = 1;
+-        } elsif (is_file($F_or_D)) {
+-            push @file_reject_list, $F_or_D;
+-        }
+-    }
+-
+-    # Normalize file names for better comparison.
+-    my %normalized_input   = normalize_file_names(@file_list);
+-    my %normalized_reject  = normalize_file_names(@file_reject_list);
+-    my %normalized_exclude = normalize_file_names(keys %{$rh_exclude_dir});
+-    foreach my $F (keys %normalized_input) {
+-        if ($normalized_reject{$F} or is_excluded($F, \%normalized_exclude)) {
+-            my $orig_F = $normalized_input{$F};
+-            $rh_ignored->{$orig_F} = "listed in exclusion file $opt_exclude_list_file";
+-            print "Ignoring $orig_F because it appears in $opt_exclude_list_file\n" 
+-                if $opt_v > 1;
+-        }
+-    }
+-    print "<- process_exclude_list_file\n" if $opt_v > 2;
+-} # 1}}}
+-sub combine_results {                        # {{{1
+-    # returns 1 if the inputs are categorized by language
+-    #         0 if no identifiable language was found
+-    my ($ra_report_files, # in
+-        $report_type    , # in  "by language" or "by report file"
+-        $rhh_count      , # out count{TYPE}{nFiles|code|blank|comment|scaled}
+-        $rhaa_Filters_by_Language , # in
+-       ) = @_;
+-
+-    print "-> combine_results(report_type=$report_type)\n" if $opt_v > 2;
+-    my $found_language = 0;
+-
+-    foreach my $file (@{$ra_report_files}) {
+-        my $IN = new IO::File $file, "r";
+-        if (!defined $IN) {
+-            warn "Unable to read $file; ignoring.\n";
+-            next;
+-        }
+-        while (<$IN>) {
+-            next if /^(http|Language|SUM|-----)/;
+-            if (!$opt_by_file  and
+-                m{^(.*?)\s+         # language
+-                   (\d+)\s+         # files
+-                   (\d+)\s+         # blank
+-                   (\d+)\s+         # comments
+-                   (\d+)\s+         # code
+-                   (                #    next four entries missing with -nno3
+-                   x\s+             # x
+-                   \d+\.\d+\s+      # scale
+-                   =\s+             # =
+-                   (\d+\.\d+)\s*    # scaled code
+-                   )?
+-                   $}x) {
+-                if ($report_type eq "by language") {
+-                    next unless defined @{$rhaa_Filters_by_Language->{$1}};
+-                    # above test necessary to avoid trying to sum reports
+-                    # of reports (which have no language breakdown).
+-                    $found_language = 1;
+-                    $rhh_count->{$1   }{'nFiles' } += $2;
+-                    $rhh_count->{$1   }{'blank'  } += $3;
+-                    $rhh_count->{$1   }{'comment'} += $4;
+-                    $rhh_count->{$1   }{'code'   } += $5;
+-                    $rhh_count->{$1   }{'scaled' } += $7 if $opt_3;
+-                } else {
+-                    $rhh_count->{$file}{'nFiles' } += $2;
+-                    $rhh_count->{$file}{'blank'  } += $3;
+-                    $rhh_count->{$file}{'comment'} += $4;
+-                    $rhh_count->{$file}{'code'   } += $5;
+-                    $rhh_count->{$file}{'scaled' } += $7 if $opt_3;
+-                }
+-            } elsif ($opt_by_file  and
+-                m{^(.*?)\s+         # language
+-                   (\d+)\s+         # blank
+-                   (\d+)\s+         # comments
+-                   (\d+)\s+         # code
+-                   (                #    next four entries missing with -nno3
+-                   x\s+             # x
+-                   \d+\.\d+\s+      # scale
+-                   =\s+             # =
+-                   (\d+\.\d+)\s*    # scaled code
+-                   )?
+-                   $}x) {
+-                if ($report_type eq "by language") {
+-                    next unless %{$rhaa_Filters_by_Language->{$1}};
+-                    # above test necessary to avoid trying to sum reports
+-                    # of reports (which have no language breakdown).
+-                    $found_language = 1;
+-                    $rhh_count->{$1   }{'nFiles' } +=  1;
+-                    $rhh_count->{$1   }{'blank'  } += $2;
+-                    $rhh_count->{$1   }{'comment'} += $3;
+-                    $rhh_count->{$1   }{'code'   } += $4;
+-                    $rhh_count->{$1   }{'scaled' } += $6 if $opt_3;
+-                } else {
+-                    $rhh_count->{$file}{'nFiles' } +=  1;
+-                    $rhh_count->{$file}{'blank'  } += $2;
+-                    $rhh_count->{$file}{'comment'} += $3;
+-                    $rhh_count->{$file}{'code'   } += $4;
+-                    $rhh_count->{$file}{'scaled' } += $6 if $opt_3;
+-                }
+-            }
+-        }
+-    }
+-    print "<- combine_results\n" if $opt_v > 2;
+-    return $found_language;
+-
+-} # 1}}}
+-sub diff_report     {                        # {{{1
+-    # returns an array of lines containing the results
+-    print "-> diff_report\n" if $opt_v > 2;
+-
+-    if ($opt_xml or $opt_yaml) {
+-        print "<- diff_report\n" if $opt_v > 2;
+-        return diff_xml_yaml_report(@_) 
+-    } elsif ($opt_csv) {
+-        print "<- diff_report\n" if $opt_v > 2;
+-        return diff_csv_report(@_) 
+-    }
+-
+-    my ($version    , # in
+-        $elapsed_sec, # in
+-        $report_type, # in  "by language" | "by report file" | "by file"
+-        $rhhh_count , # in  count{TYPE}{nFiles|code|blank|comment}{a|m|r|s}
+-        $rh_scale   , # in
+-       ) = @_;
+-
+-#print "diff_report: ", Dumper($rhhh_count), "\n";
+-    my @results       = ();
+-
+-    my $languages     = ();
+-    my %sum           = (); # sum{nFiles|blank|comment|code}{same|modified|added|removed}
+-    my $max_len       = 0;
+-    foreach my $language (keys %{$rhhh_count}) {
+-        foreach my $V (qw(nFiles blank comment code)) {
+-            foreach my $S (qw(added same modified removed)) {
+-                $rhhh_count->{$language}{$V}{$S} = 0 unless
+-                    defined $rhhh_count->{$language}{$V}{$S};
+-                $sum{$V}{$S}  += $rhhh_count->{$language}{$V}{$S};
+-            }
+-        }
+-        $max_len      = length($language) if length($language) > $max_len;
+-    }
+-    my $column_1_offset = 0;
+-       $column_1_offset = $max_len - 17 if $max_len > 17;
+-    $elapsed_sec = 0.5 unless $elapsed_sec;
+-
+-    my $spacing_0 = 23;
+-    my $spacing_1 = 13;
+-    my $spacing_2 =  9;
+-    my $spacing_3 = 17;
+-    if (!$opt_3) {
+-        $spacing_1 = 19;
+-        $spacing_2 = 14;
+-        $spacing_3 = 28;
+-    }
+-    $spacing_0 += $column_1_offset;
+-    $spacing_1 += $column_1_offset;
+-    $spacing_3 += $column_1_offset;
+-    my %Format = (
+-        '1' => { 'xml' => 'name="%s" ',
+-                 'txt' => "\%-${spacing_0}s ",
+-               },
+-        '2' => { 'xml' => 'name="%s" ',
+-                 'txt' => "\%-${spacing_3}s ",
+-               },
+-        '3' => { 'xml' => 'files_count="%d" ',
+-                 'txt' => '%5d ',
+-               },
+-        '4' => { 'xml' => 'blank="%d" comment="%d" code="%d" ',
+-                 'txt' => "\%${spacing_2}d \%${spacing_2}d \%${spacing_2}d",
+-               },
+-        '5' => { 'xml' => 'factor="%.2f" scaled="%.2f" ',
+-                 'txt' => ' x %6.2f = %14.2f',
+-               },
+-    );
+-    my $Style = "txt";
+-       $Style = "xml" if $opt_xml ;
+-       $Style = "xml" if $opt_yaml;  # not a typo; just set to anything but txt
+-       $Style = "xml" if $opt_csv ;  # not a typo; just set to anything but txt
+-
+-    my $hyphen_line = sprintf "%s", '-' x (79 + $column_1_offset);
+-       $hyphen_line = sprintf "%s", '-' x (68 + $column_1_offset) 
+-            if (!$opt_3) and (68 + $column_1_offset) > 79;
+-    my $data_line  = "";
+-    my $first_column;
+-    my $BY_LANGUAGE = 0;
+-    my $BY_FILE     = 0;
+-    if      ($report_type eq "by language") {
+-        $first_column = "Language";
+-        $BY_LANGUAGE  = 1;
+-    } elsif ($report_type eq "by file")     {
+-        $first_column = "File";
+-        $BY_FILE      = 1;
+-    } else {
+-        $first_column = "Report File";
+-    }
+-
+-    my $header_line  = sprintf "%s v %4.2f", $URL, $version;
+-    my $sum_files    = 1;
+-    my $sum_lines    = 1;
+-       $header_line .= sprintf("  T=%.1f s (%.1f files/s, %.1f lines/s)",
+-                        $elapsed_sec           ,
+-                        $sum_files/$elapsed_sec,
+-                        $sum_lines/$elapsed_sec) unless $opt_sum_reports;
+-    if ($Style eq "txt") {
+-        push @results, output_header($header_line, $hyphen_line, $BY_FILE);
+-    } elsif ($Style eq "csv") {
+-        die "csv";
+-    }
+-
+-    # column headers
+-    if (!$opt_3 and $BY_FILE) {
+-        my $spacing_n = $spacing_1 - 11;
+-        $data_line  = sprintf "%-${spacing_n}s" , $first_column;
+-    } else {
+-        $data_line  = sprintf "%-${spacing_1}s ", $first_column;
+-    }
+-    if ($BY_FILE) {
+-        $data_line .= sprintf "%${spacing_2}s"   , ""     ;
+-    } else {
+-        $data_line .= sprintf "%${spacing_2}s "  , "files";
+-    }
+-    $data_line .= sprintf "%${spacing_2}s %${spacing_2}s %${spacing_2}s",
+-        "blank"         ,
+-        "comment"       ,
+-        "code";
+-
+-    if ($Style eq "txt") {
+-        push @results, $data_line;
+-        push @results, $hyphen_line;
+-    }
+-
+-    foreach my $lang_or_file (sort {
+-                                 $rhhh_count->{$b}{'code'} <=>
+-                                 $rhhh_count->{$a}{'code'}
+-                               }
+-                          keys %{$rhhh_count}) {
+-
+-        push @results, "$lang_or_file";
+-        foreach my $S (qw(same modified added removed)) {
+-            my $indent = $spacing_1 - 2;
+-            my $line .= sprintf " %-${indent}s", $S;
+-            if ($BY_FILE) {
+-                $line .= sprintf "   ";
+-            } else {
+-                $line .= sprintf "  %${spacing_2}s", $rhhh_count->{$lang_or_file}{'nFiles'}{$S};
+-            }
+-            $line .= sprintf " %${spacing_2}s %${spacing_2}s %${spacing_2}s",
+-                $rhhh_count->{$lang_or_file}{'blank'}{$S}   ,
+-                $rhhh_count->{$lang_or_file}{'comment'}{$S} ,
+-                $rhhh_count->{$lang_or_file}{'code'}{$S}    ;
+-            push @results, $line;
+-        }
+-    }
+-    push @results, "-" x 79;
+-    push @results, "SUM:";
+-    foreach my $S (qw(same modified added removed)) {
+-        my $indent = $spacing_1 - 2;
+-        my $line .= sprintf " %-${indent}s", $S;
+-            if ($BY_FILE) {
+-                $line .= sprintf "   ";
+-            } else {
+-                $line .= sprintf "  %${spacing_2}s", $sum{'nFiles'}{$S};
+-            }
+-        $line .= sprintf " %${spacing_2}s %${spacing_2}s %${spacing_2}s",
+-            $sum{'blank'}{$S}   ,
+-            $sum{'comment'}{$S} ,
+-            $sum{'code'}{$S}    ;
+-        push @results, $line;
+-    }
+-    push @results, "-" x 79;
+-    write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL;
+-    print "<- diff_report\n" if $opt_v > 2;
+-
+-    return @results;
+-} # 1}}}
+-sub xml_or_yaml_header {                     # {{{1
+-    my ($URL, $version, $elapsed_sec, $sum_files, $sum_lines) = @_;
+-    my $header      = "";
+-    my $file_rate   = $sum_files/$elapsed_sec;
+-    my $line_rate   = $sum_lines/$elapsed_sec;
+-    my $type        = ""; 
+-       $type        = "diff_" if $opt_diff;
+-    my $report_file = "";
+-       $report_file = "  <report_file>$opt_report_file</report_file>"
+-       if $opt_report_file;
+-    if ($opt_xml) {
+-        $header = "<?xml version=\"1.0\"?>";
+-        $header .= "\n<?xml-stylesheet type=\"text/xsl\" href=\"" . $opt_xsl . "\"?>" if $opt_xsl;
+-        $header .= "<${type}results>
+-<header>
+-  <cloc_url>$URL</cloc_url>
+-  <cloc_version>$version</cloc_version>
+-  <elapsed_seconds>$elapsed_sec</elapsed_seconds>
+-  <n_files>$sum_files</n_files>
+-  <n_lines>$sum_lines</n_lines>
+-  <files_per_second>$file_rate</files_per_second>
+-  <lines_per_second>$line_rate</lines_per_second>";
+-        $header .= "\n$report_file"
+-            if $opt_report_file;
+-        $header .= "\n</header>";
+-    } elsif ($opt_yaml) {
+-        $header = "---\n# $URL
+-header :
+-  cloc_url           : http://cloc.sourceforge.net
+-  cloc_version       : $version
+-  elapsed_seconds    : $elapsed_sec
+-  n_files            : $sum_files
+-  n_lines            : $sum_lines
+-  files_per_second   : $file_rate
+-  lines_per_second   : $line_rate";
+-        $header .= "\n  report_file        : $opt_report_file"
+-            if $opt_report_file;
+-    }
+-    return $header;
+-} # 1}}}
+-sub diff_xml_yaml_report {                   # {{{1
+-    # returns an array of lines containing the results
+-    my ($version    , # in
+-        $elapsed_sec, # in
+-        $report_type, # in  "by language" | "by report file" | "by file"
+-        $rhhh_count , # in  count{TYPE}{nFiles|code|blank|comment}{a|m|r|s}
+-        $rh_scale   , # in
+-       ) = @_;
+-    print "-> diff_xml_yaml_report\n" if $opt_v > 2;
+-
+-#print "diff_report: ", Dumper($rhhh_count), "\n";
+-    my @results       = ();
+-    
+-    my $languages     = ();
+-    my %sum           = (); # sum{nFiles|blank|comment|code}{same|modified|added|removed}
+-
+-    my $sum_files = 0;
+-    my $sum_lines = 0;
+-    foreach my $language (keys %{$rhhh_count}) {
+-        foreach my $V (qw(nFiles blank comment code)) {
+-            foreach my $S (qw(added same modified removed)) {
+-                $rhhh_count->{$language}{$V}{$S} = 0 unless
+-                    defined $rhhh_count->{$language}{$V}{$S};
+-                $sum{$V}{$S}  += $rhhh_count->{$language}{$V}{$S};
+-                if ($V eq "nFiles") {
+-                    $sum_files += $rhhh_count->{$language}{$V}{$S};
+-                } else {
+-                    $sum_lines += $rhhh_count->{$language}{$V}{$S};
+-                }
+-            }
+-        }
+-    }
+-    $elapsed_sec = 0.5 unless $elapsed_sec;
+-
+-    my $data_line   = "";
+-    my $BY_LANGUAGE = 0;
+-    my $BY_FILE     = 0;
+-    if      ($report_type eq "by language") {
+-        $BY_LANGUAGE  = 1;
+-    } elsif ($report_type eq "by file")     {
+-        $BY_FILE      = 1;
+-    }
+-
+-    if (!$ALREADY_SHOWED_HEADER) {
+-        push @results,
+-              xml_or_yaml_header($URL, $version, $elapsed_sec, 
+-                                 $sum_files, $sum_lines);
+-        $ALREADY_SHOWED_HEADER = 1;
+-    }
+-
+-    foreach my $S (qw(same modified added removed)) {
+-        if ($opt_xml) {
+-            push @results, "  <$S>";
+-        } elsif ($opt_yaml) {
+-            push @results, "$S :";
+-        }
+-        foreach my $lang_or_file (sort {
+-                                     $rhhh_count->{$b}{'code'} <=>
+-                                     $rhhh_count->{$a}{'code'}
+-                                   }
+-                              keys %{$rhhh_count}) {
+-            my $L = "";
+-            if ($opt_xml) {
+-                if ($BY_FILE) {
+-                    $L .= sprintf "    <file name=\"%s\" files_count=\"1\" ", 
+-                            $lang_or_file;
+-                } else {
+-                    $L .= sprintf "    <language name=\"%s\" files_count=\"%d\" ",
+-                            $lang_or_file ,
+-                            $rhhh_count->{$lang_or_file}{'nFiles'}{$S};
+-                }
+-                foreach my $T (qw(blank comment code)) {
+-                    $L .= sprintf "%s=\"%d\" ", 
+-                            $T, $rhhh_count->{$lang_or_file}{$T}{$S};
+-                }
+-                push @results, $L . "/>";
+-            } elsif ($opt_yaml) {
+-                if ($BY_FILE) {
+-                    push @results, sprintf "  - file : %s", $lang_or_file;
+-                    push @results, sprintf "    files_count : 1", 
+-                } else {
+-                    push @results, sprintf "  - language : %s", $lang_or_file;
+-                    push @results, sprintf "    files_count : %d", 
+-                            $rhhh_count->{$lang_or_file}{'nFiles'}{$S};
+-                }
+-                foreach my $T (qw(blank comment code)) {
+-                    push @results, sprintf "    %s : %d", 
+-                            $T, $rhhh_count->{$lang_or_file}{$T}{$S};
+-                }
+-            }
+-        }
+-
+-        if ($opt_xml) {
+-            my $L = sprintf "    <total sum_files=\"%d\" ", $sum{'nFiles'}{$S};
+-            foreach my $V (qw(blank comment code)) {
+-                $L .= sprintf "%s=\"%d\" ", $V, $sum{$V}{$S};
+-            }
+-            push @results, $L . "/>";
+-            push @results, "  </$S>";
+-        } elsif ($opt_yaml) {
+-            push @results, sprintf "%s_total :\n    sum_files : %d", 
+-                                $S, $sum{'nFiles'}{$S};
+-            foreach my $V (qw(blank comment code)) {
+-                push @results, sprintf "    %s : %d", $V, $sum{$V}{$S};
+-            }
+-        }
+-    }
+-
+-    if ($opt_xml) {
+-        push @results, "</diff_results>";
+-    }
+-    write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL;
+-    print "<- diff_xml_yaml_report\n" if $opt_v > 2;
+-    return @results;
+-} # 1}}}
+-sub diff_csv_report {                        # {{{1
+-    # returns an array of lines containing the results
+-    my ($version    , # in
+-        $elapsed_sec, # in
+-        $report_type, # in  "by language" | "by report file" | "by file"
+-        $rhhh_count , # in  count{TYPE}{nFiles|code|blank|comment}{a|m|r|s}
+-        $rh_scale   , # in  unused
+-       ) = @_;
+-    print "-> diff_csv_report\n" if $opt_v > 2;
+-
+-#use Data::Dumper;
+-#print "diff_csv_report: ", Dumper($rhhh_count), "\n";
+-#die;
+-    my @results       = ();
+-    my $languages     = ();
+-
+-    my $data_line   = "";
+-    my $BY_LANGUAGE = 0;
+-    my $BY_FILE     = 0;
+-    if      ($report_type eq "by language") {
+-        $BY_LANGUAGE  = 1;
+-    } elsif ($report_type eq "by file")     {
+-        $BY_FILE      = 1;
+-    }
+-
+-    $elapsed_sec = 0.5 unless $elapsed_sec;
+-
+-    my $line = "Language, ";
+-       $line = "File, " if $BY_FILE;
+-    foreach my $item (qw(files blank comment code)) {
+-        next if $BY_FILE and $item eq 'files';
+-        foreach my $symbol qw( == != + - ) {
+-            $line .= "$symbol $item, ";
+-        }
+-    }
+-    $line .= "\"$URL v $version T=$elapsed_sec s\"";
+-    push @results, $line;
+-
+-    foreach my $lang_or_file (sort {
+-                                 $rhhh_count->{$b}{'code'} <=>
+-                                 $rhhh_count->{$a}{'code'}
+-                               }
+-                          keys %{$rhhh_count}) {
+-        $line = "$lang_or_file, ";
+-        foreach my $item (qw(nFiles blank comment code)) {
+-            next if $BY_FILE and $item eq 'nFiles';
+-            foreach my $symbol (qw(same modified added removed)) {
+-                if (defined $rhhh_count->{$lang_or_file}{$item}{$symbol}) {
+-                    $line .= "$rhhh_count->{$lang_or_file}{$item}{$symbol}, ";
+-                } else {
+-                    $line .= "0, ";
+-                }
+-            }
+-        }
+-        push @results, $line;
+-    }
+-
+-    print "<- diff_csv_report\n" if $opt_v > 2;
+-    return @results;
+-} # 1}}}
+-sub generate_sql    {                        # {{{1
+-    my ($elapsed_sec, # in
+-        $rhh_count  , # in  count{TYPE}{lang|code|blank|comment|scaled}
+-        $rh_scale   , # in
+-       ) = @_;
+-    print "-> generate_sql\n" if $opt_v > 2;
+-
+-    $opt_sql_project = cwd() unless defined $opt_sql_project;
+-    $opt_sql_project =~ s{/}{\\}g if $ON_WINDOWS;
+-
+-    my $schema = "
+-create table metadata (          -- $URL v $VERSION
+-                timestamp text,    
+-                Project   text,    
+-                elapsed_s real);   
+-create table t        (
+-                Project   text   ,  
+-                Language  text   ,  
+-                File      text   ,  
+-                nBlank    integer,  
+-                nComment  integer,  
+-                nCode     integer,  
+-                nScaled   real   ); 
+-";
+-    $opt_sql = "-" if $opt_sql eq "1";
+-
+-    my $open_mode = ">";
+-       $open_mode = ">>" if $opt_sql_append;
+-
+-    my $fh = new IO::File; # $opt_sql, "w";
+-    if (!$fh->open("${open_mode}${opt_sql}")) {
+-        die "Unable to write to $opt_sql  $!\n";
+-    }
+-    print $fh $schema unless defined $opt_sql_append;
+-
+-    print $fh "begin transaction;\n";
+-    printf $fh "insert into metadata values('%s', '%s', %f);\n",
+-                strftime("%Y-%m-%d %H:%M:%S", localtime(time())),
+-                $opt_sql_project, $elapsed_sec;
+-
+-    my $nIns = 0;
+-    foreach my $file (keys %{$rhh_count}) {
+-        my $language = $rhh_count->{$file}{'lang'};
+-        my $clean_filename = $file;
+-        # If necessary (that is, if the input contained an
+-        # archive file [.tar.gz, etc]), strip the temporary
+-        # directory name which was used to expand the archive
+-        # from the file name.
+-        foreach my $temp_d (keys %TEMP_DIR) {
+-            if ($ON_WINDOWS) {
+-            # \ -> / necessary to allow the next if test's
+-            # m{} to work in the presence of spaces in file names
+-                $temp_d         =~ s{\\}{/}g;
+-                $clean_filename =~ s{\\}{/}g;
+-            }
+-            if ($clean_filename =~ m{^$temp_d/}) {
+-                $clean_filename =~ s{^$temp_d/}{};
+-                last;
+-            }
+-        }
+-        $clean_filename =~ s{/}{\\}g if $ON_WINDOWS; # then go back from / to \
+-        printf $fh "insert into t values('%s', '%s', '%s', %d, %d, %d, %f);\n",
+-                    $opt_sql_project           ,
+-                    $language                  ,
+-                    $clean_filename            ,
+-                    $rhh_count->{$file}{'blank'},
+-                    $rhh_count->{$file}{'comment'},
+-                    $rhh_count->{$file}{'code'}   ,
+-                    $rhh_count->{$file}{'code'}*$rh_scale->{$language};
+-        ++$nIns;
+-        if (!($nIns % 10_000)) {
+-            print $fh "commit;\n";
+-            print $fh "begin transaction;\n";
+-        }
+-    }
+-    print $fh "commit;\n";
+-
+-    $fh->close unless $opt_sql eq "-"; # don't try to close STDOUT
+-    print "<- generate_sql\n" if $opt_v > 2;
+-
+-    # sample query:
+-    #
+-    #   select project, language, 
+-    #          sum(nCode)     as Code, 
+-    #          sum(nComment)  as Comments, 
+-    #          sum(nBlank)    as Blank,  
+-    #          sum(nCode)+sum(nComment)+sum(nBlank) as All_Lines,
+-    #          100.0*sum(nComment)/(sum(nCode)+sum(nComment)) as Comment_Pct
+-    #          from t group by Project, Language order by Project, Code desc;
+-    #
+-} # 1}}}
+-sub output_header   {                        # {{{1
+-    my ($header_line, 
+-        $hyphen_line,
+-        $BY_FILE    ,)    = @_;
+-    print "-> output_header\n" if $opt_v > 2;
+-    my @R = ();
+-    if      ($opt_xml) {
+-        if (!$ALREADY_SHOWED_XML_SECTION) {
+-            push @R, "<?xml version=\"1.0\"?>";
+-            push @R, '<?xml-stylesheet type="text/xsl" href="' .
+-                            $opt_xsl . '"?>' if $opt_xsl;
+-            push @R, "<results>";
+-            push @R, "<header>$header_line</header>";
+-            $ALREADY_SHOWED_XML_SECTION = 1;
+-        }
+-        if ($BY_FILE) {
+-            push @R, "<files>";
+-        } else {
+-            push @R, "<languages>";
+-        }
+-    } elsif ($opt_yaml) {
+-        push @R, "---\n# $header_line";
+-    } elsif ($opt_csv) {
+-        # append the header to the end of the column headers
+-        # to keep the output a bit cleaner from a spreadsheet
+-        # perspective
+-    } else {
+-        if ($ALREADY_SHOWED_HEADER) {
+-            push @R, "";
+-        } else {
+-            push @R, $header_line;
+-            $ALREADY_SHOWED_HEADER = 1;
+-        }
+-        push @R, $hyphen_line;
+-    }
+-    print "<- output_header\n" if $opt_v > 2;
+-    return @R;
+-} # 1}}}
+-sub generate_report {                        # {{{1
+-    # returns an array of lines containing the results
+-    my ($version    , # in
+-        $elapsed_sec, # in
+-        $report_type, # in  "by language" | "by report file" | "by file"
+-        $rhh_count  , # in  count{TYPE}{nFiles|code|blank|comment|scaled}
+-        $rh_scale   , # in
+-       ) = @_;
+-
+-    print "-> generate_report\n" if $opt_v > 2;
+-    my @results       = ();
+-    
+-    my $languages     = ();
+-
+-    my $sum_files     = 0;
+-    my $sum_code      = 0;
+-    my $sum_blank     = 0;
+-    my $sum_comment   = 0;
+-    my $max_len       = 0;
+-    foreach my $language (keys %{$rhh_count}) {
+-        $sum_files   += $rhh_count->{$language}{'nFiles'} ;
+-        $sum_blank   += $rhh_count->{$language}{'blank'}  ;
+-        $sum_comment += $rhh_count->{$language}{'comment'};
+-        $sum_code    += $rhh_count->{$language}{'code'}   ;
+-        $max_len      = length($language) if length($language) > $max_len;
+-    }
+-    my $column_1_offset = 0;
+-       $column_1_offset = $max_len - 17 if $max_len > 17;
+-    my $sum_lines = $sum_blank + $sum_comment + $sum_code;
+-    $elapsed_sec = 0.5 unless $elapsed_sec;
+-
+-    my $spacing_0 = 23;
+-    my $spacing_1 = 13;
+-    my $spacing_2 =  9;
+-    my $spacing_3 = 17;
+-    if (!$opt_3) {
+-        $spacing_1 = 19;
+-        $spacing_2 = 14;
+-        $spacing_3 = 28;
+-    }
+-    $spacing_0 += $column_1_offset;
+-    $spacing_1 += $column_1_offset;
+-    $spacing_3 += $column_1_offset;
+-    my %Format = (
+-        '1' => { 'xml' => 'name="%s" ',
+-                 'txt' => "\%-${spacing_0}s ",
+-               },
+-        '2' => { 'xml' => 'name="%s" ',
+-                 'txt' => "\%-${spacing_3}s ",
+-               },
+-        '3' => { 'xml' => 'files_count="%d" ',
+-                 'txt' => '%5d ',
+-               },
+-        '4' => { 'xml' => 'blank="%d" comment="%d" code="%d" ',
+-                 'txt' => "\%${spacing_2}d \%${spacing_2}d \%${spacing_2}d",
+-               },
+-        '5' => { 'xml' => 'factor="%.2f" scaled="%.2f" ',
+-                 'txt' => ' x %6.2f = %14.2f',
+-               },
+-    );
+-    my $Style = "txt";
+-       $Style = "xml" if $opt_xml ;
+-       $Style = "xml" if $opt_yaml;  # not a typo; just set to anything but txt
+-       $Style = "xml" if $opt_csv ;  # not a typo; just set to anything but txt
+-
+-    my $hyphen_line = sprintf "%s", '-' x (79 + $column_1_offset);
+-       $hyphen_line = sprintf "%s", '-' x (68 + $column_1_offset) 
+-            if (!$opt_3) and (68 + $column_1_offset) > 79;
+-    my $data_line  = "";
+-    my $first_column;
+-    my $BY_LANGUAGE = 0;
+-    my $BY_FILE     = 0;
+-    if      ($report_type eq "by language") {
+-        $first_column = "Language";
+-        $BY_LANGUAGE  = 1;
+-    } elsif ($report_type eq "by file")     {
+-        $first_column = "File";
+-        $BY_FILE      = 1;
+-    } else {
+-        $first_column = "Report File";
+-    }
+-
+-    my $header_line  = sprintf "%s v %4.2f", $URL, $version;
+-       $header_line .= sprintf("  T=%.1f s (%.1f files/s, %.1f lines/s)",
+-                        $elapsed_sec           ,
+-                        $sum_files/$elapsed_sec,
+-                        $sum_lines/$elapsed_sec) unless $opt_sum_reports;
+-    if ($opt_xml or $opt_yaml) {
+-        if (!$ALREADY_SHOWED_HEADER) {
+-            push @results, xml_or_yaml_header($URL, $version, $elapsed_sec, 
+-                                              $sum_files, $sum_lines);
+-            $ALREADY_SHOWED_HEADER = 1;
+-        }
+-        if ($BY_FILE) {
+-            push @results, "<files>";
+-        } else {
+-            push @results, "<languages>";
+-        }
+-    } else {
+-        push @results, output_header($header_line, $hyphen_line, $BY_FILE);
+-    }
+-
+-    if ($Style eq "txt") {
+-        # column headers
+-        if (!$opt_3 and $BY_FILE) {
+-            my $spacing_n = $spacing_1 - 11;
+-            $data_line  = sprintf "%-${spacing_n}s ", $first_column;
+-        } else {
+-            $data_line  = sprintf "%-${spacing_1}s ", $first_column;
+-        }
+-        if ($BY_FILE) {
+-            $data_line .= sprintf "%${spacing_2}s "  , " "    ;
+-        } else {
+-            $data_line .= sprintf "%${spacing_2}s "  , "files";
+-        }
+-        $data_line .= sprintf "%${spacing_2}s %${spacing_2}s %${spacing_2}s",
+-            "blank"         ,
+-            "comment"       ,
+-            "code";
+-        $data_line .= sprintf " %8s   %14s",
+-            "scale"         ,
+-            "3rd gen. equiv"
+-              if $opt_3;
+-        push @results, $data_line;
+-        push @results, $hyphen_line;
+-    }
+-    if ($opt_csv) {
+-        my $header2;
+-        if ($BY_FILE) {
+-            $header2 = "language,filename";
+-        } else {
+-            $header2 = "files,language";
+-        }
+-        $header2 .= ",blank,comment,code";
+-        $header2 .= ",scale,3rd gen. equiv" if $opt_3;
+-        $header2 .= ',"' . $header_line . '"';
+-        push @results, $header2;
+-    }
+-
+-    my $sum_scaled = 0;
+-    foreach my $lang_or_file (sort {
+-                                 $rhh_count->{$b}{'code'} <=>
+-                                 $rhh_count->{$a}{'code'}
+-                               }
+-                          keys %{$rhh_count}) {
+-        my ($factor, $scaled);
+-        if ($BY_LANGUAGE or $BY_FILE) {
+-            $factor = 1;
+-            if ($BY_LANGUAGE) {
+-                if (defined $rh_scale->{$lang_or_file}) {
+-                    $factor = $rh_scale->{$lang_or_file};
+-                } else {
+-                    warn "No scale factor for $lang_or_file; using 1.00";
+-                }
+-            } else { # by individual code file
+-                $factor = $rh_scale->{$rhh_count->{$lang_or_file}{'lang'}};
+-            }
+-            $scaled = $factor*$rhh_count->{$lang_or_file}{'code'};
+-        } else {
+-            if (!defined $rhh_count->{$lang_or_file}{'scaled'}) {
+-                $opt_3 = 0;
+-                # If we're summing together files previously generated
+-                # with --no3 then rhh_count->{$lang_or_file}{'scaled'}
+-                # this variable will be undefined.  That should only
+-                # happen when summing together by file however.
+-            } elsif ($BY_LANGUAGE) {
+-                warn "Missing scaled language info for $lang_or_file\n";
+-            }
+-            if ($opt_3) {
+-                $scaled =         $rhh_count->{$lang_or_file}{'scaled'};
+-                $factor = $scaled/$rhh_count->{$lang_or_file}{'code'};
+-            }
+-        }
+-
+-        if ($BY_FILE) {
+-            $data_line  = sprintf $Format{'1'}{$Style}, $lang_or_file;
+-        } else {
+-            $data_line  = sprintf $Format{'2'}{$Style}, $lang_or_file;
+-        }
+-        $data_line .= sprintf $Format{3}{$Style}  , 
+-                        $rhh_count->{$lang_or_file}{'nFiles'} unless $BY_FILE;
+-        $data_line .= sprintf $Format{4}{$Style}  , 
+-            $rhh_count->{$lang_or_file}{'blank'}  ,
+-            $rhh_count->{$lang_or_file}{'comment'},
+-            $rhh_count->{$lang_or_file}{'code'}   ;
+-        $data_line .= sprintf $Format{5}{$Style}  ,
+-            $factor                               ,
+-            $scaled if $opt_3;
+-        $sum_scaled  += $scaled if $opt_3;
+-
+-        if ($opt_xml) {
+-            if (defined $rhh_count->{$lang_or_file}{'lang'}) {
+-                my $lang = $rhh_count->{$lang_or_file}{'lang'};
+-                if (!defined $languages->{$lang}) {
+-                    $languages->{$lang} = $lang;
+-                }
+-                $data_line.=' language="' . $lang . '" ';
+-            }
+-            if ($BY_FILE) {
+-                push @results, "  <file " . $data_line . "/>";
+-            } else {
+-                push @results, "  <language " . $data_line . "/>";
+-            }
+-        } elsif ($opt_yaml) {
+-            push @results,$lang_or_file . ":";
+-            push @results,"  nFiles: "  .$rhh_count->{$lang_or_file}{'nFiles'} 
+-                unless $BY_FILE;
+-            push @results,"  blank: "   .$rhh_count->{$lang_or_file}{'blank'}  ;
+-            push @results,"  comment: " .$rhh_count->{$lang_or_file}{'comment'};
+-            push @results,"  code: "    .$rhh_count->{$lang_or_file}{'code'}   ;
+-            push @results,"  language: ".$rhh_count->{$lang_or_file}{'lang'} 
+-                if $BY_FILE;
+-            if ($opt_3) {
+-                push @results, "  scaled: " . $scaled;
+-                push @results, "  factor: " . $factor;
+-            }
+-        } elsif ($opt_csv) {
+-            my $extra_3 = "";
+-               $extra_3 = ",$factor,$scaled" if $opt_3;
+-            my $str;
+-            if ($BY_FILE) {
+-                $str = $rhh_count->{$lang_or_file}{'lang'}   . ",";
+-            } else {
+-                $str = $rhh_count->{$lang_or_file}{'nFiles'} . ",";
+-            }
+-            $str .= $lang_or_file                         . "," .
+-                    $rhh_count->{$lang_or_file}{'blank'}  . "," .
+-                    $rhh_count->{$lang_or_file}{'comment'}. "," .
+-                    $rhh_count->{$lang_or_file}{'code'}         .
+-                    $extra_3;
+-            push @results, $str;
+-        } else {
+-            push @results, $data_line;
+-        }
+-    }
+-
+-    my $avg_scale = 1;  # weighted average of scale factors
+-       $avg_scale = sprintf("%.2f", $sum_scaled / $sum_code) 
+-            if $sum_code and $opt_3;
+-
+-    if ($opt_xml) {
+-        $data_line = "";
+-        if (!$BY_FILE) {
+-            $data_line .= sprintf "sum_files=\"%d\" ", $sum_files;
+-        }
+-        $data_line .= sprintf $Format{'4'}{$Style},
+-            $sum_blank   ,
+-            $sum_comment ,
+-            $sum_code    ;
+-        $data_line .= sprintf $Format{'5'}{$Style},
+-            $avg_scale   ,
+-            $sum_scaled  if $opt_3;
+-        push @results, "  <total " . $data_line . "/>";
+-
+-        if ($BY_FILE) {
+-            push @results, "</files>";
+-        } else {
+-            foreach my $language (keys %{$languages}) {
+-                push @results, '  <language name="' . $language . '"/>';
+-            }
+-            push @results, "</languages>";
+-        }
+-
+-        if (!$opt_by_file_by_lang or $ALREADY_SHOWED_XML_SECTION) {
+-    	    push @results, "</results>";
+-        } else {
+-            $ALREADY_SHOWED_XML_SECTION = 1;
+-        }
+-    } elsif ($opt_yaml) {
+-        push @results, "SUM:";
+-        push @results, "  blank: "  . $sum_blank  ;
+-        push @results, "  code: "   . $sum_code   ;
+-        push @results, "  comment: ". $sum_comment;
+-        push @results, "  nFiles: " . $sum_files  ;
+-        if ($opt_3) {
+-            push @results, "  scaled: " . $sum_scaled;
+-            push @results, "  factor: " . $avg_scale ;
+-        }
+-    } elsif ($opt_csv) {
+-        # do nothing
+-    } else {
+-
+-        if ($BY_FILE) {
+-            $data_line  = sprintf "%-${spacing_0}s ", "SUM:"  ;
+-        } else {
+-            $data_line  = sprintf "%-${spacing_1}s ", "SUM:"  ;
+-            $data_line .= sprintf "%${spacing_2}d ", $sum_files;
+-        }
+-        $data_line .= sprintf $Format{'4'}{$Style},
+-            $sum_blank   ,
+-            $sum_comment ,
+-            $sum_code    ;
+-        $data_line .= sprintf $Format{'5'}{$Style},
+-            $avg_scale   ,
+-            $sum_scaled if $opt_3;
+-        push @results, $hyphen_line if $sum_files > 1 or $opt_sum_one;
+-        push @results, $data_line   if $sum_files > 1 or $opt_sum_one;
+-        push @results, $hyphen_line;
+-    }
+-    write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL;
+-    print "<- generate_report\n" if $opt_v > 2;
+-    return @results;
+-} # 1}}}
+-sub print_errors {                           # {{{1
+-    my ($rh_Error_Codes, # in
+-        $raa_errors    , # in
+-       ) = @_;
+-
+-    print "-> print_errors\n" if $opt_v > 2;
+-    my %error_string = reverse(%{$rh_Error_Codes});
+-    my $nErrors      = scalar @{$raa_errors};
+-    warn sprintf "\n%d error%s:\n", plural_form(scalar @Errors);
+-    for (my $i = 0; $i < $nErrors; $i++) {
+-        warn sprintf "%s:  %s\n", 
+-                     $error_string{ $raa_errors->[$i][0] },
+-                     $raa_errors->[$i][1] ;
+-    }
+-    print "<- print_errors\n" if $opt_v > 2;
+-
+-} # 1}}}
+-sub write_lang_def {                         # {{{1
+-    my ($file                     ,
+-        $rh_Language_by_Extension , # in
+-        $rh_Language_by_Script    , # in
+-        $rh_Language_by_File      , # in
+-        $rhaa_Filters_by_Language , # in
+-        $rh_Not_Code_Extension    , # in
+-        $rh_Not_Code_Filename     , # in
+-        $rh_Scale_Factor          , # in
+-        $rh_EOL_Continuation_re   , # in
+-       ) = @_;
+-
+-    print "-> write_lang_def($file)\n" if $opt_v > 2;
+-    my $OUT = new IO::File $file, "w";
+-    die "Unable to write to $file\n" unless defined $OUT;
+-
+-    foreach my $language (sort keys %{$rhaa_Filters_by_Language}) {
+-        next if $language eq "MATLAB/Objective C/MUMPS" or
+-                $language eq "PHP/Pascal";
+-        printf $OUT "%s\n", $language;
+-        foreach my $filter (@{$rhaa_Filters_by_Language->{$language}}) {
+-            printf $OUT "    filter %s", $filter->[0];
+-            printf $OUT " %s", $filter->[1] if defined $filter->[1];
+-            print  $OUT "\n";
+-        }
+-        foreach my $ext (sort keys %{$rh_Language_by_Extension}) {
+-            if ($language eq $rh_Language_by_Extension->{$ext}) {
+-                printf $OUT "    extension %s\n", $ext;
+-            }
+-        }
+-        foreach my $filename (sort keys %{$rh_Language_by_File}) {
+-            if ($language eq $rh_Language_by_File->{$filename}) {
+-                printf $OUT "    filename %s\n", $filename;
+-            }
+-        }
+-        foreach my $script_exe (sort keys %{$rh_Language_by_Script}) {
+-            if ($language eq $rh_Language_by_Script->{$script_exe}) {
+-                printf $OUT "    script_exe %s\n", $script_exe;
+-            }
+-        }
+-        printf $OUT "    3rd_gen_scale %.2f\n", $rh_Scale_Factor->{$language};
+-        if (defined $rh_EOL_Continuation_re->{$language}) {
+-            printf $OUT "    end_of_line_continuation %s\n", 
+-                $rh_EOL_Continuation_re->{$language};
+-        }
+-    }
+-
+-    $OUT->close;
+-    print "<- write_lang_def\n" if $opt_v > 2;
+-} # 1}}}
+-sub read_lang_def {                          # {{{1
+-    my ($file                     ,
+-        $rh_Language_by_Extension , # out
+-        $rh_Language_by_Script    , # out
+-        $rh_Language_by_File      , # out
+-        $rhaa_Filters_by_Language , # out
+-        $rh_Not_Code_Extension    , # out
+-        $rh_Not_Code_Filename     , # out
+-        $rh_Scale_Factor          , # out
+-        $rh_EOL_Continuation_re   , # out
+-        $rh_EOL_abc,
+-       ) = @_;
+-
+-
+-    print "-> read_lang_def($file)\n" if $opt_v > 2;
+-    my $IN = new IO::File $file, "r";
+-    die "Unable to read $file.\n" unless defined $IN;
+-
+-    my $language = "";
+-    while (<$IN>) {
+-        next if /^\s*#/ or /^\s*$/;
+-
+-        if (/^(\w+.*?)\s*$/) {
+-            $language = $1;
+-            next;
+-        }
+-        die "Missing computer language name, line $. of $file\n"
+-            unless $language;
+-
+-        if      (/^    filter\s+(\w+)\s*$/) {
+-            push @{$rhaa_Filters_by_Language->{$language}}, [ $1 ]
+-
+-        } elsif (/^    filter\s+(\w+)\s+(.*?)\s*$/) {
+-            push @{$rhaa_Filters_by_Language->{$language}}, [ $1 , $2 ]
+-
+-        } elsif (/^    extension\s+(\S+)\s*$/) {
+-            if (defined $rh_Language_by_Extension->{$1}) {
+-                die "File extension collision:  $1 ",
+-                    "maps to languages '$rh_Language_by_Extension->{$1}' ",
+-                    "and '$language'\n" ,
+-                    "Edit $file and remove $1 from one of these two ",
+-                    "language definitions.\n";
+-            }
+-            $rh_Language_by_Extension->{$1} = $language;
+-
+-        } elsif (/^    filename\s+(\S+)\s*$/) {
+-            $rh_Language_by_File->{$1} = $language;
+-
+-        } elsif (/^    script_exe\s+(\S+)\s*$/) {
+-            $rh_Language_by_Script->{$1} = $language;
+-
+-        } elsif (/^    3rd_gen_scale\s+(\S+)\s*$/) {
+-            $rh_Scale_Factor->{$language} = $1;
+-
+-        } elsif (/^    end_of_line_continuation\s+(\S+)\s*$/) {
+-            $rh_EOL_Continuation_re->{$language} = $1;
+-
+-        } else {
+-            die "Unexpected data line $. of $file:\n$_\n";
+-        }
+-
+-    }
+-    $IN->close;
+-    print "<- read_lang_def\n" if $opt_v > 2;
+-} # 1}}}
+-sub print_extension_info {                   # {{{1
+-    my ($extension,) = @_;
+-    if ($extension) {  # show information on this extension
+-        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
+-            # Language_by_Extension{f}    = 'Fortran 77' 
+-            printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext}
+-                if $ext =~ m{$extension}i;
+-        }
+-    } else {           # show information on all  extensions
+-        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
+-            # Language_by_Extension{f}    = 'Fortran 77' 
+-            printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext};
+-        }
+-    }
+-} # 1}}}
+-sub print_language_info {                    # {{{1
+-    my ($language,) = @_;
+-    my %extensions = (); # the subset matched by the given $language value
+-    if ($language) {  # show information on this language
+-        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
+-            # Language_by_Extension{f}    = 'Fortran 77' 
+-            push @{$extensions{$Language_by_Extension{$ext}} }, $ext
+-                if $Language_by_Extension{$ext} =~ m{$language}i;
+-        }
+-    } else {          # show information on all  languages
+-        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
+-            # Language_by_Extension{f}    = 'Fortran 77' 
+-            push @{$extensions{$Language_by_Extension{$ext}} }, $ext
+-        }
+-    }
+-
+-    # add exceptions (one file extension mapping to multiple languages)
+-    if (!$language or 
+-        $language =~ /^(Objective C|MATLAB|MUMPS)$/i) {
+-        push @{$extensions{'Objective C'}}, "m";
+-        push @{$extensions{'MATLAB'}}     , "m";
+-        push @{$extensions{'MUMPS'}}      , "m";
+-        delete $extensions{'MATLAB/Objective C/MUMPS'};
+-    }
+-
+-    if (%extensions) {
+-        foreach my $lang (sort {lc $a cmp lc $b } keys %extensions) {
+-            printf "%-26s (%s)\n", $lang, join(", ", @{$extensions{$lang}});
+-        }
+-    }
+-} # 1}}}
+-sub make_file_list {                         # {{{1
+-    my ($ra_arg_list,  # in   file and/or directory names to examine
+-        $rh_Err     ,  # in   hash of error codes
+-        $raa_errors ,  # out  errors encountered
+-        $rh_ignored ,  # out  files not recognized as computer languages
+-        ) = @_;
+-    print "-> make_file_list(@{$ra_arg_list})\n" if $opt_v > 2;
+-
+-    my ($fh, $filename);
+-    if ($opt_categorized) {
+-        $filename = $opt_categorized;
+-        $fh = new IO::File $filename, "+>";  # open for read/write
+-        die "Unable to write to $filename:  $!\n" unless defined $fh;
+-    } elsif ($opt_sdir) {
+-        # write to the user-defined scratch directory
+-        $filename = $opt_sdir . '/cloc_file_list.txt';
+-        $fh = new IO::File $filename, "+>";  # open for read/write
+-        die "Unable to write to $filename:  $!\n" unless defined $fh;
+-    } else {
+-        # let File::Temp create a suitable temporary file
+-        ($fh, $filename) = tempfile(UNLINK => 1);  # delete file on exit
+-        print "Using temp file list [$filename]\n" if $opt_v;
+-    }
+-
+-    my @dir_list = ();
+-    foreach my $file_or_dir (@{$ra_arg_list}) {
+-#print "make_file_list file_or_dir=$file_or_dir\n";
+-        my $size_in_bytes = 0;
+-        if (!-r $file_or_dir) {
+-            push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file_or_dir];
+-            next;
+-        }
+-        if (is_file($file_or_dir)) {
+-            if (!(-s $file_or_dir)) {   # 0 sized file, named pipe, socket 
+-                $rh_ignored->{$file_or_dir} = 'zero sized file';
+-                next;
+-            } elsif (-B $file_or_dir and !$opt_read_binary_files) { 
+-                # avoid binary files unless user insists on reading them
+-                if ($opt_unicode) {
+-                    # only ignore if not a Unicode file w/trivial 
+-                    # ASCII transliteration
+-                    if (!unicode_file($file_or_dir)) {
+-                        $rh_ignored->{$file_or_dir} = 'binary file';
+-                        next;
+-                    }
+-                } else {
+-                    $rh_ignored->{$file_or_dir} = 'binary file';
+-                    next;
+-                }
+-            }
+-            push @file_list, "$file_or_dir";
+-        } elsif (is_dir($file_or_dir)) {
+-            push @dir_list, $file_or_dir;
+-        } else {
+-            push @{$raa_errors}, [$rh_Err->{'Neither file nor directory'} , $file_or_dir];
+-            $rh_ignored->{$file_or_dir} = 'not file, not directory';
+-        }
+-    }
+-    foreach my $dir (@dir_list) {
+-#print "make_file_list dir=$dir\n";
+-        # populates global variable @file_list
+-        find({wanted => \&files, follow => $opt_follow_links }, $dir);  
+-    }
+-    $nFiles_Found = scalar @file_list;
+-    printf "%8d text file%s.\n", plural_form($nFiles_Found) unless $opt_quiet;
+-    write_file($opt_found, sort @file_list) if $opt_found;
+-
+-    my $nFiles_Categorized = 0;
+-    foreach my $file (@file_list) {
+-        printf "classifying $file\n" if $opt_v > 2;
+-
+-        my $basename = basename $file;
+-        if ($Not_Code_Filename{$basename}) {
+-            $rh_ignored->{$file} = "listed in " . '$' .
+-                "Not_Code_Filename{$basename}";
+-            next;
+-        } elsif ($basename =~ m{~$}) {
+-            $rh_ignored->{$file} = "temporary editor file";
+-            next;
+-        }
+-
+-        my $size_in_bytes = (stat $file)[7];
+-        my $language      = "";
+-        if ($All_One_Language) {
+-            # user over-rode auto-language detection by using
+-            # --force-lang with just a language name (no extension)
+-            $language      = $All_One_Language;
+-        } else {
+-            $language      = classify_file($file      ,
+-                                           $rh_Err    ,
+-                                           $raa_errors,
+-                                           $rh_ignored);
+-        }
+-die  "make_file_list($file) undef size" unless defined $size_in_bytes;
+-die  "make_file_list($file) undef lang" unless defined $language;
+-        printf $fh "%d,%s,%s\n", $size_in_bytes, $language, $file;
+-        ++$nFiles_Categorized;
+-        #printf "classified %d files\n", $nFiles_Categorized 
+-        #    unless (!$opt_progress_rate or 
+-        #            ($nFiles_Categorized % $opt_progress_rate));
+-    }
+-    printf "classified %d files\r", $nFiles_Categorized 
+-        if !$opt_quiet and $nFiles_Categorized > 1;
+-
+-    print "<- make_file_list()\n" if $opt_v > 2;
+-
+-    return $fh;   # handle to the file containing the list of files to process
+-}  # 1}}}
+-sub remove_duplicate_files {                 # {{{1
+-    my ($fh                   , # in 
+-        $rh_Language          , # out
+-        $rh_unique_source_file, # out
+-        $rh_Err               , # in
+-        $raa_errors           , # out  errors encountered
+-        $rh_ignored           , # out
+-        ) = @_;
+-
+-    # Check for duplicate files by comparing file sizes.
+-    # Where files are equally sized, compare their MD5 checksums.
+-    print "-> remove_duplicate_files\n" if $opt_v > 2;
+-
+-    my $n = 0;
+-    my %files_by_size = (); # files_by_size{ # bytes } = [ list of files ]
+-    seek($fh, 0, 0); # rewind to beginning of the temp file
+-    while (<$fh>) {
+-        ++$n;
+-        my ($size_in_bytes, $language, $file) = split(/,/, $_, 3);
+-        chomp($file);
+-        $rh_Language->{$file} = $language;
+-        push @{$files_by_size{$size_in_bytes}}, $file;
+-        if ($opt_skip_uniqueness) {
+-            $rh_unique_source_file->{$file} = 1;
+-        }
+-    }
+-    return if $opt_skip_uniqueness;
+-    if ($opt_progress_rate and ($n > $opt_progress_rate)) {
+-        printf "Duplicate file check %d files (%d known unique)\r", 
+-            $n, scalar keys %files_by_size;
+-    }
+-    $n = 0;
+-    foreach my $bytes (sort {$a <=> $b} keys %files_by_size) {
+-        ++$n;
+-        printf "Unique: %8d files                                          \r",
+-            $n unless (!$opt_progress_rate or ($n % $opt_progress_rate));
+-        if (scalar @{$files_by_size{$bytes}} == 1) {
+-            # only one file is this big; must be unique
+-            $rh_unique_source_file->{$files_by_size{$bytes}[0]} = 1;
+-            next;
+-        } else {
+-#print "equally sized files: ",join(", ", @{$files_by_size{$bytes}}), "\n";
+-            foreach my $F (different_files(\@{$files_by_size{$bytes}},
+-                                            $rh_Err     ,
+-                                            $raa_errors ,
+-                                            $rh_ignored ) ) {
+-                $rh_unique_source_file->{$F} = 1;
+-            }
+-        }
+-    }
+-    print "<- remove_duplicate_files\n" if $opt_v > 2;
+-} # 1}}}
+-sub files {                                  # {{{1
+-    # invoked by File::Find's find()   Populates global variable @file_list
+-    if ($opt_exclude_dir or $opt_exclude_list_file) {
+-        my $return = 0;
+-        foreach my $skip_dir (keys %Exclude_Dir) {
+-            # File::Find::dir used to always start with / but
+-            # newer versions (1.13) no longer do; have to correct for this
+-            my $dir = $File::Find::dir;
+-               $dir = "./$dir" unless $dir =~ m{^/};
+-            if ($dir =~ m{/\Q$skip_dir\E(/|$)} ) {
+-                $Ignored{$File::Find::name} = "--exclude-dir=$skip_dir";
+-                $return = 1;
+-                last;
+-            }
+-        }
+-        return if $return;
+-    }
+-    my $Dir = cwd(); # not $File::Find::dir which just gives relative path
+-	if ($opt_match_f    ) {	return unless /$opt_match_f/;     }
+-    if ($opt_not_match_f) {	return if     /$opt_not_match_f/; }
+-	if ($opt_match_d    ) {	return unless $Dir =~ m{$opt_match_d}     }
+-    if ($opt_not_match_d) {	return if     $Dir =~ m{$opt_not_match_d} }
+-
+-    my $nBytes = -s     $_ ;
+-    if (!$nBytes and $opt_v > 5) {
+-        printf "files(%s)  zero size\n", $File::Find::name;
+-    }
+-    return unless $nBytes  ; # attempting other tests w/pipe or socket will hang
+-    my $is_dir = is_dir($_);
+-    my $is_bin = -B     $_ ;
+-    printf "files(%s)  size=%d is_dir=%d  -B=%d\n",
+-        $File::Find::name, $nBytes, $is_dir, $is_bin if $opt_v > 5;
+-    $is_bin = 0 if $opt_unicode and unicode_file($_);
+-    $is_bin = 0 if $opt_read_binary_files;
+-    return if $is_dir or $is_bin;
+-    ++$nFiles_Found;
+-    printf "%8d files\r", $nFiles_Found 
+-        unless (!$opt_progress_rate or ($nFiles_Found % $opt_progress_rate));
+-    push @file_list, $File::Find::name;
+-} # 1}}}
+-sub archive_files {                          # {{{1
+-    # invoked by File::Find's find()  Populates global variable @binary_archive
+-    foreach my $ext (keys %Known_Binary_Archives) {
+-        push @binary_archive, $File::Find::name 
+-            if $File::Find::name =~ m{$ext$};
+-    }
+-} # 1}}}
+-sub is_file {                                # {{{1
+-    # portable method to test if item is a file
+-    # (-f doesn't work in ActiveState Perl on Windows)
+-    my $item = shift @_;
+-
+-    if ($ON_WINDOWS) {
+-        my $mode = (stat $item)[2];
+-           $mode = 0 unless $mode;
+-        if ($mode & 0100000) { return 1; } 
+-        else                 { return 0; }
+-    } else {
+-        return (-f $item);  # works on Unix, Linux, CygWin, z/OS
+-    }
+-} # 1}}}
+-sub is_dir {                                 # {{{1
+-    # portable method to test if item is a directory
+-    # (-d doesn't work in ActiveState Perl on Windows)
+-    my $item = shift @_;
+-
+-    if ($ON_WINDOWS) {
+-        my $mode = (stat $item)[2];
+-           $mode = 0 unless $mode;
+-        if ($mode & 0040000) { return 1; } 
+-        else                 { return 0; }
+-    } else {
+-        return (-d $item);  # works on Unix, Linux, CygWin, z/OS
+-    }
+-} # 1}}}
+-sub is_excluded {                            # {{{1
+-    my ($file       , # in
+-        $excluded   , # in   hash of excluded directories
+-       ) = @_;
+-    my($filename, $filepath, $suffix) = fileparse($file);
+-    foreach my $path (sort keys %{$excluded}) {
+-        return 1 if ($filepath =~ m{^$path/}i);
+-    }
+-} # 1}}}
+-sub classify_file {                          # {{{1
+-    my ($full_file   , # in
+-        $rh_Err      , # in   hash of error codes
+-        $raa_errors  , # out
+-        $rh_ignored  , # out
+-       ) = @_;
+-
+-    print "-> classify_file($full_file)\n" if $opt_v > 2;
+-    my $language = "(unknown)";
+-
+-    my $look_at_first_line = 0;
+-    my $file = basename $full_file; 
+-    if ($opt_autoconf and $file =~ /\.in$/) {
+-       $file =~ s/\.in$//;
+-    }
+-    return $language if $Not_Code_Filename{$file}; # (unknown)
+-    return $language if $file =~ m{~$}; # a temp edit file (unknown)
+-    if (defined $Language_by_File{$file}) {
+-        return $Language_by_File{$file};
+-    }
+-
+-    if ($file =~ /\.(\w+)$/) { # has an extension
+-      print "$full_file extension=[$1]\n" if $opt_v > 2;
+-      my $extension = $1;
+-         # Windows file names are case insensitive so map 
+-         # all extensions to lowercase there.
+-         $extension = lc $extension if $ON_WINDOWS;  
+-      my @extension_list = ( $extension );
+-      if ($file =~ /\.(\w+\.\w+)$/) { # has a double extension
+-          my $extension = $1;
+-          $extension = lc $extension if $ON_WINDOWS;  
+-          unshift @extension_list, $extension;  # examine double ext first
+-      }
+-      foreach my $extension (@extension_list) {
+-        if ($Not_Code_Extension{$extension} and 
+-           !$Forced_Extension{$extension}) {
+-           # If .1 (for example) is an extention that would ordinarily be
+-           # ignored but the user has insisted this be counted with the
+-           # --force-lang option, then go ahead and count it.
+-            $rh_ignored->{$full_file} = 
+-                'listed in $Not_Code_Extension{' . $extension . '}';
+-            return $language;
+-        }
+-        if (defined $Language_by_Extension{$extension}) {
+-            if ($Language_by_Extension{$extension} eq
+-                'MATLAB/Objective C/MUMPS') {
+-                my $lang_M_or_O = "";
+-                matlab_or_objective_C($full_file , 
+-                                      $rh_Err    ,
+-                                      $raa_errors,
+-                                     \$lang_M_or_O);
+-                if ($lang_M_or_O) {
+-                    return $lang_M_or_O;
+-                } else { # an error happened in matlab_or_objective_C()
+-                    $rh_ignored->{$full_file} = 
+-                        'failure in matlab_or_objective_C()';
+-                    return $language; # (unknown)
+-                }
+-            } elsif ($Language_by_Extension{$extension} eq 'PHP/Pascal') {
+-                if (really_is_php($full_file)) {
+-                    return 'PHP';
+-                } elsif (really_is_incpascal($full_file)) {
+-                    return 'Pascal';
+-                } else {
+-                    return $language; # (unknown)
+-                }
+-            } elsif ($Language_by_Extension{$extension} eq 'Smarty') {
+-                # Smarty extension .tpl is generic; make sure the
+-                # file at least roughly resembles PHP
+-                if (really_is_php($full_file)) {
+-                    return 'Smarty';
+-                } else {
+-                    return $language; # (unknown)
+-                }
+-            } else {
+-                return $Language_by_Extension{$extension};
+-            }
+-        } else { # has an unmapped file extension
+-            $look_at_first_line = 1;
+-        }
+-      }
+-    } elsif (defined $Language_by_File{lc $file}) {
+-        return $Language_by_File{lc $file};
+-    } elsif ($opt_lang_no_ext and 
+-             defined $Filters_by_Language{$opt_lang_no_ext}) {
+-        return $opt_lang_no_ext;
+-    } else {  # no file extension
+-        $look_at_first_line = 1;
+-    }
+-
+-    if ($look_at_first_line) {
+-        # maybe it is a shell/Perl/Python/Ruby/etc script that
+-        # starts with pound bang:
+-        #   #!/usr/bin/perl
+-        #   #!/usr/bin/env perl
+-        my $script_language = peek_at_first_line($full_file , 
+-                                                 $rh_Err    , 
+-                                                 $raa_errors);
+-        if (!$script_language) {
+-            $rh_ignored->{$full_file} = "language unknown (#2)";
+-            # returns (unknown)
+-        }
+-        if (defined $Language_by_Script{$script_language}) {
+-            if (defined $Filters_by_Language{
+-                            $Language_by_Script{$script_language}}) {
+-                $language = $Language_by_Script{$script_language};
+-            } else {
+-                $rh_ignored->{$full_file} = 
+-                    "undefined:  Filters_by_Language{" . 
+-                    $Language_by_Script{$script_language} .
+-                    "} for scripting language $script_language";
+-                # returns (unknown)
+-            }
+-        } else {
+-            $rh_ignored->{$full_file} = "language unknown (#3)";
+-            # returns (unknown)
+-        }
+-    }
+-    print "<- classify_file($full_file)\n" if $opt_v > 2;
+-    return $language;
+-} # 1}}}
+-sub peek_at_first_line {                     # {{{1
+-    my ($file        , # in
+-        $rh_Err      , # in   hash of error codes
+-        $raa_errors  , # out
+-       ) = @_;
+-
+-    print "-> peek_at_first_line($file)\n" if $opt_v > 2;
+-
+-    my $script_language = "";
+-    if (!-r $file) {
+-        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
+-        return $script_language;
+-    }
+-    my $IN = new IO::File $file, "r";
+-    if (!defined $IN) {
+-        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
+-        print "<- peek_at_first_line($file)\n" if $opt_v > 2;
+-        return $script_language;
+-    }
+-    chomp(my $first_line = <$IN>);
+-    if (defined $first_line) {
+-#print "peek_at_first_line of [$file] first_line=[$first_line]\n";
+-        if ($first_line =~ /^#\!\s*(\S.*?)$/) {
+-#print "peek_at_first_line 1=[$1]\n";
+-            my @pound_bang = split(' ', $1);
+-#print "peek_at_first_line basename 0=[", basename($pound_bang[0]), "]\n";
+-            if (basename($pound_bang[0]) eq "env" and 
+-                scalar @pound_bang > 1) {
+-                $script_language = $pound_bang[1];
+-#print "peek_at_first_line pound_bang A $pound_bang[1]\n";
+-            } else {
+-                $script_language = basename $pound_bang[0];
+-#print "peek_at_first_line pound_bang B $script_language\n";
+-            }
+-        }
+-    }
+-    $IN->close;
+-    print "<- peek_at_first_line($file)\n" if $opt_v > 2;
+-    return $script_language;
+-} # 1}}}
+-sub different_files {                        # {{{1
+-    # See which of the given files are unique by computing each file's MD5
+-    # sum.  Return the subset of files which are unique.
+-    my ($ra_files    , # in
+-        $rh_Err      , # in
+-        $raa_errors  , # out
+-        $rh_ignored  , # out
+-       ) = @_;
+-
+-    print "-> different_files(@{$ra_files})\n" if $opt_v > 2;
+-    my %file_hash = ();  # file_hash{md5 hash} = [ file1, file2, ... ]
+-    foreach my $F (@{$ra_files}) {
+-        next if is_dir($F);  # needed for Windows
+-        my $IN = new IO::File $F, "r";
+-        if (!defined $IN) {
+-            push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $F];
+-            $rh_ignored->{$F} = 'cannot read';
+-        } else {
+-            if ($HAVE_Digest_MD5) {
+-                binmode $IN;
+-                my $MD5 = Digest::MD5->new->addfile($IN)->hexdigest;
+-                push @{$file_hash{$MD5}}, $F;
+-            } else {
+-                # all files treated unique
+-                push @{$file_hash{$F}}, $F;
+-            }
+-            $IN->close;
+-        }
+-    }
+-
+-    # Loop over file sets having identical MD5 sums.  Within
+-    # each set, pick the file that most resembles known source 
+-    # code.
+-    my @unique = ();
+-    for my $md5 (sort keys %file_hash) {
+-        my $i_best = 0;
+-        for (my $i = 1; $i < scalar(@{$file_hash{$md5}}); $i++) {
+-            my $F = $file_hash{$md5}[$i];
+-            my (@nul_a, %nul_h);
+-            my $language = classify_file($F, $rh_Err, 
+-                                        # don't save these errors; pointless
+-                                        \@nul_a, \%nul_h);
+-            $i_best = $i if $language ne "(unknown)";
+-        }
+-        push @unique, $file_hash{$md5}[$i_best];
+-    }
+-    print "<- different_files(@unique)\n" if $opt_v > 2;
+-    return @unique;
+-} # 1}}}
+-sub call_counter {                           # {{{1
+-    my ($file     , # in
+-        $language , # in
+-        $ra_Errors, # out
+-       ) = @_;
+-
+-    # Logic:  pass the file through the following filters:
+-    #         1. remove blank lines
+-    #         2. remove comments using each filter defined for this language
+-    #            (example:  SQL has two, remove_starts_with(--) and 
+-    #             remove_c_comments() )
+-    #         3. compute comment lines as 
+-    #               total lines - blank lines - lines left over after all
+-    #                   comment filters have been applied
+-
+-    print "-> call_counter($file, $language)\n" if $opt_v > 2;
+-#print "call_counter:  ", Dumper(@routines), "\n";
+-
+-    my @lines = ();
+-    my $ascii = "";
+-    if (-B $file and $opt_unicode) {
+-        # was binary so must be unicode
+-
+-        $/ = undef;
+-        my $IN = new IO::File $file, "r";
+-        my $bin_text = <$IN>;
+-        $IN->close;
+-        $/ = "\n";
+-
+-        $ascii = unicode_to_ascii( $bin_text );
+-        @lines = split("\n", $ascii );
+-        foreach (@lines) { $_ = "$_\n"; }
+-
+-    } else {
+-        # regular text file
+-        @lines = read_file($file);
+-        $ascii = join('', @lines);
+-    }
+-
+-    my @original_lines = @lines;
+-    my $total_lines    = scalar @lines;
+-
+-    print_lines($file, "Original file:", \@lines) if $opt_print_filter_stages;
+-    @lines = rm_blanks(\@lines, $language, \%EOL_Continuation_re); # remove blank lines
+-    my $blank_lines = $total_lines - scalar @lines;
+-    print_lines($file, "Blank lines removed:", \@lines) 
+-        if $opt_print_filter_stages;
+-
+-    @lines = rm_comments(\@lines, $language, $file,
+-                               \%EOL_Continuation_re);
+-
+-    my $comment_lines = $total_lines - $blank_lines - scalar  @lines;
+-    if ($opt_strip_comments) {
+-        my $stripped_file = "";
+-        if ($opt_original_dir) {
+-            $stripped_file =          $file . ".$opt_strip_comments";
+-        } else {
+-            $stripped_file = basename $file . ".$opt_strip_comments";
+-        }
+-        write_file($stripped_file, @lines);
+-    }
+-    if ($opt_html and !$opt_diff) {
+-        chomp(@original_lines);  # includes blank lines, comments
+-        chomp(@lines);           # no blank lines, no comments
+-
+-        my (@diff_L, @diff_R, %count);
+-
+-        # remove blank lines to get better quality diffs; count
+-        # blank lines separately
+-        my @original_lines_minus_white = ();
+-        # however must keep track of how many blank lines were removed and
+-        # where they were removed so that the HTML display can include it
+-        my %blank_line  = ();
+-        my $insert_line = 0;
+-        foreach (@original_lines) {
+-            if (/^\s*$/) {
+-               ++$count{blank}{same};
+-               ++$blank_line{ $insert_line };
+-            } else {
+-                ++$insert_line;
+-                push @original_lines_minus_white, $_;
+-            }
+-        }
+-
+-        array_diff( $file                       ,   # in
+-                   \@original_lines_minus_white ,   # in
+-                   \@lines                      ,   # in
+-                   "comment"                    ,   # in
+-                   \@diff_L, \@diff_R,          ,   # out
+-                    $ra_Errors);                    # in/out
+-        write_comments_to_html($file, \@diff_L, \@diff_R, \%blank_line);
+-#print Dumper("count", \%count);
+-    }
+-
+-    print "<- call_counter($total_lines, $blank_lines, $comment_lines)\n" 
+-        if $opt_v > 2;
+-    return ($total_lines, $blank_lines, $comment_lines);
+-} # 1}}}
+-sub windows_glob {                           # {{{1
+-    # Windows doesn't expand wildcards.  Use code from Sean M. Burke's 
+-    # Win32::Autoglob module to do this.
+-    return map {;
+-        ( defined($_) and m/[\*\?]/ ) ? sort(glob($_)) : $_
+-          } @_; 
+-} # 1}}}
+-sub write_file {                             # {{{1
+-    my ($file  , # in
+-        @lines , # in
+-       ) = @_;
+-
+-#print "write_file 1 [$file]\n";
+-    # Do ~ expansion (by Tim LaBerge, fixes bug 2787984)
+-    my $preglob_filename = $file;
+-#print "write_file 2 [$preglob_filename]\n";
+-    if ($ON_WINDOWS) {
+-        $file = (windows_glob($file))[0];
+-    } else {
+-        $file = glob($file);  # sometimes returns null string
+-    }
+-#print "write_file 3 [$file]\n";
+-    $file = $preglob_filename unless $file;
+-#print "write_file 4 [$file]\n";
+-
+-    print "-> write_file($file)\n" if $opt_v > 2;
+-
+-    # Create the destination directory if it doesn't already exist.
+-    my $abs_file_path = File::Spec->rel2abs( $file );
+-    my ($volume, $directories, $filename) = File::Spec->splitpath( $abs_file_path );
+-    mkpath($volume . $directories, 1, 0777);
+-    
+-    my $OUT = new IO::File $file, "w";
+-    if (defined $OUT) {
+-        chomp(@lines);
+-        print $OUT join("\n", @lines), "\n";
+-        $OUT->close;
+-    } else {
+-        warn "Unable to write to $file\n";
+-    }
+-    print "Wrote $file";
+-    print ", $CLOC_XSL" if $opt_xsl and $opt_xsl eq $CLOC_XSL;
+-    print "\n";
+-    
+-    print "<- write_file\n" if $opt_v > 2;
+-} # 1}}}
+-sub read_file  {                             # {{{1
+-    my ($file, ) = @_;
+-
+-    print "-> read_file($file)\n" if $opt_v > 2;
+-    my @lines = ();
+-    my $IN = new IO::File $file, "r";
+-    if (defined $IN) {
+-        @lines = <$IN>;
+-        $IN->close;
+-        # Some files don't end with a new line.  Force this:
+-        $lines[$#lines] .= "\n" unless $lines[$#lines] =~ m/\n$/;
+-    } else {
+-        warn "Unable to read $file\n";
+-    }
+-    print "<- read_file\n" if $opt_v > 2;
+-    return @lines;
+-} # 1}}}
+-sub rm_blanks {                              # {{{1
+-    my ($ra_in    ,
+-        $language ,
+-        $rh_EOL_continuation_re) = @_;
+-    print "-> rm_blanks(language=$language)\n" if $opt_v > 2;
+-#print "rm_blanks: language = [$language]\n";
+-    my @out = ();
+-    if ($language eq "COBOL") {
+-        @out = remove_cobol_blanks($ra_in);
+-    } else {
+-        # removes blank lines
+-        if (defined $rh_EOL_continuation_re->{$language}) {
+-            @out = remove_matches_2re($ra_in, '^\s*$', 
+-                                      $rh_EOL_continuation_re->{$language}); 
+-        } else {
+-            @out = remove_matches($ra_in, '^\s*$');
+-        }
+-    }
+-    print "<- rm_blanks(language=$language)\n" if $opt_v > 2;
+-    return @out;
+-} # 1}}}
+-sub rm_comments {                            # {{{1
+-    my ($ra_lines , # in, must be free of blank lines
+-        $language , # in
+-        $file     , # in (some language counters, eg Haskell, need 
+-                    #     access to the original file)
+-        $rh_EOL_continuation_re , # in
+-       ) = @_;
+-    print "-> rm_comments(file=$file)\n" if $opt_v > 2;
+-    my @routines       = @{$Filters_by_Language{$language}};
+-    my @lines          = @{$ra_lines};
+-    my @original_lines = @{$ra_lines};
+-
+-    foreach my $call_string (@routines) {
+-        my $subroutine = $call_string->[0];
+-        if (! defined &{$subroutine}) {
+-            warn "rm_comments undefined subroutine $subroutine for $file\n";
+-            next;
+-        }
+-        print "rm_comments file=$file sub=$subroutine\n" if $opt_v > 1;
+-        my @args  = @{$call_string};
+-        shift @args; # drop the subroutine name
+-        if (@args and $args[0] eq '>filename<') {
+-            shift   @args;
+-            unshift @args, $file;
+-        }
+-
+-        no strict 'refs';
+-        @lines = &{$subroutine}(\@lines, @args);   # apply filter...
+-
+-        print_lines($file, "After $subroutine(@args)", \@lines) 
+-            if $opt_print_filter_stages;
+-        # then remove blank lines which are created by comment removal
+-        if (defined $rh_EOL_continuation_re->{$language}) {
+-            @lines = remove_matches_2re(\@lines, '^\s*$',
+-                                        $rh_EOL_continuation_re);
+-        } else {
+-            @lines = remove_matches(\@lines, '^\s*$');
+-        }
+-        
+-        print_lines($file, "post $subroutine(@args) blank cleanup:", \@lines) 
+-            if $opt_print_filter_stages;
+-    }
+-    # Exception for scripting languages:  treat the first #! line as code.
+-    # Will need to add it back in if it was removed earlier.
+-    if ($Script_Language{$language} and 
+-        $original_lines[0] =~ /^#!/ and
+-        (scalar(@lines) == 0 or 
+-         $lines[0] ne $original_lines[0])) {
+-        unshift @lines, $original_lines[0];  # add the first line back
+-    }
+-    print "<- rm_comments\n" if $opt_v > 2;
+-    return @lines;
+-} # 1}}}
+-sub remove_f77_comments {                    # {{{1
+-    my ($ra_lines, ) = @_;
+-    print "-> remove_f77_comments\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    foreach (@{$ra_lines}) {
+-        next if m{^[*cC]};
+-        next if m{^\s*!};
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_f77_comments\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub remove_f90_comments {                    # {{{1
+-    # derived from SLOCCount
+-    my ($ra_lines, ) = @_;
+-    print "-> remove_f90_comments\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    foreach (@{$ra_lines}) {
+-        # a comment is              m/^\s*!/
+-        # an empty line is          m/^\s*$/
+-        # a HPF statement is        m/^\s*!hpf\$/i
+-        # an Open MP statement is   m/^\s*!omp\$/i
+-        if (! m/^(\s*!|\s*$)/ || m/^\s*!(hpf|omp)\$/i) {
+-            push @save_lines, $_;
+-        }
+-    }
+-
+-    print "<- remove_f90_comments\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub remove_matches {                         # {{{1
+-    my ($ra_lines, # in
+-        $pattern , # in   Perl regular expression (case insensitive)
+-       ) = @_;
+-    print "-> remove_matches(pattern=$pattern)\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    foreach (@{$ra_lines}) {
+-#chomp; print "remove_matches [$pattern] [$_]\n";
+-        next if m{$pattern}i;
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_matches\n" if $opt_v > 2;
+-#print "remove_matches returning\n   ", join("\n   ", @save_lines), "\n";
+-    return @save_lines;
+-} # 1}}}
+-sub remove_matches_2re {                     # {{{1
+-    my ($ra_lines, # in
+-        $pattern1, # in Perl regex 1 (case insensitive) to match
+-        $pattern2, # in Perl regex 2 (case insensitive) to not match prev line
+-       ) = @_;
+-    print "-> remove_matches_2re(pattern=$pattern1,$pattern2)\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    for (my $i = 0; $i < scalar @{$ra_lines}; $i++) {
+-#print "remove_matches_2re [$pattern1] [$pattern2] [$ra_lines->[$i]]\n";
+-        if ($i) {
+-#print "remove_matches_2re prev=[$ra_lines->[$i-1]] this=[$ra_lines->[$i]]\n";
+-            next if ($ra_lines->[$i]   =~ m{$pattern1}i) and 
+-                    ($ra_lines->[$i-1] !~ m{$pattern2}i);
+-        } else {
+-            # on first line
+-            next if $ra_lines->[$i]   =~  m{$pattern1}i;
+-        }
+-        push @save_lines, $ra_lines->[$i];
+-    }
+-
+-    print "<- remove_matches_2re\n" if $opt_v > 2;
+-#print "remove_matches_2re returning\n   ", join("\n   ", @save_lines), "\n";
+-    return @save_lines;
+-} # 1}}}
+-sub remove_inline {                          # {{{1
+-    my ($ra_lines, # in
+-        $pattern , # in   Perl regular expression (case insensitive)
+-       ) = @_;
+-    print "-> remove_inline(pattern=$pattern)\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    unless ($opt_inline) {
+-        return @{$ra_lines};
+-    }
+-    my $nLines_affected = 0;
+-    foreach (@{$ra_lines}) {
+-#chomp; print "remove_inline [$pattern] [$_]\n";
+-        if (m{$pattern}i) {
+-            ++$nLines_affected;
+-            s{$pattern}{}i;
+-        }
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_inline\n" if $opt_v > 2;
+-#print "remove_inline returning\n   ", join("\n   ", @save_lines), "\n";
+-    return @save_lines;
+-} # 1}}}
+-sub remove_above {                           # {{{1
+-    my ($ra_lines, $marker, ) = @_;
+-    print "-> remove_above(marker=$marker)\n" if $opt_v > 2;
+-
+-    # Make two passes through the code:
+-    # 1. check if the marker exists
+-    # 2. remove anything above the marker if it exists,
+-    #    do nothing if the marker does not exist
+-
+-    # Pass 1
+-    my $found_marker = 0;
+-    for (my $line_number  = 1;
+-            $line_number <= scalar @{$ra_lines};
+-            $line_number++) {
+-        if ($ra_lines->[$line_number-1] =~ m{$marker}) {
+-            $found_marker = $line_number;
+-            last;
+-        }
+-    }
+-
+-    # Pass 2 only if needed
+-    my @save_lines = ();
+-    if ($found_marker) {
+-        my $n = 1;
+-        foreach (@{$ra_lines}) {
+-            push @save_lines, $_
+-                if $n >= $found_marker;
+-            ++$n;
+-        }
+-    } else { # marker wasn't found; save all lines
+-        foreach (@{$ra_lines}) {
+-            push @save_lines, $_;
+-        }
+-    }
+-
+-    print "<- remove_above\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub remove_below {                           # {{{1
+-    my ($ra_lines, $marker, ) = @_;
+-    print "-> remove_below(marker=$marker)\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    foreach (@{$ra_lines}) {
+-        last if m{$marker};
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_below\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub remove_below_above {                     # {{{1
+-    my ($ra_lines, $marker_below, $marker_above, ) = @_;
+-    # delete lines delimited by start and end line markers such
+-    # as Perl POD documentation
+-    print "-> remove_below_above(markerB=$marker_below, A=$marker_above)\n" 
+-        if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    my $between    = 0;
+-    foreach (@{$ra_lines}) {
+-        if (!$between and m{$marker_below}) {
+-            $between    = 1;
+-            next;
+-        }
+-        if ($between and m{$marker_above}) {
+-            $between    = 0;
+-            next;
+-        }
+-        next if $between;
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_below_above\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub remove_between {                         # {{{1
+-    my ($ra_lines, $marker, ) = @_;
+-    # $marker must contain one of the balanced pairs understood
+-    # by Regexp::Common::balanced, namely
+-    # '{}'  '()'  '[]'  or  '<>'
+-
+-    print "-> remove_between(marker=$marker)\n" if $opt_v > 2;
+-    my %acceptable = ('{}'=>1,  '()'=>1,  '[]'=>1,  '<>'=>1, );
+-    die "remove_between:  invalid delimiter '$marker'\n",
+-        "the delimiter must be one of these four pairs:\n",
+-        "{}  ()  []  <>\n" unless
+-        $acceptable{$marker};
+-
+-    Install_Regexp_Common() unless $HAVE_Rexexp_Common;
+-
+-    my $all_lines = join("", @{$ra_lines});
+-
+-    no strict 'vars';
+-    # otherwise get:
+-    #  Global symbol "%RE" requires explicit package name at cloc line xx.
+-    if ($all_lines =~ m/$RE{balanced}{-parens => $marker}/) {
+-        no warnings; 
+-        $all_lines =~ s/$1//g;
+-    }
+-
+-    print "<- remove_between\n" if $opt_v > 2;
+-    return split("\n", $all_lines);
+-} # 1}}}
+-sub remove_cobol_blanks {                    # {{{1
+-    # subroutines derived from SLOCCount
+-    my ($ra_lines, ) = @_;
+-
+-    my $free_format = 0;  # Support "free format" source code.
+-    my @save_lines  = ();
+-  
+-    foreach (@{$ra_lines}) {
+-        next if m/^\s*$/;
+-        my $line = expand($_);  # convert tabs to equivalent spaces
+-        $free_format = 1 if $line =~ m/^......\$.*SET.*SOURCEFORMAT.*FREE/i;
+-        if ($free_format) {
+-            push @save_lines, $_;
+-        } else {
+-            # Greg Toth:
+-            #  (1) Treat lines with any alphanum in cols 1-6 and 
+-            #      blanks in cols 7 through 71 as blank line, and
+-            #  (2) Treat lines with any alphanum in cols 1-6 and 
+-            #      slash (/) in col 7 as blank line (this is a 
+-            #      page eject directive). 
+-            push @save_lines, $_ unless m/^\d{6}\s*$/             or 
+-                                        ($line =~ m/^.{6}\s{66}/) or 
+-                                        ($line =~ m/^......\//);
+-        }
+-    }
+-    return @save_lines;
+-} # 1}}}
+-sub remove_cobol_comments {                  # {{{1
+-    # subroutines derived from SLOCCount
+-    my ($ra_lines, ) = @_;
+-
+-    my $free_format = 0;  # Support "free format" source code.
+-    my @save_lines  = ();
+-  
+-    foreach (@{$ra_lines}) {
+-        if (m/^......\$.*SET.*SOURCEFORMAT.*FREE/i) {$free_format = 1;}
+-        if ($free_format) {
+-            push @save_lines, $_ unless m{^\s*\*};
+-        } else {
+-            push @save_lines, $_ unless m{^......\*} or m{^\*};
+-        }
+-    }
+-    return @save_lines;
+-} # 1}}}
+-sub remove_jcl_comments {                    # {{{1
+-    my ($ra_lines, ) = @_;
+-
+-    print "-> remove_jcl_comments\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    my $in_comment = 0;
+-    foreach (@{$ra_lines}) {
+-        next if /^\s*$/;
+-        next if m{^\s*//\*};
+-        last if m{^\s*//\s*$};
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_jcl_comments\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub remove_jsp_comments {                    # {{{1
+-    #  JSP comment is   <%--  body of comment   --%>
+-    my ($ra_lines, ) = @_;
+-
+-    print "-> remove_jsp_comments\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    my $in_comment = 0;
+-    foreach (@{$ra_lines}) {
+-
+-        next if /^\s*$/;
+-        s/<\%\-\-.*?\-\-\%>//g;  # strip one-line comments
+-        next if /^\s*$/;
+-        if ($in_comment) {
+-            if (/\-\-\%>/) {
+-                s/^.*?\-\-\%>//;
+-                $in_comment = 0;
+-            }
+-        }
+-        next if /^\s*$/;
+-        $in_comment = 1 if /^(.*?)<\%\-\-/;
+-        next if defined $1 and $1 =~ /^\s*$/;
+-        next if ($in_comment);
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_jsp_comments\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub remove_html_comments {                   # {{{1
+-    #  HTML comment is   <!--  body of comment   -->
+-    #  Need to use my own routine until the HTML comment regex in
+-    #  the Regexp::Common module can handle  <!--  --  -->
+-    my ($ra_lines, ) = @_;
+-
+-    print "-> remove_html_comments\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    my $in_comment = 0;
+-    foreach (@{$ra_lines}) {
+-
+-        next if /^\s*$/;
+-        s/<!\-\-.*?\-\->//g;  # strip one-line comments
+-        next if /^\s*$/;
+-        if ($in_comment) {
+-            if (/\-\->/) {
+-                s/^.*?\-\->//;
+-                $in_comment = 0;
+-            }
+-        }
+-        next if /^\s*$/;
+-        $in_comment = 1 if /^(.*?)<!\-\-/;
+-        next if defined $1 and $1 =~ /^\s*$/;
+-        next if ($in_comment);
+-        push @save_lines, $_;
+-    }
+-
+-    print "<- remove_html_comments\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub add_newlines {                           # {{{1
+-    my ($ra_lines, ) = @_;
+-    print "-> add_newlines \n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    foreach (@{$ra_lines}) {
+-
+-        push @save_lines, "$_\n";
+-    }
+-
+-    print "<- add_newlines \n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub docstring_to_C {                         # {{{1
+-    my ($ra_lines, ) = @_;
+-    # Converts Python docstrings to C comments.
+-
+-    print "-> docstring_to_C()\n" if $opt_v > 2;
+-
+-    my $in_docstring = 0;
+-    foreach (@{$ra_lines}) {
+-        while (/"""/) {
+-            if (!$in_docstring) {
+-                s{"""}{/*};
+-                $in_docstring = 1;
+-            } else {
+-                s{"""}{*/};
+-                $in_docstring = 0;
+-            }
+-        }
+-    }
+-
+-    print "<- docstring_to_C\n" if $opt_v > 2;
+-    return @{$ra_lines};
+-} # 1}}}
+-sub smarty_to_C {                            # {{{1
+-    my ($ra_lines, ) = @_;
+-    # Converts Smarty comments to C comments.
+-
+-    print "-> smarty_to_C()\n" if $opt_v > 2;
+-
+-    foreach (@{$ra_lines}) {
+-        s[{\*][/*]g;
+-        s[\*}][*/]g;
+-    }
+-
+-    print "<- smarty_to_C\n" if $opt_v > 2;
+-    return @{$ra_lines};
+-} # 1}}}
+-sub determine_lit_type {                     # {{{1
+-  my ($file) = @_;
+-
+-  open (FILE, $file);
+-  while (<FILE>) {
+-    if (m/^\\begin{code}/) { close FILE; return 2; }
+-    if (m/^>\s/) { close FILE; return 1; }
+-  }
+-
+-  return 0;
+-} # 1}}}
+-sub remove_haskell_comments {                # {{{1
+-    # Bulk of code taken from SLOCCount's haskell_count script.
+-    # Strips out {- .. -} and -- comments and counts the rest.
+-    # Pragmas, {-#...}, are counted as SLOC.
+-    # BUG: Doesn't handle strings with embedded block comment markers gracefully.
+-    #      In practice, that shouldn't be a problem.
+-    my ($ra_lines, $file, ) = @_;
+-
+-    print "-> remove_haskell_comments\n" if $opt_v > 2;
+-
+-    my @save_lines = ();
+-    my $in_comment = 0;
+-    my $incomment  = 0;
+-    my ($literate, $inlitblock) = (0,0);
+-  
+-    $literate = 1 if $file =~ /\.lhs$/;
+-    if($literate) { $literate = determine_lit_type($file) }
+-
+-    foreach (@{$ra_lines}) {
+-        if ($literate == 1) {
+-            if (!s/^>//) { s/.*//; }
+-        } elsif ($literate == 2) {
+-            if ($inlitblock) {
+-                if (m/^\\end{code}/) { s/.*//; $inlitblock = 0; }
+-            } elsif (!$inlitblock) {
+-                if (m/^\\begin{code}/) { s/.*//; $inlitblock = 1; }
+-                else { s/.*//; }
+-            }
+-        }
+-
+-        if ($incomment) {
+-            if (m/\-\}/) { s/^.*?\-\}//;  $incomment = 0;}
+-            else { s/.*//; }
+-        }
+-        if (!$incomment) {
+-            s/--.*//;
+-            s!{-[^#].*?-}!!g;
+-            if (m/{-/ && (!m/{-#/)) {
+-              s/{-.*//;
+-              $incomment = 1;
+-            }
+-        }
+-        if (m/\S/) { push @save_lines, $_; }
+-    }
+-#   if ($incomment) {print "ERROR: ended in comment in $ARGV\n";}
+-
+-    print "<- remove_haskell_comments\n" if $opt_v > 2;
+-    return @save_lines;
+-} # 1}}}
+-sub print_lines {                            # {{{1
+-    my ($file     , # in
+-        $title    , # in
+-        $ra_lines , # in
+-       ) = @_;
+-    printf "->%-30s %s\n", $file, $title;
+-    for (my $i = 0; $i < scalar @{$ra_lines}; $i++) {
+-        printf "%5d | %s", $i+1, $ra_lines->[$i];
+-        print "\n" unless $ra_lines->[$i] =~ m{\n$}
+-    }
+-} # 1}}}
+-sub set_constants {                          # {{{1
+-    my ($rh_Language_by_Extension , # out
+-        $rh_Language_by_Script    , # out
+-        $rh_Language_by_File      , # out
+-        $rhaa_Filters_by_Language , # out
+-        $rh_Not_Code_Extension    , # out
+-        $rh_Not_Code_Filename     , # out
+-        $rh_Scale_Factor          , # out
+-        $rh_Known_Binary_Archives , # out
+-        $rh_EOL_continuation_re   , # out
+-       ) = @_;
+-# 1}}}
+-%{$rh_Language_by_Extension} = (                 # {{{1
+-            'abap'        => 'ABAP'                  ,
+-            'ac'          => 'm4'                    ,
+-            'ada'         => 'Ada'                   ,
+-            'adb'         => 'Ada'                   ,
+-            'ads'         => 'Ada'                   ,
+-            'adso'        => 'ADSO/IDSM'             ,
+-            'am'          => 'make'                  ,
+-            'ample'       => 'AMPLE'                 ,
+-            'as'          => 'ActionScript'          ,
+-            'dofile'      => 'AMPLE'                 ,
+-            'startup'     => 'AMPLE'                 ,
+-            'asa'         => 'ASP'                   ,
+-            'asax'        => 'ASP.Net'               ,
+-            'ascx'        => 'ASP.Net'               ,
+-            'asm'         => 'Assembly'              ,
+-            'asmx'        => 'ASP.Net'               ,
+-            'asp'         => 'ASP'                   ,
+-            'aspx'        => 'ASP.Net'               ,
+-            'master'      => 'ASP.Net'               ,
+-            'sitemap'     => 'ASP.Net'               ,
+-            'awk'         => 'awk'                   ,
+-            'bash'        => 'Bourne Again Shell'    ,
+-            'bas'         => 'Visual Basic'          ,
+-            'bat'         => 'DOS Batch'             ,
+-            'BAT'         => 'DOS Batch'             ,
+-            'cbl'         => 'COBOL'                 ,
+-            'CBL'         => 'COBOL'                 ,
+-            'c'           => 'C'                     ,
+-            'C'           => 'C++'                   ,
+-            'cc'          => 'C++'                   ,
+-            'ccs'         => 'CCS'                   ,
+-            'cfm'         => 'ColdFusion'            ,
+-            'cl'          => 'Lisp'                  ,
+-            'cls'         => 'Visual Basic'          ,
+-            'CMakeLists.txt' => 'CMake'              ,
+-            'cob'         => 'COBOL'                 ,
+-            'COB'         => 'COBOL'                 ,
+-            'config'      => 'ASP.Net'               ,
+-            'cpp'         => 'C++'                   ,
+-            'cs'          => 'C#'                    ,
+-            'csh'         => 'C Shell'               ,
+-            'css'         => "CSS"                   ,
+-            'cxx'         => 'C++'                   ,
+-            'd'           => 'D'                     ,
+-            'da'          => 'DAL'                   ,
+-            'dart'        => 'Dart'                  ,
+-            'def'         => 'Teamcenter def'        ,
+-            'dmap'        => 'NASTRAN DMAP'          ,
+-            'dpr'         => 'Pascal'                ,
+-            'dtd'         => 'DTD'                   ,
+-            'ec'          => 'C'                     ,
+-            'el'          => 'Lisp'                  ,
+-            'erl'         => 'Erlang'                ,
+-            'exp'         => 'Expect'                ,
+-            'f77'         => 'Fortran 77'            ,
+-            'F77'         => 'Fortran 77'            ,
+-            'f90'         => 'Fortran 90'            ,
+-            'F90'         => 'Fortran 90'            ,
+-            'f95'         => 'Fortran 95'            ,
+-            'F95'         => 'Fortran 95'            ,
+-            'f'           => 'Fortran 77'            ,
+-            'F'           => 'Fortran 77'            ,
+-            'fmt'         => 'Oracle Forms'          ,
+-            'focexec'     => 'Focus'                 ,
+-            'frm'         => 'Visual Basic'          ,
+-            'gnumakefile' => 'make'                  ,
+-            'Gnumakefile' => 'make'                  ,
+-            'go'          => 'Go'                    ,
+-            'groovy'      => 'Groovy'                ,
+-            'h'           => 'C/C++ Header'          ,
+-            'H'           => 'C/C++ Header'          ,
+-            'hh'          => 'C/C++ Header'          ,
+-            'hpp'         => 'C/C++ Header'          ,
+-            'hrl'         => 'Erlang'                ,
+-            'hs'          => 'Haskell'               , 
+-            'htm'         => 'HTML'                  ,
+-            'html'        => 'HTML'                  ,
+-            'i3'          => 'Modula3'               ,
+-            'idl'         => 'IDL'                   ,
+-            'pro'         => 'IDL'                   ,
+-            'ig'          => 'Modula3'               ,
+-            'il'          => 'SKILL'                 ,
+-            'ils'         => 'SKILL++'               ,
+-            'inc'         => 'PHP/Pascal'            , # might be PHP or Pascal
+-            'itk'         => 'Tcl/Tk'                ,
+-            'java'        => 'Java'                  ,
+-            'jcl'         => 'JCL'                   , # IBM Job Control Lang.
+-            'jl'          => 'Lisp'                  ,
+-            'js'          => 'Javascript'            ,
+-            'jsp'         => 'JSP'                   , # Java server pages
+-            'ksc'         => 'Kermit'                ,
+-            'ksh'         => 'Korn Shell'            ,
+-            'lhs'         => 'Haskell'               ,
+-            'l'           => 'lex'                   ,
+-            'lsp'         => 'Lisp'                  ,
+-            'lisp'        => 'Lisp'                  ,
+-            'lua'         => 'Lua'                   ,
+-            'm3'          => 'Modula3'               ,
+-            'm4'          => 'm4'                    ,
+-            'makefile'    => 'make'                  ,
+-            'Makefile'    => 'make'                  ,
+-            'met'         => 'Teamcenter met'        ,
+-            'mg'          => 'Modula3'               , 
+-#           'mli'         => 'ML'                    , # ML not implemented
+-#           'ml'          => 'ML'                    , 
+-            'ml'          => 'Ocaml'                 , 
+-            'm'           => 'MATLAB/Objective C/MUMPS' ,
+-            'mm'          => 'Objective C++'         ,
+-            'wdproj'      => 'MSBuild scripts'       ,
+-            'csproj'      => 'MSBuild scripts'       ,
+-            'mps'         => 'MUMPS'                 ,
+-            'mth'         => 'Teamcenter mth'        ,
+-            'oscript'     => 'LiveLink OScript'      ,
+-            'pad'         => 'Ada'                   , # Oracle Ada preprocessor
+-            'pas'         => 'Pascal'                ,
+-            'pcc'         => 'C++'                   , # Oracle C++ preprocessor
+-            'perl'        => 'Perl'                  ,
+-            'pfo'         => 'Fortran 77'            ,
+-            'pgc'         => 'C'                     , # Postgres embedded C/C++
+-            'php3'        => 'PHP'                   ,
+-            'php4'        => 'PHP'                   ,
+-            'php5'        => 'PHP'                   ,
+-            'php'         => 'PHP'                   ,
+-            'plh'         => 'Perl'                  ,
+-            'pl'          => 'Perl'                  ,
+-            'PL'          => 'Perl'                  ,
+-            'plx'         => 'Perl'                  ,
+-            'pm'          => 'Perl'                  ,
+-            'p'           => 'Pascal'                ,
+-            'pp'          => 'Pascal'                ,
+-            'psql'        => 'SQL'                   ,
+-            'py'          => 'Python'                ,
+-            'pyx'         => 'Cython'                ,
+-            'rb'          => 'Ruby'                  ,
+-         #  'resx'        => 'ASP.Net'               ,
+-            'rex'         => 'Oracle Reports'        ,
+-            'rexx'        => 'Rexx'                  ,
+-            'rhtml'       => 'Ruby HTML'             ,
+-            's'           => 'Assembly'              ,
+-            'S'           => 'Assembly'              ,
+-            'scala'       => 'Scala'                 ,
+-            'sbl'         => 'Softbridge Basic'      ,
+-            'SBL'         => 'Softbridge Basic'      ,
+-            'sc'          => 'Lisp'                  ,
+-            'scm'         => 'Lisp'                  ,
+-            'sed'         => 'sed'                   ,
+-            'ses'         => 'Patran Command Language'   ,
+-            'pcl'         => 'Patran Command Language'   ,
+-            'sh'          => 'Bourne Shell'          ,
+-            'smarty'      => 'Smarty'                ,
+-            'sql'         => 'SQL'                   ,
+-            'SQL'         => 'SQL'                   ,
+-            'sproc.sql'   => 'SQL Stored Procedure'  ,
+-            'spoc.sql'    => 'SQL Stored Procedure'  ,
+-            'spc.sql'     => 'SQL Stored Procedure'  ,
+-            'udf.sql'     => 'SQL Stored Procedure'  ,
+-            'data.sql'    => 'SQL Data'              ,
+-            'tcl'         => 'Tcl/Tk'                ,
+-            'tcsh'        => 'C Shell'               ,
+-            'tk'          => 'Tcl/Tk'                ,
+-            'tpl'         => 'Smarty'                ,
+-            'vhd'         => 'VHDL'                  ,
+-            'VHD'         => 'VHDL'                  ,
+-            'vhdl'        => 'VHDL'                  ,
+-            'VHDL'        => 'VHDL'                  ,
+-            'vba'         => 'Visual Basic'          ,
+-            'VBA'         => 'Visual Basic'          ,
+-         #  'vbp'         => 'Visual Basic'          , # .vbp - autogenerated
+-            'vb'          => 'Visual Basic'          ,
+-            'VB'          => 'Visual Basic'          ,
+-         #  'vbw'         => 'Visual Basic'          , # .vbw - autogenerated
+-            'vbs'         => 'Visual Basic'          ,
+-            'VBS'         => 'Visual Basic'          ,
+-            'webinfo'     => 'ASP.Net'               ,
+-            'xml'         => 'XML'                   ,
+-            'XML'         => 'XML'                   ,
+-            'mxml'        => 'MXML'                  ,
+-            'build'       => 'NAnt scripts'          ,
+-            'vim'         => 'vim script'            ,
+-            'xaml'        => 'XAML'                  ,
+-            'xsd'         => 'XSD'                   ,
+-            'XSD'         => 'XSD'                   ,
+-            'xslt'        => 'XSLT'                  ,
+-            'XSLT'        => 'XSLT'                  ,
+-            'xsl'         => 'XSLT'                  ,
+-            'XSL'         => 'XSLT'                  ,
+-            'y'           => 'yacc'                  ,
+-            'yaml'        => 'YAML'                  ,
+-            'yml'         => 'YAML'                  ,
+-            );
+-# 1}}}
+-%{$rh_Language_by_Script}    = (                 # {{{1
+-            'awk'      => 'awk'                   ,
+-            'bash'     => 'Bourne Again Shell'    ,
+-            'bc'       => 'bc'                    ,# calculator
+-            'csh'      => 'C Shell'               ,
+-            'dmd'      => 'D'                     ,
+-            'idl'      => 'IDL'                   ,
+-            'kermit'   => 'Kermit'                ,
+-            'ksh'      => 'Korn Shell'            ,
+-            'lua'      => 'Lua'                   ,
+-            'make'     => 'make'                  ,
+-            'octave'   => 'Octave'                ,
+-            'perl5'    => 'Perl'                  ,
+-            'perl'     => 'Perl'                  ,
+-            'ruby'     => 'Ruby'                  ,
+-            'sed'      => 'sed'                   ,
+-            'sh'       => 'Bourne Shell'          ,
+-            'tcl'      => 'Tcl/Tk'                ,
+-            'tclsh'    => 'Tcl/Tk'                ,
+-            'tcsh'     => 'C Shell'               ,
+-            'wish'     => 'Tcl/Tk'                ,
+-            );
+-# 1}}}
+-%{$rh_Language_by_File}      = (                 # {{{1
+-            'Makefile'       => 'make'               ,
+-            'makefile'       => 'make'               ,
+-            'gnumakefile'    => 'make'               ,
+-            'Gnumakefile'    => 'make'               ,
+-            'CMakeLists.txt' => 'CMake'              ,
+-            );
+-# 1}}}
+-%{$rhaa_Filters_by_Language} = (                 # {{{1
+-    'ABAP'               => [   [ 'remove_matches'      , '^\*'    ], ],
+-    'ActionScript'       => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ],
+-
+-    'ASP'                => [   [ 'remove_matches'      , '^\s*\47'], ],  # \47 = '
+-    'ASP.Net'            => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'Ada'                => [   [ 'remove_matches'      , '^\s*--' ], ],
+-    'ADSO/IDSM'          => [   [ 'remove_matches'      , '^\s*\*[\+\!]' ], ],
+-    'AMPLE'              => [   [ 'remove_matches'      , '^\s*//' ], ],
+-    'Assembly'           => [  
+-                                [ 'remove_matches'      , '^\s*//' ],
+-                                [ 'remove_matches'      , '^\s*;'  ],
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                                [ 'remove_inline'       , ';.*$'   ],
+-                            ],
+-    'awk'                => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'bc'                 => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'C'                  => [   
+-                                [ 'remove_matches'      , '^\s*//' ], # C99
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_inline'       , '//.*$'  ], # C99
+-                            ], 
+-    'C++'                => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ],
+-    'C/C++ Header'       => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ],
+-    'CMake'              => [   
+-                                [ 'remove_matches'      , '^\s*#'  ],
+-                                [ 'remove_inline'       , '#.*$'   ], 
+-                            ],
+-    'Cython'             => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'docstring_to_C'                 ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'C#'                 => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ],
+-    'CCS'                => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'CSS'                => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'COBOL'              => [   [ 'remove_cobol_comments',         ], ],
+-    'ColdFusion'         => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'Crystal Reports'    => [   [ 'remove_matches'      , '^\s*//' ], ],
+-    'D'                  => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ],
+-    'DAL'                => [   [ 'remove_between'      , '[]',    ], ],
+-    'Dart'               => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ],
+-    'NASTRAN DMAP'       => [   
+-                                [ 'remove_matches'      , '^\s*\$' ], 
+-                                [ 'remove_inline'       , '\$.*$'  ], 
+-                            ],
+-    'DOS Batch'          => [   [ 'remove_matches'      , '^\s*rem', ], ],
+-    'DTD'                => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'Erlang'             => [   
+-                                [ 'remove_matches'      , '^\s*%'  ], 
+-                                [ 'remove_inline'       , '%.*$'   ],
+-                            ],
+-    'Expect'             => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Focus'              => [   [ 'remove_matches'      , '^\s*\-\*'  ], ],
+-    'Fortran 77'         => [   
+-                                [ 'remove_f77_comments' ,          ], 
+-                                [ 'remove_inline'       , '\!.*$'  ],
+-                            ],
+-    'Fortran 90'         => [   
+-                                [ 'remove_f77_comments' ,          ],
+-                                [ 'remove_f90_comments' ,          ], 
+-                                [ 'remove_inline'       , '\!.*$'  ],
+-                            ],
+-    'Fortran 95'         => [   
+-                                [ 'remove_f77_comments' ,          ],
+-                                [ 'remove_f90_comments' ,          ], 
+-                                [ 'remove_inline'       , '\!.*$'  ],
+-                            ],
+-    'Go'                 => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ],
+-    'Groovy'             => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ],
+-    'HTML'               => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'Haskell'            => [   [ 'remove_haskell_comments', '>filename<' ], ],
+-    'IDL'                => [   [ 'remove_matches'      , '^\s*;'  ], ],
+-    'JSP'                => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ],
+-                                [ 'remove_jsp_comments' ,          ], 
+-                                [ 'remove_matches'      , '^\s*//' ],
+-                                [ 'add_newlines'        ,          ],
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ],
+-    'Java'               => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ],
+-    'Javascript'         => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ],
+-    'JCL'                => [   [ 'remove_jcl_comments' ,          ], ],
+-    'Lisp'               => [   [ 'remove_matches'      , '^\s*;'  ], ],
+-    'LiveLink OScript'   => [   [ 'remove_matches'      , '^\s*//' ], ],
+-#   'Lua'                => [   [ 'call_regexp_common'  , 'lua'    ], ],
+-    'Lua'                => [   [ 'remove_matches'      , '^\s*\-\-' ], ],
+-    'make'               => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'MATLAB'             => [   
+-                                [ 'remove_matches'      , '^\s*%'  ], 
+-                                [ 'remove_inline'       , '%.*$'   ],
+-                            ], 
+-    'Modula3'            => [   [ 'call_regexp_common'  , 'Pascal' ], ],
+-        # Modula 3 comments are (* ... *) so applying the Pascal filter
+-        # which also treats { ... } as a comment is not really correct.
+-    'Objective C'        => [   
+-                                [ 'remove_matches'      , '^\s*//' ],
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ], 
+-    'Objective C++'      => [   
+-                                [ 'remove_matches'      , '^\s*//' ],
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ], 
+-    'Ocaml'              => [   
+-                                [ 'call_regexp_common'  , 'Pascal' ], 
+-                            ],
+-    'PHP/Pascal'               => [ [ 'die' ,          ], ], # never called
+-    'MATLAB/Objective C/MUMPS' => [ [ 'die' ,          ], ], # never called
+-    'MUMPS'              => [   [ 'remove_matches'      , '^\s*;'  ], ], 
+-    'Octave'             => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Oracle Forms'       => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'Oracle Reports'     => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'Pascal'             => [   
+-                                [ 'call_regexp_common'  , 'Pascal' ], 
+-                                [ 'remove_matches'      , '^\s*//' ],
+-                            ],
+-    'Patran Command Language'=> [   
+-                                [ 'remove_matches'      , '^\s*#'   ], 
+-                                [ 'remove_matches'      , '^\s*\$#' ], 
+-                                [ 'call_regexp_common'  , 'C'       ],
+-                            ],
+-    'Perl'               => [   [ 'remove_below'        , '^__(END|DATA)__'],
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_below_above'  , '^=head1', '^=cut'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Python'             => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'docstring_to_C'                 ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'PHP'                => [   
+-                                [ 'remove_matches'      , '^\s*#'  ],
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                                [ 'remove_inline'       , '//.*$'  ],
+-                            ],
+-    'Rexx'               => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'Ruby'               => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Ruby HTML'          => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'Scala'              => [   
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ],
+-    'SKILL'              => [   
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_matches'      , '^\s*;'  ],
+-                            ],
+-    'SKILL++'            => [   
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_matches'      , '^\s*;'  ],
+-                            ],
+-    'SQL'                => [   
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_matches'      , '^\s*--' ],
+-                                [ 'remove_inline'       , '--.*$'  ],
+-                            ],
+-    'SQL Stored Procedure'=> [   
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_matches'      , '^\s*--' ],
+-                                [ 'remove_inline'       , '--.*$'  ],
+-                            ],
+-    'SQL Data'           => [   
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_matches'      , '^\s*--' ],
+-                                [ 'remove_inline'       , '--.*$'  ],
+-                            ],
+-    'sed'                => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Smarty'             => [   
+-                                [ 'smarty_to_C'                    ], 
+-                                [ 'call_regexp_common'  , 'C'      ],
+-                            ], 
+-    'Bourne Again Shell' => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Bourne Shell'       => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'm4'                 => [   [ 'remove_matches'      , '^dnl '  ], ], 
+-    'C Shell'            => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Kermit'             => [  
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_matches'      , '^\s*;'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Korn Shell'         => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Tcl/Tk'             => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ],
+-                            ], 
+-    'Teamcenter def'     => [   [ 'remove_matches'      , '^\s*#'  ], ], 
+-    'Teamcenter met'     => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'Teamcenter mth'     => [   [ 'remove_matches'      , '^\s*#'  ], ], 
+-    'Softbridge Basic'   => [   [ 'remove_above'        , '^\s*Attribute\s+VB_Name\s+=' ],               
+-                                [ 'remove_matches'      , '^\s*Attribute\s+'],
+-                                [ 'remove_matches'      , '^\s*\47'], ],  # \47 = '
+-    # http://www.altium.com/files/learningguides/TR0114%20VHDL%20Language%20Reference.pdf
+-    'VHDL'               => [   
+-                                [ 'remove_matches'      , '^\s*--' ],
+-                                [ 'remove_matches'      , '^\s*//' ], 
+-                                [ 'call_regexp_common'  , 'C'      ], 
+-                                [ 'remove_inline'       , '--.*$'  ],
+-                                [ 'remove_inline'       , '//.*$'  ], 
+-                            ],
+-    'vim script'         => [   
+-                                [ 'remove_matches'      , '^\s*"'  ], 
+-                                [ 'remove_inline'       , '".*$'   ], 
+-                            ],
+-    'Visual Basic'       => [   [ 'remove_above'        , '^\s*Attribute\s+VB_Name\s+=' ],               
+-                                [ 'remove_matches'      , '^\s*Attribute\s+'],
+-                                [ 'remove_matches'      , '^\s*\47'], ],  # \47 = '
+-    'yacc'               => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'YAML'               => [   
+-                                [ 'remove_matches'      , '^\s*#'  ], 
+-                                [ 'remove_inline'       , '#.*$'   ], 
+-                            ],
+-    'lex'                => [   [ 'call_regexp_common'  , 'C'      ], ],
+-    'XAML'               => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'MXML'               => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'XML'                => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'XSD'                => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'XSLT'               => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'NAnt scripts'       => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    'MSBuild scripts'    => [   [ 'remove_html_comments',          ],
+-                                [ 'call_regexp_common'  , 'HTML'   ], ],
+-    );
+-# 1}}}
+-%{$rh_EOL_continuation_re} = (                 # {{{1
+-    'ActionScript'       =>     '\\\\$'         ,
+-    'Assembly'           =>     '\\\\$'         ,
+-    'ASP'                =>     '\\\\$'         ,
+-    'ASP.Net'            =>     '\\\\$'         ,
+-    'Ada'                =>     '\\\\$'         ,
+-    'awk'                =>     '\\\\$'         ,
+-    'bc'                 =>     '\\\\$'         ,
+-    'C'                  =>     '\\\\$'         ,
+-    'C++'                =>     '\\\\$'         ,
+-    'C/C++ Header'       =>     '\\\\$'         ,
+-    'CMake'              =>     '\\\\$'         ,
+-    'Cython'             =>     '\\\\$'         ,
+-    'C#'                 =>     '\\\\$'         ,
+-    'D'                  =>     '\\\\$'         ,
+-    'Dart'               =>     '\\\\$'         ,
+-    'Expect'             =>     '\\\\$'         ,
+-    'Go'                 =>     '\\\\$'         ,
+-    'Java'               =>     '\\\\$'         ,
+-    'Javascript'         =>     '\\\\$'         ,
+-    'Lua'                =>     '\\\\$'         ,
+-    'make'               =>     '\\\\$'         ,
+-    'MATLAB'             =>     '\.\.\.\s*$'    ,
+-    'Objective C'        =>     '\\\\$'         ,
+-    'Objective C++'      =>     '\\\\$'         ,
+-    'Ocaml'              =>     '\\\\$'         ,
+-    'Octave'             =>     '\.\.\.\s*$'    ,
+-    'Patran Command Language'=> '\\\\$'         ,
+-    'Python'             =>     '\\\\$'         ,
+-    'Ruby'               =>     '\\\\$'         ,
+-    'sed'                =>     '\\\\$'         ,
+-    'Bourne Again Shell' =>     '\\\\$'         ,
+-    'Bourne Shell'       =>     '\\\\$'         ,
+-    'C Shell'            =>     '\\\\$'         ,
+-    'Kermit'             =>     '\\\\$'         ,
+-    'Korn Shell'         =>     '\\\\$'         ,
+-    'Tcl/Tk'             =>     '\\\\$'         ,
+-    'lex'                =>     '\\\\$'         ,
+-    );
+-# 1}}}
+-%{$rh_Not_Code_Extension}    = (                 # {{{1
+-   '1'       => 1,  # Man pages (documentation):
+-   '2'       => 1,
+-   '3'       => 1,
+-   '4'       => 1,
+-   '5'       => 1,
+-   '6'       => 1,
+-   '7'       => 1,
+-   '8'       => 1,
+-   '9'       => 1,
+-   'a'       => 1,  # Static object code.
+-   'ad'      => 1,  # X application default resource file.
+-   'afm'     => 1,  # font metrics
+-   'arc'     => 1,  # arc(1) archive
+-   'arj'     => 1,  # arj(1) archive
+-   'au'      => 1,  # Audio sound filearj(1) archive
+-   'bak'     => 1,  # Backup files - we only want to count the "real" files.
+-   'bdf'     => 1,
+-   'bmp'     => 1,
+-   'bz2'     => 1,  # bzip2(1) compressed file
+-   'csv'     => 1,  # comma separated values
+-   'desktop' => 1,
+-   'dic'     => 1,
+-   'doc'     => 1,
+-   'elc'     => 1,
+-   'eps'     => 1,
+-   'fig'     => 1,
+-   'gif'     => 1,
+-   'gz'      => 1,
+-   'hdf'     => 1,  # hierarchical data format
+-   'in'      => 1,  # Debatable.
+-   'jpg'     => 1,
+-   'kdelnk'  => 1,
+-   'man'     => 1,
+-   'mf'      => 1,
+-   'mp3'     => 1,
+-   'n'       => 1,
+-   'o'       => 1,  # Object code is generated from source code.
+-   'pbm'     => 1,
+-   'pdf'     => 1,
+-   'pfb'     => 1,
+-   'png'     => 1,
+-   'po'      => 1,
+-   'ps'      => 1,  # Postscript is _USUALLY_ generated automatically.
+-   'sgm'     => 1,
+-   'sgml'    => 1,
+-   'so'      => 1,  # Dynamically-loaded object code.
+-   'Tag'     => 1,
+-   'tex'     => 1,
+-   'text'    => 1,
+-   'tfm'     => 1,
+-   'tgz'     => 1,  # gzipped tarball
+-   'tiff'    => 1,
+-   'txt'     => 1, 
+-   'vf'      => 1,
+-   'wav'     => 1,
+-   'xbm'     => 1,
+-   'xpm'     => 1,
+-   'Y'       => 1,  # file compressed with "Yabba"
+-   'Z'       => 1,  # file compressed with "compress"
+-   'zip'     => 1,  # zip archive
+-); # 1}}}
+-%{$rh_Not_Code_Filename}     = (                 # {{{1
+-   'AUTHORS'     => 1,
+-   'BUGS'        => 1,
+-   'BUGS'        => 1,
+-   'Changelog'   => 1,
+-   'ChangeLog'   => 1,
+-   'ChangeLog'   => 1,
+-   'Changes'     => 1,
+-   'CHANGES'     => 1,
+-   'COPYING'     => 1,
+-   'COPYING'     => 1,
+-   '.cvsignore'  => 1,
+-   'Entries'     => 1,
+-   'FAQ'         => 1,
+-   'iconfig.h'   => 1, # Skip "iconfig.h" files; they're used in Imakefiles.
+-   'INSTALL'     => 1,
+-   'MAINTAINERS' => 1,
+-   'MD5SUMS'     => 1,
+-   'NEWS'        => 1,
+-   'readme'      => 1,
+-   'Readme'      => 1,
+-   'README'      => 1,
+-   'README.tk'   => 1, # used in kdemultimedia, it's confusing.
+-   'Repository'  => 1,
+-   'Root'        => 1, # CVS
+-   'TODO'        => 1,
+-);
+-# 1}}}
+-%{$rh_Scale_Factor}          = (                 # {{{1
+-    '1032/af'                      =>   5.00,
+-    '1st generation default'       =>   0.25,
+-    '2nd generation default'       =>   0.75,
+-    '3rd generation default'       =>   1.00,
+-    '4th generation default'       =>   4.00,
+-    '5th generation default'       =>  16.00,
+-    'aas macro'                    =>   0.88,
+-    'abap/4'                       =>   5.00,
+-    'ABAP'                         =>   5.00,
+-    'accel'                        =>   4.21,
+-    'access'                       =>   2.11,
+-    'ActionScript'                 =>   1.36,
+-    'actor'                        =>   3.81,
+-    'acumen'                       =>   2.86,
+-    'Ada'                          =>   0.52,
+-    'Ada 83'                       =>   1.13,
+-    'Ada 95'                       =>   1.63,
+-    'adr/dl'                       =>   2.00,
+-    'adr/ideal/pdl'                =>   4.00,
+-    'ads/batch'                    =>   4.00,
+-    'ads/online'                   =>   4.00,
+-    'ADSO/IDSM'                    =>   3.00,
+-    'advantage'                    =>   2.11,
+-    'ai shell default'             =>   1.63,
+-    'ai shells'                    =>   1.63,
+-    'algol 68'                     =>   0.75,
+-    'algol w'                      =>   0.75,
+-    'ambush'                       =>   2.50,
+-    'aml'                          =>   1.63,
+-    'AMPLE'                        =>   2.00,
+-    'amppl ii'                     =>   1.25,
+-    'ansi basic'                   =>   1.25,
+-    'ansi cobol 74'                =>   0.75,
+-    'ansi cobol 85'                =>   0.88,
+-    'SQL'                          =>   6.15,
+-    'SQL Stored Procedure'         =>   6.15,
+-    'SQL Data'                     =>   1.00,
+-    'answer/db'                    =>   6.15,
+-    'apl 360/370'                  =>   2.50,
+-    'apl default'                  =>   2.50,
+-    'apl*plus'                     =>   2.50,
+-    'applesoft basic'              =>   0.63,
+-    'application builder'          =>   4.00,
+-    'application manager'          =>   2.22,
+-    'aps'                          =>   0.96,
+-    'aps'                          =>   4.71,
+-    'apt'                          =>   1.13,
+-    'aptools'                      =>   4.00,
+-    'arc'                          =>   1.63,
+-    'ariel'                        =>   0.75,
+-    'arity'                        =>   1.63,
+-    'arity prolog'                 =>   1.25,
+-    'art'                          =>   1.63,
+-    'art enterprise'               =>   1.74,
+-    'artemis'                      =>   2.00,
+-    'artim'                        =>   1.74,
+-    'as/set'                       =>   4.21,
+-    'asi/inquiry'                  =>   6.15,
+-    'ask windows'                  =>   1.74,
+-'asa'                         =>   1.29,
+-'ASP'                         =>   1.29,
+-'ASP.Net'                     =>   1.29,
+-'aspx'                        =>   1.29,
+-#'resx'                        =>   1.29,
+-'asax'                        =>   1.29,
+-'ascx'                        =>   1.29,
+-'asmx'                        =>   1.29,
+-'config'                      =>   1.29,
+-'webinfo'                     =>   1.29,
+-'CCS'                         =>   5.33,
+-
+-#   'assembler (basic)'            =>   0.25,
+-    'Assembly'                     =>   0.25,
+-
+-    'Assembly (macro)'             =>   0.51,
+-    'associative default'          =>   1.25,
+-    'autocoder'                    =>   0.25,
+-    'awk'                          =>   3.81,
+-    'aztec c'                      =>   0.63,
+-    'balm'                         =>   0.75,
+-    'base sas'                     =>   1.51,
+-    'basic'                        =>   0.75,
+-    'basic a'                      =>   0.63,
+-#   'basic assembly'               =>   0.25,
+-    'bc'                           =>   1.50,
+-    'berkeley pascal'              =>   0.88,
+-    'better basic'                 =>   0.88,
+-    'bliss'                        =>   0.75,
+-    'bmsgen'                       =>   2.22,
+-    'boeingcalc'                   =>  13.33,
+-    'bteq'                         =>   6.15,
+-
+-    'C'                            =>   0.77,
+-
+-    'c set 2'                      =>   0.88,
+-
+-    'C#'                           =>   1.36,
+-
+-    'C++'                          =>   1.51,
+-
+-    'c86plus'                      =>   0.63,
+-    'cadbfast'                     =>   2.00,
+-    'caearl'                       =>   2.86,
+-    'cast'                         =>   1.63,
+-    'cbasic'                       =>   0.88,
+-    'cdadl'                        =>   4.00,
+-    'cellsim'                      =>   1.74,
+-'ColdFusion'               =>   4.00,
+-    'chili'                        =>   0.75,
+-    'chill'                        =>   0.75,
+-    'cics'                         =>   1.74,
+-    'clarion'                      =>   1.38,
+-    'clascal'                      =>   1.00,
+-    'cli'                          =>   2.50,
+-    'clipper'                      =>   2.05,
+-    'clipper db'                   =>   2.00,
+-    'clos'                         =>   3.81,
+-    'clout'                        =>   2.00,
+-    'CMake'                        =>   1.00,
+-    'cms2'                         =>   0.75,
+-    'cmsgen'                       =>   4.21,
+-    'COBOL'                        =>   1.04,
+-    'COBOL ii'                     =>   0.75,
+-    'COBOL/400'                    =>   0.88,
+-    'cobra'                        =>   4.00,
+-    'codecenter'                   =>   2.22,
+-    'cofac'                        =>   2.22,
+-    'cogen'                        =>   2.22,
+-    'cognos'                       =>   2.22,
+-    'cogo'                         =>   1.13,
+-    'comal'                        =>   1.00,
+-    'comit ii'                     =>   1.25,
+-    'common lisp'                  =>   1.25,
+-    'concurrent pascal'            =>   1.00,
+-    'conniver'                     =>   1.25,
+-    'cool:gen/ief'                 =>   2.58,
+-    'coral 66'                     =>   0.75,
+-    'corvet'                       =>   4.21,
+-    'corvision'                    =>   5.33,
+-    'cpl'                          =>   0.50,
+-    'Crystal Reports'              =>   4.00,
+-    'csl'                          =>   1.63,
+-    'csp'                          =>   1.51,
+-    'cssl'                         =>   1.74,
+-    
+-'CSS' => 1.0,
+-    
+-    'culprit'                      =>   1.57,
+-    'cxpert'                       =>   1.63,
+-    'cygnet'                       =>   4.21,
+-    'D'                            =>   1.70,
+-    'DAL'                          =>   1.50,
+-    'Dart'                         =>   2.00,
+-    'data base default'            =>   2.00,
+-    'dataflex'                     =>   2.00,
+-    'datatrieve'                   =>   4.00,
+-    'dbase iii'                    =>   2.00,
+-    'dbase iv'                     =>   1.54,
+-    'dcl'                          =>   0.38,
+-    'decision support default'     =>   2.22,
+-    'decrally'                     =>   2.00,
+-    'delphi'                       =>   2.76,
+-    'dl/1'                         =>   2.00,
+-    'NASTRAN DMAP'                 =>   2.35,
+-    'dna4'                         =>   4.21,
+-    'DOS Batch'                    =>   0.63,
+-    'dsp assembly'                 =>   0.50,
+-    'dtabl'                        =>   1.74,
+-    'dtipt'                        =>   1.74,
+-    'dyana'                        =>   1.13,
+-    'dynamoiii'                    =>   1.74,
+-    'easel'                        =>   2.76,
+-    'easy'                         =>   1.63,
+-    'easytrieve+'                  =>   2.35,
+-    'eclipse'                      =>   1.63,
+-    'eda/sql'                      =>   6.67,
+-    'edscheme 3.4'                 =>   1.51,
+-    'eiffel'                       =>   3.81,
+-    'enform'                       =>   1.74,
+-    'englishbased default'         =>   1.51,
+-    'ensemble'                     =>   2.76,
+-    'epos'                         =>   4.00,
+-    'Erlang'                       =>   2.11,
+-    'esf'                          =>   2.00,
+-    'espadvisor'                   =>   1.63,
+-    'espl/i'                       =>   1.13,
+-    'euclid'                       =>   0.75,
+-    'excel'                        =>   1.74,
+-    'excel 12'                     =>  13.33,
+-    'excel 34'                     =>  13.33,
+-    'excel 5'                      =>  13.33,
+-    'express'                      =>   2.22,
+-    'exsys'                        =>   1.63,
+-    'extended common lisp'         =>   1.43,
+-    'eznomad'                      =>   2.22,
+-    'facets'                       =>   4.00,
+-    'factorylink iv'               =>   2.76,
+-    'fame'                         =>   2.22,
+-    'filemaker pro'                =>   2.22,
+-    'flavors'                      =>   2.76,
+-    'flex'                         =>   1.74,
+-    'flexgen'                      =>   2.76,
+-    'Focus'                        =>   1.90,
+-    'foil'                         =>   1.51,
+-    'forte'                        =>   4.44,
+-    'forth'                        =>   1.25,
+-    'Fortran 66'                   =>   0.63,
+-    'Fortran 77'                   =>   0.75,
+-    'Fortran 90'                   =>   1.00,
+-    'Fortran 95'                   =>   1.13,
+-    'Fortran II'                   =>   0.63,
+-    'foundation'                   =>   2.76,
+-    'foxpro'                       =>   2.29,
+-    'foxpro 1'                     =>   2.00,
+-    'foxpro 2.5'                   =>   2.35,
+-    'framework'                    =>  13.33,
+-    'g2'                           =>   1.63,
+-    'gamma'                        =>   5.00,
+-    'genascript'                   =>   2.96,
+-    'gener/ol'                     =>   6.15,
+-    'genexus'                      =>   5.33,
+-    'genifer'                      =>   4.21,
+-    'geode 2.0'                    =>   5.00,
+-    'gfa basic'                    =>   2.35,
+-    'gml'                          =>   1.74,
+-    'golden common lisp'           =>   1.25,
+-    'gpss'                         =>   1.74,
+-    'guest'                        =>   2.86,
+-    'guru'                         =>   1.63,
+-    'Go'                           =>   2.50,
+-    'Groovy'                       =>   4.10,
+-    'gw basic'                     =>   0.82,
+-    'Haskell'                      =>   2.11,
+-    'high c'                       =>   0.63,
+-    'hlevel'                       =>   1.38,
+-    'hp basic'                     =>   0.63,
+-
+-'HTML'          => 1.90 ,
+-'XML'           => 1.90 ,
+-'MXML'          => 1.90 ,
+-'XSLT'          => 1.90 ,
+-'DTD'           => 1.90 ,
+-'XSD'           => 1.90 ,
+-'NAnt scripts'    => 1.90 ,
+-'MSBuild scripts' => 1.90 , 
+-
+-    'HTML 2'                       =>   5.00,
+-    'HTML 3'                       =>   5.33,
+-    'huron'                        =>   5.00,
+-    'ibm adf i'                    =>   4.00,
+-    'ibm adf ii'                   =>   4.44,
+-    'ibm advanced basic'           =>   0.82,
+-    'ibm cics/vs'                  =>   2.00,
+-    'ibm compiled basic'           =>   0.88,
+-    'ibm vs cobol'                 =>   0.75,
+-    'ibm vs cobol ii'              =>   0.88,
+-    'ices'                         =>   1.13,
+-    'icon'                         =>   1.00,
+-    'ideal'                        =>   1.54,
+-    'idms'                         =>   2.00,
+-    'ief'                          =>   5.71,
+-    'ief/cool:gen'                 =>   2.58,
+-    'iew'                          =>   5.71,
+-    'ifps/plus'                    =>   2.50,
+-    'imprs'                        =>   2.00,
+-    'informix'                     =>   2.58,
+-    'ingres'                       =>   2.00,
+-    'inquire'                      =>   6.15,
+-    'insight2'                     =>   1.63,
+-    'install/1'                    =>   5.00,
+-    'intellect'                    =>   1.51,
+-    'interlisp'                    =>   1.38,
+-    'interpreted basic'            =>   0.75,
+-    'interpreted c'                =>   0.63,
+-    'iqlisp'                       =>   1.38,
+-    'iqrp'                         =>   6.15,
+-    'j2ee'                         =>   1.60,
+-    'janus'                        =>   1.13,
+-    'Java'                         =>   1.36,
+-'Javascript'                   =>   1.48,
+-'JSP'                          =>   1.48,
+-    'JCL'                          =>   1.67,
+-    'joss'                         =>   0.75,
+-    'jovial'                       =>   0.75,
+-    'jsp'                          =>   1.36,
+-    'kappa'                        =>   2.00,
+-    'kbms'                         =>   1.63,
+-    'kcl'                          =>   1.25,
+-    'kee'                          =>   1.63,
+-    'keyplus'                      =>   2.00,
+-    'kl'                           =>   1.25,
+-    'klo'                          =>   1.25,
+-    'knowol'                       =>   1.63,
+-    'krl'                          =>   1.38,
+-    'Kermit'                       =>   2.00,
+-    'Korn Shell'                   =>   3.81,
+-    'ladder logic'                 =>   2.22,
+-    'lambit/l'                     =>   1.25,
+-    'lattice c'                    =>   0.63,
+-    'liana'                        =>   0.63,
+-    'lilith'                       =>   1.13,
+-    'linc ii'                      =>   5.71,
+-    'Lisp'                         =>   1.25,
+-    'LiveLink OScript'             =>   3.5 ,
+-    'loglisp'                      =>   1.38,
+-    'loops'                        =>   3.81,
+-    'lotus 123 dos'                =>  13.33,
+-    'lotus macros'                 =>   0.75,
+-    'lotus notes'                  =>   3.64,
+-    'lucid 3d'                     =>  13.33,
+-    'lyric'                        =>   1.51,
+-    'm4'                           =>   1.00,
+-    'm'                            =>   5.00,
+-    'macforth'                     =>   1.25,
+-    'mach1'                        =>   2.00,
+-    'machine language'             =>   0.13,
+-    'maestro'                      =>   5.00,
+-    'magec'                        =>   5.00,
+-    'magik'                        =>   3.81,
+-    'Lake'                         =>   3.81,
+-    'make'                         =>   2.50,
+-    'mantis'                       =>   2.96,
+-    'mapper'                       =>   0.99,
+-    'mark iv'                      =>   2.00,
+-    'mark v'                       =>   2.22,
+-    'mathcad'                      =>  16.00,
+-    'mdl'                          =>   2.22,
+-    'mentor'                       =>   1.51,
+-    'mesa'                         =>   0.75,
+-    'microfocus cobol'             =>   1.00,
+-    'microforth'                   =>   1.25,
+-    'microsoft c'                  =>   0.63,
+-    'microstep'                    =>   4.00,
+-    'miranda'                      =>   2.00,
+-    'model 204'                    =>   2.11,
+-    'modula 2'                     =>   1.00,
+-    'mosaic'                       =>  13.33,
+-    # 'ms c ++ v. 7'                 =>   1.51,
+-    'ms compiled basic'            =>   0.88,
+-    'msl'                          =>   1.25,
+-    'mulisp'                       =>   1.25,
+-    'MUMPS'                        =>   4.21,
+-    'Nastran'                      =>   1.13,
+-    'natural'                      =>   1.54,
+-    'natural 1'                    =>   1.51,
+-    'natural 2'                    =>   1.74,
+-    'natural construct'            =>   3.20,
+-    'natural language'             =>   0.03,
+-    'netron/cap'                   =>   4.21,
+-    'nexpert'                      =>   1.63,
+-    'nial'                         =>   1.63,
+-    'nomad2'                       =>   2.00,
+-    'nonprocedural default'        =>   2.22,
+-    'notes vip'                    =>   2.22,
+-    'nroff'                        =>   1.51,
+-    'object assembler'             =>   1.25,
+-    'object lisp'                  =>   2.76,
+-    'object logo'                  =>   2.76,
+-    'object pascal'                =>   2.76,
+-    'object star'                  =>   5.00,
+-    'Objective C'                  =>   2.96,
+-    'Objective C++'                =>   2.96,
+-    'objectoriented default'       =>   2.76,
+-    'objectview'                   =>   3.20,
+-    'Ocaml'                        =>   3.00,
+-    'ogl'                          =>   1.00,
+-    'omnis 7'                      =>   2.00,
+-    'oodl'                         =>   2.76,
+-    'ops'                          =>   1.74,
+-    'ops5'                         =>   1.38,
+-    'oracle'                       =>   2.76,
+-    'Oracle Reports'               =>   2.76,
+-    'Oracle Forms'                 =>   2.67,
+-    'Oracle Developer/2000'        =>   3.48,
+-    'oscar'                        =>   0.75,
+-    'pacbase'                      =>   1.67,
+-    'pace'                         =>   2.00,
+-    'paradox/pal'                  =>   2.22,
+-    'Pascal'                       =>   0.88,
+-    'Patran Command Language'      =>   2.50,
+-    'pc focus'                     =>   2.22,
+-    'pdl millenium'                =>   3.81,
+-    'pdp11 ade'                    =>   1.51,
+-    'peoplesoft'                   =>   2.50,
+-    'Perl'                         =>   4.00,
+-    'persistance object builder'   =>   3.81,
+-    'pilot'                        =>   1.51,
+-    'pl/1'                         =>   1.38,
+-    'pl/m'                         =>   1.13,
+-    'pl/s'                         =>   0.88,
+-    'pl/sql'                       =>   2.58,
+-    'planit'                       =>   1.51,
+-    'planner'                      =>   1.25,
+-    'planperfect 1'                =>  11.43,
+-    'plato'                        =>   1.51,
+-    'polyforth'                    =>   1.25,
+-    'pop'                          =>   1.38,
+-    'poplog'                       =>   1.38,
+-    'power basic'                  =>   1.63,
+-    'powerbuilder'                 =>   3.33,
+-    'powerhouse'                   =>   5.71,
+-    'ppl (plus)'                   =>   2.00,
+-    'problemoriented default'      =>   1.13,
+-    'proc'                         =>   2.96,
+-    'procedural default'           =>   0.75,
+-    'professional pascal'          =>   0.88,
+-    'program generator default'    =>   5.00,
+-    'progress v4'                  =>   2.22,
+-    'proiv'                        =>   1.38,
+-    'prolog'                       =>   1.25,
+-    'prose'                        =>   0.75,
+-    'proteus'                      =>   0.75,
+-    'qbasic'                       =>   1.38,
+-    'qbe'                          =>   6.15,
+-    'qmf'                          =>   5.33,
+-    'qnial'                        =>   1.63,
+-    'quattro'                      =>  13.33,
+-    'quattro pro'                  =>  13.33,
+-    'query default'                =>   6.15,
+-    'quick basic 1'                =>   1.25,
+-    'quick basic 2'                =>   1.31,
+-    'quick basic 3'                =>   1.38,
+-    'quick c'                      =>   0.63,
+-    'quickbuild'                   =>   2.86,
+-    'quiz'                         =>   5.33,
+-    'rally'                        =>   2.00,
+-    'ramis ii'                     =>   2.00,
+-    'rapidgen'                     =>   2.86,
+-    'ratfor'                       =>   0.88,
+-    'rdb'                          =>   2.00,
+-    'realia'                       =>   1.74,
+-    'realizer 1.0'                 =>   2.00,
+-    'realizer 2.0'                 =>   2.22,
+-    'relate/3000'                  =>   2.00,
+-    'reuse default'                =>  16.00,
+-    'Rexx'                         =>   1.19,
+-    'Rexx (mvs)'                   =>   1.00,
+-    'Rexx (os/2)'                  =>   1.74,
+-    'rm basic'                     =>   0.88,
+-    'rm cobol'                     =>   0.75,
+-    'rm fortran'                   =>   0.75,
+-    'rpg i'                        =>   1.00,
+-    'rpg ii'                       =>   1.63,
+-    'rpg iii'                      =>   1.63,
+-    'rtexpert 1.4'                 =>   1.38,
+-    'sabretalk'                    =>   0.90,
+-    'sail'                         =>   0.75,
+-    'sapiens'                      =>   5.00,
+-    'sas'                          =>   1.95,
+-    'savvy'                        =>   6.15,
+-    'sbasic'                       =>   0.88,
+-    'Scala'                        =>   4.10,
+-    'sceptre'                      =>   1.13,
+-    'scheme'                       =>   1.51,
+-    'screen painter default'       =>  13.33,
+-    'sequal'                       =>   6.67,
+-    'Bourne Shell'                 =>   3.81,
+-    'Bourne Again Shell'           =>   3.81,
+-    'ksh'                          =>   3.81,
+-    'C Shell'                      =>   3.81,
+-    'siebel tools '                =>   6.15,
+-    'simplan'                      =>   2.22,
+-    'simscript'                    =>   1.74,
+-    'simula'                       =>   1.74,
+-    'simula 67'                    =>   1.74,
+-    'simulation default'           =>   1.74,
+-    'SKILL'                        =>   2.00,
+-    'SKILL++'                      =>   2.00,
+-    'slogan'                       =>   0.98,
+-    'smalltalk'                    =>   2.50,
+-    'smalltalk 286'                =>   3.81,
+-    'smalltalk 80'                 =>   3.81,
+-    'smalltalk/v'                  =>   3.81,
+-    'Smarty'                       =>   3.50,
+-    'snap'                         =>   1.00,
+-    'snobol24'                     =>   0.63,
+-    'softscreen'                   =>   5.71,
+-    'Softbridge Basic'             =>   2.76,
+-    'solo'                         =>   1.38,
+-    'speakeasy'                    =>   2.22,
+-    'spinnaker ppl'                =>   2.22,
+-    'splus'                        =>   2.50,
+-    'spreadsheet default'          =>  13.33,
+-    'sps'                          =>   0.25,
+-    'spss'                         =>   2.50,
+-    'SQL'                          =>   2.29,
+-    'sqlwindows'                   =>   6.67,
+-    'statistical default'          =>   2.50,
+-    'strategem'                    =>   2.22,
+-    'stress'                       =>   1.13,
+-    'strongly typed default'       =>   0.88,
+-    'style'                        =>   1.74,
+-    'superbase 1.3'                =>   2.22,
+-    'surpass'                      =>  13.33,
+-    'sybase'                       =>   2.00,
+-    'symantec c++'                 =>   2.76,
+-    'symbolang'                    =>   1.25,
+-    'synchroworks'                 =>   4.44,
+-    'synon/2e'                     =>   4.21,
+-    'systemw'                      =>   2.22,
+-    'tandem access language'       =>   0.88,
+-    'Tcl/Tk'                       =>   4.00,
+-    'Teamcenter def'               =>   1.00,
+-    'Teamcenter met'               =>   1.00,
+-    'Teamcenter mth'               =>   1.00,
+-    'telon'                        =>   5.00,
+-    'tessaract'                    =>   2.00,
+-    'the twin'                     =>  13.33,
+-    'themis'                       =>   6.15,
+-    'tiief'                        =>   5.71,
+-    'topspeed c++'                 =>   2.76,
+-    'transform'                    =>   5.33,
+-    'translisp plus'               =>   1.43,
+-    'treet'                        =>   1.25,
+-    'treetran'                     =>   1.25,
+-    'trs80 basic'                  =>   0.63,
+-    'true basic'                   =>   1.25,
+-    'turbo c'                      =>   0.63,
+-    # 'turbo c++'                    =>   1.51,
+-    'turbo expert'                 =>   1.63,
+-    'turbo pascal >5'              =>   1.63,
+-    'turbo pascal 14'              =>   1.00,
+-    'turbo pascal 45'              =>   1.13,
+-    'turbo prolog'                 =>   1.00,
+-    'turing'                       =>   1.00,
+-    'tutor'                        =>   1.51,
+-    'twaice'                       =>   1.63,
+-    'ucsd pascal'                  =>   0.88,
+-    'ufo/ims'                      =>   2.22,
+-    'uhelp'                        =>   2.50,
+-    'uniface'                      =>   5.00,
+-    # 'unix shell scripts'           =>   3.81,
+-    'vax acms'                     =>   1.38,
+-    'vax ade'                      =>   2.00,
+-    'vbscript'                     =>   2.35,
+-    'vectran'                      =>   0.75,
+-    'VHDL'                         =>   4.21,
+-    'vim script'                   =>   3.00,
+-    'visible c'                    =>   1.63,
+-    'visible cobol'                =>   2.00,
+-    'visicalc 1'                   =>   8.89,
+-    'visual 4.0'                   =>   2.76,
+-    'visual basic'                 =>   1.90,
+-    'visual basic 1'               =>   1.74,
+-    'visual basic 2'               =>   1.86,
+-    'visual basic 3'               =>   2.00,
+-    'visual basic 4'               =>   2.22,
+-    'visual basic 5'               =>   2.76,
+-    'Visual Basic'                 =>   2.76,
+-    'visual basic dos'             =>   2.00,
+-    'visual c++'                   =>   2.35,
+-    'visual cobol'                 =>   4.00,
+-    'visual objects'               =>   5.00,
+-    'visualage'                    =>   3.81,
+-    'visualgen'                    =>   4.44,
+-    'vpf'                          =>   0.84,
+-    'vsrexx'                       =>   2.50,
+-    'vulcan'                       =>   1.25,
+-    'vz programmer'                =>   2.22,
+-    'warp x'                       =>   2.00,
+-    'watcom c'                     =>   0.63,
+-    'watcom c/386'                 =>   0.63,
+-    'waterloo c'                   =>   0.63,
+-    'waterloo pascal'              =>   0.88,
+-    'watfiv'                       =>   0.94,
+-    'watfor'                       =>   0.88,
+-    'web scripts'                  =>   5.33,
+-    'whip'                         =>   0.88,
+-    'wizard'                       =>   2.86,
+-    'xlisp'                        =>   1.25,
+-    'XAML'                         =>   1.90,
+-    'yacc'                         =>   1.51,
+-    'yacc++'                       =>   1.51,
+-    'YAML'                         =>   0.90,
+-    'zbasic'                       =>   0.88,
+-    'zim'                          =>   4.21,
+-    'zlisp'                        =>   1.25,
+-
+-'Expect'  => 2.00,
+-'C/C++ Header'  => 1.00, 
+-'inc'     => 1.00,
+-'lex'     => 1.00,
+-'MATLAB'  => 4.00,
+-'IDL'     => 3.80,
+-'Octave'  => 4.00,
+-'ML'      => 3.00,
+-'Modula3' => 2.00,
+-'PHP'     => 3.50,
+-'Python'  => 4.20,
+-'Cython'  => 3.80,
+-'Ruby'    => 4.20,
+-'Ruby HTML' => 4.00,
+-'sed'     => 4.00,
+-'Lua'     => 4.00,
+-);
+-# 1}}}
+-%{$rh_Known_Binary_Archives} = (                 # {{{1
+-            '.tar'     => 1 ,
+-            '.tar.Z'   => 1 ,
+-            '.tar.gz'  => 1 ,
+-            '.tar.bz2' => 1 ,
+-            '.zip'     => 1 ,
+-            '.Zip'     => 1 ,
+-            '.ZIP'     => 1 ,
+-            '.ear'     => 1 ,  # Java
+-            '.war'     => 1 ,  # contained within .ear
+-            );
+-# 1}}}
+-} # end sub set_constants()
+-sub Install_Regexp_Common {                  # {{{1
+-    # Installs portions of Damian Conway's & Abigail's Regexp::Common
+-    # module, v2.120, into a temporary directory for the duration of
+-    # this run.
+-
+-    my %Regexp_Common_Contents = ();
+-$Regexp_Common_Contents{'Common'} = <<'EOCommon'; # {{{2
+-package Regexp::Common;
+-
+-use 5.00473;
+-use strict;
+-
+-local $^W = 1;
+-
+-use vars qw /$VERSION %RE %sub_interface $AUTOLOAD/;
+-
+-($VERSION) = q $Revision: 2.120 $ =~ /([\d.]+)/;
+-
+-
+-sub _croak {
+-    require Carp;
+-    goto &Carp::croak;
+-}
+-
+-sub _carp {
+-    require Carp;
+-    goto &Carp::carp;
+-}
+-
+-sub new {
+-    my ($class, @data) = @_;
+-    my %self;
+-    tie %self, $class, @data;
+-    return \%self;
+-}
+-
+-sub TIEHASH {
+-    my ($class, @data) = @_;
+-    bless \@data, $class;
+-}
+-
+-sub FETCH {
+-    my ($self, $extra) = @_;
+-    return bless ref($self)->new(@$self, $extra), ref($self);
+-}
+-
+-# Modification for cloc:  only need a few modules from Regexp::Common.
+-my %imports = map {$_ => "Regexp::Common::$_"}
+-              qw /balanced comment delimited /;
+-#my %imports = map {$_ => "Regexp::Common::$_"}
+-#              qw /balanced CC     comment   delimited lingua list
+-#                  net      number profanity SEN       URI    whitespace
+-#                  zip/;
+-
+-sub import {
+-    shift;  # Shift off the class.
+-    tie %RE, __PACKAGE__;
+-    {
+-        no strict 'refs';
+-        *{caller() . "::RE"} = \%RE;
+-    }
+-
+-    my $saw_import;
+-    my $no_defaults;
+-    my %exclude;
+-    foreach my $entry (grep {!/^RE_/} @_) {
+-        if ($entry eq 'pattern') {
+-            no strict 'refs';
+-            *{caller() . "::pattern"} = \&pattern;
+-            next;
+-        }
+-        # This used to prevent $; from being set. We still recognize it,
+-        # but we won't do anything.
+-        if ($entry eq 'clean') {
+-            next;
+-        }
+-        if ($entry eq 'no_defaults') {
+-            $no_defaults ++;
+-            next;
+-        }
+-        if (my $module = $imports {$entry}) {
+-            $saw_import ++;
+-            eval "require $module;";
+-            die $@ if $@;
+-            next;
+-        }
+-        if ($entry =~ /^!(.*)/ && $imports {$1}) {
+-            $exclude {$1} ++;
+-            next;
+-        }
+-        # As a last resort, try to load the argument.
+-        my $module = $entry =~ /^Regexp::Common/
+-                            ? $entry
+-                            : "Regexp::Common::" . $entry;
+-        eval "require $module;";
+-        die $@ if $@;
+-    }
+-
+-    unless ($saw_import || $no_defaults) {
+-        foreach my $module (values %imports) {
+-            next if $exclude {$module};
+-            eval "require $module;";
+-            die $@ if $@;
+-        }
+-    }
+-
+-    my %exported;
+-    foreach my $entry (grep {/^RE_/} @_) {
+-        if ($entry =~ /^RE_(\w+_)?ALL$/) {
+-            my $m  = defined $1 ? $1 : "";
+-            my $re = qr /^RE_${m}.*$/;
+-            while (my ($sub, $interface) = each %sub_interface) {
+-                next if $exported {$sub};
+-                next unless $sub =~ /$re/;
+-                {
+-                    no strict 'refs';
+-                    *{caller() . "::$sub"} = $interface;
+-                }
+-                $exported {$sub} ++;
+-            }
+-        }
+-        else {
+-            next if $exported {$entry};
+-            _croak "Can't export unknown subroutine &$entry"
+-                unless $sub_interface {$entry};
+-            {
+-                no strict 'refs';
+-                *{caller() . "::$entry"} = $sub_interface {$entry};
+-            }
+-            $exported {$entry} ++;
+-        }
+-    }
+-}
+-
+-sub AUTOLOAD { _croak "Can't $AUTOLOAD" }
+-
+-sub DESTROY {}
+-
+-my %cache;
+-
+-my $fpat = qr/^(-\w+)/;
+-
+-sub _decache {
+-        my @args = @{tied %{$_[0]}};
+-        my @nonflags = grep {!/$fpat/} @args;
+-        my $cache = get_cache(@nonflags);
+-        _croak "Can't create unknown regex: \$RE{"
+-            . join("}{",@args) . "}"
+-                unless exists $cache->{__VAL__};
+-        _croak "Perl $] does not support the pattern "
+-            . "\$RE{" . join("}{",@args)
+-            . "}.\nYou need Perl $cache->{__VAL__}{version} or later"
+-                unless ($cache->{__VAL__}{version}||0) <= $];
+-        my %flags = ( %{$cache->{__VAL__}{default}},
+-                      map { /$fpat\Q$;\E(.*)/ ? ($1 => $2)
+-                          : /$fpat/           ? ($1 => undef)
+-                          :                     ()
+-                          } @args);
+-        $cache->{__VAL__}->_clone_with(\@args, \%flags);
+-}
+-
+-use overload q{""} => \&_decache;
+-
+-
+-sub get_cache {
+-        my $cache = \%cache;
+-        foreach (@_) {
+-                $cache = $cache->{$_}
+-                      || ($cache->{$_} = {});
+-        }
+-        return $cache;
+-}
+-
+-sub croak_version {
+-        my ($entry, @args) = @_;
+-}
+-
+-sub pattern {
+-        my %spec = @_;
+-        _croak 'pattern() requires argument: name => [ @list ]'
+-                unless $spec{name} && ref $spec{name} eq 'ARRAY';
+-        _croak 'pattern() requires argument: create => $sub_ref_or_string'
+-                unless $spec{create};
+-
+-        if (ref $spec{create} ne "CODE") {
+-                my $fixed_str = "$spec{create}";
+-                $spec{create} = sub { $fixed_str }
+-        }
+-
+-        my @nonflags;
+-        my %default;
+-        foreach ( @{$spec{name}} ) {
+-                if (/$fpat=(.*)/) {
+-                        $default{$1} = $2;
+-                }
+-                elsif (/$fpat\s*$/) {
+-                        $default{$1} = undef;
+-                }
+-                else {
+-                        push @nonflags, $_;
+-                }
+-        }
+-
+-        my $entry = get_cache(@nonflags);
+-
+-        if ($entry->{__VAL__}) {
+-                _carp "Overriding \$RE{"
+-                   . join("}{",@nonflags)
+-                   . "}";
+-        }
+-
+-        $entry->{__VAL__} = bless {
+-                                create  => $spec{create},
+-                                match   => $spec{match} || \&generic_match,
+-                                subs    => $spec{subs}  || \&generic_subs,
+-                                version => $spec{version},
+-                                default => \%default,
+-                            }, 'Regexp::Common::Entry';
+-
+-        foreach (@nonflags) {s/\W/X/g}
+-        my $subname = "RE_" . join ("_", @nonflags);
+-        $sub_interface{$subname} = sub {
+-                push @_ => undef if @_ % 2;
+-                my %flags = @_;
+-                my $pat = $spec{create}->($entry->{__VAL__},
+-                               {%default, %flags}, \@nonflags);
+-                if (exists $flags{-keep}) { $pat =~ s/\Q(?k:/(/g; }
+-                else { $pat =~ s/\Q(?k:/(?:/g; }
+-                return exists $flags {-i} ? qr /(?i:$pat)/ : qr/$pat/;
+-        };
+-
+-        return 1;
+-}
+-
+-sub generic_match {$_ [1] =~  /$_[0]/}
+-sub generic_subs  {$_ [1] =~ s/$_[0]/$_[2]/}
+-
+-sub matches {
+-        my ($self, $str) = @_;
+-        my $entry = $self -> _decache;
+-        $entry -> {match} -> ($entry, $str);
+-}
+-
+-sub subs {
+-        my ($self, $str, $newstr) = @_;
+-        my $entry = $self -> _decache;
+-        $entry -> {subs} -> ($entry, $str, $newstr);
+-        return $str;
+-}
+-
+-
+-package Regexp::Common::Entry;
+-# use Carp;
+-
+-local $^W = 1;
+-
+-use overload
+-    q{""} => sub {
+-        my ($self) = @_;
+-        my $pat = $self->{create}->($self, $self->{flags}, $self->{args});
+-        if (exists $self->{flags}{-keep}) {
+-            $pat =~ s/\Q(?k:/(/g;
+-        }
+-        else {
+-            $pat =~ s/\Q(?k:/(?:/g;
+-        }
+-        if (exists $self->{flags}{-i})   { $pat = "(?i)$pat" }
+-        return $pat;
+-    };
+-
+-sub _clone_with {
+-    my ($self, $args, $flags) = @_;
+-    bless { %$self, args=>$args, flags=>$flags }, ref $self;
+-}
+-# 
+-#    Copyright (c) 2001 - 2005, Damian Conway and Abigail. All Rights
+-#  Reserved. This module is free software. It may be used, redistributed
+-#      and/or modified under the terms of the Perl Artistic License
+-#            (see http://www.perl.com/perl/misc/Artistic.html)
+-EOCommon
+-# 2}}}
+-$Regexp_Common_Contents{'Common/comment'} = <<'EOC';   # {{{2
+-# $Id: comment.pm,v 2.116 2005/03/16 00:00:02 abigail Exp $
+-
+-package Regexp::Common::comment;
+-
+-use strict;
+-local $^W = 1;
+-
+-use Regexp::Common qw /pattern clean no_defaults/;
+-use vars qw /$VERSION/;
+-
+-($VERSION) = q $Revision: 2.116 $ =~ /[\d.]+/g;
+-
+-my @generic = (
+-    {languages => [qw /ABC Forth/],
+-     to_eol    => ['\\\\']},   # This is for just a *single* backslash.
+-
+-    {languages => [qw /Ada Alan Eiffel lua/],
+-     to_eol    => ['--']},
+-
+-    {languages => [qw /Advisor/],
+-     to_eol    => ['#|//']},
+-
+-    {languages => [qw /Advsys CQL Lisp LOGO M MUMPS REBOL Scheme
+-                       SMITH zonefile/],
+-     to_eol    => [';']},
+-
+-    {languages => ['Algol 60'],
+-     from_to   => [[qw /comment ;/]]},
+-
+-    {languages => [qw {ALPACA B C C-- LPC PL/I}],
+-     from_to   => [[qw {/* */}]]},
+-
+-    {languages => [qw /awk fvwm2 Icon mutt Perl Python QML R Ruby shell Tcl/],
+-     to_eol    => ['#']},
+-
+-    {languages => [[BASIC => 'mvEnterprise']],
+-     to_eol    => ['[*!]|REM']},
+-
+-    {languages => [qw /Befunge-98 Funge-98 Shelta/],
+-     id        => [';']},
+-
+-    {languages => ['beta-Juliet', 'Crystal Report', 'Portia'],
+-     to_eol    => ['//']},
+-
+-    {languages => ['BML'],
+-     from_to   => [['<?_c', '_c?>']],
+-    },
+-
+-    {languages => [qw /C++/, 'C#', qw /Cg ECMAScript FPL Java JavaScript/],
+-     to_eol    => ['//'],
+-     from_to   => [[qw {/* */}]]},
+-
+-    {languages => [qw /CLU LaTeX slrn TeX/],
+-     to_eol    => ['%']},
+-
+-    {languages => [qw /False/],
+-     from_to   => [[qw !{ }!]]},
+-
+-    {languages => [qw /Fortran/],
+-     to_eol    => ['!']},
+-
+-    {languages => [qw /Haifu/],
+-     id        => [',']},
+-
+-    {languages => [qw /ILLGOL/],
+-     to_eol    => ['NB']},
+-
+-    {languages => [qw /INTERCAL/],
+-     to_eol    => [q{(?:(?:PLEASE(?:\s+DO)?|DO)\s+)?(?:NOT|N'T)}]},
+-
+-    {languages => [qw /J/],
+-     to_eol    => ['NB[.]']},
+-
+-    {languages => [qw /Nickle/],
+-     to_eol    => ['#'],
+-     from_to   => [[qw {/* */}]]},
+-
+-    {languages => [qw /Oberon/],
+-     from_to   => [[qw /(* *)/]]},
+-     
+-    {languages => [[qw /Pascal Delphi/], [qw /Pascal Free/], [qw /Pascal GPC/]],
+-     to_eol    => ['//'],
+-     from_to   => [[qw !{ }!], [qw !(* *)!]]},
+-
+-    {languages => [[qw /Pascal Workshop/]],
+-     id        => [qw /"/],
+-     from_to   => [[qw !{ }!], [qw !(* *)!], [qw !/* */!]]},
+-
+-    {languages => [qw /PEARL/],
+-     to_eol    => ['!'],
+-     from_to   => [[qw {/* */}]]},
+-
+-    {languages => [qw /PHP/],
+-     to_eol    => ['#', '//'],
+-     from_to   => [[qw {/* */}]]},
+-
+-    {languages => [qw !PL/B!],
+-     to_eol    => ['[.;]']},
+-
+-    {languages => [qw !PL/SQL!],
+-     to_eol    => ['--'],
+-     from_to   => [[qw {/* */}]]},
+-
+-    {languages => [qw /Q-BAL/],
+-     to_eol    => ['`']},
+-
+-    {languages => [qw /Smalltalk/],
+-     id        => ['"']},
+-
+-    {languages => [qw /SQL/],
+-     to_eol    => ['-{2,}']},
+-
+-    {languages => [qw /troff/],
+-     to_eol    => ['\\\"']},
+-
+-    {languages => [qw /vi/],
+-     to_eol    => ['"']},
+-
+-    {languages => [qw /*W/],
+-     from_to   => [[qw {|| !!}]]},
+-);
+-
+-my @plain_or_nested = (
+-   [Caml         =>  undef,       "(*"  => "*)"],
+-   [Dylan        =>  "//",        "/*"  => "*/"],
+-   [Haskell      =>  "-{2,}",     "{-"  => "-}"],
+-   [Hugo         =>  "!(?!\\\\)", "!\\" => "\\!"],
+-   [SLIDE        =>  "#",         "(*"  => "*)"],
+-);
+-
+-#
+-# Helper subs.
+-#
+-
+-sub combine      {
+-    local $_ = join "|", @_;
+-    if (@_ > 1) {
+-        s/\(\?k:/(?:/g;
+-        $_ = "(?k:$_)";
+-    }
+-    $_
+-}
+-
+-sub to_eol  ($)  {"(?k:(?k:$_[0])(?k:[^\\n]*)(?k:\\n))"}
+-sub id      ($)  {"(?k:(?k:$_[0])(?k:[^$_[0]]*)(?k:$_[0]))"}  # One char only!
+-sub from_to      {
+-    local $^W = 1;
+-    my ($begin, $end) = @_;
+-
+-    my $qb  = quotemeta $begin;
+-    my $qe  = quotemeta $end;
+-    my $fe  = quotemeta substr $end   => 0, 1;
+-    my $te  = quotemeta substr $end   => 1;
+-
+-    "(?k:(?k:$qb)(?k:(?:[^$fe]+|$fe(?!$te))*)(?k:$qe))";
+-}
+-
+-
+-my $count = 0;
+-sub nested {
+-    local $^W = 1;
+-    my ($begin, $end) = @_;
+-
+-    $count ++;
+-    my $r = '(??{$Regexp::Common::comment ['. $count . ']})';
+-
+-    my $qb  = quotemeta $begin;
+-    my $qe  = quotemeta $end;
+-    my $fb  = quotemeta substr $begin => 0, 1;
+-    my $fe  = quotemeta substr $end   => 0, 1;
+-
+-    my $tb  = quotemeta substr $begin => 1;
+-    my $te  = quotemeta substr $end   => 1;
+-
+-    use re 'eval';
+-
+-    my $re;
+-    if ($fb eq $fe) {
+-        $re = qr /(?:$qb(?:(?>[^$fb]+)|$fb(?!$tb)(?!$te)|$r)*$qe)/;
+-    }
+-    else {
+-        local $"      =  "|";
+-        my   @clauses =  "(?>[^$fb$fe]+)";
+-        push @clauses => "$fb(?!$tb)" if length $tb;
+-        push @clauses => "$fe(?!$te)" if length $te;
+-        push @clauses =>  $r;
+-        $re           =   qr /(?:$qb(?:@clauses)*$qe)/;
+-    }
+-
+-    $Regexp::Common::comment [$count] = qr/$re/;
+-}
+-
+-#
+-# Process data.
+-#
+-
+-foreach my $info (@plain_or_nested) {
+-    my ($language, $mark, $begin, $end) = @$info;
+-    pattern name    => [comment => $language],
+-            create  =>
+-                sub {my $re     = nested $begin => $end;
+-                     my $prefix = defined $mark ? $mark . "[^\n]*\n|" : "";
+-                     exists $_ [1] -> {-keep} ? qr /($prefix$re)/
+-                                              : qr  /$prefix$re/
+-                },
+-            version => 5.006,
+-            ;
+-}
+-
+-
+-foreach my $group (@generic) {
+-    my $pattern = combine +(map {to_eol   $_} @{$group -> {to_eol}}),
+-                           (map {from_to @$_} @{$group -> {from_to}}),
+-                           (map {id       $_} @{$group -> {id}}),
+-                  ;
+-    foreach my $language  (@{$group -> {languages}}) {
+-        pattern name    => [comment => ref $language ? @$language : $language],
+-                create  => $pattern,
+-                ;
+-    }
+-}
+-                
+-
+-    
+-#
+-# Other languages.
+-#
+-
+-# http://www.pascal-central.com/docs/iso10206.txt
+-pattern name    => [qw /comment Pascal/],
+-        create  => '(?k:' . '(?k:[{]|[(][*])'
+-                          . '(?k:[^}*]*(?:[*][^)][^}*]*)*)'
+-                          . '(?k:[}]|[*][)])'
+-                          . ')'
+-        ;
+-
+-# http://www.templetons.com/brad/alice/language/
+-pattern name    =>  [qw /comment Pascal Alice/],
+-        create  =>  '(?k:(?k:[{])(?k:[^}\n]*)(?k:[}]))'
+-        ;
+-
+-
+-# http://westein.arb-phys.uni-dortmund.de/~wb/a68s.txt
+-pattern name    => [qw (comment), 'Algol 68'],
+-        create  => q {(?k:(?:#[^#]*#)|}                           .
+-                   q {(?:\bco\b(?:[^c]+|\Bc|\bc(?!o\b))*\bco\b)|} .
+-                   q {(?:\bcomment\b(?:[^c]+|\Bc|\bc(?!omment\b))*\bcomment\b))}
+-        ;
+-
+-
+-# See rules 91 and 92 of ISO 8879 (SGML).
+-# Charles F. Goldfarb: "The SGML Handbook".
+-# Oxford: Oxford University Press. 1990. ISBN 0-19-853737-9.
+-# Ch. 10.3, pp 390.
+-pattern name    => [qw (comment HTML)],
+-        create  => q {(?k:(?k:<!)(?k:(?:--(?k:[^-]*(?:-[^-]+)*)--\s*)*)(?k:>))},
+-        ;
+-
+-
+-pattern name    => [qw /comment SQL MySQL/],
+-        create  => q {(?k:(?:#|-- )[^\n]*\n|} .
+-                   q {/\*(?:(?>[^*;"']+)|"[^"]*"|'[^']*'|\*(?!/))*(?:;|\*/))},
+-        ;
+-
+-# Anything that isn't <>[]+-.,
+-# http://home.wxs.nl/~faase009/Ha_BF.html
+-pattern name    => [qw /comment Brainfuck/],
+-        create  => '(?k:[^<>\[\]+\-.,]+)'
+-        ;
+-
+-# Squeak is a variant of Smalltalk-80.
+-# http://www.squeak.
+-# http://mucow.com/squeak-qref.html
+-pattern name    => [qw /comment Squeak/],
+-        create  => '(?k:(?k:")(?k:[^"]*(?:""[^"]*)*)(?k:"))'
+-        ;
+-
+-#
+-# Scores of less than 5 or above 17....
+-# http://www.cliff.biffle.org/esoterica/beatnik.html
+-@Regexp::Common::comment::scores = (1,  3,  3,  2,  1,  4,  2,  4,  1,  8,
+-                                    5,  1,  3,  1,  1,  3, 10,  1,  1,  1,
+-                                    1,  4,  4,  8,  4, 10);
+-pattern name    =>  [qw /comment Beatnik/],
+-        create  =>  sub {
+-            use re 'eval';
+-            my ($s, $x);
+-            my $re = qr {\b([A-Za-z]+)\b
+-                         (?(?{($s, $x) = (0, lc $^N);
+-                              $s += $Regexp::Common::comment::scores
+-                                    [ord (chop $x) - ord ('a')] while length $x;
+-                              $s  >= 5 && $s < 18})XXX|)}x;
+-            $re;
+-        },
+-        version  => 5.008,
+-        ;
+-
+-
+-# http://www.cray.com/craydoc/manuals/007-3692-005/html-007-3692-005/
+-#  (Goto table of contents/3.3 Source Form)
+-# Fortran, in fixed format. Comments start with a C, c or * in the first
+-# column, or a ! anywhere, but the sixth column. Then end with a newline.
+-pattern name    =>  [qw /comment Fortran fixed/],
+-        create  =>  '(?k:(?k:(?:^[Cc*]|(?<!^.....)!))(?k:[^\n]*)(?k:\n))'
+-        ;
+-
+-
+-# http://www.csis.ul.ie/cobol/Course/COBOLIntro.htm
+-# Traditionally, comments in COBOL were indicated with an asteriks in
+-# the seventh column. Modern compilers may be more lenient.
+-pattern name    =>  [qw /comment COBOL/],
+-        create  =>  '(?<=^......)(?k:(?k:[*])(?k:[^\n]*)(?k:\n))',
+-        version =>  '5.008',
+-        ;
+-
+-1;
+-#
+-#    Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved.
+-#      This module is free software. It may be used, redistributed
+-#     and/or modified under the terms of the Perl Artistic License
+-#           (see http://www.perl.com/perl/misc/Artistic.html)
+-EOC
+-# 2}}}
+-$Regexp_Common_Contents{'Common/balanced'} = <<'EOB';   # {{{2
+-package Regexp::Common::balanced; {
+-
+-use strict;
+-local $^W = 1;
+-
+-use vars qw /$VERSION/;
+-($VERSION) = q $Revision: 2.101 $ =~ /[\d.]+/g;
+-
+-use Regexp::Common qw /pattern clean no_defaults/;
+-
+-my %closer = ( '{'=>'}', '('=>')', '['=>']', '<'=>'>' );
+-my $count = -1;
+-my %cache;
+-
+-sub nested {
+-    local $^W = 1;
+-    my ($start, $finish) = @_;
+-
+-    return $Regexp::Common::balanced [$cache {$start} {$finish}]
+-            if exists $cache {$start} {$finish};
+-
+-    $count ++;
+-    my $r = '(??{$Regexp::Common::balanced ['. $count . ']})';
+-
+-    my @starts   = map {s/\\(.)/$1/g; $_} grep {length}
+-                        $start  =~ /([^|\\]+|\\.)+/gs;
+-    my @finishes = map {s/\\(.)/$1/g; $_} grep {length}
+-                        $finish =~ /([^|\\]+|\\.)+/gs;
+-
+-    push @finishes => ($finishes [-1]) x (@starts - @finishes);
+-
+-    my @re;
+-    local $" = "|";
+-    foreach my $begin (@starts) {
+-        my $end = shift @finishes;
+-
+-        my $qb  = quotemeta $begin;
+-        my $qe  = quotemeta $end;
+-        my $fb  = quotemeta substr $begin => 0, 1;
+-        my $fe  = quotemeta substr $end   => 0, 1;
+-
+-        my $tb  = quotemeta substr $begin => 1;
+-        my $te  = quotemeta substr $end   => 1;
+-
+-        use re 'eval';
+-
+-        my $add;
+-        if ($fb eq $fe) {
+-            push @re =>
+-                   qr /(?:$qb(?:(?>[^$fb]+)|$fb(?!$tb)(?!$te)|$r)*$qe)/;
+-        }
+-        else {
+-            my   @clauses =  "(?>[^$fb$fe]+)";
+-            push @clauses => "$fb(?!$tb)" if length $tb;
+-            push @clauses => "$fe(?!$te)" if length $te;
+-            push @clauses =>  $r;
+-            push @re      =>  qr /(?:$qb(?:@clauses)*$qe)/;
+-        }
+-    }
+-
+-    $cache {$start} {$finish} = $count;
+-    $Regexp::Common::balanced [$count] = qr/@re/;
+-}
+-
+-
+-pattern name    => [qw /balanced -parens=() -begin= -end=/],
+-        create  => sub {
+-            my $flag = $_[1];
+-            unless (defined $flag -> {-begin} && length $flag -> {-begin} &&
+-                    defined $flag -> {-end}   && length $flag -> {-end}) {
+-                my @open  = grep {index ($flag->{-parens}, $_) >= 0}
+-                             ('[','(','{','<');
+-                my @close = map {$closer {$_}} @open;
+-                $flag -> {-begin} = join "|" => @open;
+-                $flag -> {-end}   = join "|" => @close;
+-            }
+-            my $pat = nested @$flag {qw /-begin -end/};
+-            return exists $flag -> {-keep} ? qr /($pat)/ : $pat;
+-        },
+-        version => 5.006,
+-        ;
+-
+-}
+-
+-1;
+-#
+-#     Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved.
+-#       This module is free software. It may be used, redistributed
+-#      and/or modified under the terms of the Perl Artistic License
+-#            (see http://www.perl.com/perl/misc/Artistic.html)
+-EOB
+-# 2}}}
+-$Regexp_Common_Contents{'Common/delimited'} = <<'EOD';   # {{{2
+-# $Id: delimited.pm,v 2.104 2005/03/16 00:22:45 abigail Exp $
+-
+-package Regexp::Common::delimited;
+-
+-use strict;
+-local $^W = 1;
+-
+-use Regexp::Common qw /pattern clean no_defaults/;
+-use vars qw /$VERSION/;
+-
+-($VERSION) = q $Revision: 2.104 $ =~ /[\d.]+/g;
+-
+-sub gen_delimited {
+-
+-    my ($dels, $escs) = @_;
+-    # return '(?:\S*)' unless $dels =~ /\S/;
+-    if (length $escs) {
+-        $escs .= substr ($escs, -1) x (length ($dels) - length ($escs));
+-    }
+-    my @pat = ();
+-    my $i;
+-    for ($i=0; $i < length $dels; $i++) {
+-        my $del = quotemeta substr ($dels, $i, 1);
+-        my $esc = length($escs) ? quotemeta substr ($escs, $i, 1) : "";
+-        if ($del eq $esc) {
+-            push @pat,
+-                 "(?k:$del)(?k:[^$del]*(?:(?:$del$del)[^$del]*)*)(?k:$del)";
+-        }
+-        elsif (length $esc) {
+-            push @pat,
+-                 "(?k:$del)(?k:[^$esc$del]*(?:$esc.[^$esc$del]*)*)(?k:$del)";
+-        }
+-        else {
+-            push @pat, "(?k:$del)(?k:[^$del]*)(?k:$del)";
+-        }
+-    }
+-    my $pat = join '|', @pat;
+-    return "(?k:$pat)";
+-}
+-
+-sub _croak {
+-    require Carp;
+-    goto &Carp::croak;
+-}
+-
+-pattern name   => [qw( delimited -delim= -esc=\\ )],
+-        create => sub {my $flags = $_[1];
+-                       _croak 'Must specify delimiter in $RE{delimited}'
+-                             unless length $flags->{-delim};
+-                       return gen_delimited (@{$flags}{-delim, -esc});
+-                  },
+-        ;
+-
+-pattern name   => [qw( quoted -esc=\\ )],
+-        create => sub {my $flags = $_[1];
+-                       return gen_delimited (q{"'`}, $flags -> {-esc});
+-                  },
+-        ;
+-
+-
+-1;
+-#
+-#     Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved.
+-#       This module is free software. It may be used, redistributed
+-#      and/or modified under the terms of the Perl Artistic License
+-#            (see http://www.perl.com/perl/misc/Artistic.html)
+-EOD
+-# 2}}}
+-    my $problems        = 0;
+-    $HAVE_Rexexp_Common = 0;
+-    my $dir             = "";
+-    if ($opt_sdir) {
+-        # write to the user-defined scratch directory
+-        $dir = $opt_sdir;
+-    } else {
+-        # let File::Temp create a suitable temporary directory
+-        $dir = tempdir( CLEANUP => 1 );  # 1 = delete on exit
+-    }
+-    print "Using temp dir [$dir] to install Regexp::Common\n" if $opt_v;
+-    my $Regexp_dir        = "$dir/Regexp";
+-    my $Regexp_Common_dir = "$dir/Regexp/Common";
+-    mkdir $Regexp_dir       ;
+-    mkdir $Regexp_Common_dir;
+-
+-    foreach my $module_file (keys %Regexp_Common_Contents) {
+-        my $OUT = new IO::File "$dir/Regexp/${module_file}.pm", "w";
+-        if (defined $OUT) {
+-            print $OUT $Regexp_Common_Contents{$module_file};
+-            $OUT->close;
+-        } else {
+-            warn "Failed to install Regexp::${module_file}.pm\n";
+-            $problems = 1;
+-        }
+-    }
+-
+-    push @INC, $dir;
+-    eval "use Regexp::Common qw /comment RE_comment_HTML balanced/";
+-    $HAVE_Rexexp_Common = 1 unless $problems;
+-} # 1}}}
+-sub Install_Algorithm_Diff {                 # {{{1
+-    # Installs Tye McQueen's Algorithm::Diff module, v1.1902, into a 
+-    # temporary directory for the duration of this run.
+-
+-my $Algorithm_Diff_Contents = <<'EOAlgDiff'; # {{{2
+-package Algorithm::Diff;
+-# Skip to first "=head" line for documentation.
+-use strict;
+-
+-use integer;    # see below in _replaceNextLargerWith() for mod to make
+-                # if you don't use this
+-use vars qw( $VERSION @EXPORT_OK );
+-$VERSION = 1.19_02;
+-#          ^ ^^ ^^-- Incremented at will
+-#          | \+----- Incremented for non-trivial changes to features
+-#          \-------- Incremented for fundamental changes
+-require Exporter;
+-*import    = \&Exporter::import;
+-@EXPORT_OK = qw(
+-    prepare LCS LCSidx LCS_length
+-    diff sdiff compact_diff
+-    traverse_sequences traverse_balanced
+-);
+-
+-# McIlroy-Hunt diff algorithm
+-# Adapted from the Smalltalk code of Mario I. Wolczko, <mario@wolczko.com>
+-# by Ned Konz, perl@bike-nomad.com
+-# Updates by Tye McQueen, http://perlmonks.org/?node=tye
+-
+-# Create a hash that maps each element of $aCollection to the set of
+-# positions it occupies in $aCollection, restricted to the elements
+-# within the range of indexes specified by $start and $end.
+-# The fourth parameter is a subroutine reference that will be called to
+-# generate a string to use as a key.
+-# Additional parameters, if any, will be passed to this subroutine.
+-#
+-# my $hashRef = _withPositionsOfInInterval( \@array, $start, $end, $keyGen );
+-
+-sub _withPositionsOfInInterval
+-{
+-    my $aCollection = shift;    # array ref
+-    my $start       = shift;
+-    my $end         = shift;
+-    my $keyGen      = shift;
+-    my %d;
+-    my $index;
+-    for ( $index = $start ; $index <= $end ; $index++ )
+-    {
+-        my $element = $aCollection->[$index];
+-        my $key = &$keyGen( $element, @_ );
+-        if ( exists( $d{$key} ) )
+-        {
+-            unshift ( @{ $d{$key} }, $index );
+-        }
+-        else
+-        {
+-            $d{$key} = [$index];
+-        }
+-    }
+-    return wantarray ? %d : \%d;
+-}
+-
+-# Find the place at which aValue would normally be inserted into the
+-# array. If that place is already occupied by aValue, do nothing, and
+-# return undef. If the place does not exist (i.e., it is off the end of
+-# the array), add it to the end, otherwise replace the element at that
+-# point with aValue.  It is assumed that the array's values are numeric.
+-# This is where the bulk (75%) of the time is spent in this module, so
+-# try to make it fast!
+-
+-sub _replaceNextLargerWith
+-{
+-    my ( $array, $aValue, $high ) = @_;
+-    $high ||= $#$array;
+-
+-    # off the end?
+-    if ( $high == -1 || $aValue > $array->[-1] )
+-    {
+-        push ( @$array, $aValue );
+-        return $high + 1;
+-    }
+-
+-    # binary search for insertion point...
+-    my $low = 0;
+-    my $index;
+-    my $found;
+-    while ( $low <= $high )
+-    {
+-        $index = ( $high + $low ) / 2;
+-
+-        # $index = int(( $high + $low ) / 2);  # without 'use integer'
+-        $found = $array->[$index];
+-
+-        if ( $aValue == $found )
+-        {
+-            return undef;
+-        }
+-        elsif ( $aValue > $found )
+-        {
+-            $low = $index + 1;
+-        }
+-        else
+-        {
+-            $high = $index - 1;
+-        }
+-    }
+-
+-    # now insertion point is in $low.
+-    $array->[$low] = $aValue;    # overwrite next larger
+-    return $low;
+-}
+-
+-# This method computes the longest common subsequence in $a and $b.
+-
+-# Result is array or ref, whose contents is such that
+-#   $a->[ $i ] == $b->[ $result[ $i ] ]
+-# foreach $i in ( 0 .. $#result ) if $result[ $i ] is defined.
+-
+-# An additional argument may be passed; this is a hash or key generating
+-# function that should return a string that uniquely identifies the given
+-# element.  It should be the case that if the key is the same, the elements
+-# will compare the same. If this parameter is undef or missing, the key
+-# will be the element as a string.
+-
+-# By default, comparisons will use "eq" and elements will be turned into keys
+-# using the default stringizing operator '""'.
+-
+-# Additional parameters, if any, will be passed to the key generation
+-# routine.
+-
+-sub _longestCommonSubsequence
+-{
+-    my $a        = shift;    # array ref or hash ref
+-    my $b        = shift;    # array ref or hash ref
+-    my $counting = shift;    # scalar
+-    my $keyGen   = shift;    # code ref
+-    my $compare;             # code ref
+-
+-    if ( ref($a) eq 'HASH' )
+-    {                        # prepared hash must be in $b
+-        my $tmp = $b;
+-        $b = $a;
+-        $a = $tmp;
+-    }
+-
+-    # Check for bogus (non-ref) argument values
+-    if ( !ref($a) || !ref($b) )
+-    {
+-        my @callerInfo = caller(1);
+-        die 'error: must pass array or hash references to ' . $callerInfo[3];
+-    }
+-
+-    # set up code refs
+-    # Note that these are optimized.
+-    if ( !defined($keyGen) )    # optimize for strings
+-    {
+-        $keyGen = sub { $_[0] };
+-        $compare = sub { my ( $a, $b ) = @_; $a eq $b };
+-    }
+-    else
+-    {
+-        $compare = sub {
+-            my $a = shift;
+-            my $b = shift;
+-            &$keyGen( $a, @_ ) eq &$keyGen( $b, @_ );
+-        };
+-    }
+-
+-    my ( $aStart, $aFinish, $matchVector ) = ( 0, $#$a, [] );
+-    my ( $prunedCount, $bMatches ) = ( 0, {} );
+-
+-    if ( ref($b) eq 'HASH' )    # was $bMatches prepared for us?
+-    {
+-        $bMatches = $b;
+-    }
+-    else
+-    {
+-        my ( $bStart, $bFinish ) = ( 0, $#$b );
+-
+-        # First we prune off any common elements at the beginning
+-        while ( $aStart <= $aFinish
+-            and $bStart <= $bFinish
+-            and &$compare( $a->[$aStart], $b->[$bStart], @_ ) )
+-        {
+-            $matchVector->[ $aStart++ ] = $bStart++;
+-            $prunedCount++;
+-        }
+-
+-        # now the end
+-        while ( $aStart <= $aFinish
+-            and $bStart <= $bFinish
+-            and &$compare( $a->[$aFinish], $b->[$bFinish], @_ ) )
+-        {
+-            $matchVector->[ $aFinish-- ] = $bFinish--;
+-            $prunedCount++;
+-        }
+-
+-        # Now compute the equivalence classes of positions of elements
+-        $bMatches =
+-          _withPositionsOfInInterval( $b, $bStart, $bFinish, $keyGen, @_ );
+-    }
+-    my $thresh = [];
+-    my $links  = [];
+-
+-    my ( $i, $ai, $j, $k );
+-    for ( $i = $aStart ; $i <= $aFinish ; $i++ )
+-    {
+-        $ai = &$keyGen( $a->[$i], @_ );
+-        if ( exists( $bMatches->{$ai} ) )
+-        {
+-            $k = 0;
+-            for $j ( @{ $bMatches->{$ai} } )
+-            {
+-
+-                # optimization: most of the time this will be true
+-                if ( $k and $thresh->[$k] > $j and $thresh->[ $k - 1 ] < $j )
+-                {
+-                    $thresh->[$k] = $j;
+-                }
+-                else
+-                {
+-                    $k = _replaceNextLargerWith( $thresh, $j, $k );
+-                }
+-
+-                # oddly, it's faster to always test this (CPU cache?).
+-                if ( defined($k) )
+-                {
+-                    $links->[$k] =
+-                      [ ( $k ? $links->[ $k - 1 ] : undef ), $i, $j ];
+-                }
+-            }
+-        }
+-    }
+-
+-    if (@$thresh)
+-    {
+-        return $prunedCount + @$thresh if $counting;
+-        for ( my $link = $links->[$#$thresh] ; $link ; $link = $link->[0] )
+-        {
+-            $matchVector->[ $link->[1] ] = $link->[2];
+-        }
+-    }
+-    elsif ($counting)
+-    {
+-        return $prunedCount;
+-    }
+-
+-    return wantarray ? @$matchVector : $matchVector;
+-}
+-
+-sub traverse_sequences
+-{
+-    my $a                 = shift;          # array ref
+-    my $b                 = shift;          # array ref
+-    my $callbacks         = shift || {};
+-    my $keyGen            = shift;
+-    my $matchCallback     = $callbacks->{'MATCH'} || sub { };
+-    my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
+-    my $finishedACallback = $callbacks->{'A_FINISHED'};
+-    my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
+-    my $finishedBCallback = $callbacks->{'B_FINISHED'};
+-    my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );
+-
+-    # Process all the lines in @$matchVector
+-    my $lastA = $#$a;
+-    my $lastB = $#$b;
+-    my $bi    = 0;
+-    my $ai;
+-
+-    for ( $ai = 0 ; $ai <= $#$matchVector ; $ai++ )
+-    {
+-        my $bLine = $matchVector->[$ai];
+-        if ( defined($bLine) )    # matched
+-        {
+-            &$discardBCallback( $ai, $bi++, @_ ) while $bi < $bLine;
+-            &$matchCallback( $ai,    $bi++, @_ );
+-        }
+-        else
+-        {
+-            &$discardACallback( $ai, $bi, @_ );
+-        }
+-    }
+-
+-    # The last entry (if any) processed was a match.
+-    # $ai and $bi point just past the last matching lines in their sequences.
+-
+-    while ( $ai <= $lastA or $bi <= $lastB )
+-    {
+-
+-        # last A?
+-        if ( $ai == $lastA + 1 and $bi <= $lastB )
+-        {
+-            if ( defined($finishedACallback) )
+-            {
+-                &$finishedACallback( $lastA, @_ );
+-                $finishedACallback = undef;
+-            }
+-            else
+-            {
+-                &$discardBCallback( $ai, $bi++, @_ ) while $bi <= $lastB;
+-            }
+-        }
+-
+-        # last B?
+-        if ( $bi == $lastB + 1 and $ai <= $lastA )
+-        {
+-            if ( defined($finishedBCallback) )
+-            {
+-                &$finishedBCallback( $lastB, @_ );
+-                $finishedBCallback = undef;
+-            }
+-            else
+-            {
+-                &$discardACallback( $ai++, $bi, @_ ) while $ai <= $lastA;
+-            }
+-        }
+-
+-        &$discardACallback( $ai++, $bi, @_ ) if $ai <= $lastA;
+-        &$discardBCallback( $ai, $bi++, @_ ) if $bi <= $lastB;
+-    }
+-
+-    return 1;
+-}
+-
+-sub traverse_balanced
+-{
+-    my $a                 = shift;              # array ref
+-    my $b                 = shift;              # array ref
+-    my $callbacks         = shift || {};
+-    my $keyGen            = shift;
+-    my $matchCallback     = $callbacks->{'MATCH'} || sub { };
+-    my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
+-    my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
+-    my $changeCallback    = $callbacks->{'CHANGE'};
+-    my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );
+-
+-    # Process all the lines in match vector
+-    my $lastA = $#$a;
+-    my $lastB = $#$b;
+-    my $bi    = 0;
+-    my $ai    = 0;
+-    my $ma    = -1;
+-    my $mb;
+-
+-    while (1)
+-    {
+-
+-        # Find next match indices $ma and $mb
+-        do {
+-            $ma++;
+-        } while(
+-                $ma <= $#$matchVector
+-            &&  !defined $matchVector->[$ma]
+-        );
+-
+-        last if $ma > $#$matchVector;    # end of matchVector?
+-        $mb = $matchVector->[$ma];
+-
+-        # Proceed with discard a/b or change events until
+-        # next match
+-        while ( $ai < $ma || $bi < $mb )
+-        {
+-
+-            if ( $ai < $ma && $bi < $mb )
+-            {
+-
+-                # Change
+-                if ( defined $changeCallback )
+-                {
+-                    &$changeCallback( $ai++, $bi++, @_ );
+-                }
+-                else
+-                {
+-                    &$discardACallback( $ai++, $bi, @_ );
+-                    &$discardBCallback( $ai, $bi++, @_ );
+-                }
+-            }
+-            elsif ( $ai < $ma )
+-            {
+-                &$discardACallback( $ai++, $bi, @_ );
+-            }
+-            else
+-            {
+-
+-                # $bi < $mb
+-                &$discardBCallback( $ai, $bi++, @_ );
+-            }
+-        }
+-
+-        # Match
+-        &$matchCallback( $ai++, $bi++, @_ );
+-    }
+-
+-    while ( $ai <= $lastA || $bi <= $lastB )
+-    {
+-        if ( $ai <= $lastA && $bi <= $lastB )
+-        {
+-
+-            # Change
+-            if ( defined $changeCallback )
+-            {
+-                &$changeCallback( $ai++, $bi++, @_ );
+-            }
+-            else
+-            {
+-                &$discardACallback( $ai++, $bi, @_ );
+-                &$discardBCallback( $ai, $bi++, @_ );
+-            }
+-        }
+-        elsif ( $ai <= $lastA )
+-        {
+-            &$discardACallback( $ai++, $bi, @_ );
+-        }
+-        else
+-        {
+-
+-            # $bi <= $lastB
+-            &$discardBCallback( $ai, $bi++, @_ );
+-        }
+-    }
+-
+-    return 1;
+-}
+-
+-sub prepare
+-{
+-    my $a       = shift;    # array ref
+-    my $keyGen  = shift;    # code ref
+-
+-    # set up code ref
+-    $keyGen = sub { $_[0] } unless defined($keyGen);
+-
+-    return scalar _withPositionsOfInInterval( $a, 0, $#$a, $keyGen, @_ );
+-}
+-
+-sub LCS
+-{
+-    my $a = shift;                  # array ref
+-    my $b = shift;                  # array ref or hash ref
+-    my $matchVector = _longestCommonSubsequence( $a, $b, 0, @_ );
+-    my @retval;
+-    my $i;
+-    for ( $i = 0 ; $i <= $#$matchVector ; $i++ )
+-    {
+-        if ( defined( $matchVector->[$i] ) )
+-        {
+-            push ( @retval, $a->[$i] );
+-        }
+-    }
+-    return wantarray ? @retval : \@retval;
+-}
+-
+-sub LCS_length
+-{
+-    my $a = shift;                          # array ref
+-    my $b = shift;                          # array ref or hash ref
+-    return _longestCommonSubsequence( $a, $b, 1, @_ );
+-}
+-
+-sub LCSidx
+-{
+-    my $a= shift @_;
+-    my $b= shift @_;
+-    my $match= _longestCommonSubsequence( $a, $b, 0, @_ );
+-    my @am= grep defined $match->[$_], 0..$#$match;
+-    my @bm= @{$match}[@am];
+-    return \@am, \@bm;
+-}
+-
+-sub compact_diff
+-{
+-    my $a= shift @_;
+-    my $b= shift @_;
+-    my( $am, $bm )= LCSidx( $a, $b, @_ );
+-    my @cdiff;
+-    my( $ai, $bi )= ( 0, 0 );
+-    push @cdiff, $ai, $bi;
+-    while( 1 ) {
+-        while(  @$am  &&  $ai == $am->[0]  &&  $bi == $bm->[0]  ) {
+-            shift @$am;
+-            shift @$bm;
+-            ++$ai, ++$bi;
+-        }
+-        push @cdiff, $ai, $bi;
+-        last   if  ! @$am;
+-        $ai = $am->[0];
+-        $bi = $bm->[0];
+-        push @cdiff, $ai, $bi;
+-    }
+-    push @cdiff, 0+@$a, 0+@$b
+-        if  $ai < @$a || $bi < @$b;
+-    return wantarray ? @cdiff : \@cdiff;
+-}
+-
+-sub diff
+-{
+-    my $a      = shift;    # array ref
+-    my $b      = shift;    # array ref
+-    my $retval = [];
+-    my $hunk   = [];
+-    my $discard = sub {
+-        push @$hunk, [ '-', $_[0], $a->[ $_[0] ] ];
+-    };
+-    my $add = sub {
+-        push @$hunk, [ '+', $_[1], $b->[ $_[1] ] ];
+-    };
+-    my $match = sub {
+-        push @$retval, $hunk
+-            if 0 < @$hunk;
+-        $hunk = []
+-    };
+-    traverse_sequences( $a, $b,
+-        { MATCH => $match, DISCARD_A => $discard, DISCARD_B => $add }, @_ );
+-    &$match();
+-    return wantarray ? @$retval : $retval;
+-}
+-
+-sub sdiff
+-{
+-    my $a      = shift;    # array ref
+-    my $b      = shift;    # array ref
+-    my $retval = [];
+-    my $discard = sub { push ( @$retval, [ '-', $a->[ $_[0] ], "" ] ) };
+-    my $add = sub { push ( @$retval, [ '+', "", $b->[ $_[1] ] ] ) };
+-    my $change = sub {
+-        push ( @$retval, [ 'c', $a->[ $_[0] ], $b->[ $_[1] ] ] );
+-    };
+-    my $match = sub {
+-        push ( @$retval, [ 'u', $a->[ $_[0] ], $b->[ $_[1] ] ] );
+-    };
+-    traverse_balanced(
+-        $a,
+-        $b,
+-        {
+-            MATCH     => $match,
+-            DISCARD_A => $discard,
+-            DISCARD_B => $add,
+-            CHANGE    => $change,
+-        },
+-        @_
+-    );
+-    return wantarray ? @$retval : $retval;
+-}
+-
+-########################################
+-my $Root= __PACKAGE__;
+-package Algorithm::Diff::_impl;
+-use strict;
+-
+-sub _Idx()  { 0 } # $me->[_Idx]: Ref to array of hunk indices
+-            # 1   # $me->[1]: Ref to first sequence
+-            # 2   # $me->[2]: Ref to second sequence
+-sub _End()  { 3 } # $me->[_End]: Diff between forward and reverse pos
+-sub _Same() { 4 } # $me->[_Same]: 1 if pos 1 contains unchanged items
+-sub _Base() { 5 } # $me->[_Base]: Added to range's min and max
+-sub _Pos()  { 6 } # $me->[_Pos]: Which hunk is currently selected
+-sub _Off()  { 7 } # $me->[_Off]: Offset into _Idx for current position
+-sub _Min() { -2 } # Added to _Off to get min instead of max+1
+-
+-sub Die
+-{
+-    require Carp;
+-    Carp::confess( @_ );
+-}
+-
+-sub _ChkPos
+-{
+-    my( $me )= @_;
+-    return   if  $me->[_Pos];
+-    my $meth= ( caller(1) )[3];
+-    Die( "Called $meth on 'reset' object" );
+-}
+-
+-sub _ChkSeq
+-{
+-    my( $me, $seq )= @_;
+-    return $seq + $me->[_Off]
+-        if  1 == $seq  ||  2 == $seq;
+-    my $meth= ( caller(1) )[3];
+-    Die( "$meth: Invalid sequence number ($seq); must be 1 or 2" );
+-}
+-
+-sub getObjPkg
+-{
+-    my( $us )= @_;
+-    return ref $us   if  ref $us;
+-    return $us . "::_obj";
+-}
+-
+-sub new
+-{
+-    my( $us, $seq1, $seq2, $opts ) = @_;
+-    my @args;
+-    for( $opts->{keyGen} ) {
+-        push @args, $_   if  $_;
+-    }
+-    for( $opts->{keyGenArgs} ) {
+-        push @args, @$_   if  $_;
+-    }
+-    my $cdif= Algorithm::Diff::compact_diff( $seq1, $seq2, @args );
+-    my $same= 1;
+-    if(  0 == $cdif->[2]  &&  0 == $cdif->[3]  ) {
+-        $same= 0;
+-        splice @$cdif, 0, 2;
+-    }
+-    my @obj= ( $cdif, $seq1, $seq2 );
+-    $obj[_End] = (1+@$cdif)/2;
+-    $obj[_Same] = $same;
+-    $obj[_Base] = 0;
+-    my $me = bless \@obj, $us->getObjPkg();
+-    $me->Reset( 0 );
+-    return $me;
+-}
+-
+-sub Reset
+-{
+-    my( $me, $pos )= @_;
+-    $pos= int( $pos || 0 );
+-    $pos += $me->[_End]
+-        if  $pos < 0;
+-    $pos= 0
+-        if  $pos < 0  ||  $me->[_End] <= $pos;
+-    $me->[_Pos]= $pos || !1;
+-    $me->[_Off]= 2*$pos - 1;
+-    return $me;
+-}
+-
+-sub Base
+-{
+-    my( $me, $base )= @_;
+-    my $oldBase= $me->[_Base];
+-    $me->[_Base]= 0+$base   if  defined $base;
+-    return $oldBase;
+-}
+-
+-sub Copy
+-{
+-    my( $me, $pos, $base )= @_;
+-    my @obj= @$me;
+-    my $you= bless \@obj, ref($me);
+-    $you->Reset( $pos )   if  defined $pos;
+-    $you->Base( $base );
+-    return $you;
+-}
+-
+-sub Next {
+-    my( $me, $steps )= @_;
+-    $steps= 1   if  ! defined $steps;
+-    if( $steps ) {
+-        my $pos= $me->[_Pos];
+-        my $new= $pos + $steps;
+-        $new= 0   if  $pos  &&  $new < 0;
+-        $me->Reset( $new )
+-    }
+-    return $me->[_Pos];
+-}
+-
+-sub Prev {
+-    my( $me, $steps )= @_;
+-    $steps= 1   if  ! defined $steps;
+-    my $pos= $me->Next(-$steps);
+-    $pos -= $me->[_End]   if  $pos;
+-    return $pos;
+-}
+-
+-sub Diff {
+-    my( $me )= @_;
+-    $me->_ChkPos();
+-    return 0   if  $me->[_Same] == ( 1 & $me->[_Pos] );
+-    my $ret= 0;
+-    my $off= $me->[_Off];
+-    for my $seq ( 1, 2 ) {
+-        $ret |= $seq
+-            if  $me->[_Idx][ $off + $seq + _Min ]
+-            <   $me->[_Idx][ $off + $seq ];
+-    }
+-    return $ret;
+-}
+-
+-sub Min {
+-    my( $me, $seq, $base )= @_;
+-    $me->_ChkPos();
+-    my $off= $me->_ChkSeq($seq);
+-    $base= $me->[_Base] if !defined $base;
+-    return $base + $me->[_Idx][ $off + _Min ];
+-}
+-
+-sub Max {
+-    my( $me, $seq, $base )= @_;
+-    $me->_ChkPos();
+-    my $off= $me->_ChkSeq($seq);
+-    $base= $me->[_Base] if !defined $base;
+-    return $base + $me->[_Idx][ $off ] -1;
+-}
+-
+-sub Range {
+-    my( $me, $seq, $base )= @_;
+-    $me->_ChkPos();
+-    my $off = $me->_ChkSeq($seq);
+-    if( !wantarray ) {
+-        return  $me->[_Idx][ $off ]
+-            -   $me->[_Idx][ $off + _Min ];
+-    }
+-    $base= $me->[_Base] if !defined $base;
+-    return  ( $base + $me->[_Idx][ $off + _Min ] )
+-        ..  ( $base + $me->[_Idx][ $off ] - 1 );
+-}
+-
+-sub Items {
+-    my( $me, $seq )= @_;
+-    $me->_ChkPos();
+-    my $off = $me->_ChkSeq($seq);
+-    if( !wantarray ) {
+-        return  $me->[_Idx][ $off ]
+-            -   $me->[_Idx][ $off + _Min ];
+-    }
+-    return
+-        @{$me->[$seq]}[
+-                $me->[_Idx][ $off + _Min ]
+-            ..  ( $me->[_Idx][ $off ] - 1 )
+-        ];
+-}
+-
+-sub Same {
+-    my( $me )= @_;
+-    $me->_ChkPos();
+-    return wantarray ? () : 0
+-        if  $me->[_Same] != ( 1 & $me->[_Pos] );
+-    return $me->Items(1);
+-}
+-
+-my %getName;
+-BEGIN {
+-    %getName= (
+-        same => \&Same,
+-        diff => \&Diff,
+-        base => \&Base,
+-        min  => \&Min,
+-        max  => \&Max,
+-        range=> \&Range,
+-        items=> \&Items, # same thing
+-    );
+-}
+-
+-sub Get
+-{
+-    my $me= shift @_;
+-    $me->_ChkPos();
+-    my @value;
+-    for my $arg (  @_  ) {
+-        for my $word (  split ' ', $arg  ) {
+-            my $meth;
+-            if(     $word !~ /^(-?\d+)?([a-zA-Z]+)([12])?$/
+-                ||  not  $meth= $getName{ lc $2 }
+-            ) {
+-                Die( $Root, ", Get: Invalid request ($word)" );
+-            }
+-            my( $base, $name, $seq )= ( $1, $2, $3 );
+-            push @value, scalar(
+-                4 == length($name)
+-                    ? $meth->( $me )
+-                    : $meth->( $me, $seq, $base )
+-            );
+-        }
+-    }
+-    if(  wantarray  ) {
+-        return @value;
+-    } elsif(  1 == @value  ) {
+-        return $value[0];
+-    }
+-    Die( 0+@value, " values requested from ",
+-        $Root, "'s Get in scalar context" );
+-}
+-
+-
+-my $Obj= getObjPkg($Root);
+-no strict 'refs';
+-
+-for my $meth (  qw( new getObjPkg )  ) {
+-    *{$Root."::".$meth} = \&{$meth};
+-    *{$Obj ."::".$meth} = \&{$meth};
+-}
+-for my $meth (  qw(
+-    Next Prev Reset Copy Base Diff
+-    Same Items Range Min Max Get
+-    _ChkPos _ChkSeq
+-)  ) {
+-    *{$Obj."::".$meth} = \&{$meth};
+-}
+-
+-1;
+-# This version released by Tye McQueen (http://perlmonks.org/?node=tye).
+-# 
+-# =head1 LICENSE
+-# 
+-# Parts Copyright (c) 2000-2004 Ned Konz.  All rights reserved.
+-# Parts by Tye McQueen.
+-# 
+-# This program is free software; you can redistribute it and/or modify it
+-# under the same terms as Perl.
+-# 
+-# =head1 MAILING LIST
+-# 
+-# Mark-Jason still maintains a mailing list.  To join a low-volume mailing
+-# list for announcements related to diff and Algorithm::Diff, send an
+-# empty mail message to mjd-perl-diff-request@plover.com.
+-# =head1 CREDITS
+-# 
+-# Versions through 0.59 (and much of this documentation) were written by:
+-# 
+-# Mark-Jason Dominus, mjd-perl-diff@plover.com
+-# 
+-# This version borrows some documentation and routine names from
+-# Mark-Jason's, but Diff.pm's code was completely replaced.
+-# 
+-# This code was adapted from the Smalltalk code of Mario Wolczko
+-# <mario@wolczko.com>, which is available at
+-# ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st
+-# 
+-# C<sdiff> and C<traverse_balanced> were written by Mike Schilli
+-# <m@perlmeister.com>.
+-# 
+-# The algorithm is that described in
+-# I<A Fast Algorithm for Computing Longest Common Subsequences>,
+-# CACM, vol.20, no.5, pp.350-353, May 1977, with a few
+-# minor improvements to improve the speed.
+-# 
+-# Much work was done by Ned Konz (perl@bike-nomad.com).
+-# 
+-# The OO interface and some other changes are by Tye McQueen.
+-# 
+-EOAlgDiff
+-# 2}}}
+-    my $problems        = 0;
+-    $HAVE_Algorith_Diff = 0;
+-    my $dir             = "";
+-    if ($opt_sdir) {
+-        # write to the user-defined scratch directory
+-        $dir = $opt_sdir;
+-    } else {
+-        # let File::Temp create a suitable temporary directory
+-        $dir = tempdir( CLEANUP => 1 );  # 1 = delete on exit
+-    }
+-    print "Using temp dir [$dir] to install Algorithm::Diff\n" if $opt_v;
+-    my $Algorithm_dir      = "$dir/Algorithm";
+-    my $Algorithm_Diff_dir = "$dir/Algorithm/Diff";
+-    mkdir $Algorithm_dir     ;
+-    mkdir $Algorithm_Diff_dir;
+-
+-    my $OUT = new IO::File "$dir/Algorithm/Diff.pm", "w";
+-    if (defined $OUT) {
+-        print $OUT $Algorithm_Diff_Contents;
+-        $OUT->close;
+-    } else {
+-        warn "Failed to install Algorithm/Diff.pm\n";
+-        $problems = 1;
+-    }
+-
+-    push @INC, $dir;  # between this & Regexp::Common only need to do once
+-    eval "use Algorithm::Diff qw / sdiff /";
+-    $HAVE_Algorith_Diff = 1 unless $problems;
+-} # 1}}}
+-sub call_regexp_common {                     # {{{1
+-    my ($ra_lines, $language ) = @_;
+-    print "-> call_regexp_common\n" if $opt_v > 2;
+-
+-    Install_Regexp_Common() unless $HAVE_Rexexp_Common;
+-
+-    my $all_lines = join("", @{$ra_lines});
+-
+-    no strict 'vars';
+-    # otherwise get:
+-    #  Global symbol "%RE" requires explicit package name at cloc line xx.
+-    if ($all_lines =~ $RE{comment}{$language}) {
+-        # Suppress "Use of uninitialized value in regexp compilation" that
+-        # pops up when $1 is undefined--happens if there's a bug in the $RE
+-        # This Pascal comment will trigger it:
+-        #         (* This is { another } test. **)
+-        # Curiously, testing for "defined $1" breaks the substitution.
+-        no warnings; 
+-        # remove   comments
+-        $all_lines =~ s/$1//g;
+-    }
+-    # a bogus use of %RE to avoid:
+-    # Name "main::RE" used only once: possible typo at cloc line xx.
+-    print scalar keys %RE if $opt_v < -20;
+-#?#print "$all_lines\n";
+-    print "<- call_regexp_common\n" if $opt_v > 2;
+-    return split("\n", $all_lines);
+-} # 1}}}
+-sub plural_form {                            # {{{1
+-    # For getting the right plural form on some English nouns.
+-    my $n = shift @_;
+-    if ($n == 1) { return ( 1, "" ); }
+-    else         { return ($n, "s"); }
+-} # 1}}}
+-sub matlab_or_objective_C {                  # {{{1
+-    # Decide if code is MATLAB, Objective C, or MUMPS
+-    my ($file        , # in
+-        $rh_Err      , # in   hash of error codes
+-        $raa_errors  , # out
+-        $rs_language , # out
+-       ) = @_;
+-
+-    print "-> matlab_or_objective_C\n" if $opt_v > 2;
+-    # matlab markers:
+-    #   first line starts with "function"
+-    #   some lines start with "%"
+-    #   high marks for lines that start with [
+-    #
+-    # Objective C markers:
+-    #   must have at least two brace characters, { }
+-    #   has /* ... */ style comments
+-    #   some lines start with @
+-    #   some lines start with #include
+-    #
+-    # MUMPS:
+-    #   has ; comment markers
+-    #   do not match:  \w+\s*=\s*\w
+-    #   lines begin with   \s*\.?\w+\s+\w
+-    #   high marks for lines that start with \s*K\s+ or \s*Kill\s+
+-
+-    ${$rs_language} = "";
+-    my $IN = new IO::File $file, "r";
+-    if (!defined $IN) {
+-        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
+-        return;
+-    }
+-
+-    my $DEBUG              = 0;
+-
+-    my $matlab_points      = 0;
+-    my $objective_C_points = 0;
+-    my $mumps_points       = 0;
+-    my $has_braces         = 0;
+-    while (<$IN>) {
+-        ++$has_braces if m/[{}]/;
+-        ++$mumps_points if $. == 1 and m{^[A-Z]};
+-        if      (m{^\s*/\*}) {           #   /*
+-            ++$objective_C_points;
+-            --$matlab_points;
+-printf ".m:  /*     obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{\w+\s*=\s*\[}) {      # matrix assignment, very matlab
+-            $matlab_points += 5;
+-printf ".m:  \\w=[   obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{^\s*\w+\s*=\s*}) {    # definitely not MUMPS
+-            --$mumps_points;
+-printf ".m:  \\w=    obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{^\s*\.?(\w)\s+(\w)} and $1 !~ /\d/ and $2 !~ /\d/) {
+-            ++$mumps_points;
+-printf ".m:  \\w \\w  obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{^\s*;}) {
+-            ++$mumps_points;
+-printf ".m:  ;      obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{^\s*#(include|import)}) {
+-            # Objective C without a doubt
+-            $objective_C_points = 1;
+-            $matlab_points      = 0;
+-printf ".m: #includ obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-            last;
+-        } elsif (m{^\s*@(interface|implementation|protocol|public|protected|private|end)\s}o) {
+-            # Objective C without a doubt
+-            $objective_C_points = 1;
+-            $matlab_points      = 0;
+-printf ".m: keyword obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-            last;
+-        } elsif (m{^\s*\[}) {             #   line starts with [  -- very matlab
+-            $matlab_points += 5;
+-printf ".m:  [      obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{^\sK(ill)?\s+}) {
+-            $mumps_points  += 5;
+-printf ".m:  Kill   obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{^\s*function}) {
+-            --$objective_C_points;
+-            ++$matlab_points;
+-printf ".m:  funct  obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        } elsif (m{^\s*%}) {              #   %
+-            --$objective_C_points;
+-            ++$matlab_points;
+-            ++$mumps_points;
+-printf ".m:  pcent  obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
+-        }
+-    }
+-    $IN->close;
+-
+-    print "<- matlab_or_objective_C(matlab=$matlab_points, C=$objective_C_points, mumps=$mumps_points)\n"
+-        if $opt_v > 2;
+-    $objective_C_points = -9.9e20 unless $has_braces >= 2;
+-    if      (($matlab_points > $objective_C_points) and
+-             ($matlab_points > $mumps_points)      ) {
+-        ${$rs_language} = "MATLAB";
+-    } elsif (($mumps_points > $objective_C_points) and
+-             ($mumps_points > $matlab_points)      ) {
+-        ${$rs_language} = "MUMPS";
+-    } else {
+-        ${$rs_language} = "Objective C";
+-    }
+-
+-} # 1}}}
+-sub html_colored_text {                      # {{{1
+-    # http://www.pagetutor.com/pagetutor/makapage/pics/net216-2.gif
+-    my ($color, $text) = @_;
+-#?#die "html_colored_text($text)";
+-    if      ($color =~ /^red$/i)   {
+-        $color = "#ff0000";
+-    } elsif ($color =~ /^green$/i) {
+-        $color = "#00ff00";
+-    } elsif ($color =~ /^blue$/i)  {
+-        $color = "#0000ff";
+-    } elsif ($color =~ /^grey$/i)  {
+-        $color = "#cccccc";
+-    }
+-#   return "" unless $text;
+-    return '<font color="' . $color . '">' . html_metachars($text) . "</font>";
+-} # 1}}}
+-sub html_metachars {                         # {{{1
+-    # Replace HTML metacharacters with their printable forms.
+-    # Future:  use HTML-Encoder-0.00_04/lib/HTML/Encoder.pm
+-    # from Fabiano Reese Righetti's HTML::Encoder module if 
+-    # this subroutine proves to be too simplistic.
+-    my ($string, ) = shift @_;
+-
+-    my  @in_chars    = split(//, $string);
+-    my  @out_chars   = ();
+-    foreach my $c (@in_chars) {
+-        if      ($c eq '<') {
+-            push @out_chars, '&lt;'
+-        } elsif ($c eq '>') {
+-            push @out_chars, '&gt;'
+-        } elsif ($c eq '&') {
+-            push @out_chars, '&amp;'
+-        } else {
+-            push @out_chars, $c;
+-        }
+-    }
+-    return join "", @out_chars; 
+-} # 1}}}
+-sub test_alg_diff {                          # {{{1
+-    my ($file_1 ,
+-        $file_2 )
+-       = @_;
+-    my $fh_1 = new IO::File $file_1, "r";
+-    die "Unable to read $file_1:  $!\n" unless defined $fh_1;
+-    chomp(my @lines_1 = <$fh_1>);
+-    $fh_1->close;
+-
+-    my $fh_2 = new IO::File $file_2, "r";
+-    die "Unable to read $file_2:  $!\n" unless defined $fh_2;
+-    chomp(my @lines_2 = <$fh_2>);
+-    $fh_2->close;
+-
+-    my $n_no_change = 0;
+-    my $n_modified  = 0;
+-    my $n_added     = 0;
+-    my $n_deleted   = 0;
+-    my @min_sdiff   = ();
+-my $NN = chr(27) . "[0m";  # normal
+-my $BB = chr(27) . "[1m";  # bold
+-
+-    my @sdiffs = sdiff( \@lines_1, \@lines_2 );
+-    foreach my $entry (@sdiffs) {
+-        my ($out_1, $out_2) = ('', '');
+-        if ($entry->[0] eq 'u') { 
+-            ++$n_no_change; 
+-          # $out_1 = $entry->[1];
+-          # $out_2 = $entry->[2];
+-            next; 
+-        }
+-#       push @min_sdiff, $entry;
+-        if      ($entry->[0] eq 'c') { 
+-            ++$n_modified;
+-            ($out_1, $out_2) = diff_two_strings($entry->[1], $entry->[2]);
+-            $out_1 =~ s/\cA(\w)/${BB}$1${NN}/g;
+-            $out_2 =~ s/\cA(\w)/${BB}$1${NN}/g;
+-          # $out_1 =~ s/\cA//g;
+-          # $out_2 =~ s/\cA//g;
+-        } elsif ($entry->[0] eq '+') { 
+-            ++$n_added;
+-            $out_1 = $entry->[1];
+-            $out_2 = $entry->[2];
+-        } elsif ($entry->[0] eq '-') { 
+-            ++$n_deleted;
+-            $out_1 = $entry->[1];
+-            $out_2 = $entry->[2];
+-        } elsif ($entry->[0] eq 'u') { 
+-        } else { die "unknown entry->[0]=[$entry->[0]]\n"; }
+-        printf "%-80s | %s\n", $out_1, $out_2;
+-    }
+-
+-#   foreach my $entry (@min_sdiff) {
+-#       printf "DIFF:  %s  %s  %s\n", @{$entry};
+-#   }
+-} # 1}}}
+-sub write_comments_to_html {                 # {{{1
+-    my ($filename      , # in
+-        $rah_diff_L    , # in  see routine array_diff() for explanation
+-        $rah_diff_R    , # in  see routine array_diff() for explanation
+-        $rh_blank      , # in  location and counts of blank lines
+-       ) = @_;
+-
+-    print "-> write_comments_to_html($filename)\n" if $opt_v > 2;
+-    my $file = $filename . ".html";
+-#use Data::Dumper;
+-#print Dumper("rah_diff_L", $rah_diff_L, "rah_diff_R", $rah_diff_R);
+-    my $OUT = new IO::File $file, "w";
+-    if (!defined $OUT) {
+-        warn "Unable to write to $file\n";
+-        print "<- write_comments_to_html\n" if $opt_v > 2;
+-        return;
+-    }
+-
+-    my $approx_line_count = scalar @{$rah_diff_L};
+-    my $n_digits = 1 + int(log($approx_line_count)/2.30258509299405); # log_10
+-
+-    my $html_out = html_header($filename);
+-
+-    my $comment_line_number = 0;
+-    for (my $i = 0; $i < scalar @{$rah_diff_R}; $i++) {
+-        if (defined $rh_blank->{$i}) {
+-            foreach (1..$rh_blank->{$i}) {
+-                $html_out .= "<!-- blank -->\n";
+-            }
+-        }
+-        my $line_num = "";
+-        my $pre      = "";
+-        my $post     = '</span> &nbsp;';
+-warn "undef rah_diff_R[$i]{type} " unless defined $rah_diff_R->[$i]{type};
+-        if ($rah_diff_R->[$i]{type} eq 'nonexist') {
+-            ++$comment_line_number;
+-            $line_num = sprintf "\&nbsp; <span class=\"clinenum\"> %0${n_digits}d %s",
+-                            $comment_line_number, $post;
+-            $pre = '<span class="comment">';
+-            $html_out .= $line_num;  
+-            $html_out .= $pre .  
+-                         html_metachars($rah_diff_L->[$i]{char}) . 
+-                         $post . "\n";
+-            next;
+-        }
+-        if      ($rah_diff_R->[$i]{type} eq 'code' and
+-                 $rah_diff_R->[$i]{desc} eq 'same') {
+-            # entire line remains as-is
+-            $line_num = sprintf "\&nbsp; <span class=\"linenum\"> %0${n_digits}d %s",
+-                            $rah_diff_R->[$i]{lnum}, $post;
+-            $pre    = '<span class="normal">';
+-            $html_out .= $line_num;  
+-            $html_out .= $pre . 
+-                         html_metachars($rah_diff_R->[$i]{char}) . $post;
+-#XX     } elsif ($rah_diff_R->[$i]{type} eq 'code') { # code+comments
+-#XX
+-#XX         $line_num = '<span class="linenum">' .
+-#XX                      $rah_diff_R->[$i]{lnum} . $post;
+-#XX         $html_out .= $line_num;  
+-#XX
+-#XX         my @strings = @{$rah_diff_R->[$i]{char}{strings}}; 
+-#XX         my @type    = @{$rah_diff_R->[$i]{char}{type}}; 
+-#XX         for (my $i = 0; $i < scalar @strings; $i++) {
+-#XX             if ($type[$i] eq 'u') {
+-#XX                 $pre = '<span class="normal">';
+-#XX             } else {
+-#XX                 $pre = '<span class="comment">';
+-#XX             }
+-#XX             $html_out .= $pre .  html_metachars($strings[$i]) . $post;
+-#XX         }
+-# print Dumper(@strings, @type); die;
+-
+-        } elsif ($rah_diff_R->[$i]{type} eq 'comment') {
+-            $line_num = '<span class="clinenum">' . $comment_line_number . $post;
+-            # entire line is a comment
+-            $pre    = '<span class="comment">';
+-            $html_out .= $pre .
+-                         html_metachars($rah_diff_R->[$i]{char}) . $post;
+-        }
+-#printf "%-30s %s %-30s\n", $line_1, $separator, $line_2;
+-        $html_out .= "\n";
+-    }
+-
+-    $html_out .= html_end();
+-
+-    my $out_file = "$filename.html";
+-    open  OUT, ">$out_file" or die "Cannot write to $out_file $!\n";
+-    print OUT $html_out;
+-    close OUT;
+-    print "Wrote $out_file\n" unless $opt_quiet;
+-    $OUT->close;
+-
+-    print "<- write_comments_to_html\n" if $opt_v > 2;
+-} # 1}}}
+-sub array_diff {                             # {{{1
+-    my ($file          , # in  only used for error reporting
+-        $ra_lines_L    , # in  array of lines in Left  file (no blank lines)
+-        $ra_lines_R    , # in  array of lines in Right file (no blank lines)
+-        $mode          , # in  "comment" | "revision"
+-        $rah_diff_L    , # out
+-        $rah_diff_R    , # out
+-        $raa_Errors    , # in/out
+-       ) = @_;
+-
+-    # This routine operates in two ways:
+-    # A. Computes diffs of the same file with and without comments.
+-    #    This is used to classify lines as code, comments, or blank.
+-    # B. Computes diffs of two revisions of a file.  This method
+-    #    requires a prior run of method A using the older version
+-    #    of the file because it needs lines to be classified.
+-
+-    # $rah_diff structure:
+-    # An array with n entries where n equals the number of lines in 
+-    # an sdiff of the two files.  Each entry in the array describes
+-    # the contents of the corresponding line in file Left and file Right:
+-    #  diff[]{type} = blank | code | code+comment | comment | nonexist
+-    #        {lnum} = line number within the original file (1-based)
+-    #        {desc} = same | added | removed | modified
+-    #        {char} = the input line unless {desc} = 'modified' in
+-    #                 which case
+-    #        {char}{strings} = [ substrings ]
+-    #        {char}{type}    = [ disposition (added, removed, etc)]
+-    #
+-
+-    print "-> array_diff()\n" if $opt_v > 2;
+-    my $COMMENT_MODE = 0;
+-       $COMMENT_MODE = 1 if $mode eq "comment";
+-
+-#print "array_diff(mode=$mode)\n";
+-#print Dumper("block left:" , $ra_lines_L);
+-#print Dumper("block right:", $ra_lines_R);
+-
+-    my @sdiffs = sdiff($ra_lines_L, $ra_lines_R);
+-#use Data::Dumper::Simple;
+-#print Dumper($ra_lines_L, $ra_lines_R, @sdiffs);
+-#die;
+-
+-    my $n_L        = 0;
+-    my $n_R        = 0;
+-    my $n_sdiff    = 0;  # index to $rah_diff_L, $rah_diff_R
+-    @{$rah_diff_L} = ();
+-    @{$rah_diff_R} = ();
+-    foreach my $triple (@sdiffs) {
+-        my $flag   = $triple->[0];
+-        my $line_L = $triple->[1];
+-        my $line_R = $triple->[2];
+-        $rah_diff_L->[$n_sdiff]{char} = $line_L;
+-        $rah_diff_R->[$n_sdiff]{char} = $line_R;
+-        if      ($flag eq 'u') {  # u = unchanged
+-            ++$n_L;
+-            ++$n_R;
+-            if ($COMMENT_MODE) {
+-                # line exists in both with & without comments, must be code
+-                $rah_diff_L->[$n_sdiff]{type} = "code";
+-                $rah_diff_R->[$n_sdiff]{type} = "code";
+-            }
+-            $rah_diff_L->[$n_sdiff]{desc} = "same";
+-            $rah_diff_R->[$n_sdiff]{desc} = "same";
+-            $rah_diff_L->[$n_sdiff]{lnum} = $n_L;
+-            $rah_diff_R->[$n_sdiff]{lnum} = $n_R;
+-        } elsif ($flag eq 'c') {  # c = changed
+-# warn "per line sdiff() commented out\n"; if (0) {
+-            ++$n_L;
+-            ++$n_R;
+-
+-            if ($COMMENT_MODE) {
+-                # line has text both with & without comments;
+-                # count as code
+-                $rah_diff_L->[$n_sdiff]{type} = "code";
+-                $rah_diff_R->[$n_sdiff]{type} = "code";
+-            }
+-
+-            my @chars_L = split '', $line_L;
+-            my @chars_R = split '', $line_R;
+-
+-#XX         my @inline_sdiffs = sdiff( \@chars_L, \@chars_R );
+-
+-#use Data::Dumper::Simple; 
+-#if ($n_R == 6 or $n_R == 1 or $n_R == 2) {
+-#print "L=[$line_L]\n";
+-#print "R=[$line_R]\n";
+-#print Dumper(@chars_L, @chars_R, @inline_sdiffs);
+-#}
+-#XX         my @index = ();
+-#XX         foreach my $il_triple (@inline_sdiffs) {
+-#XX             # make an array of u|c|+|- corresponding
+-#XX             # to each character
+-#XX             push @index, $il_triple->[0];
+-#XX         }
+-#XX#print Dumper(@index); die;
+-#XX          # expect problems if arrays @index and $inline_sdiffs[1];
+-#XX          # (@{$inline_sdiffs->[1]} are the characters of line_L)
+-#XX          # aren't the same length
+-#XX          my $prev_type = $index[0];
+-#XX          my @strings   = ();  # blocks of consecutive code or comment
+-#XX          my @type      = ();  # u (=code) or c (=comment)
+-#XX          my $j_str     = 0;
+-#XX          $strings[$j_str] .= $chars_L[0];
+-#XX          $type[$j_str] = $prev_type;
+-#XX          for (my $i = 1; $i < scalar @chars_L; $i++) {
+-#XX              if ($index[$i] ne $prev_type) {
+-#XX                  ++$j_str;
+-#XX#print "change at j_str=$j_str type=$index[$i]\n";
+-#XX                  $type[$j_str] = $index[$i];
+-#XX                  $prev_type    = $index[$i];
+-#XX              }
+-#XX              $strings[$j_str] .= $chars_L[$i];
+-#XX          }
+-# print Dumper(@strings, @type); die;
+-#XX         delete $rah_diff_R->[$n_sdiff]{char};
+-#XX         @{$rah_diff_R->[$n_sdiff]{char}{strings}} = @strings;
+-#XX         @{$rah_diff_R->[$n_sdiff]{char}{type}}    = @type;
+-            $rah_diff_L->[$n_sdiff]{desc} = "modified";
+-            $rah_diff_R->[$n_sdiff]{desc} = "modified";
+-            $rah_diff_L->[$n_sdiff]{lnum} = $n_L;
+-            $rah_diff_R->[$n_sdiff]{lnum} = $n_R;
+-#}
+-
+-        } elsif ($flag eq '+') {  # + = added
+-            ++$n_R;
+-            if ($COMMENT_MODE) {
+-                # should never get here
+-                @{$rah_diff_L} = ();
+-                @{$rah_diff_R} = ();
+-                push @{$raa_Errors}, 
+-                     [ $Error_Codes{'Diff error (quoted comments?)'}, $file ];
+-                if ($opt_v) {
+-                  warn "array_diff: diff failure (diff says the\n";
+-                  warn "comment-free file has added lines).\n";
+-                  warn "$n_sdiff  $line_L\n";
+-                }
+-                last;
+-            }
+-            $rah_diff_L->[$n_sdiff]{type} = "nonexist";
+-            $rah_diff_L->[$n_sdiff]{desc} = "removed";
+-            $rah_diff_R->[$n_sdiff]{desc} = "added";
+-            $rah_diff_R->[$n_sdiff]{lnum} = $n_R;
+-        } elsif ($flag eq '-') {  # - = removed
+-            ++$n_L;
+-            if ($COMMENT_MODE) {
+-                # line must be comment because blanks already gone
+-                $rah_diff_L->[$n_sdiff]{type} = "comment";
+-            }
+-            $rah_diff_R->[$n_sdiff]{type} = "nonexist";
+-            $rah_diff_R->[$n_sdiff]{desc} = "removed";
+-            $rah_diff_L->[$n_sdiff]{desc} = "added";
+-            $rah_diff_L->[$n_sdiff]{lnum} = $n_L;
+-        }
+-#printf "%-30s %s %-30s\n", $line_L, $separator, $line_R;
+-        ++$n_sdiff;
+-    }
+-#use Data::Dumper::Simple;
+-#print Dumper($rah_diff_L, $rah_diff_R);
+-
+-    print "<- array_diff\n" if $opt_v > 2;
+-} # 1}}}
+-sub remove_leading_dir {                     # {{{1 
+-    my @filenames = @_;
+-    #
+-    #  Input should be a list of file names
+-    #  with the same leading directory such as
+-    # 
+-    #      dir1/dir2/a.txt
+-    #      dir1/dir2/b.txt
+-    #      dir1/dir2/dir3/c.txt
+-    #
+-    #  Output is the same list minus the common
+-    #  directory path:
+-    # 
+-    #      a.txt
+-    #      b.txt
+-    #      dir3/c.txt
+-    #
+-    print "-> remove_leading_dir()\n" if $opt_v > 2;
+-    my @D = (); # a matrix:   [ [ dir1, dir2 ],         # dir1/dir2/a.txt
+-                #               [ dir1, dir2 ],         # dir1/dir2/b.txt
+-                #               [ dir1, dir2 , dir3] ]  # dir1/dir2/dir3/c.txt
+-    if ($ON_WINDOWS) {
+-        foreach my $F (@filenames) {
+-            $F =~ s{\\}{/}g;
+-            $F = ucfirst($F) if $F =~ /^\w:/;  # uppercase drive letter
+-        }
+-    }
+-    if (scalar @filenames == 1) {
+-        # special case:  with only one filename
+-        # cannot determine a baseline
+-        return ( basename $filenames[0] );
+-    }
+-    foreach my $F (@filenames) {
+-        my ($Vol, $Dir, $File) = File::Spec->splitpath($F);
+-        my @x = File::Spec->splitdir( $Dir );
+-        pop @x unless $x[$#x]; # last entry usually null, remove it
+-        if ($ON_WINDOWS) {
+-            if (defined($Vol) and $Vol) {
+-                # put the drive letter, eg, C:, at the front
+-                unshift @x, uc $Vol;
+-            }
+-        }
+-#print "F=$F, Dir=$Dir  x=[", join("][", @x), "]\n";
+-        push @D, [ @x ];
+-    }
+-
+-    # now loop over columns until either they are all
+-    # eliminated or a unique column is found
+-
+-#use Data::Dumper::Simple;
+-#print Dumper("remove_leading_dir after ", @D);
+-
+-    my @common   = ();  # to contain the common leading directories
+-    my $mismatch = 0;
+-    while (!$mismatch) {
+-        for (my $row = 1; $row < scalar @D; $row++) {
+-#print "comparing $D[$row][0] to $D[0][0]\n";
+-
+-            if (!defined $D[$row][0] or !defined $D[0][0] or
+-                ($D[$row][0] ne $D[0][0])) {
+-                $mismatch = 1;
+-                last;
+-            }
+-        }
+-#print "mismatch=$mismatch\n";
+-        if (!$mismatch) {
+-            push @common, $D[0][0];
+-            # all terms in the leading match; unshift the batch
+-            foreach my $ra (@D) {
+-                shift @{$ra};
+-            }
+-        }
+-    }
+-
+-    push @common, " ";  # so that $leading will end with "/ "
+-    my $leading = File::Spec->catdir( @common );
+-       $leading =~ s{ $}{};  # now take back the bogus appended space
+-#print "remove_leading_dir leading=[$leading]\n"; die;
+-    if ($ON_WINDOWS) {
+-       $leading =~ s{\\}{/}g;
+-    }
+-    foreach my $F (@filenames) {
+-        $F =~ s{^$leading}{};
+-    }
+-
+-    print "<- remove_leading_dir()\n" if $opt_v > 2;
+-    return @filenames;
+-
+-} # 1}}}
+-sub align_by_pairs {                         # {{{1 
+-    my ($rh_file_list_L        , # in
+-        $rh_file_list_R        , # in
+-        $ra_added              , # out
+-        $ra_removed            , # out
+-        $ra_compare_list       , # out
+-        ) = @_;
+-    print "-> align_by_pairs()\n" if $opt_v > 2;
+-    @{$ra_compare_list} = ();
+-
+-    my @files_L = sort keys %{$rh_file_list_L};
+-    my @files_R = sort keys %{$rh_file_list_R};
+-    return () unless @files_L or  @files_R;  # at least one must have stuff
+-    if      ( @files_L and !@files_R) {
+-        # left side has stuff, right side is empty; everything deleted
+-        @{$ra_added   }     = ();
+-        @{$ra_removed }     = @files_L;
+-        @{$ra_compare_list} = ();
+-        return;
+-    } elsif (!@files_L and  @files_R) {
+-        # left side is empty, right side has stuff; everything added
+-        @{$ra_added   }     = @files_R;
+-        @{$ra_removed }     = ();
+-        @{$ra_compare_list} = ();
+-        return;
+-    }
+-#use Data::Dumper::Simple;
+-#print Dumper("align_by_pairs", @files_L, @files_R);
+-#die;
+-    if (scalar @files_L == 1 and scalar @files_R == 1) {
+-        # The easy case:  compare two files.
+-        push @{$ra_compare_list}, [ $files_L[0],  $files_R[0] ]; 
+-        @{$ra_added  } = ();
+-        @{$ra_removed} = ();
+-        return;
+-    }
+-    # The harder case:  compare groups of files.  This only works
+-    # if the groups are in different directories so the first step
+-    # is to strip the leading directory names from file lists to
+-    # make it possible to align by file names.
+-    my @files_L_minus_dir = remove_leading_dir(@files_L);
+-    my @files_R_minus_dir = remove_leading_dir(@files_R);
+-
+-    # Keys of the stripped_X arrays are canonical file names;
+-    # should overlap mostly.  Keys in stripped_L but not in
+-    # stripped_R are files that have been deleted.  Keys in
+-    # stripped_R but not in stripped_L have been added.
+-    my %stripped_L = ();
+-       @stripped_L{ @files_L_minus_dir } = @files_L;
+-    my %stripped_R = ();
+-       @stripped_R{ @files_R_minus_dir } = @files_R;
+-
+-    my %common = ();
+-    foreach my $f (keys %stripped_L) {
+-        $common{$f}  = 1 if     defined $stripped_R{$f};
+-    }
+-
+-    my %deleted = ();
+-    foreach my $f (keys %stripped_L) {
+-        $deleted{$stripped_L{$f}} = $f unless defined $stripped_R{$f};
+-    }
+-
+-    my %added = ();
+-    foreach my $f (keys %stripped_R) {
+-        $added{$stripped_R{$f}}   = $f unless defined $stripped_L{$f};
+-    }
+-
+-#use Data::Dumper::Simple;
+-#print Dumper("align_by_pairs", %stripped_L, %stripped_R);
+-#print Dumper("align_by_pairs", %common, %added, %deleted);
+-    
+-    foreach my $f (keys %common) {
+-        push @{$ra_compare_list}, [ $stripped_L{$f},  
+-                                    $stripped_R{$f} ]; 
+-    }
+-    @{$ra_added   } = keys %added  ;
+-    @{$ra_removed } = keys %deleted;
+-
+-    print "<- align_by_pairs()\n" if $opt_v > 2;
+-    return;
+-#print Dumper("align_by_pairs", @files_L_minus_dir, @files_R_minus_dir);
+-#die;
+-} # 1}}}
+-sub html_header {                            # {{{1
+-    my ($title , ) = @_;
+-
+-    print "-> html_header\n" if $opt_v > 2;
+-    return 
+-'<html>
+-<head>
+-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+-<meta name="GENERATOR" content="cloc http://cloc.sourceforge.net">
+-' .
+-"
+-<!-- Created by $script v$VERSION -->
+-<title>$title</title>
+-" .
+-'
+-<style TYPE="text/css">
+-<!--
+-    body {
+-        color: black;
+-        background-color: white;
+-        font-family: monospace
+-    }
+-
+-    .whitespace {
+-        background-color: gray;
+-    }
+-
+-    .comment {
+-        color: gray;
+-        font-style: italic;
+-    }
+-
+-    .clinenum {
+-        color: red;
+-    }
+-
+-    .linenum {
+-        color: green;
+-    }
+- -->
+-</style>
+-</head>
+-<body>
+-<pre><tt>
+-';
+-    print "<- html_header\n" if $opt_v > 2;
+-} # 1}}}
+-sub html_end {                               # {{{1
+-return 
+-'</tt></pre>
+-</body>
+-</html>
+-';
+-} # 1}}}
+-sub die_unknown_lang {                       # {{{1
+-    my ($lang, $option_name) = @_;
+-    die "Unknown language '$lang' used with $option_name option.  " .
+-        "The command\n  $script --show-lang\n" .
+-        "will print all recognized languages.  Language names are " .
+-        "case sensitive.\n" ;
+-} # 1}}}
+-sub unicode_file {                           # {{{1
+-    my $file = shift @_; 
+-
+-    print "-> unicode_file($file)\n" if $opt_v > 2;
+-    return 0 if (-s $file > 2_000_000);  
+-    # don't bother trying to test binary files bigger than 2 MB
+-
+-    my $IN = new IO::File $file, "r";
+-    if (!defined $IN) {
+-        warn "Unable to read $file; ignoring.\n";
+-        return 0;
+-    }
+-    my @lines = <$IN>;
+-    $IN->close;
+-
+-    if (unicode_to_ascii( join('', @lines) )) {
+-        print "<- unicode_file()\n" if $opt_v > 2;
+-        return 1;
+-    } else {
+-        print "<- unicode_file()\n" if $opt_v > 2;
+-        return 0;
+-    }
+-
+-} # 1}}}
+-sub unicode_to_ascii {                       # {{{1
+-    my $string = shift @_; 
+-
+-    # A trivial attempt to convert Microsoft Windows style Unicode
+-    # files into ASCII.  These files exhibit the following byte
+-    # sequence:
+-    # byte   1:  255
+-    # byte   2:  254
+-    # byte   3:  ord of ASCII character
+-    # byte   4:    0
+-    # byte 3+i:  ord of ASCII character
+-    # byte 4+i:    0
+-
+-    my @ascii              = ();
+-    my $looks_like_unicode = 1;
+-    my $length             = length $string;
+-# print "length=$length\n";
+-    if ($length <= 3) {
+-        $looks_like_unicode = 0;
+-        return '';
+-    }
+-    my @unicode            = split(//, $string);
+-
+-    for (my $i = 2; $i < $length; $i += 2) {
+-# print "examining [$unicode[$i]]  ord ", ord($unicode[$i]), "\n";
+-        if (32 <= ord($unicode[$i]) and ord($unicode[$i]) <= 127
+-            or ord($unicode[$i]) == 13
+-            or ord($unicode[$i]) == 10
+-            or ord($unicode[$i]) ==  9
+-            ) {
+-            push @ascii, $unicode[$i];
+-# print "adding [$unicode[$i]]\n";
+-        } else {
+-            $looks_like_unicode = 0;
+-            last;
+-        }
+-        if ($i+1 < $length) {
+-            if (!$unicode[$i+1]) {
+-                $looks_like_unicode = 0;
+-                last;
+-            }
+-        }
+-    }
+-    if ($looks_like_unicode) {
+-        return join("", @ascii);
+-    } else {
+-        return '';
+-    }
+-} # 1}}}
+-sub uncompress_archive_cmd {                 # {{{1
+-    my ($archive_file, ) = @_;
+-
+-    # Wrap $archive_file in single or double quotes in the system
+-    # commands below to avoid filename chicanery (including
+-    # spaces in the names).
+-
+-    print "-> uncompress_archive_cmd($archive_file)\n" if $opt_v > 2;
+-    my $extract_cmd = "";
+-    my $missing     = "";
+-    if ($opt_extract_with) {
+-        ( $extract_cmd = $opt_extract_with ) =~ s/>FILE</$archive_file/g;
+-    } elsif (($archive_file =~ /\.tar\.(gz|Z)$/ or 
+-              $archive_file =~ /\.tgz$/       ) and !$ON_WINDOWS)    {
+-        if (external_utility_exists("gzip --version")) {
+-            if (external_utility_exists("tar --version")) {
+-                $extract_cmd = "gzip -dc '$archive_file' | tar xf -";
+-            } else {
+-                $missing = "tar";
+-            }
+-        } else {
+-            $missing = "gzip";
+-        }
+-    } elsif ($archive_file =~ /\.tar\.bz2$/ and !$ON_WINDOWS)    {
+-        if (external_utility_exists("bzip2 --help")) {
+-            if (external_utility_exists("tar --version")) {
+-                $extract_cmd = "bzip2 -dc '$archive_file' | tar xf -";
+-            } else {
+-                $missing = "tar";
+-            }
+-        } else {
+-            $missing = "bzip2";
+-        }
+-    } elsif ($archive_file =~ /\.tar$/ and !$ON_WINDOWS)    {
+-        $extract_cmd = "tar xf '$archive_file'";
+-    } elsif ($archive_file =~ /\.src\.rpm$/i and !$ON_WINDOWS) {
+-        if (external_utility_exists("cpio --version")) {
+-            if (external_utility_exists("rpm2cpio")) {
+-                $extract_cmd = "rpm2cpio '$archive_file' | cpio -i";
+-            } else {
+-                $missing = "rpm2cpio";
+-            }
+-        } else {
+-            $missing = "bzip2";
+-        }
+-    } elsif ($archive_file =~ /\.zip$/i and !$ON_WINDOWS)    {
+-        if (external_utility_exists("unzip")) {
+-            $extract_cmd = "unzip -qq -d . '$archive_file'";
+-        } else {
+-            $missing = "unzip";
+-        }
+-    } elsif ($ON_WINDOWS and $archive_file =~ /\.zip$/i) {
+-        # zip on Windows, guess default Winzip install location
+-        $extract_cmd = "";
+-        my $WinZip = '"C:\\Program Files\\WinZip\\WinZip32.exe"';
+-        if (external_utility_exists($WinZip)) {
+-            $extract_cmd = "$WinZip -e -o \"$archive_file\" .";
+-#print "trace 5 extract_cmd=[$extract_cmd]\n";
+-        } else {
+-#print "trace 6\n";
+-            $missing = $WinZip;
+-        }
+-    }
+-    print "<- uncompress_archive_cmd\n" if $opt_v > 2;
+-    if ($missing) {
+-        die "Unable to expand $archive_file because external\n",
+-            "utility '$missing' is not available.\n",
+-            "Another possibility is to use the --extract-with option.\n";
+-    } else {
+-        return $extract_cmd;
+-    }
+-}
+-# 1}}}
+-sub read_list_file {                         # {{{1
+-    my ($file, ) = @_;
+-
+-    print "-> read_list_file($file)\n" if $opt_v > 2;
+-    my $IN = new IO::File $file, "r";
+-    if (!defined $IN) {
+-        warn "Unable to read $file; ignoring.\n";
+-        next;
+-    }
+-    my @entry = ();
+-    while (<$IN>) {
+-        next if /^\s*$/ or /^\s*#/; # skip empty or commented lines
+-        chomp;
+-        push @entry, $_;
+-    }
+-    $IN->close;
+-
+-    print "<- read_list_file\n" if $opt_v > 2;
+-    return @entry;
+-}
+-# 1}}}
+-sub external_utility_exists {                # {{{1
+-    my $exe = shift @_;
+-
+-    my $success      = 0;
+-    if ($ON_WINDOWS) {
+-        $success = 1 unless system $exe . ' > nul';
+-    } else {
+-        $success = 1 unless system $exe . ' >& /dev/null';
+-        if (!$success) {
+-            $success = 1 unless system "which" . " $exe" . ' >& /dev/null';
+-        }
+-    }
+-    
+-    return $success;
+-} # 1}}}
+-sub write_xsl_file {                         # {{{1
+-    my $OUT = new IO::File $CLOC_XSL, "w";
+-    if (!defined $OUT) {
+-        warn "Unable to write $CLOC_XSL  $!\n";
+-        return;
+-    }
+-    my $XSL =             # <style>  </style> {{{2
+-'<?xml version="1.0" encoding="US-ASCII"?>
+-<!-- XLS file by Paul Schwann, January 2009.
+-     Fixes for by-file and by-file-by-lang by d_uragan, November 2010.
+-     -->
+-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+-  <xsl:output method="html"/>
+-  <xsl:template match="/">
+-    <html xmlns="http://www.w3.org/1999/xhtml">
+-      <head>
+-        <title>CLOC Results</title>
+-      </head>
+-      <style type="text/css">
+-        table {
+-          table-layout: auto;
+-          border-collapse: collapse;
+-          empty-cells: show;
+-        }
+-        td, th {
+-          padding: 4px;
+-        }
+-        th {
+-          background-color: #CCCCCC;
+-        }
+-        td {
+-          text-align: center;
+-        }
+-        table, td, tr, th {
+-          border: thin solid #999999;
+-        }
+-      </style>
+-      <body>
+-        <h3><xsl:value-of select="results/header"/></h3>
+-';
+-# 2}}}
+-
+-    if ($opt_by_file) {
+-        $XSL .=             # <table> </table>{{{2
+-'        <table>
+-          <thead>
+-            <tr>
+-              <th>File</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>
+-              <th>Language</th>
+-';
+-        $XSL .=
+-'             <th>3<sup>rd</sup> Generation Equivalent</th>
+-              <th>Scale</th>
+-' if $opt_3;
+-        $XSL .=
+-'           </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="results/files/file">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>
+-              <td><xsl:value-of select="@language"/></td>
+-';
+-        $XSL .=
+-'             <td><xsl:value-of select="@factor"/></td>
+-              <td><xsl:value-of select="@scaled"/></td>
+-' if $opt_3;
+-        $XSL .=
+-'           </tr>
+-          </xsl:for-each>
+-            <tr>
+-              <th>Total</th>
+-              <th><xsl:value-of select="results/files/total/@blank"/></th>
+-              <th><xsl:value-of select="results/files/total/@comment"/></th>
+-              <th><xsl:value-of select="results/files/total/@code"/></th>
+-              <th><xsl:value-of select="results/files/total/@language"/></th>
+-';
+-        $XSL .=
+-'             <th><xsl:value-of select="results/files/total/@factor"/></th>
+-              <th><xsl:value-of select="results/files/total/@scaled"/></th>
+-' if $opt_3;
+-        $XSL .=
+-'           </tr>
+-          </tbody>
+-        </table>
+-        <br/>
+-';
+-# 2}}}
+-    }
+-
+-    if (!$opt_by_file or $opt_by_file_by_lang) {
+-        $XSL .=             # <table> </table> {{{2
+-'       <table>
+-          <thead>
+-            <tr>
+-              <th>Language</th>
+-              <th>Files</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>
+-';
+-        $XSL .=
+-'             <th>Scale</th>
+-              <th>3<sup>rd</sup> Generation Equivalent</th>
+-' if $opt_3;
+-        $XSL .=
+-'           </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="results/languages/language">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@files_count"/></td>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>
+-';
+-        $XSL .=
+-'             <td><xsl:value-of select="@factor"/></td>
+-              <td><xsl:value-of select="@scaled"/></td>
+-' if $opt_3;
+-        $XSL .=
+-'          </tr>
+-          </xsl:for-each>
+-            <tr>
+-              <th>Total</th>
+-              <th><xsl:value-of select="results/languages/total/@sum_files"/></th>
+-              <th><xsl:value-of select="results/languages/total/@blank"/></th>
+-              <th><xsl:value-of select="results/languages/total/@comment"/></th>
+-              <th><xsl:value-of select="results/languages/total/@code"/></th>
+-';
+-        $XSL .=
+-'             <th><xsl:value-of select="results/languages/total/@factor"/></th>
+-              <th><xsl:value-of select="results/languages/total/@scaled"/></th>
+-' if $opt_3;
+-        $XSL .=
+-'           </tr>
+-          </tbody>
+-        </table>
+-';
+-# 2}}}
+-    }
+-
+-    $XSL.= <<'EO_XSL'; # {{{2
+-      </body>
+-    </html>
+-  </xsl:template>
+-</xsl:stylesheet>
+-
+-EO_XSL
+-# 2}}}
+-
+-    my $XSL_DIFF = <<'EO_DIFF_XSL'; # {{{2
+-<?xml version="1.0" encoding="US-ASCII"?>
+-<!-- XLS file by Blazej Kroll, November 2010 -->
+-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+-  <xsl:output method="html"/>
+-  <xsl:template match="/">
+-    <html xmlns="http://www.w3.org/1999/xhtml">
+-      <head>
+-        <title>CLOC Results</title>
+-      </head>
+-      <style type="text/css">
+-        table {
+-          table-layout: auto;
+-          border-collapse: collapse;
+-          empty-cells: show;
+-		  margin: 1em;
+-        }
+-        td, th {
+-          padding: 4px;
+-        }
+-        th {
+-          background-color: #CCCCCC;
+-        }
+-        td {
+-          text-align: center;
+-        }
+-        table, td, tr, th {
+-          border: thin solid #999999;
+-        }
+-      </style>
+-      <body>
+-        <h3><xsl:value-of select="results/header"/></h3>
+-EO_DIFF_XSL
+-# 2}}}
+-
+-    if ($opt_by_file) {
+-        $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2
+-		<table>
+-          <thead>
+-		  <tr><th colspan="4">Same</th>
+-		  </tr>
+-            <tr>
+-              <th>File</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/same/file">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-		
+-		<table>
+-          <thead>
+-		  <tr><th colspan="4">Modified</th>
+-		  </tr>
+-            <tr>
+-              <th>File</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/modified/file">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-		
+-		<table>
+-          <thead>
+-		  <tr><th colspan="4">Added</th>
+-		  </tr>
+-            <tr>
+-              <th>File</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/added/file">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-		
+-		<table>
+-          <thead>
+-		  <tr><th colspan="4">Removed</th>
+-		  </tr>
+-            <tr>
+-              <th>File</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/removed/file">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-EO_DIFF_XSL
+-# 2}}}
+-    }
+-
+-    if (!$opt_by_file or $opt_by_file_by_lang) {
+-        $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2
+-		<table>
+-          <thead>
+-		  <tr><th colspan="5">Same</th>
+-		  </tr>
+-            <tr>
+-              <th>Language</th>
+-              <th>Files</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/same/language">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@files_count"/></td>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-		
+-		<table>
+-          <thead>
+-		  <tr><th colspan="5">Modified</th>
+-		  </tr>
+-            <tr>
+-              <th>Language</th>
+-              <th>Files</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/modified/language">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@files_count"/></td>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-		
+-		<table>
+-          <thead>
+-		  <tr><th colspan="5">Added</th>
+-		  </tr>
+-            <tr>
+-              <th>Language</th>
+-              <th>Files</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/added/language">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@files_count"/></td>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-		
+-		<table>
+-          <thead>
+-		  <tr><th colspan="5">Removed</th>
+-		  </tr>
+-            <tr>
+-              <th>Language</th>
+-              <th>Files</th>
+-              <th>Blank</th>
+-              <th>Comment</th>
+-              <th>Code</th>              
+-            </tr>
+-          </thead>
+-          <tbody>
+-          <xsl:for-each select="diff_results/removed/language">
+-            <tr>
+-              <th><xsl:value-of select="@name"/></th>
+-              <td><xsl:value-of select="@files_count"/></td>
+-              <td><xsl:value-of select="@blank"/></td>
+-              <td><xsl:value-of select="@comment"/></td>
+-              <td><xsl:value-of select="@code"/></td>              
+-            </tr>
+-          </xsl:for-each>            
+-          </tbody>
+-        </table>
+-EO_DIFF_XSL
+-# 2}}}
+-
+-    }
+-    
+-    $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2
+-      </body>
+-    </html>
+-  </xsl:template>
+-</xsl:stylesheet>
+-EO_DIFF_XSL
+-# 2}}}
+-    if ($opt_diff) {
+-        print $OUT $XSL_DIFF;
+-    } else {
+-        print $OUT $XSL;
+-    }
+-    $OUT->close();
+-} # 1}}}
+-sub normalize_file_names {                   # {{{1 
+-    my (@files, ) = @_;
+-
+-    # Returns a hash of file names reduced to a canonical form
+-    # (fully qualified file names, all path separators changed to /,
+-    # Windows file names lowercased).  Hash values are the original
+-    # file name.
+-
+-    my %normalized = ();
+-    foreach my $F (@files) {
+-        my $F_norm = $F;
+-        if ($ON_WINDOWS) {
+-            $F_norm = lc $F_norm; # for case insensitive file name comparisons
+-            $F_norm =~ s{\\}{/}g; # Windows directory separators to Unix
+-            $F_norm =~ s{^\./}{}g;  # remove leading ./
+-            if (($F_norm !~ m{^/}) and ($F_norm !~ m{^\w:/})) {
+-                # looks like a relative path; prefix with cwd
+-                $F_norm = lc "$cwd/$F_norm";
+-            }
+-        } else {
+-            $F_norm =~ s{^\./}{}g;  # remove leading ./
+-            if ($F_norm !~ m{^/}) {
+-                # looks like a relative path; prefix with cwd
+-                $F_norm = lc "$cwd/$F_norm";
+-            }
+-        }
+-        $normalized{ $F_norm } = $F;
+-    }
+-    return %normalized;
+-} # 1}}}
+-sub combine_diffs {                          # {{{1
+-    # subroutine by Andy (awalshe@sf.net)
+-    # https://sourceforge.net/tracker/?func=detail&aid=3261017&group_id=174787&atid=870625
+-    my ($ra_files) = @_;
+-
+-    my $res   = "$URL v $VERSION\n";
+-    my $dl    = '-';
+-    my $width = 79;
+-    # columns are in this order
+-    my @cols  = ('files', 'blank', 'comment', 'code');
+-    my %HoH   = ();
+-  
+-    foreach my $file (@{$ra_files}) {
+-        my $IN = new IO::File $file, "r";
+-        if (!defined $IN) {
+-            warn "Unable to read $file; ignoring.\n";
+-            next;
+-        }
+-
+-        my $sec;
+-        while (<$IN>) {
+-            next if /^(http|Language|-----)/;
+-            if (/^[A-Z][a-z]*/) {        # section title
+-                $sec = $_;
+-                chomp($sec);
+-                $HoH{$sec} = () if ! exists $HoH{$sec};
+-                next;
+-            }
+-  
+-            if (/^\s(same|modified|added|removed)/) {  # calculated totals row
+-                my @ar = grep { $_ ne '' } split(/ /, $_);
+-                chomp(@ar);
+-                my $ttl = shift @ar;
+-                my $i = 0;
+-                foreach(@ar) {
+-                    my $t = "$ttl$dl$cols[$i]";
+-                    $HoH{$sec}{$t} = 0 if ! exists $HoH{$sec}{$t};
+-                    $HoH{$sec}{$t} += $_;
+-                    $i++;
+-                }
+-            }
+-        }
+-        $IN->close;
+-    }
+-  
+-    # rows are in this order
+-    my @rows = ('same', 'modified', 'added', 'removed');
+-  
+-    $res .= sprintf("%s\n", "-" x $width);
+-    $res .= sprintf("%-19s %14s %14s %14s %14s\n", 'Language', 
+-                    $cols[0], $cols[1], $cols[2], $cols[3]);
+-    $res .= sprintf("%s\n", "-" x $width);
+-  
+-    for my $sec ( keys %HoH ) {
+-        next if $sec =~ /SUM:/;
+-        $res .= "$sec\n";
+-        foreach (@rows) {
+-            $res .= sprintf(" %-18s %14s %14s %14s %14s\n", 
+-                            $_, $HoH{$sec}{"$_$dl$cols[0]"},
+-                                $HoH{$sec}{"$_$dl$cols[1]"},
+-                                $HoH{$sec}{"$_$dl$cols[2]"},
+-                                $HoH{$sec}{"$_$dl$cols[3]"});
+-        }
+-    }
+-    $res .= sprintf("%s\n", "-" x $width);
+-    my $sec = 'SUM:';
+-    $res .= "$sec\n";
+-    foreach (@rows) {
+-        $res .= sprintf(" %-18s %14s %14s %14s %14s\n", 
+-                        $_, $HoH{$sec}{"$_$dl$cols[0]"},
+-                            $HoH{$sec}{"$_$dl$cols[1]"},
+-                            $HoH{$sec}{"$_$dl$cols[2]"},
+-                            $HoH{$sec}{"$_$dl$cols[3]"});
+-    }
+-    $res .= sprintf("%s\n", "-" x $width);
+-  
+-    return $res;
+-} # 1}}}
+-# subroutines copied from SLOCCount
+-my %lex_files    = ();  # really_is_lex()
+-my %expect_files = ();  # really_is_expect()
+-my %pascal_files = ();  # really_is_pascal(), really_is_incpascal()
+-my %php_files    = ();  # really_is_php()
+-sub really_is_lex {                          # {{{1
+-# Given filename, returns TRUE if its contents really is lex.
+-# lex file must have "%%", "%{", and "%}".
+-# In theory, a lex file doesn't need "%{" and "%}", but in practice
+-# they all have them, and requiring them avoid mislabeling a
+-# non-lexfile as a lex file.
+-
+- my $filename = shift;
+- chomp($filename);
+-
+- my $is_lex = 0;      # Value to determine.
+- my $percent_percent = 0;
+- my $percent_opencurly = 0;
+- my $percent_closecurly = 0;
+-
+- # Return cached result, if available:
+- if ($lex_files{$filename}) { return $lex_files{$filename};}
+-
+- open(LEX_FILE, "<$filename") ||
+-      die "Can't open $filename to determine if it's lex.\n";
+- while(<LEX_FILE>) {
+-   $percent_percent++     if (m/^\s*\%\%/);
+-   $percent_opencurly++   if (m/^\s*\%\{/);
+-   $percent_closecurly++   if (m/^\s*\%\}/);
+- }
+- close(LEX_FILE);
+-
+- if ($percent_percent && $percent_opencurly && $percent_closecurly)
+-          {$is_lex = 1;}
+-
+- $lex_files{$filename} = $is_lex; # Store result in cache.
+-
+- return $is_lex;
+-} # 1}}}
+-sub really_is_expect {                       # {{{1
+-# Given filename, returns TRUE if its contents really are Expect.
+-# Many "exp" files (such as in Apache and Mesa) are just "export" data,
+-# summarizing something else # (e.g., its interface).
+-# Sometimes (like in RPM) it's just misc. data.
+-# Thus, we need to look at the file to determine
+-# if it's really an "expect" file.
+-
+- my $filename = shift;
+- chomp($filename);
+-
+-# The heuristic is as follows: it's Expect _IF_ it:
+-# 1. has "load_lib" command and either "#" comments or {}.
+-# 2. {, }, and one of: proc, if, [...], expect
+-
+- my $is_expect = 0;      # Value to determine.
+-
+- my $begin_brace = 0;  # Lines that begin with curly braces.
+- my $end_brace = 0;    # Lines that begin with curly braces.
+- my $load_lib = 0;     # Lines with the Load_lib command.
+- my $found_proc = 0;
+- my $found_if = 0;
+- my $found_brackets = 0;
+- my $found_expect = 0;
+- my $found_pound = 0;
+-
+- # Return cached result, if available:
+- if ($expect_files{$filename}) { return expect_files{$filename};}
+-
+- open(EXPECT_FILE, "<$filename") ||
+-      die "Can't open $filename to determine if it's expect.\n";
+- while(<EXPECT_FILE>) {
+-
+-   if (m/#/) {$found_pound++; s/#.*//;}
+-   if (m/^\s*\{/) { $begin_brace++;}
+-   if (m/\{\s*$/) { $begin_brace++;}
+-   if (m/^\s*\}/) { $end_brace++;}
+-   if (m/\};?\s*$/) { $end_brace++;}
+-   if (m/^\s*load_lib\s+\S/) { $load_lib++;}
+-   if (m/^\s*proc\s/) { $found_proc++;}
+-   if (m/^\s*if\s/) { $found_if++;}
+-   if (m/\[.*\]/) { $found_brackets++;}
+-   if (m/^\s*expect\s/) { $found_expect++;}
+- }
+- close(EXPECT_FILE);
+-
+- if ($load_lib && ($found_pound || ($begin_brace && $end_brace)))
+-          {$is_expect = 1;}
+- if ( $begin_brace && $end_brace &&
+-      ($found_proc || $found_if || $found_brackets || $found_expect))
+-          {$is_expect = 1;}
+-
+- $expect_files{$filename} = $is_expect; # Store result in cache.
+-
+- return $is_expect;
+-} # 1}}}
+-sub really_is_pascal {                       # {{{1
+-# Given filename, returns TRUE if its contents really are Pascal.
+-
+-# This isn't as obvious as it seems.
+-# Many ".p" files are Perl files
+-# (such as /usr/src/redhat/BUILD/ispell-3.1/dicts/czech/glob.p),
+-# others are C extractions
+-# (such as /usr/src/redhat/BUILD/linux/include/linux/umsdos_fs.p
+-# and some files in linuxconf).
+-# However, test files in "p2c" really are Pascal, for example.
+-
+-# Note that /usr/src/redhat/BUILD/ucd-snmp-4.1.1/ov/bitmaps/UCD.20.p
+-# is actually C code.  The heuristics determine that they're not Pascal,
+-# but because it ends in ".p" it's not counted as C code either.
+-# I believe this is actually correct behavior, because frankly it
+-# looks like it's automatically generated (it's a bitmap expressed as code).
+-# Rather than guess otherwise, we don't include it in a list of
+-# source files.  Let's face it, someone who creates C files ending in ".p"
+-# and expects them to be counted by default as C files in SLOCCount needs
+-# their head examined.  I suggest examining their head
+-# with a sucker rod (see syslogd(8) for more on sucker rods).
+-
+-# This heuristic counts as Pascal such files such as:
+-#  /usr/src/redhat/BUILD/teTeX-1.0/texk/web2c/tangleboot.p
+-# Which is hand-generated.  We don't count woven documents now anyway,
+-# so this is justifiable.
+-
+- my $filename = shift;
+- chomp($filename);
+-
+-# The heuristic is as follows: it's Pascal _IF_ it has all of the following
+-# (ignoring {...} and (*...*) comments):
+-# 1. "^..program NAME" or "^..unit NAME",
+-# 2. "procedure", "function", "^..interface", or "^..implementation",
+-# 3. a "begin", and
+-# 4. it ends with "end.",
+-#
+-# Or it has all of the following:
+-# 1. "^..module NAME" and
+-# 2. it ends with "end.".
+-#
+-# Or it has all of the following:
+-# 1. "^..program NAME",
+-# 2. a "begin", and
+-# 3. it ends with "end.".
+-#
+-# The "end." requirements in particular filter out non-Pascal.
+-#
+-# Note (jgb): this does not detect Pascal main files in fpc, like
+-# fpc-1.0.4/api/test/testterminfo.pas, which does not have "program" in
+-# it
+-
+- my $is_pascal = 0;      # Value to determine.
+-
+- my $has_program = 0;
+- my $has_unit = 0;
+- my $has_module = 0;
+- my $has_procedure_or_function = 0;
+- my $found_begin = 0;
+- my $found_terminating_end = 0;
+- my $has_begin = 0;
+-
+- # Return cached result, if available:
+- if ($pascal_files{$filename}) { return pascal_files{$filename};}
+-
+- open(PASCAL_FILE, "<$filename") ||
+-      die "Can't open $filename to determine if it's pascal.\n";
+- while(<PASCAL_FILE>) {
+-   s/\{.*?\}//g;  # Ignore {...} comments on this line; imperfect, but effective.
+-   s/\(\*.*?\*\)//g;  # Ignore (*...*) comments on this line; imperfect, but effective.
+-   if (m/\bprogram\s+[A-Za-z]/i)  {$has_program=1;}
+-   if (m/\bunit\s+[A-Za-z]/i)     {$has_unit=1;}
+-   if (m/\bmodule\s+[A-Za-z]/i)   {$has_module=1;}
+-   if (m/\bprocedure\b/i)         { $has_procedure_or_function = 1; }
+-   if (m/\bfunction\b/i)          { $has_procedure_or_function = 1; }
+-   if (m/^\s*interface\s+/i)      { $has_procedure_or_function = 1; }
+-   if (m/^\s*implementation\s+/i) { $has_procedure_or_function = 1; }
+-   if (m/\bbegin\b/i) { $has_begin = 1; }
+-   # Originally I said:
+-   # "This heuristic fails if there are multi-line comments after
+-   # "end."; I haven't seen that in real Pascal programs:"
+-   # But jgb found there are a good quantity of them in Debian, specially in 
+-   # fpc (at the end of a lot of files there is a multiline comment
+-   # with the changelog for the file).
+-   # Therefore, assume Pascal if "end." appears anywhere in the file.
+-   if (m/end\.\s*$/i) {$found_terminating_end = 1;}
+-#   elsif (m/\S/) {$found_terminating_end = 0;}
+- }
+- close(PASCAL_FILE);
+-
+- # Okay, we've examined the entire file looking for clues;
+- # let's use those clues to determine if it's really Pascal:
+-
+- if ( ( ($has_unit || $has_program) && $has_procedure_or_function &&
+-     $has_begin && $found_terminating_end ) ||
+-      ( $has_module && $found_terminating_end ) ||
+-      ( $has_program && $has_begin && $found_terminating_end ) )
+-          {$is_pascal = 1;}
+-
+- $pascal_files{$filename} = $is_pascal; # Store result in cache.
+-
+- return $is_pascal;
+-} # 1}}}
+-sub really_is_incpascal {                    # {{{1
+-# Given filename, returns TRUE if its contents really are Pascal.
+-# For .inc files (mainly seen in fpc)
+-
+- my $filename = shift;
+- chomp($filename);
+-
+-# The heuristic is as follows: it is Pacal if any of the following:
+-# 1. really_is_pascal returns true
+-# 2. Any usual reserverd word is found (program, unit, const, begin...)
+-
+- # If the general routine for Pascal files works, we have it
+- if (&really_is_pascal ($filename)) { 
+-   $pascal_files{$filename} = 1;
+-   return 1;
+- }
+-
+- my $is_pascal = 0;      # Value to determine.
+- my $found_begin = 0;
+-
+- open(PASCAL_FILE, "<$filename") ||
+-      die "Can't open $filename to determine if it's pascal.\n";
+- while(<PASCAL_FILE>) {
+-   s/\{.*?\}//g;  # Ignore {...} comments on this line; imperfect, but effective.
+-   s/\(\*.*?\*\)//g;  # Ignore (*...*) comments on this line; imperfect, but effective.
+-   if (m/\bprogram\s+[A-Za-z]/i)  {$is_pascal=1;}
+-   if (m/\bunit\s+[A-Za-z]/i)     {$is_pascal=1;}
+-   if (m/\bmodule\s+[A-Za-z]/i)   {$is_pascal=1;}
+-   if (m/\bprocedure\b/i)         {$is_pascal = 1; }
+-   if (m/\bfunction\b/i)          {$is_pascal = 1; }
+-   if (m/^\s*interface\s+/i)      {$is_pascal = 1; }
+-   if (m/^\s*implementation\s+/i) {$is_pascal = 1; }
+-   if (m/\bconstant\s+/i)         {$is_pascal=1;}
+-   if (m/\bbegin\b/i) { $found_begin = 1; }
+-   if ((m/end\.\s*$/i) && ($found_begin = 1)) {$is_pascal = 1;}
+-   if ($is_pascal) {
+-     last;
+-   }
+- }
+-
+- close(PASCAL_FILE);
+- $pascal_files{$filename} = $is_pascal; # Store result in cache.
+- return $is_pascal;
+-} # 1}}}
+-sub really_is_php {                          # {{{1
+-# Given filename, returns TRUE if its contents really is php.
+-
+- my $filename = shift;
+- chomp($filename);
+-
+- my $is_php = 0;      # Value to determine.
+- # Need to find a matching pair of surrounds, with ending after beginning:
+- my $normal_surround = 0;  # <?; bit 0 = <?, bit 1 = ?>
+- my $script_surround = 0;  # <script..>; bit 0 = <script language="php">
+- my $asp_surround = 0;     # <%; bit 0 = <%, bit 1 = %>
+-
+- # Return cached result, if available:
+- if ($php_files{$filename}) { return $php_files{$filename};}
+-
+- open(PHP_FILE, "<$filename") ||
+-      die "Can't open $filename to determine if it's php.\n";
+- while(<PHP_FILE>) {
+-   if (m/\<\?/)                           { $normal_surround |= 1; }
+-   if (m/\?\>/ && ($normal_surround & 1)) { $normal_surround |= 2; }
+-   if (m/\<script.*language="?php"?/i)    { $script_surround |= 1; }
+-   if (m/\<\/script\>/i && ($script_surround & 1)) { $script_surround |= 2; }
+-   if (m/\<\%/)                           { $asp_surround |= 1; }
+-   if (m/\%\>/ && ($asp_surround & 1)) { $asp_surround |= 2; }
+- }
+- close(PHP_FILE);
+-
+- if ( ($normal_surround == 3) || ($script_surround == 3) ||
+-      ($asp_surround == 3)) {
+-   $is_php = 1;
+- }
+-
+- $php_files{$filename} = $is_php; # Store result in cache.
+-
+- return $is_php;
+-} # 1}}}
+-__END__
+-mode values (stat $item)[2]
+-       Unix    Windows
+-file:  33188   33206
+-dir :  16832   16895
+-link:  33261   33206
+-pipe:   4544    null
+Index: ../trunk-jpl/scripts/cloc2html.py
+===================================================================
+--- ../trunk-jpl/scripts/cloc2html.py	(revision 17911)
++++ ../trunk-jpl/scripts/cloc2html.py	(revision 17912)
+@@ -45,7 +45,7 @@
+ 		if(toggle): mystr = '<tr>\n<th '+color1+style_l+'>'
+ 		else:       mystr = '<tr>\n<th '+color2+style_l+'>'
+ 		for i in line.split():
+-			if(not i.isdigit()):
++			if(not i.isdigit() or (i.isdigit and int(i)==77)):
+ 				mystr += ' '+i+' '
+ 			else:
+ 				if(column==1): mystr += '</th>'
+Index: ../trunk-jpl/scripts/getloc.sh
+===================================================================
+--- ../trunk-jpl/scripts/getloc.sh	(revision 17911)
++++ ../trunk-jpl/scripts/getloc.sh	(revision 17912)
+@@ -1,6 +1,6 @@
+ #!/bin/bash
+ #get number of lines of code
+-cloc-1.55.pl $ISSM_DIR/src $ISSM_DIR/m4 --exclude-dir=.svn --exclude-dir=ad  --exclude-ext=exp --exclude-lang=make --out=temp
++cloc-1.60.pl $ISSM_DIR/src $ISSM_DIR/m4 --exclude-dir=.svn --exclude-dir=ad  --exclude-ext=exp --exclude-lang=make --out=temp
+ cat temp
+ ./cloc2html.py
+ rm temp
+@@ -9,28 +9,3 @@
+ cat $ISSM_DIR/src/dox/issm.dox | sed '1,/<\/table>/d' > input2
+ cat input1 temp.html input2 > $ISSM_DIR/src/dox/issm.dox
+ rm input1 input2 temp.html
+-
+-exit 1
+-
+-
+-
+-
+-
+-#OLDER MANUAL VESION
+-#get Matlab number of lines
+-cd $ISSM_DIR/src/m
+-M_LOC=$(find . -name "*.m" -exec wc -l '{}' \; | awk '{ sum += $1 } END { print sum}');
+-echo "Matlab code: $M_LOC"
+-
+-#get C/CPP number of lines
+-cd $ISSM_DIR/src
+-CPP_LOC=$(find . -name "*.cpp" -exec wc -l '{}' \; | awk '{ sum += $1 } END { print sum}');
+-echo "C++    code: $CPP_LOC"
+-C_LOC=$(find . -name "*.c" -exec wc -l '{}' \; | awk '{ sum += $1 } END { print sum}');
+-echo "C      code: $C_LOC"
+-H_LOC=$(find . -name "*.h" -exec wc -l '{}' \; | awk '{ sum += $1 } END { print sum}');
+-echo "header code: $H_LOC"
+-
+-#print total
+-let SUM=$M_LOC+$CPP_LOC+$C_LOC+$H_LOC
+-echo "Total      : $SUM"
+Index: ../trunk-jpl/scripts/GenerateReferences.sh
+===================================================================
+--- ../trunk-jpl/scripts/GenerateReferences.sh	(revision 17911)
++++ ../trunk-jpl/scripts/GenerateReferences.sh	(revision 17912)
+@@ -35,4 +35,4 @@
+ rm -rf references.tex
+ 
+ #open output
+-open references.rtf
++#open references.rtf
+Index: ../trunk-jpl/scripts/cloc-1.60.pl
+===================================================================
+--- ../trunk-jpl/scripts/cloc-1.60.pl	(revision 0)
++++ ../trunk-jpl/scripts/cloc-1.60.pl	(revision 17912)
+@@ -0,0 +1,9064 @@
++#!/usr/bin/env perl
++# cloc -- Count Lines of Code                  {{{1
++# Copyright (C) 2006-2013 Northrop Grumman Corporation
++# Author:  Al Danial <al.danial@gmail.com>
++#          First release August 2006
++#
++# Includes code from:
++#   - SLOCCount v2.26 
++#     http://www.dwheeler.com/sloccount/
++#     by David Wheeler.
++#   - Regexp::Common v2.120
++#     http://search.cpan.org/~abigail/Regexp-Common-2.120/lib/Regexp/Common.pm
++#     by Damian Conway and Abigail.
++#   - Win32::Autoglob 
++#     http://search.cpan.org/~sburke/Win32-Autoglob-1.01/Autoglob.pm
++#     by Sean M. Burke.
++#   - Algorithm::Diff
++#     http://search.cpan.org/~tyemq/Algorithm-Diff-1.1902/lib/Algorithm/Diff.pm
++#     by Tye McQueen.
++#
++# 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:
++# <http://www.gnu.org/licenses/gpl.txt>.
++#
++# 1}}}
++my $VERSION = "1.60";  # odd number == beta; even number == stable
++my $URL     = "http://cloc.sourceforge.net";
++require 5.006;
++# use modules                                  {{{1
++use warnings;
++use strict;
++use Getopt::Long;
++use File::Basename;
++use File::Temp qw { tempfile tempdir };
++use File::Find;
++use File::Path;
++use File::Spec;
++use IO::File;
++use POSIX "strftime";
++
++# Digest::MD5 isn't in the standard distribution. Use it only if installed.
++my $HAVE_Digest_MD5 = 0;
++eval "use Digest::MD5;";
++if (defined $Digest::MD5::VERSION) {
++    $HAVE_Digest_MD5 = 1;
++} else {
++    warn "Digest::MD5 not installed; will skip file uniqueness checks.\n";
++}
++
++# Time::HiRes became standard with Perl 5.8
++my $HAVE_Time_HiRes = 0;
++eval "use Time::HiRes;";
++$HAVE_Time_HiRes = 1 if defined $Time::HiRes::VERSION;
++
++my $HAVE_Rexexp_Common;
++# Regexp::Common isn't in the standard distribution.  It will
++# be installed in a temp directory if necessary.
++BEGIN {
++    if (eval "use Regexp::Common;") {
++        $HAVE_Rexexp_Common = 1;
++    } else {
++        $HAVE_Rexexp_Common = 0;
++    }
++}
++
++my $HAVE_Algorith_Diff = 0;
++# Algorithm::Diff isn't in the standard distribution.  It will
++# be installed in a temp directory if necessary.
++eval "use Algorithm::Diff qw ( sdiff ) ";
++if (defined $Algorithm::Diff::VERSION) {
++    $HAVE_Algorith_Diff = 1;
++} else {
++    Install_Algorithm_Diff();
++}
++# print "2 HAVE_Algorith_Diff = $HAVE_Algorith_Diff\n";
++# test_alg_diff($ARGV[$#ARGV - 1], $ARGV[$#ARGV]); die;
++
++# Uncomment next two lines when building Windows executable with perl2exe
++# or if running on a system that already has Regexp::Common.
++#use Regexp::Common;
++#$HAVE_Rexexp_Common = 1;
++
++#perl2exe_include "Regexp/Common/whitespace.pm"
++#perl2exe_include "Regexp/Common/URI.pm"
++#perl2exe_include "Regexp/Common/URI/fax.pm"
++#perl2exe_include "Regexp/Common/URI/file.pm"
++#perl2exe_include "Regexp/Common/URI/ftp.pm"
++#perl2exe_include "Regexp/Common/URI/gopher.pm"
++#perl2exe_include "Regexp/Common/URI/http.pm"
++#perl2exe_include "Regexp/Common/URI/pop.pm"
++#perl2exe_include "Regexp/Common/URI/prospero.pm"
++#perl2exe_include "Regexp/Common/URI/news.pm"
++#perl2exe_include "Regexp/Common/URI/tel.pm"
++#perl2exe_include "Regexp/Common/URI/telnet.pm"
++#perl2exe_include "Regexp/Common/URI/tv.pm"
++#perl2exe_include "Regexp/Common/URI/wais.pm"
++#perl2exe_include "Regexp/Common/CC.pm"
++#perl2exe_include "Regexp/Common/SEN.pm"
++#perl2exe_include "Regexp/Common/number.pm"
++#perl2exe_include "Regexp/Common/delimited.pm"
++#perl2exe_include "Regexp/Common/profanity.pm"
++#perl2exe_include "Regexp/Common/net.pm"
++#perl2exe_include "Regexp/Common/zip.pm"
++#perl2exe_include "Regexp/Common/comment.pm"
++#perl2exe_include "Regexp/Common/balanced.pm"
++#perl2exe_include "Regexp/Common/lingua.pm"
++#perl2exe_include "Regexp/Common/list.pm"
++#perl2exe_include "File/Glob.pm"
++
++use Text::Tabs qw { expand };
++use Cwd qw { cwd };
++use File::Glob;
++my $PERL_516 = $] >= 5.016 ? 1 : 0;  # 5.16 deprecates defined(@array)
++no warnings 'deprecated';            # will need to comment this out to test
++                                     # each new Perl version
++# 1}}}
++# Usage information, options processing.       {{{1
++my $ON_WINDOWS = 0;
++   $ON_WINDOWS = 1 if ($^O =~ /^MSWin/) or ($^O eq "Windows_NT");
++if ($ON_WINDOWS and $ENV{'SHELL'}) {
++    if ($ENV{'SHELL'} =~ m{^/}) {
++        $ON_WINDOWS = 0;  # make Cygwin look like Unix
++    } else {
++        $ON_WINDOWS = 1;  # MKS defines $SHELL but still acts like Windows
++    }
++}
++
++my $NN     = chr(27) . "[0m";  # normal
++   $NN     = "" if $ON_WINDOWS or !(-t STDERR); # -t STDERR:  is it a terminal?
++my $BB     = chr(27) . "[1m";  # bold
++   $BB     = "" if $ON_WINDOWS or !(-t STDERR);
++my $script = basename $0;
++my $usage  = "
++Usage: $script [options] <file(s)/dir(s)> | <set 1> <set 2> | <report files>
++
++ Count, or compute differences of, physical lines of source code in the
++ given files (may be archives such as compressed tarballs or zip files)
++ and/or recursively below the given directories.
++
++ ${BB}Input Options${NN}
++   --extract-with=<cmd>      This option is only needed if cloc is unable
++                             to figure out how to extract the contents of
++                             the input file(s) by itself.
++                             Use <cmd> to extract binary archive files (e.g.:
++                             .tar.gz, .zip, .Z).  Use the literal '>FILE<' as
++                             a stand-in for the actual file(s) to be
++                             extracted.  For example, to count lines of code
++                             in the input files
++                                gcc-4.2.tar.gz  perl-5.8.8.tar.gz
++                             on Unix use
++                               --extract-with='gzip -dc >FILE< | tar xf -'
++                             or, if you have GNU tar,
++                               --extract-with='tar zxf >FILE<'
++                             and on Windows use, for example:
++                               --extract-with=\"\\\"c:\\Program Files\\WinZip\\WinZip32.exe\\\" -e -o >FILE< .\"
++                             (if WinZip is installed there).
++   --list-file=<file>        Take the list of file and/or directory names to
++                             process from <file> which has one file/directory
++                             name per line.  See also --exclude-list-file.
++   --unicode                 Check binary files to see if they contain Unicode
++                             expanded ASCII text.  This causes performance to
++                             drop noticably.
++
++ ${BB}Processing Options${NN}
++   --autoconf                Count .in files (as processed by GNU autoconf) of
++                             recognized languages.
++   --by-file                 Report results for every source file encountered.
++   --by-file-by-lang         Report results for every source file encountered
++                             in addition to reporting by language.
++   --diff <set1> <set2>      Compute differences in code and comments between
++                             source file(s) of <set1> and <set2>.  The inputs
++                             may be pairs of files, directories, or archives.
++                             Use --diff-alignment to generate a list showing
++                             which file pairs where compared.  See also
++                             --ignore-case, --ignore-whitespace.
++   --diff-timeout <N>        Ignore files which take more than <N> seconds
++                             to process.  Default is 10 seconds.
++                             (Large files with many repeated lines can cause 
++                             Algorithm::Diff::sdiff() to take hours.)
++   --follow-links            [Unix only] Follow symbolic links to directories
++                             (sym links to files are always followed).
++   --force-lang=<lang>[,<ext>]
++                             Process all files that have a <ext> extension
++                             with the counter for language <lang>.  For
++                             example, to count all .f files with the
++                             Fortran 90 counter (which expects files to
++                             end with .f90) instead of the default Fortran 77
++                             counter, use
++                               --force-lang=\"Fortran 90\",f
++                             If <ext> is omitted, every file will be counted
++                             with the <lang> counter.  This option can be
++                             specified multiple times (but that is only
++                             useful when <ext> is given each time).
++                             See also --script-lang, --lang-no-ext.
++   --force-lang-def=<file>   Load language processing filters from <file>,
++                             then use these filters instead of the built-in
++                             filters.  Note:  languages which map to the same 
++                             file extension (for example:
++                             MATLAB/Objective C/MUMPS;  Pascal/PHP; 
++                             Lisp/OpenCL) will be ignored as these require 
++                             additional processing that is not expressed in 
++                             language definition files.  Use --read-lang-def 
++                             to define new language filters without replacing 
++                             built-in filters (see also --write-lang-def).
++   --ignore-whitespace       Ignore horizontal white space when comparing files
++                             with --diff.  See also --ignore-case.
++   --ignore-case             Ignore changes in case; consider upper- and lower-
++                             case letters equivalent when comparing files with
++                             --diff.  See also --ignore-whitespace.
++   --lang-no-ext=<lang>      Count files without extensions using the <lang>
++                             counter.  This option overrides internal logic
++                             for files without extensions (where such files
++                             are checked against known scripting languages
++                             by examining the first line for #!).  See also
++                             --force-lang, --script-lang.
++   --max-file-size=<MB>      Skip files larger than <MB> megabytes when
++                             traversing directories.  By default, <MB>=100.
++                             cloc's memory requirement is roughly twenty times 
++                             larger than the largest file so running with 
++                             files larger than 100 MB on a computer with less 
++                             than 2 GB of memory will cause problems.  
++                             Note:  this check does not apply to files 
++                             explicitly passed as command line arguments.
++   --read-binary-files       Process binary files in addition to text files.
++                             This is usually a bad idea and should only be
++                             attempted with text files that have embedded
++                             binary data.
++   --read-lang-def=<file>    Load new language processing filters from <file>
++                             and merge them with those already known to cloc.  
++                             If <file> defines a language cloc already knows 
++                             about, cloc's definition will take precedence.  
++                             Use --force-lang-def to over-ride cloc's 
++                             definitions (see also --write-lang-def ).
++   --script-lang=<lang>,<s>  Process all files that invoke <s> as a #!
++                             scripting language with the counter for language
++                             <lang>.  For example, files that begin with
++                                #!/usr/local/bin/perl5.8.8
++                             will be counted with the Perl counter by using
++                                --script-lang=Perl,perl5.8.8
++                             The language name is case insensitive but the
++                             name of the script language executable, <s>,
++                             must have the right case.  This option can be
++                             specified multiple times.  See also --force-lang,
++                             --lang-no-ext.
++   --sdir=<dir>              Use <dir> as the scratch directory instead of
++                             letting File::Temp chose the location.  Files
++                             written to this location are not removed at
++                             the end of the run (as they are with File::Temp).
++   --skip-uniqueness         Skip the file uniqueness check.  This will give
++                             a performance boost at the expense of counting
++                             files with identical contents multiple times
++                             (if such duplicates exist).
++   --stdin-name=<file>       Give a file name to use to determine the language
++                             for standard input.
++   --strip-comments=<ext>    For each file processed, write to the current
++                             directory a version of the file which has blank
++                             lines and comments removed.  The name of each
++                             stripped file is the original file name with
++                             .<ext> appended to it.  It is written to the
++                             current directory unless --original-dir is on.
++   --original-dir            [Only effective in combination with
++                             --strip-comments]  Write the stripped files
++                             to the same directory as the original files.
++   --sum-reports             Input arguments are report files previously
++                             created with the --report-file option.  Makes
++                             a cumulative set of results containing the
++                             sum of data from the individual report files.
++   --unix                    Override the operating system autodetection
++                             logic and run in UNIX mode.  See also
++                             --windows, --show-os.
++   --windows                 Override the operating system autodetection
++                             logic and run in Microsoft Windows mode.
++                             See also --unix, --show-os.
++
++ ${BB}Filter Options${NN}
++   --exclude-dir=<D1>[,D2,]  Exclude the given comma separated directories
++                             D1, D2, D3, et cetera, from being scanned.  For
++                             example  --exclude-dir=.cache,test  will skip
++                             all files that have /.cache/ or /test/ as part
++                             of their path.
++                             Directories named .bzr, .cvs, .hg, .git, and
++                             .svn are always excluded.
++   --exclude-ext=<ext1>[,<ext2>[...]]
++                             Do not count files having the given file name
++                             extensions.
++   --exclude-lang=<L1>[,L2,] Exclude the given comma separated languages
++                             L1, L2, L3, et cetera, from being counted.
++   --exclude-list-file=<file>  Ignore files and/or directories whose names
++                             appear in <file>.  <file> should have one entry
++                             per line.  Relative path names will be resolved
++                             starting from the directory where cloc is
++                             invoked.  See also --list-file.
++   --match-d=<regex>         Only count files in directories matching the Perl
++                             regex.  For example
++                               --match-d='/(src|include)/'
++                             only counts files in directories containing
++                             /src/ or /include/.
++   --not-match-d=<regex>     Count all files except those in directories
++                             matching the Perl regex.
++   --match-f=<regex>         Only count files whose basenames match the Perl
++                             regex.  For example
++                               --match-f='^[Ww]idget'
++                             only counts files that start with Widget or widget.
++   --not-match-f=<regex>     Count all files except those whose basenames
++                             match the Perl regex.
++   --skip-archive=<regex>    Ignore files that end with the given Perl regular
++                             expression.  For example, if given
++                               --skip-archive='(zip|tar(\.(gz|Z|bz2|xz|7z))?)'
++                             the code will skip files that end with .zip,
++                             .tar, .tar.gz, .tar.Z, .tar.bz2, .tar.xz, and
++                             .tar.7z.
++   --skip-win-hidden         On Windows, ignore hidden files.
++
++ ${BB}Debug Options${NN}
++   --categorized=<file>      Save names of categorized files to <file>.
++   --counted=<file>          Save names of processed source files to <file>.
++   --diff-alignment=<file>   Write to <file> a list of files and file pairs
++                             showing which files were added, removed, and/or
++                             compared during a run with --diff.  This switch
++                             forces the --diff mode on.
++   --help                    Print this usage information and exit.
++   --found=<file>            Save names of every file found to <file>.
++   --ignored=<file>          Save names of ignored files and the reason they
++                             were ignored to <file>.
++   --print-filter-stages     Print to STDOUT processed source code before and
++                             after each filter is applied.
++   --show-ext[=<ext>]        Print information about all known (or just the
++                             given) file extensions and exit.
++   --show-lang[=<lang>]      Print information about all known (or just the
++                             given) languages and exit.
++   --show-os                 Print the value of the operating system mode
++                             and exit.  See also --unix, --windows.
++   -v[=<n>]                  Verbose switch (optional numeric value).
++   --version                 Print the version of this program and exit.
++   --write-lang-def=<file>   Writes to <file> the language processing filters
++                             then exits.  Useful as a first step to creating
++                             custom language definitions (see also
++                             --force-lang-def, --read-lang-def).
++
++ ${BB}Output Options${NN}
++   --3                       Print third-generation language output.
++                             (This option can cause report summation to fail
++                             if some reports were produced with this option
++                             while others were produced without it.)
++   --progress-rate=<n>       Show progress update after every <n> files are
++                             processed (default <n>=100).  Set <n> to 0 to
++                             suppress progress output (useful when redirecting
++                             output to STDOUT).
++   --quiet                   Suppress all information messages except for
++                             the final report.
++   --report-file=<file>      Write the results to <file> instead of STDOUT.
++   --out=<file>              Synonym for --report-file=<file>.
++   --csv                     Write the results as comma separated values.
++   --csv-delimiter=<C>       Use the character <C> as the delimiter for comma
++                             separated files instead of ,.  This switch forces
++                             --csv to be on.
++   --sql=<file>              Write results as SQL create and insert statements
++                             which can be read by a database program such as
++                             SQLite.  If <file> is -, output is sent to STDOUT.
++   --sql-project=<name>      Use <name> as the project identifier for the
++                             current run.  Only valid with the --sql option.
++   --sql-append              Append SQL insert statements to the file specified
++                             by --sql and do not generate table creation
++                             statements.  Only valid with the --sql option.
++   --sum-one                 For plain text reports, show the SUM: output line
++                             even if only one input file is processed.
++   --xml                     Write the results in XML.
++   --xsl=<file>              Reference <file> as an XSL stylesheet within
++                             the XML output.  If <file> is 1 (numeric one),
++                             writes a default stylesheet, cloc.xsl (or
++                             cloc-diff.xsl if --diff is also given).
++                             This switch forces --xml on.
++   --yaml                    Write the results in YAML.
++
++";
++#  Help information for options not yet implemented:
++#  --inline                  Process comments that appear at the end
++#                            of lines containing code.
++#  --html                    Create HTML files of each input file showing
++#                            comment and code lines in different colors.
++
++$| = 1;  # flush STDOUT
++my $start_time = get_time();
++my (
++    $opt_categorized          ,
++    $opt_found                ,
++    @opt_force_lang           ,
++    $opt_lang_no_ext          ,
++    @opt_script_lang          ,
++    $opt_diff                 ,
++    $opt_diff_alignment       ,
++    $opt_diff_timeout         ,
++    $opt_html                 ,
++    $opt_ignored              ,
++    $opt_counted              ,
++    $opt_show_ext             ,
++    $opt_show_lang            ,
++    $opt_progress_rate        ,
++    $opt_print_filter_stages  ,
++    $opt_v                    ,
++    $opt_version              ,
++    $opt_exclude_lang         ,
++    $opt_exclude_list_file    ,
++    $opt_exclude_dir          ,
++    $opt_force_lang_def       ,
++    $opt_read_lang_def        ,
++    $opt_write_lang_def       ,
++    $opt_strip_comments       ,
++    $opt_original_dir         ,
++    $opt_quiet                ,
++    $opt_report_file          ,
++    $opt_sdir                 ,
++    $opt_sum_reports          ,
++    $opt_unicode              ,
++    $opt_no3                  ,   # accept it but don't use it
++    $opt_3                    ,
++    $opt_extract_with         ,
++    $opt_by_file              ,
++    $opt_by_file_by_lang      ,
++    $opt_xml                  ,
++    $opt_xsl                  ,
++    $opt_yaml                 ,
++    $opt_csv                  ,
++    $opt_csv_delimiter        ,
++    $opt_match_f              ,
++    $opt_not_match_f          ,
++    $opt_match_d              ,
++    $opt_not_match_d          ,
++    $opt_skip_uniqueness      ,
++    $opt_list_file            ,
++    $opt_help                 ,
++    $opt_skip_win_hidden      ,
++    $opt_read_binary_files    ,
++    $opt_sql                  ,
++    $opt_sql_append           ,
++    $opt_sql_project          ,
++    $opt_inline               ,
++    $opt_exclude_ext          ,
++    $opt_ignore_whitespace    ,
++    $opt_ignore_case          ,
++    $opt_follow_links         ,
++    $opt_autoconf             ,
++    $opt_sum_one              ,
++    $opt_stdin_name           ,
++    $opt_force_on_windows     ,
++    $opt_force_on_unix        ,   # actually forces !$ON_WINDOWS
++    $opt_show_os              ,
++    $opt_skip_archive         ,
++    $opt_max_file_size        ,   # in MB
++   );
++my $getopt_success = GetOptions(
++   "by_file|by-file"                         => \$opt_by_file             ,
++   "by_file_by_lang|by-file-by-lang"         => \$opt_by_file_by_lang     ,
++   "categorized=s"                           => \$opt_categorized         ,
++   "counted=s"                               => \$opt_counted             ,
++   "exclude_lang|exclude-lang=s"             => \$opt_exclude_lang        ,
++   "exclude_dir|exclude-dir=s"               => \$opt_exclude_dir         ,
++   "exclude_list_file|exclude-list-file=s"   => \$opt_exclude_list_file   ,
++   "extract_with|extract-with=s"             => \$opt_extract_with        ,
++   "found=s"                                 => \$opt_found               ,
++   "diff"                                    => \$opt_diff                ,
++   "diff-alignment|diff_alignment=s"         => \$opt_diff_alignment      ,
++   "diff-timeout|diff_timeout=i"             => \$opt_diff_timeout        ,
++   "html"                                    => \$opt_html                ,
++   "ignored=s"                               => \$opt_ignored             ,
++   "quiet"                                   => \$opt_quiet               ,
++   "force_lang_def|force-lang-def=s"         => \$opt_force_lang_def      ,
++   "read_lang_def|read-lang-def=s"           => \$opt_read_lang_def       ,
++   "show_ext|show-ext:s"                     => \$opt_show_ext            ,
++   "show_lang|show-lang:s"                   => \$opt_show_lang           ,
++   "progress_rate|progress-rate=i"           => \$opt_progress_rate       ,
++   "print_filter_stages|print-filter-stages" => \$opt_print_filter_stages ,
++   "report_file|report-file=s"               => \$opt_report_file         ,
++   "out=s"                                   => \$opt_report_file         ,
++   "script_lang|script-lang=s"               => \@opt_script_lang         ,
++   "sdir=s"                                  => \$opt_sdir                ,
++   "skip_uniqueness|skip-uniqueness"         => \$opt_skip_uniqueness     ,
++   "strip_comments|strip-comments=s"         => \$opt_strip_comments      ,
++   "original_dir|original-dir"               => \$opt_original_dir        ,
++   "sum_reports|sum-reports"                 => \$opt_sum_reports         ,
++   "unicode"                                 => \$opt_unicode             ,
++   "no3"                                     => \$opt_no3                 ,  # ignored
++   "3"                                       => \$opt_3                   ,
++   "v:i"                                     => \$opt_v                   ,
++   "version"                                 => \$opt_version             ,
++   "write_lang_def|write-lang-def=s"         => \$opt_write_lang_def      ,
++   "xml"                                     => \$opt_xml                 ,
++   "xsl=s"                                   => \$opt_xsl                 ,
++   "force_lang|force-lang=s"                 => \@opt_force_lang          ,
++   "lang_no_ext|lang-no-ext=s"               => \$opt_lang_no_ext         ,
++   "yaml"                                    => \$opt_yaml                ,
++   "csv"                                     => \$opt_csv                 ,
++   "csv_delimeter|csv-delimiter=s"           => \$opt_csv_delimiter       ,
++   "match_f|match-f=s"                       => \$opt_match_f             ,
++   "not_match_f|not-match-f=s"               => \$opt_not_match_f         ,
++   "match_d|match-d=s"                       => \$opt_match_d             ,
++   "not_match_d|not-match-d=s"               => \$opt_not_match_d         ,
++   "list_file|list-file=s"                   => \$opt_list_file           ,
++   "help"                                    => \$opt_help                ,
++   "skip_win_hidden|skip-win-hidden"         => \$opt_skip_win_hidden     ,
++   "read_binary_files|read-binary-files"     => \$opt_read_binary_files   ,
++   "sql=s"                                   => \$opt_sql                 ,
++   "sql_project|sql-project=s"               => \$opt_sql_project         ,
++   "sql_append|sql-append"                   => \$opt_sql_append          ,
++   "inline"                                  => \$opt_inline              ,
++   "exclude_ext|exclude-ext=s"               => \$opt_exclude_ext         ,
++   "ignore_whitespace|ignore-whitespace"     => \$opt_ignore_whitespace   ,
++   "ignore_case|ignore-case"                 => \$opt_ignore_case         ,
++   "follow_links|follow-links"               => \$opt_follow_links        ,
++   "autoconf"                                => \$opt_autoconf            ,
++   "sum_one|sum-one"                         => \$opt_sum_one             ,
++   "stdin_name|stdin-name=s"                 => \$opt_stdin_name          ,
++   "windows"                                 => \$opt_force_on_windows    ,
++   "unix"                                    => \$opt_force_on_unix       ,
++   "show_os|show-os"                         => \$opt_show_os             ,
++   "skip_archive|skip-archive=s"             => \$opt_skip_archive        ,
++   "max_file_size|max-file-size=i"           => \$opt_max_file_size       ,
++  );
++$opt_by_file  = 1 if defined  $opt_by_file_by_lang;
++my $CLOC_XSL = "cloc.xsl"; # created with --xsl
++   $CLOC_XSL = "cloc-diff.xsl" if $opt_diff;
++die "\n" unless $getopt_success;
++die $usage if $opt_help;
++my %Exclude_Language = ();
++   %Exclude_Language = map { $_ => 1 } split(/,/, $opt_exclude_lang) 
++        if $opt_exclude_lang;
++my %Exclude_Dir      = ();
++   %Exclude_Dir      = map { $_ => 1 } split(/,/, $opt_exclude_dir ) 
++        if $opt_exclude_dir ;
++# Forcibly exclude .svn, .cvs, .hg, .git, .bzr directories.  The contents of these
++# directories often conflict with files of interest.
++$opt_exclude_dir       = 1;
++$Exclude_Dir{".svn"}   = 1;
++$Exclude_Dir{".cvs"}   = 1;
++$Exclude_Dir{".hg"}    = 1;
++$Exclude_Dir{".git"}   = 1;
++$Exclude_Dir{".bzr"}   = 1;
++$opt_diff              = 1  if $opt_diff_alignment;
++$opt_exclude_ext       = "" unless $opt_exclude_ext;
++$opt_ignore_whitespace = 0  unless $opt_ignore_whitespace;
++$opt_ignore_case       = 0  unless $opt_ignore_case;
++$opt_lang_no_ext       = 0  unless $opt_lang_no_ext;
++$opt_follow_links      = 0  unless $opt_follow_links;
++$opt_diff_timeout      =10  unless $opt_diff_timeout;
++$opt_csv               = 1  if $opt_csv_delimiter;
++$ON_WINDOWS            = 1  if $opt_force_on_windows;
++$ON_WINDOWS            = 0  if $opt_force_on_unix;
++$opt_max_file_size     = 100 unless $opt_max_file_size;
++
++# Options defaults:
++$opt_progress_rate = 100 unless defined $opt_progress_rate;
++if (!defined $opt_v) {
++    $opt_v  = 0;
++} elsif (!$opt_v) {
++    $opt_v  = 1;
++}
++if (defined $opt_xsl) {
++    $opt_xsl = $CLOC_XSL if $opt_xsl eq "1";
++    $opt_xml = 1;
++}
++my $skip_generate_report = 0;
++$opt_sql = 0 unless defined $opt_sql;
++if ($opt_sql eq "-" || $opt_sql eq "1") { # stream SQL output to STDOUT
++    $opt_quiet            = 1;
++    $skip_generate_report = 1;
++    $opt_by_file          = 1;
++    $opt_sum_reports      = 0;
++    $opt_progress_rate    = 0;
++} elsif ($opt_sql)  { # write SQL output to a file
++    $opt_by_file          = 1;
++    $skip_generate_report = 1;
++    $opt_sum_reports      = 0;
++}
++
++die $usage unless defined $opt_version         or
++                  defined $opt_show_lang       or
++                  defined $opt_show_ext        or
++                  defined $opt_show_os         or
++                  defined $opt_write_lang_def  or
++                  defined $opt_list_file       or
++                  defined $opt_xsl             or
++                  scalar @ARGV >= 1;
++die "--diff requires at least two arguments\n" 
++    if $opt_diff and scalar @ARGV < 2;
++if ($opt_version) {
++    printf "$VERSION\n";
++    exit;
++}
++# 1}}}
++# Step 1:  Initialize global constants.        {{{1
++#
++my $nFiles_Found = 0;  # updated in make_file_list
++my (%Language_by_Extension, %Language_by_Script,
++    %Filters_by_Language, %Not_Code_Extension, %Not_Code_Filename,
++    %Language_by_File, %Scale_Factor, %Known_Binary_Archives,
++    %EOL_Continuation_re,
++   );
++my $ALREADY_SHOWED_HEADER = 0;
++my $ALREADY_SHOWED_XML_SECTION = 0;
++my %Error_Codes = ( 'Unable to read'                => -1,
++                    'Neither file nor directory'    => -2, 
++                    'Diff error (quoted comments?)' => -3, 
++                    'Diff error, exceeded timeout'  => -4, 
++                  );
++if ($opt_force_lang_def) {
++    # replace cloc's definitions
++    read_lang_def(
++        $opt_force_lang_def    , #        Sample values:
++        \%Language_by_Extension, # Language_by_Extension{f}    = 'Fortran 77' 
++        \%Language_by_Script   , # Language_by_Script{sh}      = 'Bourne Shell'
++        \%Language_by_File     , # Language_by_File{makefile}  = 'make'
++        \%Filters_by_Language  , # Filters_by_Language{Bourne Shell}[0] = 
++                                 #      [ 'remove_matches' , '^\s*#'  ]
++        \%Not_Code_Extension   , # Not_Code_Extension{jpg}     = 1
++        \%Not_Code_Filename    , # Not_Code_Filename{README}   = 1
++        \%Scale_Factor         , # Scale_Factor{Perl}          = 4.0
++        \%EOL_Continuation_re  , # EOL_Continuation_re{C++}    = '\\$'
++        );
++} else {
++    set_constants(               #
++        \%Language_by_Extension, # Language_by_Extension{f}    = 'Fortran 77' 
++        \%Language_by_Script   , # Language_by_Script{sh}      = 'Bourne Shell'
++        \%Language_by_File     , # Language_by_File{makefile}  = 'make'
++        \%Filters_by_Language  , # Filters_by_Language{Bourne Shell}[0] = 
++                                 #      [ 'remove_matches' , '^\s*#'  ]
++        \%Not_Code_Extension   , # Not_Code_Extension{jpg}     = 1
++        \%Not_Code_Filename    , # Not_Code_Filename{README}   = 1
++        \%Scale_Factor         , # Scale_Factor{Perl}          = 4.0
++        \%Known_Binary_Archives, # Known_Binary_Archives{.tar} = 1
++        \%EOL_Continuation_re  , # EOL_Continuation_re{C++}    = '\\$'
++        );
++}
++if ($opt_read_lang_def) {
++    # augment cloc's definitions (keep cloc's where there are overlaps)
++    merge_lang_def(
++        $opt_read_lang_def     , #        Sample values:
++        \%Language_by_Extension, # Language_by_Extension{f}    = 'Fortran 77' 
++        \%Language_by_Script   , # Language_by_Script{sh}      = 'Bourne Shell'
++        \%Language_by_File     , # Language_by_File{makefile}  = 'make'
++        \%Filters_by_Language  , # Filters_by_Language{Bourne Shell}[0] = 
++                                 #      [ 'remove_matches' , '^\s*#'  ]
++        \%Not_Code_Extension   , # Not_Code_Extension{jpg}     = 1
++        \%Not_Code_Filename    , # Not_Code_Filename{README}   = 1
++        \%Scale_Factor         , # Scale_Factor{Perl}          = 4.0
++        \%EOL_Continuation_re  , # EOL_Continuation_re{C++}    = '\\$'
++        );
++}
++if ($opt_lang_no_ext and !defined $Filters_by_Language{$opt_lang_no_ext}) {
++    die_unknown_lang($opt_lang_no_ext, "--lang-no-ext")
++}
++
++# Process command line provided extention-to-language mapping overrides.
++# Make a hash of known languages in lower case for easier matching.
++my %Recognized_Language_lc = (); # key = language name in lc, value = true name
++foreach my $language (keys %Filters_by_Language) {
++    my $lang_lc = lc $language;
++    $Recognized_Language_lc{$lang_lc} = $language;
++}
++my %Forced_Extension = (); # file name extensions which user wants to count
++my $All_One_Language = 0;  # set to !0 if --force-lang's <ext> is missing
++foreach my $pair (@opt_force_lang) {
++    my ($lang, $extension) = split(',', $pair);
++    my $lang_lc = lc $lang;
++    if (defined $extension) {
++        $Forced_Extension{$extension} = $lang;
++
++        die_unknown_lang($lang, "--force-lang")
++            unless $Recognized_Language_lc{$lang_lc}; 
++
++        $Language_by_Extension{$extension} = $Recognized_Language_lc{$lang_lc};
++    } else {
++        # the scary case--count everything as this language
++        $All_One_Language = $Recognized_Language_lc{$lang_lc};
++    }
++}
++
++foreach my $pair (@opt_script_lang) {
++    my ($lang, $script_name) = split(',', $pair);
++    my $lang_lc = lc $lang;
++    if (!defined $script_name) {
++        die "The --script-lang option requires a comma separated pair of ".
++            "strings.\n";
++    }
++
++    die_unknown_lang($lang, "--script-lang")
++        unless $Recognized_Language_lc{$lang_lc}; 
++
++    $Language_by_Script{$script_name} = $Recognized_Language_lc{$lang_lc};
++}
++
++# If user provided file extensions to ignore, add these to
++# the exclusion list.
++foreach my $ext (map { $_ => 1 } split(/,/, $opt_exclude_ext ) ) {
++    $ext = lc $ext if $ON_WINDOWS;
++    $Not_Code_Extension{$ext} = 1;
++}
++
++# If SQL or --by-file output is requested, keep track of directory names
++# generated by File::Temp::tempdir and used to temporarily hold the results
++# of compressed archives.  Contents of the SQL table 't' will be much
++# cleaner if these meaningless directory names are stripped from the front
++# of files pulled from the archives.
++my %TEMP_DIR = ();
++my $TEMP_OFF =  0;  # Needed for --sdir; keep track of the number of
++                    # scratch directories made in this run to avoid
++                    # file overwrites by multiple extractions to same
++                    # sdir.
++# Also track locations where temporary installations, if necessary, of
++# Algorithm::Diff and/or Regexp::Common are done.  Make sure these 
++# directories are not counted as inputs (ref bug #80 2012-11-23).
++my %TEMP_INST = ();
++
++# invert %Language_by_Script hash to get an easy-to-look-up list of known
++# scripting languages
++my %Script_Language = map { $_ => 1 } values %Language_by_Script ;
++# 1}}}
++# Step 2:  Early exits for display, summation. {{{1
++#
++print_extension_info($opt_show_ext ) if defined $opt_show_ext ;
++print_language_info( $opt_show_lang) if defined $opt_show_lang;
++exit if (defined $opt_show_ext) or (defined $opt_show_lang);
++
++#print "Before glob have [", join(",", @ARGV), "]\n";
++@ARGV = windows_glob(@ARGV) if $ON_WINDOWS;
++#print "after  glob have [", join(",", @ARGV), "]\n";
++
++# filter out archive files if requested to do so
++if (defined $opt_skip_archive) {
++    my @non_archive = ();
++    foreach my $candidate (@ARGV) {
++        if ($candidate !~ m/${opt_skip_archive}$/) {
++            push @non_archive, $candidate;
++
++        } 
++    }
++    @ARGV = @non_archive;
++}
++
++if ($opt_sum_reports and $opt_diff) {
++    my @results = ();
++    if ($opt_list_file) { # read inputs from the list file
++        my @list = read_list_file($opt_list_file);
++        @results = combine_diffs(\@list);
++    } else { # get inputs from the command line
++        @results = combine_diffs(\@ARGV);
++    }
++    if ($opt_report_file) {
++        write_file($opt_report_file, @results);
++    } else {
++        print "\n", join("\n", @results), "\n";
++    }
++    exit;
++}
++if ($opt_sum_reports) {
++    my %Results = ();
++    foreach my $type( "by language", "by report file" ) {
++        my $found_lang = undef; 
++        if ($opt_list_file) { # read inputs from the list file
++            my @list = read_list_file($opt_list_file);
++            $found_lang = combine_results(\@list, 
++                                           $type, 
++                                          \%{$Results{ $type }}, 
++                                          \%Filters_by_Language );
++        } else { # get inputs from the command line
++            $found_lang = combine_results(\@ARGV, 
++                                           $type, 
++                                          \%{$Results{ $type }}, 
++                                          \%Filters_by_Language );
++        }
++        next unless %Results;
++        my $end_time = get_time();
++        my @results  = generate_report($VERSION, $end_time - $start_time,
++                                       $type,
++                                      \%{$Results{ $type }}, \%Scale_Factor);
++        if ($opt_report_file) {
++            my $ext  = ".lang";
++               $ext  = ".file" unless $type eq "by language";
++            next if !$found_lang and  $ext  eq ".lang";
++            write_file($opt_report_file . $ext, @results);
++        } else {
++            print "\n", join("\n", @results), "\n";
++        }
++    }
++    exit;
++}
++if ($opt_write_lang_def) {
++    write_lang_def($opt_write_lang_def   ,
++                  \%Language_by_Extension,
++                  \%Language_by_Script   ,
++                  \%Language_by_File     ,
++                  \%Filters_by_Language  ,
++                  \%Not_Code_Extension   ,
++                  \%Not_Code_Filename    ,
++                  \%Scale_Factor         ,
++                  \%EOL_Continuation_re  ,
++                  );
++    exit;
++}
++if ($opt_show_os) {
++    if ($ON_WINDOWS) {
++        print "Windows\n";
++    } else {
++        print "UNIX\n";
++    }
++    exit;
++}
++# 1}}}
++# Step 3:  Create a list of files to consider. {{{1
++#  a) If inputs are binary archives, first cd to a temp
++#     directory, expand the archive with the user-given
++#     extraction tool, then add the temp directory to
++#     the list of dirs to process.
++#  b) Create a list of every file that might contain source
++#     code.  Ignore binary files, zero-sized files, and
++#     any file in a directory the user says to exclude.
++#  c) Determine the language for each file in the list.
++#
++my @binary_archive = ();
++my $cwd            = cwd();
++if ($opt_extract_with) {
++#print "cwd main = [$cwd]\n";
++    my @extract_location = ();
++    foreach my $bin_file (@ARGV) {
++        my $extract_dir = undef;
++        if ($opt_sdir) {
++            ++$TEMP_OFF;
++            $extract_dir = "$opt_sdir/$TEMP_OFF";
++            File::Path::rmtree($extract_dir) if     is_dir($extract_dir);
++            File::Path::mkpath($extract_dir) unless is_dir($extract_dir);
++        } else {
++            $extract_dir = tempdir( CLEANUP => 1 );  # 1 = delete on exit
++        }
++        $TEMP_DIR{ $extract_dir } = 1 if $opt_sql or $opt_by_file;
++        print "mkdir $extract_dir\n"  if $opt_v;
++        print "cd    $extract_dir\n"  if $opt_v;
++        chdir $extract_dir;
++        my $bin_file_full_path = "";
++        if (File::Spec->file_name_is_absolute( $bin_file )) {
++            $bin_file_full_path = $bin_file;
++#print "bin_file_full_path (was ful) = [$bin_file_full_path]\n";
++        } else {
++            $bin_file_full_path = File::Spec->catfile( $cwd, $bin_file );
++#print "bin_file_full_path (was rel) = [$bin_file_full_path]\n";
++        }
++        my     $extract_cmd = uncompress_archive_cmd($bin_file_full_path);
++        print  $extract_cmd, "\n" if $opt_v;
++        system $extract_cmd;
++        push @extract_location, $extract_dir;
++        chdir $cwd;
++    }
++    # It is possible that the binary archive itself contains additional
++    # files compressed the same way (true for Java .ear files).  Go
++    # through all the files that were extracted, see if they are binary
++    # archives and try to extract them.  Lather, rinse, repeat.
++    my $binary_archives_exist = 1;
++    my $count_binary_archives = 0;
++    my $previous_count        = 0;
++    my $n_pass                = 0;
++    while ($binary_archives_exist) {
++        @binary_archive = ();
++        foreach my $dir (@extract_location) {
++            find(\&archive_files, $dir);  # populates global @binary_archive
++        }
++        foreach my $archive (@binary_archive) {
++            my $extract_dir = undef;
++            if ($opt_sdir) {
++                ++$TEMP_OFF;
++                $extract_dir = "$opt_sdir/$TEMP_OFF";
++                File::Path::rmtree($extract_dir) if     is_dir($extract_dir);
++                File::Path::mkpath($extract_dir) unless is_dir($extract_dir);
++            } else {
++                $extract_dir = tempdir( CLEANUP => 1 );  # 1 = delete on exit
++            }
++            $TEMP_DIR{ $extract_dir } = 1 if $opt_sql or $opt_by_file;
++            print "mkdir $extract_dir\n"  if $opt_v;
++            print "cd    $extract_dir\n"  if $opt_v;
++            chdir  $extract_dir;
++
++            my     $extract_cmd = uncompress_archive_cmd($archive);
++            print  $extract_cmd, "\n" if $opt_v;
++            system $extract_cmd;
++            push @extract_location, $extract_dir;
++            unlink $archive;  # otherwise will be extracting it forever 
++        }
++        $count_binary_archives = scalar @binary_archive;
++        if ($count_binary_archives == $previous_count) {
++            $binary_archives_exist = 0;
++        }
++        $previous_count = $count_binary_archives;
++    }
++    chdir $cwd;
++
++    @ARGV = @extract_location;
++} else {
++    # see if any of the inputs need to be auto-uncompressed &/or expanded
++    my @updated_ARGS = ();
++    foreach my $Arg (@ARGV) {
++        if (is_dir($Arg)) {
++            push @updated_ARGS, $Arg;
++            next;
++        }
++        my $full_path = "";
++        if (File::Spec->file_name_is_absolute( $Arg )) {
++            $full_path = $Arg;
++        } else {
++            $full_path = File::Spec->catfile( $cwd, $Arg );
++        }
++#print "full_path = [$full_path]\n";
++        my $extract_cmd = uncompress_archive_cmd($full_path);
++        if ($extract_cmd) {
++            my $extract_dir = undef;
++            if ($opt_sdir) {
++                ++$TEMP_OFF;
++                $extract_dir = "$opt_sdir/$TEMP_OFF";
++                File::Path::rmtree($extract_dir) if     is_dir($extract_dir);
++                File::Path::mkpath($extract_dir) unless is_dir($extract_dir);
++            } else {
++                $extract_dir = tempdir( CLEANUP => 1 ); # 1 = delete on exit
++            }
++            $TEMP_DIR{ $extract_dir } = 1 if $opt_sql or $opt_by_file;
++            print "mkdir $extract_dir\n"  if $opt_v;
++            print "cd    $extract_dir\n"  if $opt_v;
++            chdir  $extract_dir;
++            print  $extract_cmd, "\n" if $opt_v;
++            system $extract_cmd;
++            push @updated_ARGS, $extract_dir;
++            chdir $cwd;
++        } else {
++            # this is a conventional, uncompressed, unarchived file
++            # or a directory; keep as-is
++            push @updated_ARGS, $Arg;
++        }
++    }
++    @ARGV = @updated_ARGS;
++
++    # make sure we're not counting any directory containing
++    # temporary installations of Regexp::Common, Algorithm::Diff
++    foreach my $d (sort keys %TEMP_INST) {
++        foreach my $a (@ARGV) {
++            next unless is_dir($a);
++            if ($opt_v > 2) {
++                printf "Comparing %s (location of %s) to input [%s]\n",
++                        $d, $TEMP_INST{$d}, $a;
++            }
++            if ($a eq $d) {
++                die "File::Temp::tempdir chose directory ",
++                    $d, " to install ", $TEMP_INST{$d}, " but this ",
++                    "matches one of your input directories.  Rerun ",
++                    "with --sdir and supply a different temporary ",
++                    "directory for ", $TEMP_INST{$d}, "\n";
++            }
++        }
++    }
++}
++# 1}}}
++my @Errors    = ();
++my @file_list = ();  # global variable updated in files()
++my %Ignored   = ();  # files that are not counted (language not recognized or
++                     # problems reading the file)
++my @Lines_Out = ();
++if ($opt_diff) {
++# Step 4:  Separate code from non-code files.  {{{1
++my @fh            = ();
++my @files_for_set = ();
++# make file lists for each separate argument
++if ($opt_exclude_list_file) {
++    process_exclude_list_file($opt_exclude_list_file, 
++                             \%Exclude_Dir,
++                             \%Ignored);
++}
++for (my $i = 0; $i < scalar @ARGV; $i++) {
++    push @fh, 
++         make_file_list([ $ARGV[$i] ], \%Error_Codes, \@Errors, \%Ignored);
++    @{$files_for_set[$i]} = @file_list;
++    @file_list = ();
++}
++# 1}}}
++# Step 5:  Remove duplicate files.             {{{1
++#
++my %Language           = ();
++my %unique_source_file = ();
++my $n_set = 0;
++foreach my $FH (@fh) {  # loop over each pair of file sets
++    ++$n_set;
++    remove_duplicate_files($FH, 
++                               \%{$Language{$FH}}               , 
++                               \%{$unique_source_file{$FH}}     , 
++                          \%Error_Codes                         , 
++                               \@Errors                         , 
++                               \%Ignored                        );
++    printf "%2d: %8d unique file%s.                          \r", 
++        $n_set,
++        plural_form(scalar keys %unique_source_file) 
++        unless $opt_quiet;
++}
++# 1}}}
++# Step 6:  Count code, comments, blank lines.  {{{1
++#
++my %Results_by_Language = ();
++my %Results_by_File     = ();
++my %Delta_by_Language   = ();
++my %Delta_by_File       = ();
++my $nFiles_added        = 0;
++my $nFiles_removed      = 0;
++my $nFiles_modified     = 0;
++my $nFiles_same         = 0;
++
++foreach (my $F = 0; $F < scalar @fh - 1; $F++) { 
++    # loop over file sets; do diff between set $F to $F+1
++
++    my $nCounted = 0;
++
++    my @file_pairs    = ();
++    my @files_added   = ();
++    my @files_removed = ();
++
++    align_by_pairs(\%{$unique_source_file{$fh[$F  ]}}    , # in
++                   \%{$unique_source_file{$fh[$F+1]}}    , # in
++                   \@files_added                         , # out
++                   \@files_removed                       , # out
++                   \@file_pairs                          , # out
++                   );
++    my %already_counted = (); # already_counted{ filename } = 1
++                              
++    if (!@file_pairs) {
++        # Special case where all files were either added or deleted.
++        # In this case, one of these arrays will be empty: 
++        #   @files_added, @files_removed
++        # so loop over both to cover both cases.
++        my $status = @files_added ? 'added' : 'removed';
++        my $offset = @files_added ? 1       : 0        ;
++        foreach my $file (@files_added, @files_removed) {
++            next unless defined $Language{$fh[$F+$offset]}{$file};
++            my $Lang = $Language{$fh[$F+$offset]}{$file};
++            next if $Lang eq '(unknown)';
++            my ($all_line_count,
++                $blank_count   ,
++                $comment_count ,
++               ) = call_counter($file, $Lang, \@Errors);
++            $already_counted{$file} = 1;
++            my $code_count = $all_line_count-$blank_count-$comment_count;
++            if ($opt_by_file) {
++                $Delta_by_File{$file}{'code'   }{$status} += $code_count   ;
++                $Delta_by_File{$file}{'blank'  }{$status} += $blank_count  ;
++                $Delta_by_File{$file}{'comment'}{$status} += $comment_count;
++                $Delta_by_File{$file}{'lang'   }{$status}  = $Lang         ;
++                $Delta_by_File{$file}{'nFiles' }{$status} += 1             ;
++            }
++            $Delta_by_Language{$Lang}{'code'   }{$status} += $code_count   ;
++            $Delta_by_Language{$Lang}{'blank'  }{$status} += $blank_count  ;
++            $Delta_by_Language{$Lang}{'comment'}{$status} += $comment_count;
++            $Delta_by_Language{$Lang}{'nFiles' }{$status} += 1             ;
++        }
++    }
++   #use Data::Dumper::Simple;
++   #use Data::Dumper;
++   #print Dumper(\@files_added, \@files_removed, \@file_pairs);
++    my @alignment = (); # only  used if --diff-alignment
++#print "after align_by_pairs:\n";
++
++#print "added:\n";
++    push @alignment, sprintf "Files added: %d\n", scalar @files_added
++        if $opt_diff_alignment;
++    foreach my $f (@files_added) {
++        next if $already_counted{$f};
++#printf "%10s -> %s\n", $f, $Language{$fh[$F+1]}{$f};
++        # Don't proceed unless the file (both L and R versions)
++        # is in a known language.
++        next if $Language{$fh[$F+1]}{$f} eq "(unknown)";
++        next if $Exclude_Language{$Language{$fh[$F+1]}{$f}};
++        push @alignment, sprintf "  + %s ; %s\n", $f, $Language{$fh[$F+1]}{$f}
++            if $opt_diff_alignment;
++        ++$Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'nFiles'}{'added'};
++        # Additionally, add contents of file $f to 
++        #        Delta_by_File{$f}{comment/blank/code}{'added'}
++        #        Delta_by_Language{$lang}{comment/blank/code}{'added'}
++        my ($all_line_count,
++            $blank_count   ,
++            $comment_count ,
++           ) = call_counter($f, $Language{$fh[$F+1]}{$f}, \@Errors);
++        $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'comment'}{'added'} +=
++            $comment_count;
++        $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'blank'}{'added'}   +=
++            $blank_count;
++        $Delta_by_Language{ $Language{$fh[$F+1]}{$f} }{'code'}{'added'}    +=
++            $all_line_count - $blank_count - $comment_count;
++        $Delta_by_File{ $f }{'comment'}{'added'} = $comment_count;
++        $Delta_by_File{ $f }{'blank'}{'added'}   = $blank_count;
++        $Delta_by_File{ $f }{'code'}{'added'}    = 
++            $all_line_count - $blank_count - $comment_count;
++    }
++    push @alignment, "\n";
++
++#print "removed:\n";
++    push @alignment, sprintf "Files removed: %d\n", scalar @files_removed
++        if $opt_diff_alignment;
++    foreach my $f (@files_removed) {
++        next if $already_counted{$f};
++        # Don't proceed unless the file (both L and R versions)
++        # is in a known language.
++        next if $Language{$fh[$F  ]}{$f} eq "(unknown)";
++        next if $Exclude_Language{$Language{$fh[$F  ]}{$f}};
++        ++$Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'nFiles'}{'removed'};
++        push @alignment, sprintf "  - %s ; %s\n", $f, $Language{$fh[$F]}{$f}
++            if $opt_diff_alignment;
++#printf "%10s -> %s\n", $f, $Language{$fh[$F  ]}{$f};
++        # Additionally, add contents of file $f to 
++        #        Delta_by_File{$f}{comment/blank/code}{'removed'}
++        #        Delta_by_Language{$lang}{comment/blank/code}{'removed'}
++        my ($all_line_count,
++            $blank_count   ,
++            $comment_count ,
++           ) = call_counter($f, $Language{$fh[$F  ]}{$f}, \@Errors);
++        $Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'comment'}{'removed'} +=
++            $comment_count;
++        $Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'blank'}{'removed'}   +=
++            $blank_count;
++        $Delta_by_Language{ $Language{$fh[$F  ]}{$f} }{'code'}{'removed'}    +=
++            $all_line_count - $blank_count - $comment_count;
++        $Delta_by_File{ $f }{'comment'}{'removed'} = $comment_count;
++        $Delta_by_File{ $f }{'blank'}{'removed'}   = $blank_count;
++        $Delta_by_File{ $f }{'code'}{'removed'}    = 
++            $all_line_count - $blank_count - $comment_count;
++    }
++    push @alignment, "\n";
++
++    my $alignment_pairs_index = scalar @alignment;
++    my $n_file_pairs_compared = 0;
++    # Don't know ahead of time how many file pairs will be compared
++    # since duplicates are weeded out below.  The answer is
++    # scalar @file_pairs only if there are no duplicates.
++    push @alignment, sprintf "File pairs compared: UPDATE_ME\n"
++        if $opt_diff_alignment;
++
++    foreach my $pair (@file_pairs) {
++        my $file_L = $pair->[0];
++        my $file_R = $pair->[1];
++        my $Lang_L = $Language{$fh[$F  ]}{$file_L};
++        my $Lang_R = $Language{$fh[$F+1]}{$file_R};
++#print "main step 6 file_L=$file_L    file_R=$file_R\n";
++        ++$nCounted;
++        printf "Counting:  %d\r", $nCounted 
++            unless (!$opt_progress_rate or ($nCounted % $opt_progress_rate));
++        next if $Ignored{$file_L};
++
++        # filter out excluded or unrecognized languages
++        if ($Exclude_Language{$Lang_L} or $Exclude_Language{$Lang_R}) {
++            $Ignored{$file_L} = "--exclude-lang=$Lang_L}";
++            $Ignored{$file_R} = "--exclude-lang=$Lang_R}";
++            next;
++        }
++        my $not_Filters_by_Language_Lang_LR = 0;
++        if ($PERL_516) {
++            if (!(@{$Filters_by_Language{$Lang_L} }) or
++                !(@{$Filters_by_Language{$Lang_R} })) {
++                $not_Filters_by_Language_Lang_LR = 1;
++            }
++        } else {
++            if (!defined(@{$Filters_by_Language{$Lang_L} }) or
++                !defined(@{$Filters_by_Language{$Lang_R} })) {
++                $not_Filters_by_Language_Lang_LR = 1;
++            }
++        }
++        if ($not_Filters_by_Language_Lang_LR) {
++            if (($Lang_L eq "(unknown)") or ($Lang_R eq "(unknown)")) {
++                $Ignored{$fh[$F  ]}{$file_L} = "language unknown (#1)";
++                $Ignored{$fh[$F+1]}{$file_R} = "language unknown (#1)";
++            } else {
++                $Ignored{$fh[$F  ]}{$file_L} = "missing Filters_by_Language{$Lang_L}";
++                $Ignored{$fh[$F+1]}{$file_R} = "missing Filters_by_Language{$Lang_R}";
++            }
++            next;
++        }
++
++#print "DIFF($file_L, $file_R)\n";
++        # step 0: compare the two files' contents 
++        chomp ( my @lines_L = read_file($file_L) );
++        chomp ( my @lines_R = read_file($file_R) );
++        my $language_file_L = "";
++        if (defined $Language{$fh[$F]}{$file_L}) {
++            $language_file_L = $Language{$fh[$F]}{$file_L};
++        } else {
++            # files $file_L and $file_R do not contain known language
++            next;
++        }
++        my $contents_are_same = 1;
++        if (scalar @lines_L == scalar @lines_R) {
++            # same size, must compare line-by-line
++            for (my $i = 0; $i < scalar @lines_L; $i++) {
++                if ($lines_L[$i] ne $lines_R[$i]) {
++                    $contents_are_same = 0;
++                    last;
++                }
++            }
++            if ($contents_are_same) {
++                ++$Delta_by_Language{$language_file_L}{'nFiles'}{'same'};
++            } else {
++                ++$Delta_by_Language{$language_file_L}{'nFiles'}{'modified'};
++            }
++        } else {
++            $contents_are_same = 0;
++            # different sizes, contents have changed
++            ++$Delta_by_Language{$language_file_L}{'nFiles'}{'modified'};
++        }
++        if ($opt_diff_alignment) {
++            my $str =  "$file_L | $file_R ; $language_file_L";
++            if ($contents_are_same) {
++                push @alignment, "  == $str";
++            } else {
++                push @alignment, "  != $str";
++            }
++            ++$n_file_pairs_compared;
++        }
++
++        # step 1: identify comments in both files
++#print "Diff blank removal L language= $Lang_L";
++#print " scalar(lines_L)=", scalar @lines_L, "\n";
++        my @original_minus_blanks_L 
++                    = rm_blanks(  \@lines_L, $Lang_L, \%EOL_Continuation_re);
++#print "1: scalar(original_minus_blanks_L)=", scalar @original_minus_blanks_L, "\n";
++        @lines_L    = @original_minus_blanks_L;
++#print "2: scalar(lines_L)=", scalar @lines_L, "\n";
++        @lines_L    = add_newlines(\@lines_L); # compensate for rm_comments()
++        @lines_L    = rm_comments( \@lines_L, $Lang_L, $file_L,
++                                   \%EOL_Continuation_re);
++#print "3: scalar(lines_L)=", scalar @lines_L, "\n";
++
++#print "Diff blank removal R language= $Lang_R\n";
++        my @original_minus_blanks_R 
++                    = rm_blanks(  \@lines_R, $Lang_R, \%EOL_Continuation_re);
++        @lines_R    = @original_minus_blanks_R;
++        @lines_R    = add_newlines(\@lines_R); # taken away by rm_comments()
++        @lines_R    = rm_comments( \@lines_R, $Lang_R, $file_R,
++                                   \%EOL_Continuation_re);
++
++        my (@diff_LL, @diff_LR, );
++        array_diff( $file_L                  ,   # in
++                   \@original_minus_blanks_L ,   # in
++                   \@lines_L                 ,   # in
++                   "comment"                 ,   # in
++                   \@diff_LL, \@diff_LR      ,   # out
++                   \@Errors);                    # in/out
++
++        my (@diff_RL, @diff_RR, );
++        array_diff( $file_R                  ,   # in
++                   \@original_minus_blanks_R ,   # in
++                   \@lines_R                 ,   # in
++                   "comment"                 ,   # in
++                   \@diff_RL, \@diff_RR      ,   # out
++                   \@Errors);                    # in/out
++        # each line of each file is now classified as
++        # code or comment
++
++#use Data::Dumper; 
++#print Dumper("diff_LL", \@diff_LL, "diff_LR", \@diff_LR, );
++#print Dumper("diff_RL", \@diff_RL, "diff_RR", \@diff_RR, );
++#die;
++        # step 2: separate code from comments for L and R files
++        my @code_L = ();
++        my @code_R = ();
++        my @comm_L = ();
++        my @comm_R = ();
++        foreach my $line_info (@diff_LL) {
++            if      ($line_info->{'type'} eq "code"   ) {
++                push @code_L, $line_info->{char};
++            } elsif ($line_info->{'type'} eq "comment") {
++                push @comm_L, $line_info->{char};
++            } else {
++                die "Diff unexpected line type ",
++                    $line_info->{'type'}, "for $file_L line ",
++                    $line_info->{'lnum'};
++            }
++        }
++        foreach my $line_info (@diff_RL) {
++            if      ($line_info->{type} eq "code"   ) {
++                push @code_R, $line_info->{'char'};
++            } elsif ($line_info->{type} eq "comment") {
++                push @comm_R, $line_info->{'char'};
++            } else {
++                die "Diff unexpected line type ",
++                    $line_info->{'type'}, "for $file_R line ",
++                    $line_info->{'lnum'};
++            }
++        }
++
++        if ($opt_ignore_whitespace) {
++            # strip all whitespace from each line of source code
++            # and comments then use these stripped arrays in diffs
++            foreach (@code_L) { s/\s+//g }
++            foreach (@code_R) { s/\s+//g }
++            foreach (@comm_L) { s/\s+//g }
++            foreach (@comm_R) { s/\s+//g }
++        }
++        if ($opt_ignore_case) {
++            # change all text to lowercase in diffs
++            foreach (@code_L) { $_ = lc }
++            foreach (@code_R) { $_ = lc }
++            foreach (@comm_L) { $_ = lc }
++            foreach (@comm_R) { $_ = lc }
++        }
++        # step 3: compute code diffs
++        array_diff("$file_L v. $file_R"   ,   # in
++                   \@code_L               ,   # in
++                   \@code_R               ,   # in
++                   "revision"             ,   # in
++                   \@diff_LL, \@diff_LR   ,   # out
++                   \@Errors);                 # in/out
++#print Dumper("diff_LL", \@diff_LL, "diff_LR", \@diff_LR, );
++#print Dumper("diff_LR", \@diff_LR);
++        foreach my $line_info (@diff_LR) {
++            my $status = $line_info->{'desc'}; # same|added|removed|modified
++            ++$Delta_by_Language{$Lang_L}{'code'}{$status};
++            if ($opt_by_file) {
++                ++$Delta_by_File{$file_L}{'code'}{$status};
++            }
++        }
++#use Data::Dumper;
++#print Dumper("code diffs:", \@diff_LL, \@diff_LR);
++
++        # step 4: compute comment diffs
++        array_diff("$file_L v. $file_R"   ,   # in
++                   \@comm_L               ,   # in
++                   \@comm_R               ,   # in
++                   "revision"             ,   # in
++                   \@diff_LL, \@diff_LR   ,   # out
++                   \@Errors);                 # in/out
++#print Dumper("comment diff_LR", \@diff_LR);
++        foreach my $line_info (@diff_LR) {
++            my $status = $line_info->{'desc'}; # same|added|removed|modified
++            ++$Delta_by_Language{$Lang_L}{'comment'}{$status};
++            if ($opt_by_file) {
++                ++$Delta_by_File{$file_L}{'comment'}{$status};
++            }
++        }
++#print Dumper("comment diffs:", \@diff_LL, \@diff_LR);
++#die; here=  need to save original line number in diff result for html display
++
++        # step 5: compute difference in blank lines (kind of pointless)
++        next if $Lang_L eq '(unknown)' or 
++                $Lang_R eq '(unknown)';
++        my ($all_line_count_L,
++            $blank_count_L   ,
++            $comment_count_L ,
++           ) = call_counter($file_L, $Lang_L, \@Errors);
++
++        my ($all_line_count_R,
++            $blank_count_R   ,
++            $comment_count_R ,
++           ) = call_counter($file_R, $Lang_R, \@Errors);
++
++        if ($blank_count_L <  $blank_count_R) {
++            my $D = $blank_count_R - $blank_count_L;
++            $Delta_by_Language{$Lang_L}{'blank'}{'added'}   += $D;
++        } else {
++            my $D = $blank_count_L - $blank_count_R;
++            $Delta_by_Language{$Lang_L}{'blank'}{'removed'} += $D;
++        }
++        if ($opt_by_file) {
++            if ($blank_count_L <  $blank_count_R) {
++                my $D = $blank_count_R - $blank_count_L;
++                $Delta_by_File{$file_L}{'blank'}{'added'}   += $D;
++            } else {
++                my $D = $blank_count_L - $blank_count_R;
++                $Delta_by_File{$file_L}{'blank'}{'removed'} += $D;
++            }
++        }
++
++        my $code_count_L = $all_line_count_L-$blank_count_L-$comment_count_L;
++        if ($opt_by_file) {
++            $Results_by_File{$file_L}{'code'   } = $code_count_L    ;
++            $Results_by_File{$file_L}{'blank'  } = $blank_count_L   ;
++            $Results_by_File{$file_L}{'comment'} = $comment_count_L ;
++            $Results_by_File{$file_L}{'lang'   } = $Lang_L          ;
++            $Results_by_File{$file_L}{'nFiles' } = 1                ;
++        } else {
++            $Results_by_File{$file_L} = 1;  # just keep track of counted files
++        }
++   
++        $Results_by_Language{$Lang_L}{'nFiles'}++;
++        $Results_by_Language{$Lang_L}{'code'}    += $code_count_L   ;
++        $Results_by_Language{$Lang_L}{'blank'}   += $blank_count_L  ;
++        $Results_by_Language{$Lang_L}{'comment'} += $comment_count_L;
++    }
++    if ($opt_diff_alignment) {
++        $alignment[$alignment_pairs_index] =~ s/UPDATE_ME/$n_file_pairs_compared/;
++        write_file($opt_diff_alignment, @alignment);
++    }
++
++}
++#use Data::Dumper;
++#print Dumper("Delta_by_Language:"  , \%Delta_by_Language);
++#print Dumper("Results_by_Language:", \%Results_by_Language);
++#print Dumper("Delta_by_File:"      , \%Delta_by_File);
++#print Dumper("Results_by_File:"    , \%Results_by_File);
++#die;
++my @ignored_reasons = map { "$_: $Ignored{$_}" } sort keys %Ignored;
++write_file($opt_ignored, @ignored_reasons   ) if $opt_ignored;
++write_file($opt_counted, sort keys %Results_by_File) if $opt_counted;
++# 1}}}
++# Step 7:  Assemble results.                   {{{1
++#
++my $end_time = get_time();
++printf "%8d file%s ignored.                           \n", 
++    plural_form(scalar keys %Ignored) unless $opt_quiet;
++print_errors(\%Error_Codes, \@Errors) if @Errors;
++if (!%Delta_by_Language) {
++    print "Nothing to count.\n";
++    exit;
++}
++
++if ($opt_by_file) {
++    @Lines_Out = diff_report($VERSION, get_time() - $start_time,
++                            "by file",
++                            \%Delta_by_File, \%Scale_Factor);
++} else {
++    @Lines_Out = diff_report($VERSION, get_time() - $start_time,
++                            "by language",
++                            \%Delta_by_Language, \%Scale_Factor);
++}
++
++# 1}}}
++} else {
++# Step 4:  Separate code from non-code files.  {{{1
++my $fh = 0;
++if ($opt_list_file) {
++    my @list = read_list_file($opt_list_file);
++    $fh = make_file_list(\@list, \%Error_Codes, \@Errors, \%Ignored);
++} else {
++    $fh = make_file_list(\@ARGV, \%Error_Codes, \@Errors, \%Ignored);
++    #     make_file_list populates global variable @file_list via call to 
++    #     File::Find's find() which in turn calls files()
++}
++if ($opt_exclude_list_file) {
++    process_exclude_list_file($opt_exclude_list_file, 
++                             \%Exclude_Dir,
++                             \%Ignored);
++}
++if ($opt_skip_win_hidden and $ON_WINDOWS) {
++    my @file_list_minus_hidded = ();
++    # eval code to run on Unix without 'missing Win32::File module' error.
++    my $win32_file_invocation = '
++        use Win32::File;
++        foreach my $F (@file_list) {
++            my $attr = undef;
++            Win32::File::GetAttributes($F, $attr);
++            if ($attr & HIDDEN) {
++                $Ignored{$F} = "Windows hidden file";
++                print "Ignoring $F since it is a Windows hidden file\n" 
++                    if $opt_v > 1;
++            } else {
++                push @file_list_minus_hidded, $F;
++            }
++        }';
++    eval $win32_file_invocation;
++    @file_list = @file_list_minus_hidded;
++}
++#printf "%8d file%s excluded.                     \n", 
++#   plural_form(scalar keys %Ignored) 
++#   unless $opt_quiet;
++# die print ": ", join("\n: ", @file_list), "\n";
++# 1}}}
++# Step 5:  Remove duplicate files.             {{{1
++#
++my %Language           = ();
++my %unique_source_file = ();
++remove_duplicate_files($fh                          ,   # in 
++                           \%Language               ,   # out
++                           \%unique_source_file     ,   # out
++                      \%Error_Codes                 ,   # in
++                           \@Errors                 ,   # out
++                           \%Ignored                );  # out
++printf "%8d unique file%s.                              \n", 
++    plural_form(scalar keys %unique_source_file) 
++    unless $opt_quiet;
++# 1}}}
++# Step 6:  Count code, comments, blank lines.  {{{1
++#
++
++my %Results_by_Language = ();
++my %Results_by_File     = ();
++my $nCounted = 0;
++foreach my $file (sort keys %unique_source_file) {
++    ++$nCounted;
++    printf "Counting:  %d\r", $nCounted 
++        unless (!$opt_progress_rate or ($nCounted % $opt_progress_rate));
++    next if $Ignored{$file};
++    if ($Exclude_Language{$Language{$file}}) {
++        $Ignored{$file} = "--exclude-lang=$Language{$file}";
++        next;
++    }
++    my $Filters_by_Language_Language_file = !defined @{$Filters_by_Language{$Language{$file}} };
++    if ($Filters_by_Language_Language_file) {
++        if ($Language{$file} eq "(unknown)") {
++            $Ignored{$file} = "language unknown (#1)";
++        } else {
++            $Ignored{$file} = "missing Filters_by_Language{$Language{$file}}";
++        }
++        next;
++    }
++
++    my ($all_line_count,
++        $blank_count   ,
++        $comment_count ,
++       ) = call_counter($file, $Language{$file}, \@Errors);
++    my $code_count = $all_line_count - $blank_count - $comment_count;
++    if ($opt_by_file) {
++        $Results_by_File{$file}{'code'   } = $code_count     ;
++        $Results_by_File{$file}{'blank'  } = $blank_count    ;
++        $Results_by_File{$file}{'comment'} = $comment_count  ;
++        $Results_by_File{$file}{'lang'   } = $Language{$file};
++        $Results_by_File{$file}{'nFiles' } = 1;
++    } else {
++        $Results_by_File{$file} = 1;  # just keep track of counted files
++    }
++
++    $Results_by_Language{$Language{$file}}{'nFiles'}++;
++    $Results_by_Language{$Language{$file}}{'code'}    += $code_count   ;
++    $Results_by_Language{$Language{$file}}{'blank'}   += $blank_count  ;
++    $Results_by_Language{$Language{$file}}{'comment'} += $comment_count;
++}
++my @ignored_reasons = map { "$_: $Ignored{$_}" } sort keys %Ignored;
++write_file($opt_ignored, @ignored_reasons   ) if $opt_ignored;
++write_file($opt_counted, sort keys %Results_by_File) if $opt_counted;
++# 1}}}
++# Step 7:  Assemble results.                   {{{1
++#
++my $end_time = get_time();
++printf "%8d file%s ignored.\n", plural_form(scalar keys %Ignored) 
++    unless $opt_quiet;
++print_errors(\%Error_Codes, \@Errors) if @Errors;
++exit unless %Results_by_Language;
++
++generate_sql($end_time - $start_time,
++            \%Results_by_File, \%Scale_Factor) if $opt_sql;
++
++exit if $skip_generate_report;
++if      ($opt_by_file_by_lang) {
++    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
++                                      "by file",
++                                      \%Results_by_File,    \%Scale_Factor);
++    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
++                                      "by language",
++                                      \%Results_by_Language, \%Scale_Factor);
++} elsif ($opt_by_file) {
++    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
++                                      "by file",
++                                      \%Results_by_File,    \%Scale_Factor);
++} else {
++    push @Lines_Out, generate_report( $VERSION, $end_time - $start_time,
++                                      "by language",
++                                      \%Results_by_Language, \%Scale_Factor);
++}
++# 1}}}
++}
++if ($opt_report_file) { write_file($opt_report_file, @Lines_Out); } 
++else                  { print "\n", join("\n", @Lines_Out), "\n"; }
++
++sub process_exclude_list_file {              # {{{1
++    my ($list_file      , # in
++        $rh_exclude_dir , # out
++        $rh_ignored     , # out
++       ) = @_;
++    print "-> process_exclude_list_file($list_file)\n" if $opt_v > 2;
++    # reject a specific set of files and/or directories
++    my @reject_list   = read_list_file($list_file);
++    my @file_reject_list = ();
++    foreach my $F_or_D (@reject_list) {
++        if (is_dir($F_or_D)) {
++            $rh_exclude_dir->{$F_or_D} = 1;
++        } elsif (is_file($F_or_D)) {
++            push @file_reject_list, $F_or_D;
++        }
++    }
++
++    # Normalize file names for better comparison.
++    my %normalized_input   = normalize_file_names(@file_list);
++    my %normalized_reject  = normalize_file_names(@file_reject_list);
++    my %normalized_exclude = normalize_file_names(keys %{$rh_exclude_dir});
++    foreach my $F (keys %normalized_input) {
++        if ($normalized_reject{$F} or is_excluded($F, \%normalized_exclude)) {
++            my $orig_F = $normalized_input{$F};
++            $rh_ignored->{$orig_F} = "listed in exclusion file $opt_exclude_list_file";
++            print "Ignoring $orig_F because it appears in $opt_exclude_list_file\n" 
++                if $opt_v > 1;
++        }
++    }
++    print "<- process_exclude_list_file\n" if $opt_v > 2;
++} # 1}}}
++sub combine_results {                        # {{{1
++    # returns 1 if the inputs are categorized by language
++    #         0 if no identifiable language was found
++    my ($ra_report_files, # in
++        $report_type    , # in  "by language" or "by report file"
++        $rhh_count      , # out count{TYPE}{nFiles|code|blank|comment|scaled}
++        $rhaa_Filters_by_Language , # in
++       ) = @_;
++
++    print "-> combine_results(report_type=$report_type)\n" if $opt_v > 2;
++    my $found_language = 0;
++
++    foreach my $file (@{$ra_report_files}) {
++        my $IN = new IO::File $file, "r";
++        if (!defined $IN) {
++            warn "Unable to read $file; ignoring.\n";
++            next;
++        }
++        while (<$IN>) {
++            next if /^(http|Language|SUM|-----)/;
++            if (!$opt_by_file  and
++                m{^(.*?)\s+         # language
++                   (\d+)\s+         # files
++                   (\d+)\s+         # blank
++                   (\d+)\s+         # comments
++                   (\d+)\s+         # code
++                   (                #    next four entries missing with -nno3
++                   x\s+             # x
++                   \d+\.\d+\s+      # scale
++                   =\s+             # =
++                   (\d+\.\d+)\s*    # scaled code
++                   )?
++                   $}x) {
++                if ($report_type eq "by language") {
++                    if ($PERL_516) {
++                        next unless         @{$rhaa_Filters_by_Language->{$1}};
++                    } else {
++                        next unless defined @{$rhaa_Filters_by_Language->{$1}};
++                    }
++                    # above test necessary to avoid trying to sum reports
++                    # of reports (which have no language breakdown).
++                    $found_language = 1;
++                    $rhh_count->{$1   }{'nFiles' } += $2;
++                    $rhh_count->{$1   }{'blank'  } += $3;
++                    $rhh_count->{$1   }{'comment'} += $4;
++                    $rhh_count->{$1   }{'code'   } += $5;
++                    $rhh_count->{$1   }{'scaled' } += $7 if $opt_3;
++                } else {
++                    $rhh_count->{$file}{'nFiles' } += $2;
++                    $rhh_count->{$file}{'blank'  } += $3;
++                    $rhh_count->{$file}{'comment'} += $4;
++                    $rhh_count->{$file}{'code'   } += $5;
++                    $rhh_count->{$file}{'scaled' } += $7 if $opt_3;
++                }
++            } elsif ($opt_by_file  and
++                m{^(.*?)\s+         # language
++                   (\d+)\s+         # blank
++                   (\d+)\s+         # comments
++                   (\d+)\s+         # code
++                   (                #    next four entries missing with -nno3
++                   x\s+             # x
++                   \d+\.\d+\s+      # scale
++                   =\s+             # =
++                   (\d+\.\d+)\s*    # scaled code
++                   )?
++                   $}x) {
++                if ($report_type eq "by language") {
++                    next unless %{$rhaa_Filters_by_Language->{$1}};
++                    # above test necessary to avoid trying to sum reports
++                    # of reports (which have no language breakdown).
++                    $found_language = 1;
++                    $rhh_count->{$1   }{'nFiles' } +=  1;
++                    $rhh_count->{$1   }{'blank'  } += $2;
++                    $rhh_count->{$1   }{'comment'} += $3;
++                    $rhh_count->{$1   }{'code'   } += $4;
++                    $rhh_count->{$1   }{'scaled' } += $6 if $opt_3;
++                } else {
++                    $rhh_count->{$file}{'nFiles' } +=  1;
++                    $rhh_count->{$file}{'blank'  } += $2;
++                    $rhh_count->{$file}{'comment'} += $3;
++                    $rhh_count->{$file}{'code'   } += $4;
++                    $rhh_count->{$file}{'scaled' } += $6 if $opt_3;
++                }
++            }
++        }
++    }
++    print "<- combine_results\n" if $opt_v > 2;
++    return $found_language;
++} # 1}}}
++sub diff_report     {                        # {{{1
++    # returns an array of lines containing the results
++    print "-> diff_report\n" if $opt_v > 2;
++
++    if ($opt_xml or $opt_yaml) {
++        print "<- diff_report\n" if $opt_v > 2;
++        return diff_xml_yaml_report(@_) 
++    } elsif ($opt_csv) {
++        print "<- diff_report\n" if $opt_v > 2;
++        return diff_csv_report(@_) 
++    }
++
++    my ($version    , # in
++        $elapsed_sec, # in
++        $report_type, # in  "by language" | "by report file" | "by file"
++        $rhhh_count , # in  count{TYPE}{nFiles|code|blank|comment}{a|m|r|s}
++        $rh_scale   , # in
++       ) = @_;
++
++#use Data::Dumper;
++#print "diff_report: ", Dumper($rhhh_count), "\n";
++    my @results       = ();
++
++    my $languages     = ();
++    my %sum           = (); # sum{nFiles|blank|comment|code}{same|modified|added|removed}
++    my $max_len       = 0;
++    foreach my $language (keys %{$rhhh_count}) {
++        foreach my $V (qw(nFiles blank comment code)) {
++            foreach my $S (qw(added same modified removed)) {
++                $rhhh_count->{$language}{$V}{$S} = 0 unless
++                    defined $rhhh_count->{$language}{$V}{$S};
++                $sum{$V}{$S}  += $rhhh_count->{$language}{$V}{$S};
++            }
++        }
++        $max_len      = length($language) if length($language) > $max_len;
++    }
++    my $column_1_offset = 0;
++       $column_1_offset = $max_len - 17 if $max_len > 17;
++    $elapsed_sec = 0.5 unless $elapsed_sec;
++
++    my $spacing_0 = 23;
++    my $spacing_1 = 13;
++    my $spacing_2 =  9;
++    my $spacing_3 = 17;
++    if (!$opt_3) {
++        $spacing_1 = 19;
++        $spacing_2 = 14;
++        $spacing_3 = 28;
++    }
++    $spacing_0 += $column_1_offset;
++    $spacing_1 += $column_1_offset;
++    $spacing_3 += $column_1_offset;
++    my %Format = (
++        '1' => { 'xml' => 'name="%s" ',
++                 'txt' => "\%-${spacing_0}s ",
++               },
++        '2' => { 'xml' => 'name="%s" ',
++                 'txt' => "\%-${spacing_3}s ",
++               },
++        '3' => { 'xml' => 'files_count="%d" ',
++                 'txt' => '%5d ',
++               },
++        '4' => { 'xml' => 'blank="%d" comment="%d" code="%d" ',
++                 'txt' => "\%${spacing_2}d \%${spacing_2}d \%${spacing_2}d",
++               },
++        '5' => { 'xml' => 'factor="%.2f" scaled="%.2f" ',
++                 'txt' => ' x %6.2f = %14.2f',
++               },
++    );
++    my $Style = "txt";
++       $Style = "xml" if $opt_xml ;
++       $Style = "xml" if $opt_yaml;  # not a typo; just set to anything but txt
++       $Style = "xml" if $opt_csv ;  # not a typo; just set to anything but txt
++
++    my $hyphen_line = sprintf "%s", '-' x (79 + $column_1_offset);
++       $hyphen_line = sprintf "%s", '-' x (68 + $column_1_offset) 
++            if (!$opt_3) and (68 + $column_1_offset) > 79;
++    my $data_line  = "";
++    my $first_column;
++    my $BY_LANGUAGE = 0;
++    my $BY_FILE     = 0;
++    if      ($report_type eq "by language") {
++        $first_column = "Language";
++        $BY_LANGUAGE  = 1;
++    } elsif ($report_type eq "by file")     {
++        $first_column = "File";
++        $BY_FILE      = 1;
++    } else {
++        $first_column = "Report File";
++    }
++
++    my $header_line  = sprintf "%s v %s", $URL, $version;
++    my $sum_files    = 1;
++    my $sum_lines    = 1;
++       $header_line .= sprintf("  T=%.2f s (%.1f files/s, %.1f lines/s)",
++                        $elapsed_sec           ,
++                        $sum_files/$elapsed_sec,
++                        $sum_lines/$elapsed_sec) unless $opt_sum_reports;
++    if ($Style eq "txt") {
++        push @results, output_header($header_line, $hyphen_line, $BY_FILE);
++    } elsif ($Style eq "csv") {
++        die "csv";
++    }
++
++    # column headers
++    if (!$opt_3 and $BY_FILE) {
++        my $spacing_n = $spacing_1 - 11;
++        $data_line  = sprintf "%-${spacing_n}s" , $first_column;
++    } else {
++        $data_line  = sprintf "%-${spacing_1}s ", $first_column;
++    }
++    if ($BY_FILE) {
++        $data_line .= sprintf "%${spacing_2}s"   , ""     ;
++    } else {
++        $data_line .= sprintf "%${spacing_2}s "  , "files";
++    }
++    $data_line .= sprintf "%${spacing_2}s %${spacing_2}s %${spacing_2}s",
++        "blank"         ,
++        "comment"       ,
++        "code";
++
++    if ($Style eq "txt") {
++        push @results, $data_line;
++        push @results, $hyphen_line;
++    }
++
++####foreach my $lang_or_file (keys %{$rhhh_count}) {
++####    $rhhh_count->{$lang_or_file}{'code'} = 0 unless 
++####        defined $rhhh_count->{$lang_or_file}{'code'};
++####}
++    foreach my $lang_or_file (sort {
++                                 $rhhh_count->{$b}{'code'} <=>
++                                 $rhhh_count->{$a}{'code'}
++                               }
++                          keys %{$rhhh_count}) {
++
++        if ($BY_FILE) {
++            push @results, rm_leading_tempdir($lang_or_file, \%TEMP_DIR);
++        } else {
++            push @results, $lang_or_file;
++        }
++        foreach my $S (qw(same modified added removed)) {
++            my $indent = $spacing_1 - 2;
++            my $line .= sprintf " %-${indent}s", $S;
++            if ($BY_FILE) {
++                $line .= sprintf "   ";
++            } else {
++                $line .= sprintf "  %${spacing_2}s", $rhhh_count->{$lang_or_file}{'nFiles'}{$S};
++            }
++            $line .= sprintf " %${spacing_2}s %${spacing_2}s %${spacing_2}s",
++                $rhhh_count->{$lang_or_file}{'blank'}{$S}   ,
++                $rhhh_count->{$lang_or_file}{'comment'}{$S} ,
++                $rhhh_count->{$lang_or_file}{'code'}{$S}    ;
++            push @results, $line;
++        }
++    }
++    push @results, "-" x 79;
++    push @results, "SUM:";
++    foreach my $S (qw(same modified added removed)) {
++        my $indent = $spacing_1 - 2;
++        my $line .= sprintf " %-${indent}s", $S;
++            if ($BY_FILE) {
++                $line .= sprintf "   ";
++            } else {
++                $line .= sprintf "  %${spacing_2}s", $sum{'nFiles'}{$S};
++            }
++        $line .= sprintf " %${spacing_2}s %${spacing_2}s %${spacing_2}s",
++            $sum{'blank'}{$S}   ,
++            $sum{'comment'}{$S} ,
++            $sum{'code'}{$S}    ;
++        push @results, $line;
++    }
++    push @results, "-" x 79;
++    write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL;
++    print "<- diff_report\n" if $opt_v > 2;
++
++    return @results;
++} # 1}}}
++sub xml_or_yaml_header {                     # {{{1
++    my ($URL, $version, $elapsed_sec, $sum_files, $sum_lines, $by_file) = @_;
++    print "-> xml_or_yaml_header\n" if $opt_v > 2;
++    my $header      = "";
++    my $file_rate   = $sum_files/$elapsed_sec;
++    my $line_rate   = $sum_lines/$elapsed_sec;
++    my $type        = ""; 
++       $type        = "diff_" if $opt_diff;
++    my $report_file = "";
++    if ($opt_report_file) {
++        if ($opt_sum_reports) {
++            if ($by_file) {
++                $report_file = "  <report_file>$opt_report_file.file</report_file>"
++            } else {
++                $report_file = "  <report_file>$opt_report_file.lang</report_file>"
++            }
++        } else {
++            $report_file = "  <report_file>$opt_report_file</report_file>"
++        }
++    }
++    if ($opt_xml) {
++        $header = "<?xml version=\"1.0\"?>";
++        $header .= "\n<?xml-stylesheet type=\"text/xsl\" href=\"" . $opt_xsl . "\"?>" if $opt_xsl;
++        $header .= "<${type}results>
++<header>
++  <cloc_url>$URL</cloc_url>
++  <cloc_version>$version</cloc_version>
++  <elapsed_seconds>$elapsed_sec</elapsed_seconds>
++  <n_files>$sum_files</n_files>
++  <n_lines>$sum_lines</n_lines>
++  <files_per_second>$file_rate</files_per_second>
++  <lines_per_second>$line_rate</lines_per_second>";
++        $header .= "\n$report_file"
++            if $opt_report_file;
++        $header .= "\n</header>";
++    } elsif ($opt_yaml) {
++        $header = "---\n# $URL
++header :
++  cloc_url           : http://cloc.sourceforge.net
++  cloc_version       : $version
++  elapsed_seconds    : $elapsed_sec
++  n_files            : $sum_files
++  n_lines            : $sum_lines
++  files_per_second   : $file_rate
++  lines_per_second   : $line_rate";
++        if ($opt_report_file) {
++            if ($opt_sum_reports) {
++                if ($by_file) {
++                    $header .= "\n  report_file        : $opt_report_file.file"
++                } else {
++                    $header .= "\n  report_file        : $opt_report_file.lang"
++                }
++            } else {
++                $header .= "\n  report_file        : $opt_report_file";
++            }
++        }
++    }
++    print "<- xml_or_yaml_header\n" if $opt_v > 2;
++    return $header;
++} # 1}}}
++sub diff_xml_yaml_report {                   # {{{1
++    # returns an array of lines containing the results
++    my ($version    , # in
++        $elapsed_sec, # in
++        $report_type, # in  "by language" | "by report file" | "by file"
++        $rhhh_count , # in  count{TYPE}{nFiles|code|blank|comment}{a|m|r|s}
++        $rh_scale   , # in
++       ) = @_;
++    print "-> diff_xml_yaml_report\n" if $opt_v > 2;
++
++#print "diff_report: ", Dumper($rhhh_count), "\n";
++    my @results       = ();
++    
++    my $languages     = ();
++    my %sum           = (); # sum{nFiles|blank|comment|code}{same|modified|added|removed}
++
++    my $sum_files = 0;
++    my $sum_lines = 0;
++    foreach my $language (keys %{$rhhh_count}) {
++        foreach my $V (qw(nFiles blank comment code)) {
++            foreach my $S (qw(added same modified removed)) {
++                $rhhh_count->{$language}{$V}{$S} = 0 unless
++                    defined $rhhh_count->{$language}{$V}{$S};
++                $sum{$V}{$S}  += $rhhh_count->{$language}{$V}{$S};
++                if ($V eq "nFiles") {
++                    $sum_files += $rhhh_count->{$language}{$V}{$S};
++                } else {
++                    $sum_lines += $rhhh_count->{$language}{$V}{$S};
++                }
++            }
++        }
++    }
++    $elapsed_sec = 0.5 unless $elapsed_sec;
++
++    my $data_line   = "";
++    my $BY_LANGUAGE = 0;
++    my $BY_FILE     = 0;
++    if      ($report_type eq "by language") {
++        $BY_LANGUAGE  = 1;
++    } elsif ($report_type eq "by file")     {
++        $BY_FILE      = 1;
++    }
++
++    if (!$ALREADY_SHOWED_HEADER) {
++        push @results,
++              xml_or_yaml_header($URL, $version, $elapsed_sec, 
++                                 $sum_files, $sum_lines, $BY_FILE);
++        $ALREADY_SHOWED_HEADER = 1;
++    }
++
++    foreach my $S (qw(same modified added removed)) {
++        if ($opt_xml) {
++            push @results, "  <$S>";
++        } elsif ($opt_yaml) {
++            push @results, "$S :";
++        }
++########foreach my $lang_or_file (keys %{$rhhh_count}) {
++########    $rhhh_count->{$lang_or_file}{'code'} = 0 unless 
++########        defined $rhhh_count->{$lang_or_file}{'code'};
++########}
++        foreach my $lang_or_file (sort {
++                                     $rhhh_count->{$b}{'code'} <=>
++                                     $rhhh_count->{$a}{'code'}
++                                   }
++                              keys %{$rhhh_count}) {
++            my $L = "";
++            if ($opt_xml) {
++                if ($BY_FILE) {
++                    $L .= sprintf "    <file name=\"%s\" files_count=\"1\" ", 
++                            rm_leading_tempdir($lang_or_file, \%TEMP_DIR);
++                } else {
++                    $L .= sprintf "    <language name=\"%s\" files_count=\"%d\" ",
++                            $lang_or_file ,
++                            $rhhh_count->{$lang_or_file}{'nFiles'}{$S};
++                }
++                foreach my $T (qw(blank comment code)) {
++                    $L .= sprintf "%s=\"%d\" ", 
++                            $T, $rhhh_count->{$lang_or_file}{$T}{$S};
++                }
++                push @results, $L . "/>";
++            } elsif ($opt_yaml) {
++                if ($BY_FILE) {
++                    push @results, sprintf "  - file : %s", 
++                                   rm_leading_tempdir($lang_or_file, \%TEMP_DIR);
++                    push @results, sprintf "    files_count : 1", 
++                } else {
++                    push @results, sprintf "  - language : %s", $lang_or_file;
++                    push @results, sprintf "    files_count : %d", 
++                            $rhhh_count->{$lang_or_file}{'nFiles'}{$S};
++                }
++                foreach my $T (qw(blank comment code)) {
++                    push @results, sprintf "    %s : %d", 
++                            $T, $rhhh_count->{$lang_or_file}{$T}{$S};
++                }
++            }
++        }
++
++        if ($opt_xml) {
++            my $L = sprintf "    <total sum_files=\"%d\" ", $sum{'nFiles'}{$S};
++            foreach my $V (qw(blank comment code)) {
++                $L .= sprintf "%s=\"%d\" ", $V, $sum{$V}{$S};
++            }
++            push @results, $L . "/>";
++            push @results, "  </$S>";
++        } elsif ($opt_yaml) {
++            push @results, sprintf "%s_total :\n    sum_files : %d", 
++                                $S, $sum{'nFiles'}{$S};
++            foreach my $V (qw(blank comment code)) {
++                push @results, sprintf "    %s : %d", $V, $sum{$V}{$S};
++            }
++        }
++    }
++
++    if ($opt_xml) {
++        push @results, "</diff_results>";
++    }
++    write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL;
++    print "<- diff_xml_yaml_report\n" if $opt_v > 2;
++    return @results;
++} # 1}}}
++sub diff_csv_report {                        # {{{1
++    # returns an array of lines containing the results
++    my ($version    , # in
++        $elapsed_sec, # in
++        $report_type, # in  "by language" | "by report file" | "by file"
++        $rhhh_count , # in  count{TYPE}{nFiles|code|blank|comment}{a|m|r|s}
++        $rh_scale   , # in  unused
++       ) = @_;
++    print "-> diff_csv_report\n" if $opt_v > 2;
++
++#use Data::Dumper;
++#print "diff_csv_report: ", Dumper($rhhh_count), "\n";
++#die;
++    my @results       = ();
++    my $languages     = ();
++
++    my $data_line   = "";
++    my $BY_LANGUAGE = 0;
++    my $BY_FILE     = 0;
++    if      ($report_type eq "by language") {
++        $BY_LANGUAGE  = 1;
++    } elsif ($report_type eq "by file")     {
++        $BY_FILE      = 1;
++    }
++    my $DELIM = ",";
++       $DELIM = $opt_csv_delimiter if defined $opt_csv_delimiter;
++
++    $elapsed_sec = 0.5 unless $elapsed_sec;
++
++    my $line = "Language${DELIM} ";
++       $line = "File${DELIM} " if $BY_FILE;
++    foreach my $item (qw(files blank comment code)) {
++        next if $BY_FILE and $item eq 'files';
++        foreach my $symbol ( '==', '!=', '+', '-', ) {
++            $line .= "$symbol $item${DELIM} ";
++        }
++    }
++    $line .= "\"$URL v $version T=$elapsed_sec s\"";
++    push @results, $line;
++
++    foreach my $lang_or_file (keys %{$rhhh_count}) {
++        $rhhh_count->{$lang_or_file}{'code'}{'added'} = 0 unless 
++            defined $rhhh_count->{$lang_or_file}{'code'};
++    }
++    foreach my $lang_or_file (sort {
++                                 $rhhh_count->{$b}{'code'} <=>
++                                 $rhhh_count->{$a}{'code'}
++                               }
++                          keys %{$rhhh_count}) {
++        if ($BY_FILE) {
++            $line = rm_leading_tempdir($lang_or_file, \%TEMP_DIR) . "$DELIM ";
++        } else {
++            $line = $lang_or_file . "${DELIM} ";
++        }
++        foreach my $item (qw(nFiles blank comment code)) {
++            next if $BY_FILE and $item eq 'nFiles';
++            foreach my $symbol (qw(same modified added removed)) {
++                if (defined $rhhh_count->{$lang_or_file}{$item}{$symbol}) {
++                    $line .= "$rhhh_count->{$lang_or_file}{$item}{$symbol}${DELIM} ";
++                } else {
++                    $line .= "0${DELIM} ";
++                }
++            }
++        }
++        push @results, $line;
++    }
++
++    print "<- diff_csv_report\n" if $opt_v > 2;
++    return @results;
++} # 1}}}
++sub rm_leading_tempdir {                     # {{{1
++    my ($in_file, $rh_temp_dirs, ) = @_;
++    my $clean_filename = $in_file;
++    foreach my $temp_d (keys %{$rh_temp_dirs}) {
++        if ($ON_WINDOWS) {
++        # \ -> / necessary to allow the next if test's
++        # m{} to work in the presence of spaces in file names
++            $temp_d         =~ s{\\}{/}g;
++            $clean_filename =~ s{\\}{/}g;
++        }
++        if ($clean_filename =~ m{^$temp_d/}) {
++            $clean_filename =~ s{^$temp_d/}{};
++            last;
++        }
++    }
++    $clean_filename =~ s{/}{\\}g if $ON_WINDOWS; # then go back from / to \
++    return $clean_filename;
++} # 1}}}
++sub generate_sql    {                        # {{{1
++    my ($elapsed_sec, # in
++        $rhh_count  , # in  count{TYPE}{lang|code|blank|comment|scaled}
++        $rh_scale   , # in
++       ) = @_;
++    print "-> generate_sql\n" if $opt_v > 2;
++
++    $opt_sql_project = cwd() unless defined $opt_sql_project;
++    $opt_sql_project =~ s{/}{\\}g if $ON_WINDOWS;
++
++    my $schema = "
++create table metadata (          -- $URL v $VERSION
++                timestamp text,    
++                Project   text,    
++                elapsed_s real);   
++create table t        (
++                Project   text   ,  
++                Language  text   ,  
++                File      text   ,  
++                nBlank    integer,  
++                nComment  integer,  
++                nCode     integer,  
++                nScaled   real   ); 
++";
++    $opt_sql = "-" if $opt_sql eq "1";
++
++    my $open_mode = ">";
++       $open_mode = ">>" if $opt_sql_append;
++
++    my $fh = new IO::File; # $opt_sql, "w";
++    if (!$fh->open("${open_mode}${opt_sql}")) {
++        die "Unable to write to $opt_sql  $!\n";
++    }
++    print $fh $schema unless defined $opt_sql_append;
++
++    print $fh "begin transaction;\n";
++    printf $fh "insert into metadata values('%s', '%s', %f);\n",
++                strftime("%Y-%m-%d %H:%M:%S", localtime(time())),
++                $opt_sql_project, $elapsed_sec;
++
++    my $nIns = 0;
++    foreach my $file (keys %{$rhh_count}) {
++        my $language = $rhh_count->{$file}{'lang'};
++        my $clean_filename = $file;
++        # If necessary (that is, if the input contained an
++        # archive file [.tar.gz, etc]), strip the temporary
++        # directory name which was used to expand the archive
++        # from the file name.
++
++        $clean_filename = rm_leading_tempdir($clean_filename, \%TEMP_DIR);
++        printf $fh "insert into t values('%s', '%s', '%s', %d, %d, %d, %f);\n",
++                    $opt_sql_project           ,
++                    $language                  ,
++                    $clean_filename            ,
++                    $rhh_count->{$file}{'blank'},
++                    $rhh_count->{$file}{'comment'},
++                    $rhh_count->{$file}{'code'}   ,
++                    $rhh_count->{$file}{'code'}*$rh_scale->{$language};
++        ++$nIns;
++        if (!($nIns % 10_000)) {
++            print $fh "commit;\n";
++            print $fh "begin transaction;\n";
++        }
++    }
++    print $fh "commit;\n";
++
++    $fh->close unless $opt_sql eq "-"; # don't try to close STDOUT
++    print "<- generate_sql\n" if $opt_v > 2;
++
++    # sample query:
++    #
++    #   select project, language, 
++    #          sum(nCode)     as Code, 
++    #          sum(nComment)  as Comments, 
++    #          sum(nBlank)    as Blank,  
++    #          sum(nCode)+sum(nComment)+sum(nBlank) as All_Lines,
++    #          100.0*sum(nComment)/(sum(nCode)+sum(nComment)) as Comment_Pct
++    #          from t group by Project, Language order by Project, Code desc;
++    #
++} # 1}}}
++sub output_header   {                        # {{{1
++    my ($header_line, 
++        $hyphen_line,
++        $BY_FILE    ,)    = @_;
++    print "-> output_header\n" if $opt_v > 2;
++    my @R = ();
++    if      ($opt_xml) {
++        if (!$ALREADY_SHOWED_XML_SECTION) {
++            push @R, "<?xml version=\"1.0\"?>";
++            push @R, '<?xml-stylesheet type="text/xsl" href="' .
++                            $opt_xsl . '"?>' if $opt_xsl;
++            push @R, "<results>";
++            push @R, "<header>$header_line</header>";
++            $ALREADY_SHOWED_XML_SECTION = 1;
++        }
++        if ($BY_FILE) {
++            push @R, "<files>";
++        } else {
++            push @R, "<languages>";
++        }
++    } elsif ($opt_yaml) {
++        push @R, "---\n# $header_line";
++    } elsif ($opt_csv) {
++        # append the header to the end of the column headers
++        # to keep the output a bit cleaner from a spreadsheet
++        # perspective
++    } else {
++        if ($ALREADY_SHOWED_HEADER) {
++            push @R, "";
++        } else {
++            push @R, $header_line;
++            $ALREADY_SHOWED_HEADER = 1;
++        }
++        push @R, $hyphen_line;
++    }
++    print "<- output_header\n" if $opt_v > 2;
++    return @R;
++} # 1}}}
++sub generate_report {                        # {{{1
++    # returns an array of lines containing the results
++    my ($version    , # in
++        $elapsed_sec, # in
++        $report_type, # in  "by language" | "by report file" | "by file"
++        $rhh_count  , # in  count{TYPE}{nFiles|code|blank|comment|scaled}
++        $rh_scale   , # in
++       ) = @_;
++
++    print "-> generate_report\n" if $opt_v > 2;
++    my $DELIM = ",";
++       $DELIM = $opt_csv_delimiter if defined $opt_csv_delimiter;
++
++    my @results       = ();
++    
++    my $languages     = ();
++
++    my $sum_files     = 0;
++    my $sum_code      = 0;
++    my $sum_blank     = 0;
++    my $sum_comment   = 0;
++    my $max_len       = 0;
++    foreach my $language (keys %{$rhh_count}) {
++        $sum_files   += $rhh_count->{$language}{'nFiles'} ;
++        $sum_blank   += $rhh_count->{$language}{'blank'}  ;
++        $sum_comment += $rhh_count->{$language}{'comment'};
++        $sum_code    += $rhh_count->{$language}{'code'}   ;
++        $max_len      = length($language) if length($language) > $max_len;
++    }
++    my $column_1_offset = 0;
++       $column_1_offset = $max_len - 17 if $max_len > 17;
++    my $sum_lines = $sum_blank + $sum_comment + $sum_code;
++    $elapsed_sec = 0.5 unless $elapsed_sec;
++
++    my $spacing_0 = 23;
++    my $spacing_1 = 13;
++    my $spacing_2 =  9;
++    my $spacing_3 = 17;
++    if (!$opt_3) {
++        $spacing_1 = 19;
++        $spacing_2 = 14;
++        $spacing_3 = 28;
++    }
++    $spacing_0 += $column_1_offset;
++    $spacing_1 += $column_1_offset;
++    $spacing_3 += $column_1_offset;
++    my %Format = (
++        '1' => { 'xml' => 'name="%s" ',
++                 'txt' => "\%-${spacing_0}s ",
++               },
++        '2' => { 'xml' => 'name="%s" ',
++                 'txt' => "\%-${spacing_3}s ",
++               },
++        '3' => { 'xml' => 'files_count="%d" ',
++                 'txt' => '%5d ',
++               },
++        '4' => { 'xml' => 'blank="%d" comment="%d" code="%d" ',
++                 'txt' => "\%${spacing_2}d \%${spacing_2}d \%${spacing_2}d",
++               },
++        '5' => { 'xml' => 'factor="%.2f" scaled="%.2f" ',
++                 'txt' => ' x %6.2f = %14.2f',
++               },
++    );
++    my $Style = "txt";
++       $Style = "xml" if $opt_xml ;
++       $Style = "xml" if $opt_yaml;  # not a typo; just set to anything but txt
++       $Style = "xml" if $opt_csv ;  # not a typo; just set to anything but txt
++
++    my $hyphen_line = sprintf "%s", '-' x (79 + $column_1_offset);
++       $hyphen_line = sprintf "%s", '-' x (68 + $column_1_offset) 
++            if (!$opt_3) and (68 + $column_1_offset) > 79;
++    my $data_line  = "";
++    my $first_column;
++    my $BY_LANGUAGE = 0;
++    my $BY_FILE     = 0;
++    if      ($report_type eq "by language") {
++        $first_column = "Language";
++        $BY_LANGUAGE  = 1;
++    } elsif ($report_type eq "by file")     {
++        $first_column = "File";
++        $BY_FILE      = 1;
++    } elsif ($report_type eq "by report file")     {
++        $first_column = "File";
++        $BY_FILE      = 1;
++    } else {
++        $first_column = "Report File";
++    }
++
++    my $header_line  = sprintf "%s v %s", $URL, $version;
++       $header_line .= sprintf("  T=%.2f s (%.1f files/s, %.1f lines/s)",
++                        $elapsed_sec           ,
++                        $sum_files/$elapsed_sec,
++                        $sum_lines/$elapsed_sec) unless $opt_sum_reports;
++    if ($opt_xml or $opt_yaml) {
++        if (!$ALREADY_SHOWED_HEADER) {
++            push @results, xml_or_yaml_header($URL, $version, $elapsed_sec, 
++                                              $sum_files, $sum_lines, $BY_FILE);
++            $ALREADY_SHOWED_HEADER = 1 unless $opt_sum_reports;
++            # --sum-reports yields two xml or yaml files, one by
++            # language and one by report file, each of which needs a header
++        }
++        if ($opt_xml) {
++            if ($BY_FILE) {
++                push @results, "<files>";
++            } else {
++                push @results, "<languages>";
++            }
++        }
++    } else {
++        push @results, output_header($header_line, $hyphen_line, $BY_FILE);
++    }
++
++    if ($Style eq "txt") {
++        # column headers
++        if (!$opt_3 and $BY_FILE) {
++            my $spacing_n = $spacing_1 - 11;
++            $data_line  = sprintf "%-${spacing_n}s ", $first_column;
++        } else {
++            $data_line  = sprintf "%-${spacing_1}s ", $first_column;
++        }
++        if ($BY_FILE) {
++            $data_line .= sprintf "%${spacing_2}s "  , " "    ;
++        } else {
++            $data_line .= sprintf "%${spacing_2}s "  , "files";
++        }
++        $data_line .= sprintf "%${spacing_2}s %${spacing_2}s %${spacing_2}s",
++            "blank"         ,
++            "comment"       ,
++            "code";
++        $data_line .= sprintf " %8s   %14s",
++            "scale"         ,
++            "3rd gen. equiv"
++              if $opt_3;
++        push @results, $data_line;
++        push @results, $hyphen_line;
++    }
++    if ($opt_csv) {
++        my $header2;
++        if ($BY_FILE) {
++            $header2 = "language${DELIM}filename";
++        } else {
++            $header2 = "files${DELIM}language";
++        }
++        $header2 .= "${DELIM}blank${DELIM}comment${DELIM}code";
++        $header2 .= "${DELIM}scale${DELIM}3rd gen. equiv" if $opt_3;
++        $header2 .= ${DELIM} . '"' . $header_line . '"';
++        push @results, $header2;
++    }
++
++    my $sum_scaled = 0;
++####foreach my $lang_or_file (keys %{$rhh_count}) {
++####    $rhh_count->{$lang_or_file}{'code'} = 0 unless 
++####        defined $rhh_count->{$lang_or_file}{'code'};
++####}
++    foreach my $lang_or_file (sort {
++                                 $rhh_count->{$b}{'code'} <=>
++                                 $rhh_count->{$a}{'code'}
++                               }
++                          keys %{$rhh_count}) {
++        next if $lang_or_file eq "by report file";
++        my ($factor, $scaled);
++        if ($BY_LANGUAGE or $BY_FILE) {
++            $factor = 1;
++            if ($BY_LANGUAGE) {
++                if (defined $rh_scale->{$lang_or_file}) {
++                    $factor = $rh_scale->{$lang_or_file};
++                } else {
++                    warn "No scale factor for $lang_or_file; using 1.00";
++                }
++            } else { # by individual code file
++                if ($report_type ne "by report file") {
++                    next unless defined $rhh_count->{$lang_or_file}{'lang'};
++                    next unless defined $rh_scale->{$rhh_count->{$lang_or_file}{'lang'}};
++                    $factor = $rh_scale->{$rhh_count->{$lang_or_file}{'lang'}};
++                }
++            }
++            $scaled = $factor*$rhh_count->{$lang_or_file}{'code'};
++        } else {
++            if (!defined $rhh_count->{$lang_or_file}{'scaled'}) {
++                $opt_3 = 0;
++                # If we're summing together files previously generated
++                # with --no3 then rhh_count->{$lang_or_file}{'scaled'}
++                # this variable will be undefined.  That should only
++                # happen when summing together by file however.
++            } elsif ($BY_LANGUAGE) {
++                warn "Missing scaled language info for $lang_or_file\n";
++            }
++            if ($opt_3) {
++                $scaled =         $rhh_count->{$lang_or_file}{'scaled'};
++                $factor = $scaled/$rhh_count->{$lang_or_file}{'code'};
++            }
++        }
++
++        if ($BY_FILE) {
++            my $clean_filename = rm_leading_tempdir($lang_or_file, \%TEMP_DIR);
++            $data_line  = sprintf $Format{'1'}{$Style}, $clean_filename;
++        } else {
++            $data_line  = sprintf $Format{'2'}{$Style}, $lang_or_file;
++        }
++        $data_line .= sprintf $Format{3}{$Style}  , 
++                        $rhh_count->{$lang_or_file}{'nFiles'} unless $BY_FILE;
++        $data_line .= sprintf $Format{4}{$Style}  , 
++            $rhh_count->{$lang_or_file}{'blank'}  ,
++            $rhh_count->{$lang_or_file}{'comment'},
++            $rhh_count->{$lang_or_file}{'code'}   ;
++        $data_line .= sprintf $Format{5}{$Style}  ,
++            $factor                               ,
++            $scaled if $opt_3;
++        $sum_scaled  += $scaled if $opt_3;
++
++        if ($opt_xml) {
++            if (defined $rhh_count->{$lang_or_file}{'lang'}) {
++                my $lang = $rhh_count->{$lang_or_file}{'lang'};
++                if (!defined $languages->{$lang}) {
++                    $languages->{$lang} = $lang;
++                }
++                $data_line.=' language="' . $lang . '" ';
++            }
++            if ($BY_FILE) {
++                push @results, "  <file " . $data_line . "/>";
++            } else {
++                push @results, "  <language " . $data_line . "/>";
++            }
++        } elsif ($opt_yaml) {
++            push @results,$lang_or_file . ":";
++            push @results,"  nFiles: "  .$rhh_count->{$lang_or_file}{'nFiles'} 
++                unless $BY_FILE;
++            push @results,"  blank: "   .$rhh_count->{$lang_or_file}{'blank'}  ;
++            push @results,"  comment: " .$rhh_count->{$lang_or_file}{'comment'};
++            push @results,"  code: "    .$rhh_count->{$lang_or_file}{'code'}   ;
++            push @results,"  language: ".$rhh_count->{$lang_or_file}{'lang'} 
++                if $BY_FILE;
++            if ($opt_3) {
++                push @results, "  scaled: " . $scaled;
++                push @results, "  factor: " . $factor;
++            }
++        } elsif ($opt_csv) {
++            my $extra_3 = "";
++               $extra_3 = "${DELIM}$factor${DELIM}$scaled" if $opt_3;
++            my $first_column = undef;
++            my $clean_name   = $lang_or_file;
++            if ($BY_FILE) { 
++                $first_column = $rhh_count->{$lang_or_file}{'lang'};
++                $clean_name   = rm_leading_tempdir($lang_or_file, \%TEMP_DIR);
++            } else {
++                $first_column = $rhh_count->{$lang_or_file}{'nFiles'};
++            } 
++            my $str = $first_column                         . ${DELIM} .
++                      $clean_name                           . ${DELIM} .
++                      $rhh_count->{$lang_or_file}{'blank'}  . ${DELIM} .
++                      $rhh_count->{$lang_or_file}{'comment'}. ${DELIM} .
++                      $rhh_count->{$lang_or_file}{'code'}   .
++                      $extra_3;
++            push @results, $str;
++        } else {
++            push @results, $data_line;
++        }
++    }
++
++    my $avg_scale = 1;  # weighted average of scale factors
++       $avg_scale = sprintf("%.2f", $sum_scaled / $sum_code) 
++            if $sum_code and $opt_3;
++
++    if ($opt_xml) {
++        $data_line = "";
++        if (!$BY_FILE) {
++            $data_line .= sprintf "sum_files=\"%d\" ", $sum_files;
++        }
++        $data_line .= sprintf $Format{'4'}{$Style},
++            $sum_blank   ,
++            $sum_comment ,
++            $sum_code    ;
++        $data_line .= sprintf $Format{'5'}{$Style},
++            $avg_scale   ,
++            $sum_scaled  if $opt_3;
++        push @results, "  <total " . $data_line . "/>";
++
++        if ($BY_FILE) {
++            push @results, "</files>";
++        } else {
++            foreach my $language (keys %{$languages}) {
++                push @results, '  <language name="' . $language . '"/>';
++            }
++            push @results, "</languages>";
++        }
++
++        if (!$opt_by_file_by_lang or $ALREADY_SHOWED_XML_SECTION) {
++    	    push @results, "</results>";
++        } else {
++            $ALREADY_SHOWED_XML_SECTION = 1;
++        }
++    } elsif ($opt_yaml) {
++        push @results, "SUM:";
++        push @results, "  blank: "  . $sum_blank  ;
++        push @results, "  code: "   . $sum_code   ;
++        push @results, "  comment: ". $sum_comment;
++        push @results, "  nFiles: " . $sum_files  ;
++        if ($opt_3) {
++            push @results, "  scaled: " . $sum_scaled;
++            push @results, "  factor: " . $avg_scale ;
++        }
++    } elsif ($opt_csv) {
++        # do nothing
++    } else {
++
++        if ($BY_FILE) {
++            $data_line  = sprintf "%-${spacing_0}s ", "SUM:"  ;
++        } else {
++            $data_line  = sprintf "%-${spacing_1}s ", "SUM:"  ;
++            $data_line .= sprintf "%${spacing_2}d ", $sum_files;
++        }
++        $data_line .= sprintf $Format{'4'}{$Style},
++            $sum_blank   ,
++            $sum_comment ,
++            $sum_code    ;
++        $data_line .= sprintf $Format{'5'}{$Style},
++            $avg_scale   ,
++            $sum_scaled if $opt_3;
++        push @results, $hyphen_line if $sum_files > 1 or $opt_sum_one;
++        push @results, $data_line   if $sum_files > 1 or $opt_sum_one;
++        push @results, $hyphen_line;
++    }
++    write_xsl_file() if $opt_xsl and $opt_xsl eq $CLOC_XSL;
++    print "<- generate_report\n" if $opt_v > 2;
++    return @results;
++} # 1}}}
++sub print_errors {                           # {{{1
++    my ($rh_Error_Codes, # in
++        $raa_errors    , # in
++       ) = @_;
++
++    print "-> print_errors\n" if $opt_v > 2;
++    my %error_string = reverse(%{$rh_Error_Codes});
++    my $nErrors      = scalar @{$raa_errors};
++    warn sprintf "\n%d error%s:\n", plural_form(scalar @Errors);
++    for (my $i = 0; $i < $nErrors; $i++) {
++        warn sprintf "%s:  %s\n", 
++                     $error_string{ $raa_errors->[$i][0] },
++                     $raa_errors->[$i][1] ;
++    }
++    print "<- print_errors\n" if $opt_v > 2;
++
++} # 1}}}
++sub write_lang_def {                         # {{{1
++    my ($file                     ,
++        $rh_Language_by_Extension , # in
++        $rh_Language_by_Script    , # in
++        $rh_Language_by_File      , # in
++        $rhaa_Filters_by_Language , # in
++        $rh_Not_Code_Extension    , # in
++        $rh_Not_Code_Filename     , # in
++        $rh_Scale_Factor          , # in
++        $rh_EOL_Continuation_re   , # in
++       ) = @_;
++
++    print "-> write_lang_def($file)\n" if $opt_v > 2;
++    my $OUT = new IO::File $file, "w";
++    die "Unable to write to $file\n" unless defined $OUT;
++
++    foreach my $language (sort keys %{$rhaa_Filters_by_Language}) {
++        next if $language eq "MATLAB/Objective C/MUMPS" or
++                $language eq "PHP/Pascal"               or
++                $language eq "Lisp/OpenCL";
++        printf $OUT "%s\n", $language;
++        foreach my $filter (@{$rhaa_Filters_by_Language->{$language}}) {
++            printf $OUT "    filter %s", $filter->[0];
++            printf $OUT " %s", $filter->[1] if defined $filter->[1];
++            print  $OUT "\n";
++        }
++        foreach my $ext (sort keys %{$rh_Language_by_Extension}) {
++            if ($language eq $rh_Language_by_Extension->{$ext}) {
++                printf $OUT "    extension %s\n", $ext;
++            }
++        }
++        foreach my $filename (sort keys %{$rh_Language_by_File}) {
++            if ($language eq $rh_Language_by_File->{$filename}) {
++                printf $OUT "    filename %s\n", $filename;
++            }
++        }
++        foreach my $script_exe (sort keys %{$rh_Language_by_Script}) {
++            if ($language eq $rh_Language_by_Script->{$script_exe}) {
++                printf $OUT "    script_exe %s\n", $script_exe;
++            }
++        }
++        printf $OUT "    3rd_gen_scale %.2f\n", $rh_Scale_Factor->{$language};
++        if (defined $rh_EOL_Continuation_re->{$language}) {
++            printf $OUT "    end_of_line_continuation %s\n", 
++                $rh_EOL_Continuation_re->{$language};
++        }
++    }
++
++    $OUT->close;
++    print "<- write_lang_def\n" if $opt_v > 2;
++} # 1}}}
++sub read_lang_def {                          # {{{1
++    my ($file                     ,
++        $rh_Language_by_Extension , # out
++        $rh_Language_by_Script    , # out
++        $rh_Language_by_File      , # out
++        $rhaa_Filters_by_Language , # out
++        $rh_Not_Code_Extension    , # out
++        $rh_Not_Code_Filename     , # out
++        $rh_Scale_Factor          , # out
++        $rh_EOL_Continuation_re   , # out
++        $rh_EOL_abc,
++       ) = @_;
++
++
++    print "-> read_lang_def($file)\n" if $opt_v > 2;
++    my $IN = new IO::File $file, "r";
++    die "Unable to read $file.\n" unless defined $IN;
++
++    my $language = "";
++    while (<$IN>) {
++        next if /^\s*#/ or /^\s*$/;
++
++        if (/^(\w+.*?)\s*$/) {
++            $language = $1;
++            next;
++        }
++        die "Missing computer language name, line $. of $file\n"
++            unless $language;
++
++        if      (/^    filter\s+(\w+)\s*$/) {
++            push @{$rhaa_Filters_by_Language->{$language}}, [ $1 ]
++
++        } elsif (/^    filter\s+(\w+)\s+(.*?)\s*$/) {
++            push @{$rhaa_Filters_by_Language->{$language}}, [ $1 , $2 ]
++
++        } elsif (/^    extension\s+(\S+)\s*$/) {
++            if (defined $rh_Language_by_Extension->{$1}) {
++                die "File extension collision:  $1 ",
++                    "maps to languages '$rh_Language_by_Extension->{$1}' ",
++                    "and '$language'\n" ,
++                    "Edit $file and remove $1 from one of these two ",
++                    "language definitions.\n";
++            }
++            $rh_Language_by_Extension->{$1} = $language;
++
++        } elsif (/^    filename\s+(\S+)\s*$/) {
++            $rh_Language_by_File->{$1} = $language;
++
++        } elsif (/^    script_exe\s+(\S+)\s*$/) {
++            $rh_Language_by_Script->{$1} = $language;
++
++        } elsif (/^    3rd_gen_scale\s+(\S+)\s*$/) {
++            $rh_Scale_Factor->{$language} = $1;
++
++        } elsif (/^    end_of_line_continuation\s+(\S+)\s*$/) {
++            $rh_EOL_Continuation_re->{$language} = $1;
++
++        } else {
++            die "Unexpected data line $. of $file:\n$_\n";
++        }
++
++    }
++    $IN->close;
++    print "<- read_lang_def\n" if $opt_v > 2;
++} # 1}}}
++sub merge_lang_def {                         # {{{1
++    my ($file                     ,
++        $rh_Language_by_Extension , # in/out
++        $rh_Language_by_Script    , # in/out
++        $rh_Language_by_File      , # in/out
++        $rhaa_Filters_by_Language , # in/out
++        $rh_Not_Code_Extension    , # in/out
++        $rh_Not_Code_Filename     , # in/out
++        $rh_Scale_Factor          , # in/out
++        $rh_EOL_Continuation_re   , # in/out
++        $rh_EOL_abc,
++       ) = @_;
++
++
++    print "-> merge_lang_def($file)\n" if $opt_v > 2;
++    my $IN = new IO::File $file, "r";
++    die "Unable to read $file.\n" unless defined $IN;
++
++    my $language        = "";  
++    my $already_know_it = undef;
++    while (<$IN>) {
++        next if /^\s*#/ or /^\s*$/;
++
++        if (/^(\w+.*?)\s*$/) {
++            $language = $1;
++            $already_know_it = defined $rh_Scale_Factor->{$language};
++            next;
++        }
++        die "Missing computer language name, line $. of $file\n"
++            unless $language;
++
++        if      (/^    filter\s+(\w+)\s*$/) {
++            next if $already_know_it;
++            push @{$rhaa_Filters_by_Language->{$language}}, [ $1 ]
++
++        } elsif (/^    filter\s+(\w+)\s+(.*?)\s*$/) {
++            next if $already_know_it;
++            push @{$rhaa_Filters_by_Language->{$language}}, [ $1 , $2 ]
++
++        } elsif (/^    extension\s+(\S+)\s*$/) {
++            next if $already_know_it;
++            if (defined $rh_Language_by_Extension->{$1}) {
++                die "File extension collision:  $1 ",
++                    "maps to languages '$rh_Language_by_Extension->{$1}' ",
++                    "and '$language'\n" ,
++                    "Edit $file and remove $1 from one of these two ",
++                    "language definitions.\n";
++            }
++            $rh_Language_by_Extension->{$1} = $language;
++
++        } elsif (/^    filename\s+(\S+)\s*$/) {
++            next if $already_know_it;
++            $rh_Language_by_File->{$1} = $language;
++
++        } elsif (/^    script_exe\s+(\S+)\s*$/) {
++            next if $already_know_it;
++            $rh_Language_by_Script->{$1} = $language;
++
++        } elsif (/^    3rd_gen_scale\s+(\S+)\s*$/) {
++            next if $already_know_it;
++            $rh_Scale_Factor->{$language} = $1;
++
++        } elsif (/^    end_of_line_continuation\s+(\S+)\s*$/) {
++            next if $already_know_it;
++            $rh_EOL_Continuation_re->{$language} = $1;
++
++        } else {
++            die "Unexpected data line $. of $file:\n$_\n";
++        }
++
++    }
++    $IN->close;
++    print "<- merge_lang_def\n" if $opt_v > 2;
++} # 1}}}
++sub print_extension_info {                   # {{{1
++    my ($extension,) = @_;
++    if ($extension) {  # show information on this extension
++        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
++            # Language_by_Extension{f}    = 'Fortran 77' 
++            printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext}
++                if $ext =~ m{$extension}i;
++        }
++    } else {           # show information on all  extensions
++        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
++            # Language_by_Extension{f}    = 'Fortran 77' 
++            printf "%-12s -> %s\n", $ext, $Language_by_Extension{$ext};
++        }
++    }
++} # 1}}}
++sub print_language_info {                    # {{{1
++    my ($language,) = @_;
++    my %extensions = (); # the subset matched by the given $language value
++    if ($language) {  # show information on this language
++        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
++            # Language_by_Extension{f}    = 'Fortran 77' 
++            push @{$extensions{$Language_by_Extension{$ext}} }, $ext
++                if $Language_by_Extension{$ext} =~ m{$language}i;
++        }
++    } else {          # show information on all  languages
++        foreach my $ext (sort {lc $a cmp lc $b } keys %Language_by_Extension) {
++            # Language_by_Extension{f}    = 'Fortran 77' 
++            push @{$extensions{$Language_by_Extension{$ext}} }, $ext
++        }
++    }
++
++    # add exceptions (one file extension mapping to multiple languages)
++    if (!$language or 
++        $language =~ /^(Objective C|MATLAB|MUMPS)$/i) {
++        push @{$extensions{'Objective C'}}, "m";
++        push @{$extensions{'MATLAB'}}     , "m";
++        push @{$extensions{'MUMPS'}}      , "m";
++        delete $extensions{'MATLAB/Objective C/MUMPS'};
++    } elsif ($language =~ /^(Lisp|OpenCL)$/i) {
++        push @{$extensions{'Lisp'}}  , "cl";
++        push @{$extensions{'OpenCL'}}, "cl";
++        delete $extensions{'Lisp/OpenCL'};
++    } elsif ($language =~ /^(Ant)$/i) {
++        push @{$extensions{'Ant'}}  , "build.xml";
++        delete $extensions{'Ant/XML'};
++    }
++
++    if (%extensions) {
++        foreach my $lang (sort {lc $a cmp lc $b } keys %extensions) {
++            printf "%-26s (%s)\n", $lang, join(", ", @{$extensions{$lang}});
++        }
++    }
++} # 1}}}
++sub make_file_list {                         # {{{1
++    my ($ra_arg_list,  # in   file and/or directory names to examine
++        $rh_Err     ,  # in   hash of error codes
++        $raa_errors ,  # out  errors encountered
++        $rh_ignored ,  # out  files not recognized as computer languages
++        ) = @_;
++    print "-> make_file_list(@{$ra_arg_list})\n" if $opt_v > 2;
++
++    my ($fh, $filename);
++    if ($opt_categorized) {
++        $filename = $opt_categorized;
++        $fh = new IO::File $filename, "+>";  # open for read/write
++        die "Unable to write to $filename:  $!\n" unless defined $fh;
++    } elsif ($opt_sdir) {
++        # write to the user-defined scratch directory
++        $filename = $opt_sdir . '/cloc_file_list.txt';
++        $fh = new IO::File $filename, "+>";  # open for read/write
++        die "Unable to write to $filename:  $!\n" unless defined $fh;
++    } else {
++        # let File::Temp create a suitable temporary file
++        ($fh, $filename) = tempfile(UNLINK => 1);  # delete file on exit
++        print "Using temp file list [$filename]\n" if $opt_v;
++    }
++
++    my @dir_list = ();
++    foreach my $file_or_dir (@{$ra_arg_list}) {
++#print "make_file_list file_or_dir=$file_or_dir\n";
++        my $size_in_bytes = 0;
++        if (!-r $file_or_dir) {
++            push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file_or_dir];
++            next;
++        }
++        if (is_file($file_or_dir)) {
++            if (!(-s $file_or_dir)) {   # 0 sized file, named pipe, socket 
++                $rh_ignored->{$file_or_dir} = 'zero sized file';
++                next;
++            } elsif (-B $file_or_dir and !$opt_read_binary_files) { 
++                # avoid binary files unless user insists on reading them
++                if ($opt_unicode) {
++                    # only ignore if not a Unicode file w/trivial 
++                    # ASCII transliteration
++                    if (!unicode_file($file_or_dir)) {
++                        $rh_ignored->{$file_or_dir} = 'binary file';
++                        next;
++                    }
++                } else {
++                    $rh_ignored->{$file_or_dir} = 'binary file';
++                    next;
++                }
++            }
++            push @file_list, "$file_or_dir";
++        } elsif (is_dir($file_or_dir)) {
++            push @dir_list, $file_or_dir;
++        } else {
++            push @{$raa_errors}, [$rh_Err->{'Neither file nor directory'} , $file_or_dir];
++            $rh_ignored->{$file_or_dir} = 'not file, not directory';
++        }
++    }
++    foreach my $dir (@dir_list) {
++#print "make_file_list dir=$dir\n";
++        # populates global variable @file_list
++        find({wanted => \&files, follow => $opt_follow_links }, $dir);  
++    }
++    $nFiles_Found = scalar @file_list;
++    printf "%8d text file%s.\n", plural_form($nFiles_Found) unless $opt_quiet;
++    write_file($opt_found, sort @file_list) if $opt_found;
++
++    my $nFiles_Categorized = 0;
++    foreach my $file (@file_list) {
++        printf "classifying $file\n" if $opt_v > 2;
++
++        my $basename = basename $file;
++        if ($Not_Code_Filename{$basename}) {
++            $rh_ignored->{$file} = "listed in " . '$' .
++                "Not_Code_Filename{$basename}";
++            next;
++        } elsif ($basename =~ m{~$}) {
++            $rh_ignored->{$file} = "temporary editor file";
++            next;
++        }
++
++        my $size_in_bytes = (stat $file)[7];
++        my $language      = "";
++        if ($All_One_Language) {
++            # user over-rode auto-language detection by using
++            # --force-lang with just a language name (no extension)
++            $language      = $All_One_Language;
++        } else {
++            $language      = classify_file($file      ,
++                                           $rh_Err    ,
++                                           $raa_errors,
++                                           $rh_ignored);
++        }
++die  "make_file_list($file) undef size" unless defined $size_in_bytes;
++die  "make_file_list($file) undef lang" unless defined $language;
++        printf $fh "%d,%s,%s\n", $size_in_bytes, $language, $file;
++        ++$nFiles_Categorized;
++        #printf "classified %d files\n", $nFiles_Categorized 
++        #    unless (!$opt_progress_rate or 
++        #            ($nFiles_Categorized % $opt_progress_rate));
++    }
++    printf "classified %d files\r", $nFiles_Categorized 
++        if !$opt_quiet and $nFiles_Categorized > 1;
++
++    print "<- make_file_list()\n" if $opt_v > 2;
++
++    return $fh;   # handle to the file containing the list of files to process
++}  # 1}}}
++sub remove_duplicate_files {                 # {{{1
++    my ($fh                   , # in 
++        $rh_Language          , # out
++        $rh_unique_source_file, # out
++        $rh_Err               , # in
++        $raa_errors           , # out  errors encountered
++        $rh_ignored           , # out
++        ) = @_;
++
++    # Check for duplicate files by comparing file sizes.
++    # Where files are equally sized, compare their MD5 checksums.
++    print "-> remove_duplicate_files\n" if $opt_v > 2;
++
++    my $n = 0;
++    my %files_by_size = (); # files_by_size{ # bytes } = [ list of files ]
++    seek($fh, 0, 0); # rewind to beginning of the temp file
++    while (<$fh>) {
++        ++$n;
++        my ($size_in_bytes, $language, $file) = split(/,/, $_, 3);
++        chomp($file);
++        $rh_Language->{$file} = $language;
++        push @{$files_by_size{$size_in_bytes}}, $file;
++        if ($opt_skip_uniqueness) {
++            $rh_unique_source_file->{$file} = 1;
++        }
++    }
++    return if $opt_skip_uniqueness;
++    if ($opt_progress_rate and ($n > $opt_progress_rate)) {
++        printf "Duplicate file check %d files (%d known unique)\r", 
++            $n, scalar keys %files_by_size;
++    }
++    $n = 0;
++    foreach my $bytes (sort {$a <=> $b} keys %files_by_size) {
++        ++$n;
++        printf "Unique: %8d files                                          \r",
++            $n unless (!$opt_progress_rate or ($n % $opt_progress_rate));
++        if (scalar @{$files_by_size{$bytes}} == 1) {
++            # only one file is this big; must be unique
++            $rh_unique_source_file->{$files_by_size{$bytes}[0]} = 1;
++            next;
++        } else {
++#print "equally sized files: ",join(", ", @{$files_by_size{$bytes}}), "\n";
++            # Files in the list @{$files_by_size{$bytes} all are
++            # $bytes long.  Sort the list by file basename.
++            my @sorted_bn = ();
++            my %BN = map { basename($_) => $_ } @{$files_by_size{$bytes}};
++            foreach my $F (sort keys %BN) {
++                push @sorted_bn, $BN{$F};
++            }
++            foreach my $F (different_files(\@sorted_bn  ,
++                                            $rh_Err     ,
++                                            $raa_errors ,
++                                            $rh_ignored ) ) {
++                $rh_unique_source_file->{$F} = 1;
++            }
++        }
++    }
++    print "<- remove_duplicate_files\n" if $opt_v > 2;
++} # 1}}}
++sub files {                                  # {{{1
++    # invoked by File::Find's find()   Populates global variables,
++    # @file_list, %Ignored
++    if ($opt_exclude_dir or $opt_exclude_list_file) {
++        my $return = 0;
++        foreach my $skip_dir (keys %Exclude_Dir) {
++            # File::Find::dir used to always start with / but
++            # newer versions (1.13) no longer do; have to correct for this
++            my $dir = $File::Find::dir;
++               $dir = "./$dir" unless $dir =~ m{^/};
++            if ($dir =~ m{/\Q$skip_dir\E(/|$)} ) {
++                $Ignored{$File::Find::name} = "--exclude-dir=$skip_dir";
++                $return = 1;
++                last;
++            }
++        }
++        return if $return;
++    }
++    my $Dir = cwd(); # not $File::Find::dir which just gives relative path
++	if ($opt_match_f    ) {	return unless /$opt_match_f/;     }
++    if ($opt_not_match_f) {	return if     /$opt_not_match_f/; }
++	if ($opt_match_d    ) {	return unless $Dir =~ m{$opt_match_d}     }
++    if ($opt_not_match_d) {	return if     $Dir =~ m{$opt_not_match_d} }
++
++    my $nBytes = -s     $_ ;
++    if (!$nBytes) {
++        $Ignored{$File::Find::name} = 'zero sized file';
++        printf "files(%s)  zero size\n", $File::Find::name if $opt_v > 5;
++    }
++    return unless $nBytes  ; # attempting other tests w/pipe or socket will hang
++    if ($nBytes > $opt_max_file_size*1024**2) {
++        $Ignored{$File::Find::name} = "file size of " .
++            $nBytes/1024**2 . " MB exceeds max file size of " .
++            "$opt_max_file_size MB";
++        printf "file(%s)  exceeds $opt_max_file_size MB\n", 
++            $File::Find::name if $opt_v > 5;
++        return;
++    }
++    my $is_dir = is_dir($_);
++    my $is_bin = -B     $_ ;
++    printf "files(%s)  size=%d is_dir=%d  -B=%d\n",
++        $File::Find::name, $nBytes, $is_dir, $is_bin if $opt_v > 5;
++    $is_bin = 0 if $opt_unicode and unicode_file($_);
++    $is_bin = 0 if $opt_read_binary_files;
++    return if $is_dir or $is_bin;
++    ++$nFiles_Found;
++    printf "%8d files\r", $nFiles_Found 
++        unless (!$opt_progress_rate or ($nFiles_Found % $opt_progress_rate));
++    push @file_list, $File::Find::name;
++} # 1}}}
++sub archive_files {                          # {{{1
++    # invoked by File::Find's find()  Populates global variable @binary_archive
++    foreach my $ext (keys %Known_Binary_Archives) {
++        push @binary_archive, $File::Find::name 
++            if $File::Find::name =~ m{$ext$};
++    }
++} # 1}}}
++sub is_file {                                # {{{1
++    # portable method to test if item is a file
++    # (-f doesn't work in ActiveState Perl on Windows)
++    my $item = shift @_;
++
++    if ($ON_WINDOWS) {
++        my $mode = (stat $item)[2];
++           $mode = 0 unless $mode;
++        if ($mode & 0100000) { return 1; } 
++        else                 { return 0; }
++    } else {
++        return (-f $item);  # works on Unix, Linux, CygWin, z/OS
++    }
++} # 1}}}
++sub is_dir {                                 # {{{1
++    # portable method to test if item is a directory
++    # (-d doesn't work in ActiveState Perl on Windows)
++    my $item = shift @_;
++
++    if ($ON_WINDOWS) {
++        my $mode = (stat $item)[2];
++           $mode = 0 unless $mode;
++        if ($mode & 0040000) { return 1; } 
++        else                 { return 0; }
++    } else {
++        return (-d $item);  # works on Unix, Linux, CygWin, z/OS
++    }
++} # 1}}}
++sub is_excluded {                            # {{{1
++    my ($file       , # in
++        $excluded   , # in   hash of excluded directories
++       ) = @_;
++    my($filename, $filepath, $suffix) = fileparse($file);
++    foreach my $path (sort keys %{$excluded}) {
++        return 1 if ($filepath =~ m{^$path/}i);
++    }
++} # 1}}}
++sub classify_file {                          # {{{1
++    my ($full_file   , # in
++        $rh_Err      , # in   hash of error codes
++        $raa_errors  , # out
++        $rh_ignored  , # out
++       ) = @_;
++
++    print "-> classify_file($full_file)\n" if $opt_v > 2;
++    my $language = "(unknown)";
++
++    if (basename($full_file) eq "-" && defined $opt_stdin_name) {
++       $full_file = $opt_stdin_name;
++    }
++
++    my $look_at_first_line = 0;
++    my $file = basename $full_file; 
++    if ($opt_autoconf and $file =~ /\.in$/) {
++       $file =~ s/\.in$//;
++    }
++    return $language if $Not_Code_Filename{$file}; # (unknown)
++    return $language if $file =~ m{~$}; # a temp edit file (unknown)
++    if (defined $Language_by_File{$file}) {
++        if      ($Language_by_File{$file} eq "Ant/XML") {
++            return Ant_or_XML(  $full_file, $rh_Err, $raa_errors);
++        } elsif ($Language_by_File{$file} eq "Maven/XML") {
++            return Maven_or_XML($full_file, $rh_Err, $raa_errors);
++        } else {
++            return $Language_by_File{$file};
++        }
++    }
++
++    if ($file =~ /\.(\w+)$/) { # has an extension
++      print "$full_file extension=[$1]\n" if $opt_v > 2;
++      my $extension = $1;
++         # Windows file names are case insensitive so map 
++         # all extensions to lowercase there.
++         $extension = lc $extension if $ON_WINDOWS;  
++      my @extension_list = ( $extension );
++      if ($file =~ /\.(\w+\.\w+)$/) { # has a double extension
++          my $extension = $1;
++          $extension = lc $extension if $ON_WINDOWS;  
++          unshift @extension_list, $extension;  # examine double ext first
++      }
++      foreach my $extension (@extension_list) {
++        if ($Not_Code_Extension{$extension} and 
++           !$Forced_Extension{$extension}) {
++           # If .1 (for example) is an extention that would ordinarily be
++           # ignored but the user has insisted this be counted with the
++           # --force-lang option, then go ahead and count it.
++            $rh_ignored->{$full_file} = 
++                'listed in $Not_Code_Extension{' . $extension . '}';
++            return $language;
++        }
++        if (defined $Language_by_Extension{$extension}) {
++            if ($Language_by_Extension{$extension} eq
++                'MATLAB/Objective C/MUMPS') {
++                my $lang_M_or_O = "";
++                matlab_or_objective_C($full_file , 
++                                      $rh_Err    ,
++                                      $raa_errors,
++                                     \$lang_M_or_O);
++                if ($lang_M_or_O) {
++                    return $lang_M_or_O;
++                } else { # an error happened in matlab_or_objective_C()
++                    $rh_ignored->{$full_file} = 
++                        'failure in matlab_or_objective_C()';
++                    return $language; # (unknown)
++                }
++            } elsif ($Language_by_Extension{$extension} eq 'PHP/Pascal') {
++                if (really_is_php($full_file)) {
++                    return 'PHP';
++                } elsif (really_is_incpascal($full_file)) {
++                    return 'Pascal';
++                } else {
++                    return $language; # (unknown)
++                }
++            } elsif ($Language_by_Extension{$extension} eq 'Lisp/OpenCL') {
++                return Lisp_or_OpenCL($full_file, $rh_Err, $raa_errors);
++            } elsif ($Language_by_Extension{$extension} eq 'Smarty') {
++                # Smarty extension .tpl is generic; make sure the
++                # file at least roughly resembles PHP.  Alternatively,
++                # if the user forces the issue, do the count.
++                my $force_smarty = 0;
++                foreach (@opt_force_lang) {
++                    if (lc($_) eq "smarty,tpl") {
++                        $force_smarty = 1; 
++                        last;
++                    }
++                }
++                if (really_is_php($full_file) or $force_smarty) {
++                    return 'Smarty';
++                } else {
++                    return $language; # (unknown)
++                }
++            } else {
++                return $Language_by_Extension{$extension};
++            }
++        } else { # has an unmapped file extension
++            $look_at_first_line = 1;
++        }
++      }
++    } elsif (defined $Language_by_File{lc $file}) {
++        return $Language_by_File{lc $file};
++    } elsif ($opt_lang_no_ext and 
++             defined $Filters_by_Language{$opt_lang_no_ext}) {
++        return $opt_lang_no_ext;
++    } else {  # no file extension
++        $look_at_first_line = 1;
++    }
++
++    if ($look_at_first_line) {
++        # maybe it is a shell/Perl/Python/Ruby/etc script that
++        # starts with pound bang:
++        #   #!/usr/bin/perl
++        #   #!/usr/bin/env perl
++        my $script_language = peek_at_first_line($full_file , 
++                                                 $rh_Err    , 
++                                                 $raa_errors);
++        if (!$script_language) {
++            $rh_ignored->{$full_file} = "language unknown (#2)";
++            # returns (unknown)
++        }
++        if (defined $Language_by_Script{$script_language}) {
++            if (defined $Filters_by_Language{
++                            $Language_by_Script{$script_language}}) {
++                $language = $Language_by_Script{$script_language};
++            } else {
++                $rh_ignored->{$full_file} = 
++                    "undefined:  Filters_by_Language{" . 
++                    $Language_by_Script{$script_language} .
++                    "} for scripting language $script_language";
++                # returns (unknown)
++            }
++        } else {
++            $rh_ignored->{$full_file} = "language unknown (#3)";
++            # returns (unknown)
++        }
++    }
++    print "<- classify_file($full_file)\n" if $opt_v > 2;
++    return $language;
++} # 1}}}
++sub peek_at_first_line {                     # {{{1
++    my ($file        , # in
++        $rh_Err      , # in   hash of error codes
++        $raa_errors  , # out
++       ) = @_;
++
++    print "-> peek_at_first_line($file)\n" if $opt_v > 2;
++
++    my $script_language = "";
++    if (!-r $file) {
++        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
++        return $script_language;
++    }
++    my $IN = new IO::File $file, "r";
++    if (!defined $IN) {
++        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
++        print "<- peek_at_first_line($file)\n" if $opt_v > 2;
++        return $script_language;
++    }
++    chomp(my $first_line = <$IN>);
++    if (defined $first_line) {
++#print "peek_at_first_line of [$file] first_line=[$first_line]\n";
++        if ($first_line =~ /^#\!\s*(\S.*?)$/) {
++#print "peek_at_first_line 1=[$1]\n";
++            my @pound_bang = split(' ', $1);
++#print "peek_at_first_line basename 0=[", basename($pound_bang[0]), "]\n";
++            if (basename($pound_bang[0]) eq "env" and 
++                scalar @pound_bang > 1) {
++                $script_language = $pound_bang[1];
++#print "peek_at_first_line pound_bang A $pound_bang[1]\n";
++            } else {
++                $script_language = basename $pound_bang[0];
++#print "peek_at_first_line pound_bang B $script_language\n";
++            }
++        }
++    }
++    $IN->close;
++    print "<- peek_at_first_line($file)\n" if $opt_v > 2;
++    return $script_language;
++} # 1}}}
++sub different_files {                        # {{{1
++    # See which of the given files are unique by computing each file's MD5
++    # sum.  Return the subset of files which are unique.
++    my ($ra_files    , # in
++        $rh_Err      , # in
++        $raa_errors  , # out
++        $rh_ignored  , # out
++       ) = @_;
++
++    print "-> different_files(@{$ra_files})\n" if $opt_v > 2;
++    my %file_hash = ();  # file_hash{md5 hash} = [ file1, file2, ... ]
++    foreach my $F (@{$ra_files}) {
++        next if is_dir($F);  # needed for Windows
++        my $IN = new IO::File $F, "r";
++        if (!defined $IN) {
++            push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $F];
++            $rh_ignored->{$F} = 'cannot read';
++        } else {
++            if ($HAVE_Digest_MD5) {
++                binmode $IN;
++                my $MD5 = Digest::MD5->new->addfile($IN)->hexdigest;
++#print "$F, $MD5\n";
++                push @{$file_hash{$MD5}}, $F;
++            } else {
++                # all files treated unique
++                push @{$file_hash{$F}}, $F;
++            }
++            $IN->close;
++        }
++    }
++
++    # Loop over file sets having identical MD5 sums.  Within
++    # each set, pick the file that most resembles known source 
++    # code.
++    my @unique = ();
++    for my $md5 (sort keys %file_hash) {
++        my $i_best = 0;
++        for (my $i = 1; $i < scalar(@{$file_hash{$md5}}); $i++) {
++            my $F = $file_hash{$md5}[$i];
++            my (@nul_a, %nul_h);
++            my $language = classify_file($F, $rh_Err, 
++                                        # don't save these errors; pointless
++                                        \@nul_a, \%nul_h);
++            $i_best = $i if $language ne "(unknown)";
++        }
++        # keep the best one found and identify the rest as ignored
++        for (my $i = 0; $i < scalar(@{$file_hash{$md5}}); $i++) {
++            if ($i == $i_best) {
++                push @unique, $file_hash{$md5}[$i_best];
++            } else {
++                $rh_ignored->{$file_hash{$md5}[$i]} = "duplicate of " .
++                    $file_hash{$md5}[$i_best];
++            }
++        }
++
++    }
++    print "<- different_files(@unique)\n" if $opt_v > 2;
++    return @unique;
++} # 1}}}
++sub call_counter {                           # {{{1
++    my ($file     , # in
++        $language , # in
++        $ra_Errors, # out
++       ) = @_;
++
++    # Logic:  pass the file through the following filters:
++    #         1. remove blank lines
++    #         2. remove comments using each filter defined for this language
++    #            (example:  SQL has two, remove_starts_with(--) and 
++    #             remove_c_comments() )
++    #         3. compute comment lines as 
++    #               total lines - blank lines - lines left over after all
++    #                   comment filters have been applied
++
++    print "-> call_counter($file, $language)\n" if $opt_v > 2;
++#print "call_counter:  ", Dumper(@routines), "\n";
++
++    my @lines = ();
++    my $ascii = "";
++    if (-B $file and $opt_unicode) {
++        # was binary so must be unicode
++
++        $/ = undef;
++        my $IN = new IO::File $file, "r";
++        my $bin_text = <$IN>;
++        $IN->close;
++        $/ = "\n";
++
++        $ascii = unicode_to_ascii( $bin_text );
++        @lines = split("\n", $ascii );
++        foreach (@lines) { $_ = "$_\n"; }
++
++    } else {
++        # regular text file
++        @lines = read_file($file);
++        $ascii = join('', @lines);
++    }
++
++    my @original_lines = @lines;
++    my $total_lines    = scalar @lines;
++
++    print_lines($file, "Original file:", \@lines) if $opt_print_filter_stages;
++    @lines = rm_blanks(\@lines, $language, \%EOL_Continuation_re); # remove blank lines
++    my $blank_lines = $total_lines - scalar @lines;
++    print_lines($file, "Blank lines removed:", \@lines) 
++        if $opt_print_filter_stages;
++
++    @lines = rm_comments(\@lines, $language, $file,
++                               \%EOL_Continuation_re);
++
++    my $comment_lines = $total_lines - $blank_lines - scalar  @lines;
++    if ($opt_strip_comments) {
++        my $stripped_file = "";
++        if ($opt_original_dir) {
++            $stripped_file =          $file . ".$opt_strip_comments";
++        } else {
++            $stripped_file = basename $file . ".$opt_strip_comments";
++        }
++        write_file($stripped_file, @lines);
++    }
++    if ($opt_html and !$opt_diff) {
++        chomp(@original_lines);  # includes blank lines, comments
++        chomp(@lines);           # no blank lines, no comments
++
++        my (@diff_L, @diff_R, %count);
++
++        # remove blank lines to get better quality diffs; count
++        # blank lines separately
++        my @original_lines_minus_white = ();
++        # however must keep track of how many blank lines were removed and
++        # where they were removed so that the HTML display can include it
++        my %blank_line  = ();
++        my $insert_line = 0;
++        foreach (@original_lines) {
++            if (/^\s*$/) {
++               ++$count{blank}{same};
++               ++$blank_line{ $insert_line };
++            } else {
++                ++$insert_line;
++                push @original_lines_minus_white, $_;
++            }
++        }
++
++        array_diff( $file                       ,   # in
++                   \@original_lines_minus_white ,   # in
++                   \@lines                      ,   # in
++                   "comment"                    ,   # in
++                   \@diff_L, \@diff_R,          ,   # out
++                    $ra_Errors);                    # in/out
++        write_comments_to_html($file, \@diff_L, \@diff_R, \%blank_line);
++#print Dumper("count", \%count);
++    }
++
++    print "<- call_counter($total_lines, $blank_lines, $comment_lines)\n" 
++        if $opt_v > 2;
++    return ($total_lines, $blank_lines, $comment_lines);
++} # 1}}}
++sub windows_glob {                           # {{{1
++    # Windows doesn't expand wildcards.  Use code from Sean M. Burke's 
++    # Win32::Autoglob module to do this.
++    return map {;
++        ( defined($_) and m/[\*\?]/ ) ? sort(glob($_)) : $_
++          } @_; 
++} # 1}}}
++sub write_file {                             # {{{1
++    my ($file  , # in
++        @lines , # in
++       ) = @_;
++
++#print "write_file 1 [$file]\n";
++    # Do ~ expansion (by Tim LaBerge, fixes bug 2787984)
++    my $preglob_filename = $file;
++#print "write_file 2 [$preglob_filename]\n";
++    if ($ON_WINDOWS) {
++        $file = (windows_glob($file))[0];
++    } else {
++        $file = File::Glob::glob($file);
++    }
++#print "write_file 3 [$file]\n";
++    $file = $preglob_filename unless $file;
++#print "write_file 4 [$file]\n";
++
++    print "-> write_file($file)\n" if $opt_v > 2;
++
++    # Create the destination directory if it doesn't already exist.
++    my $abs_file_path = File::Spec->rel2abs( $file );
++    my ($volume, $directories, $filename) = File::Spec->splitpath( $abs_file_path );
++    mkpath($volume . $directories, 1, 0777);
++    
++    my $OUT = new IO::File $file, "w";
++    if (defined $OUT) {
++        chomp(@lines);
++        print $OUT join("\n", @lines), "\n";
++        $OUT->close;
++    } else {
++        warn "Unable to write to $file\n";
++    }
++    print "Wrote $file" unless $opt_quiet;
++    print ", $CLOC_XSL" if $opt_xsl and $opt_xsl eq $CLOC_XSL;
++    print "\n" unless $opt_quiet;
++    
++    print "<- write_file\n" if $opt_v > 2;
++} # 1}}}
++sub read_file  {                             # {{{1
++    my ($file, ) = @_;
++
++    print "-> read_file($file)\n" if $opt_v > 2;
++    my @lines = ();
++    my $IN = new IO::File $file, "r";
++    if (defined $IN) {
++        @lines = <$IN>;
++        $IN->close;
++        if ($lines[$#lines]) {  # test necessary for zero content files
++                                # (superfluous?)
++            # Some files don't end with a new line.  Force this:
++            $lines[$#lines] .= "\n" unless $lines[$#lines] =~ m/\n$/;
++        }
++    } else {
++        warn "Unable to read $file\n";
++    }
++    print "<- read_file\n" if $opt_v > 2;
++    return @lines;
++} # 1}}}
++sub rm_blanks {                              # {{{1
++    my ($ra_in    ,
++        $language ,
++        $rh_EOL_continuation_re) = @_;
++    print "-> rm_blanks(language=$language)\n" if $opt_v > 2;
++#print "rm_blanks: language = [$language]\n";
++    my @out = ();
++    if ($language eq "COBOL") {
++        @out = remove_cobol_blanks($ra_in);
++    } else {
++        # removes blank lines
++        if (defined $rh_EOL_continuation_re->{$language}) {
++            @out = remove_matches_2re($ra_in, '^\s*$', 
++                                      $rh_EOL_continuation_re->{$language}); 
++        } else {
++            @out = remove_matches($ra_in, '^\s*$');
++        }
++    }
++    print "<- rm_blanks(language=$language)\n" if $opt_v > 2;
++    return @out;
++} # 1}}}
++sub rm_comments {                            # {{{1
++    my ($ra_lines , # in, must be free of blank lines
++        $language , # in
++        $file     , # in (some language counters, eg Haskell, need 
++                    #     access to the original file)
++        $rh_EOL_continuation_re , # in
++       ) = @_;
++    print "-> rm_comments(file=$file)\n" if $opt_v > 2;
++    my @routines       = @{$Filters_by_Language{$language}};
++    my @lines          = @{$ra_lines};
++    my @original_lines = @{$ra_lines};
++
++    foreach my $call_string (@routines) {
++        my $subroutine = $call_string->[0];
++        if (! defined &{$subroutine}) {
++            warn "rm_comments undefined subroutine $subroutine for $file\n";
++            next;
++        }
++        print "rm_comments file=$file sub=$subroutine\n" if $opt_v > 1;
++        my @args  = @{$call_string};
++        shift @args; # drop the subroutine name
++        if (@args and $args[0] eq '>filename<') {
++            shift   @args;
++            unshift @args, $file;
++        }
++
++        no strict 'refs';
++        @lines = &{$subroutine}(\@lines, @args);   # apply filter...
++
++        print_lines($file, "After $subroutine(@args)", \@lines) 
++            if $opt_print_filter_stages;
++        # then remove blank lines which are created by comment removal
++        if (defined $rh_EOL_continuation_re->{$language}) {
++            @lines = remove_matches_2re(\@lines, '^\s*$',
++                                        $rh_EOL_continuation_re->{$language});
++        } else {
++            @lines = remove_matches(\@lines, '^\s*$');
++        }
++        
++        print_lines($file, "post $subroutine(@args) blank cleanup:", \@lines) 
++            if $opt_print_filter_stages;
++    }
++    # Exception for scripting languages:  treat the first #! line as code.
++    # Will need to add it back in if it was removed earlier.
++    if ($Script_Language{$language} and 
++        $original_lines[0] =~ /^#!/ and
++        (scalar(@lines) == 0 or 
++         $lines[0] ne $original_lines[0])) {
++        unshift @lines, $original_lines[0];  # add the first line back
++    }
++    print "<- rm_comments\n" if $opt_v > 2;
++    return @lines;
++} # 1}}}
++sub remove_f77_comments {                    # {{{1
++    my ($ra_lines, ) = @_;
++    print "-> remove_f77_comments\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    foreach (@{$ra_lines}) {
++        next if m{^[*cC]};
++        next if m{^\s*!};
++        push @save_lines, $_;
++    }
++
++    print "<- remove_f77_comments\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_f90_comments {                    # {{{1
++    # derived from SLOCCount
++    my ($ra_lines, ) = @_;
++    print "-> remove_f90_comments\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    foreach (@{$ra_lines}) {
++        # a comment is              m/^\s*!/
++        # an empty line is          m/^\s*$/
++        # a HPF statement is        m/^\s*!hpf\$/i
++        # an Open MP statement is   m/^\s*!omp\$/i
++        if (! m/^(\s*!|\s*$)/ || m/^\s*!(hpf|omp)\$/i) {
++            push @save_lines, $_;
++        }
++    }
++
++    print "<- remove_f90_comments\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_matches {                         # {{{1
++    my ($ra_lines, # in
++        $pattern , # in   Perl regular expression (case insensitive)
++       ) = @_;
++    print "-> remove_matches(pattern=$pattern)\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    foreach (@{$ra_lines}) {
++#chomp; print "remove_matches [$pattern] [$_]\n";
++        next if m{$pattern}i;
++        push @save_lines, $_;
++    }
++
++    print "<- remove_matches\n" if $opt_v > 2;
++#print "remove_matches returning\n   ", join("\n   ", @save_lines), "\n";
++    return @save_lines;
++} # 1}}}
++sub remove_matches_2re {                     # {{{1
++    my ($ra_lines, # in
++        $pattern1, # in Perl regex 1 (case insensitive) to match
++        $pattern2, # in Perl regex 2 (case insensitive) to not match prev line
++       ) = @_;
++    print "-> remove_matches_2re(pattern=$pattern1,$pattern2)\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    for (my $i = 0; $i < scalar @{$ra_lines}; $i++) {
++#print "remove_matches_2re [$pattern1] [$pattern2] [$ra_lines->[$i]]\n";
++        if ($i) {
++#print "remove_matches_2re prev=[$ra_lines->[$i-1]] this=[$ra_lines->[$i]]\n";
++            next if ($ra_lines->[$i]   =~ m{$pattern1}i) and 
++                    ($ra_lines->[$i-1] !~ m{$pattern2}i);
++        } else {
++            # on first line
++            next if $ra_lines->[$i]   =~  m{$pattern1}i;
++        }
++        push @save_lines, $ra_lines->[$i];
++    }
++
++    print "<- remove_matches_2re\n" if $opt_v > 2;
++#print "remove_matches_2re returning\n   ", join("\n   ", @save_lines), "\n";
++    return @save_lines;
++} # 1}}}
++sub remove_inline {                          # {{{1
++    my ($ra_lines, # in
++        $pattern , # in   Perl regular expression (case insensitive)
++       ) = @_;
++    print "-> remove_inline(pattern=$pattern)\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    unless ($opt_inline) {
++        return @{$ra_lines};
++    }
++    my $nLines_affected = 0;
++    foreach (@{$ra_lines}) {
++#chomp; print "remove_inline [$pattern] [$_]\n";
++        if (m{$pattern}i) {
++            ++$nLines_affected;
++            s{$pattern}{}i;
++        }
++        push @save_lines, $_;
++    }
++
++    print "<- remove_inline\n" if $opt_v > 2;
++#print "remove_inline returning\n   ", join("\n   ", @save_lines), "\n";
++    return @save_lines;
++} # 1}}}
++sub remove_above {                           # {{{1
++    my ($ra_lines, $marker, ) = @_;
++    print "-> remove_above(marker=$marker)\n" if $opt_v > 2;
++
++    # Make two passes through the code:
++    # 1. check if the marker exists
++    # 2. remove anything above the marker if it exists,
++    #    do nothing if the marker does not exist
++
++    # Pass 1
++    my $found_marker = 0;
++    for (my $line_number  = 1;
++            $line_number <= scalar @{$ra_lines};
++            $line_number++) {
++        if ($ra_lines->[$line_number-1] =~ m{$marker}) {
++            $found_marker = $line_number;
++            last;
++        }
++    }
++
++    # Pass 2 only if needed
++    my @save_lines = ();
++    if ($found_marker) {
++        my $n = 1;
++        foreach (@{$ra_lines}) {
++            push @save_lines, $_
++                if $n >= $found_marker;
++            ++$n;
++        }
++    } else { # marker wasn't found; save all lines
++        foreach (@{$ra_lines}) {
++            push @save_lines, $_;
++        }
++    }
++
++    print "<- remove_above\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_below {                           # {{{1
++    my ($ra_lines, $marker, ) = @_;
++    print "-> remove_below(marker=$marker)\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    foreach (@{$ra_lines}) {
++        last if m{$marker};
++        push @save_lines, $_;
++    }
++
++    print "<- remove_below\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_below_above {                     # {{{1
++    my ($ra_lines, $marker_below, $marker_above, ) = @_;
++    # delete lines delimited by start and end line markers such
++    # as Perl POD documentation
++    print "-> remove_below_above(markerB=$marker_below, A=$marker_above)\n" 
++        if $opt_v > 2;
++
++    my @save_lines = ();
++    my $between    = 0;
++    foreach (@{$ra_lines}) {
++        if (!$between and m{$marker_below}) {
++            $between    = 1;
++            next;
++        }
++        if ($between and m{$marker_above}) {
++            $between    = 0;
++            next;
++        }
++        next if $between;
++        push @save_lines, $_;
++    }
++
++    print "<- remove_below_above\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_between {                         # {{{1
++    my ($ra_lines, $marker, ) = @_;
++    # $marker must contain one of the balanced pairs understood
++    # by Regexp::Common::balanced, namely
++    # '{}'  '()'  '[]'  or  '<>'
++
++    print "-> remove_between(marker=$marker)\n" if $opt_v > 2;
++    my %acceptable = ('{}'=>1,  '()'=>1,  '[]'=>1,  '<>'=>1, );
++    die "remove_between:  invalid delimiter '$marker'\n",
++        "the delimiter must be one of these four pairs:\n",
++        "{}  ()  []  <>\n" unless
++        $acceptable{$marker};
++
++    Install_Regexp_Common() unless $HAVE_Rexexp_Common;
++
++    my $all_lines = join("", @{$ra_lines});
++
++    no strict 'vars';
++    # otherwise get:
++    #  Global symbol "%RE" requires explicit package name at cloc line xx.
++    if ($all_lines =~ m/$RE{balanced}{-parens => $marker}/) {
++        no warnings; 
++        $all_lines =~ s/$1//g;
++    }
++
++    print "<- remove_between\n" if $opt_v > 2;
++    return split("\n", $all_lines);
++} # 1}}}
++sub remove_between_general {                 # {{{1
++    my ($ra_lines, $start_marker, $end_marker, ) = @_;
++    # Start and end markers may be any length strings.
++
++    print "-> remove_between_general(start=$start_marker, end=$end_marker)\n"
++        if $opt_v > 2;
++
++    my $all_lines = join("", @{$ra_lines});
++
++    my @save_lines = ();
++    my $in_comment = 0;
++    foreach (@{$ra_lines}) {
++
++        next if /^\s*$/;
++        s/\Q$start_marker\E.*?\Q$end_marker\E//g;  # strip one-line comments
++        next if /^\s*$/;
++        if ($in_comment) {
++            if (/\Q$end_marker\E/) {
++                s/^.*?\Q$end_marker\E//;
++                $in_comment = 0;
++            }
++        }
++        next if /^\s*$/;
++        $in_comment = 1 if /^(.*?)\Q$start_marker\E/;
++        next if defined $1 and $1 =~ /^\s*$/;
++        next if ($in_comment);
++        push @save_lines, $_;
++    }
++
++    print "<- remove_between_general\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_cobol_blanks {                    # {{{1
++    # subroutines derived from SLOCCount
++    my ($ra_lines, ) = @_;
++
++    my $free_format = 0;  # Support "free format" source code.
++    my @save_lines  = ();
++  
++    foreach (@{$ra_lines}) {
++        next if m/^\s*$/;
++        my $line = expand($_);  # convert tabs to equivalent spaces
++        $free_format = 1 if $line =~ m/^......\$.*SET.*SOURCEFORMAT.*FREE/i;
++        if ($free_format) {
++            push @save_lines, $_;
++        } else {
++            # Greg Toth:
++            #  (1) Treat lines with any alphanum in cols 1-6 and 
++            #      blanks in cols 7 through 71 as blank line, and
++            #  (2) Treat lines with any alphanum in cols 1-6 and 
++            #      slash (/) in col 7 as blank line (this is a 
++            #      page eject directive). 
++            push @save_lines, $_ unless m/^\d{6}\s*$/             or 
++                                        ($line =~ m/^.{6}\s{66}/) or 
++                                        ($line =~ m/^......\//);
++        }
++    }
++    return @save_lines;
++} # 1}}}
++sub remove_cobol_comments {                  # {{{1
++    # subroutines derived from SLOCCount
++    my ($ra_lines, ) = @_;
++
++    my $free_format = 0;  # Support "free format" source code.
++    my @save_lines  = ();
++  
++    foreach (@{$ra_lines}) {
++        if (m/^......\$.*SET.*SOURCEFORMAT.*FREE/i) {$free_format = 1;}
++        if ($free_format) {
++            push @save_lines, $_ unless m{^\s*\*};
++        } else {
++            push @save_lines, $_ unless m{^......\*} or m{^\*};
++        }
++    }
++    return @save_lines;
++} # 1}}}
++sub remove_jcl_comments {                    # {{{1
++    my ($ra_lines, ) = @_;
++
++    print "-> remove_jcl_comments\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    my $in_comment = 0;
++    foreach (@{$ra_lines}) {
++        next if /^\s*$/;
++        next if m{^\s*//\*};
++        last if m{^\s*//\s*$};
++        push @save_lines, $_;
++    }
++
++    print "<- remove_jcl_comments\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_jsp_comments {                    # {{{1
++    #  JSP comment is   <%--  body of comment   --%>
++    my ($ra_lines, ) = @_;
++
++    print "-> remove_jsp_comments\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    my $in_comment = 0;
++    foreach (@{$ra_lines}) {
++
++        next if /^\s*$/;
++        s/<\%\-\-.*?\-\-\%>//g;  # strip one-line comments
++        next if /^\s*$/;
++        if ($in_comment) {
++            if (/\-\-\%>/) {
++                s/^.*?\-\-\%>//;
++                $in_comment = 0;
++            }
++        }
++        next if /^\s*$/;
++        $in_comment = 1 if /^(.*?)<\%\-\-/;
++        next if defined $1 and $1 =~ /^\s*$/;
++        next if ($in_comment);
++        push @save_lines, $_;
++    }
++
++    print "<- remove_jsp_comments\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub remove_html_comments {                   # {{{1
++    #  HTML comment is   <!--  body of comment   -->
++    #  Need to use my own routine until the HTML comment regex in
++    #  the Regexp::Common module can handle  <!--  --  -->
++    my ($ra_lines, ) = @_;
++
++    print "-> remove_html_comments\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    my $in_comment = 0;
++    foreach (@{$ra_lines}) {
++
++        next if /^\s*$/;
++        s/<!\-\-.*?\-\->//g;  # strip one-line comments
++        next if /^\s*$/;
++        if ($in_comment) {
++            if (/\-\->/) {
++                s/^.*?\-\->//;
++                $in_comment = 0;
++            }
++        }
++        next if /^\s*$/;
++        $in_comment = 1 if /^(.*?)<!\-\-/;
++        next if defined $1 and $1 =~ /^\s*$/;
++        next if ($in_comment);
++        push @save_lines, $_;
++    }
++
++    print "<- remove_html_comments\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub add_newlines {                           # {{{1
++    my ($ra_lines, ) = @_;
++    print "-> add_newlines \n" if $opt_v > 2;
++
++    my @save_lines = ();
++    foreach (@{$ra_lines}) {
++
++        push @save_lines, "$_\n";
++    }
++
++    print "<- add_newlines \n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub docstring_to_C {                         # {{{1
++    my ($ra_lines, ) = @_;
++    # Converts Python docstrings to C comments.
++
++    print "-> docstring_to_C()\n" if $opt_v > 2;
++
++    my $in_docstring = 0;
++    foreach (@{$ra_lines}) {
++        while (/"""/) {
++            if (!$in_docstring) {
++                s{"""}{/*};
++                $in_docstring = 1;
++            } else {
++                s{"""}{*/};
++                $in_docstring = 0;
++            }
++        }
++    }
++
++    print "<- docstring_to_C\n" if $opt_v > 2;
++    return @{$ra_lines};
++} # 1}}}
++sub powershell_to_C {                        # {{{1
++    my ($ra_lines, ) = @_;
++    # Converts PowerShell block comment markers to C comments.
++
++    print "-> powershell_to_C()\n" if $opt_v > 2;
++
++    my $in_docstring = 0;
++    foreach (@{$ra_lines}) {
++        s{<#}{/*}g;
++        s{#>}{*/}g;
++    }
++
++    print "<- powershell_to_C\n" if $opt_v > 2;
++    return @{$ra_lines};
++} # 1}}}
++sub smarty_to_C {                            # {{{1
++    my ($ra_lines, ) = @_;
++    # Converts Smarty comments to C comments.
++
++    print "-> smarty_to_C()\n" if $opt_v > 2;
++
++    foreach (@{$ra_lines}) {
++        s[{\*][/*]g;
++        s[\*}][*/]g;
++    }
++
++    print "<- smarty_to_C\n" if $opt_v > 2;
++    return @{$ra_lines};
++} # 1}}}
++sub determine_lit_type {                     # {{{1
++  my ($file) = @_;
++
++  open (FILE, $file);
++  while (<FILE>) {
++    if (m/^\\begin{code}/) { close FILE; return 2; }
++    if (m/^>\s/) { close FILE; return 1; }
++  }
++
++  return 0;
++} # 1}}}
++sub remove_haskell_comments {                # {{{1
++    # Bulk of code taken from SLOCCount's haskell_count script.
++    # Strips out {- .. -} and -- comments and counts the rest.
++    # Pragmas, {-#...}, are counted as SLOC.
++    # BUG: Doesn't handle strings with embedded block comment markers gracefully.
++    #      In practice, that shouldn't be a problem.
++    my ($ra_lines, $file, ) = @_;
++
++    print "-> remove_haskell_comments\n" if $opt_v > 2;
++
++    my @save_lines = ();
++    my $in_comment = 0;
++    my $incomment  = 0;
++    my ($literate, $inlitblock) = (0,0);
++  
++    $literate = 1 if $file =~ /\.lhs$/;
++    if($literate) { $literate = determine_lit_type($file) }
++
++    foreach (@{$ra_lines}) {
++        if ($literate == 1) {
++            if (!s/^>//) { s/.*//; }
++        } elsif ($literate == 2) {
++            if ($inlitblock) {
++                if (m/^\\end{code}/) { s/.*//; $inlitblock = 0; }
++            } elsif (!$inlitblock) {
++                if (m/^\\begin{code}/) { s/.*//; $inlitblock = 1; }
++                else { s/.*//; }
++            }
++        }
++
++        if ($incomment) {
++            if (m/\-\}/) { s/^.*?\-\}//;  $incomment = 0;}
++            else { s/.*//; }
++        }
++        if (!$incomment) {
++            s/--.*//;
++            s!{-[^#].*?-}!!g;
++            if (m/{-/ && (!m/{-#/)) {
++              s/{-.*//;
++              $incomment = 1;
++            }
++        }
++        if (m/\S/) { push @save_lines, $_; }
++    }
++#   if ($incomment) {print "ERROR: ended in comment in $ARGV\n";}
++
++    print "<- remove_haskell_comments\n" if $opt_v > 2;
++    return @save_lines;
++} # 1}}}
++sub print_lines {                            # {{{1
++    my ($file     , # in
++        $title    , # in
++        $ra_lines , # in
++       ) = @_;
++    printf "->%-30s %s\n", $file, $title;
++    for (my $i = 0; $i < scalar @{$ra_lines}; $i++) {
++        printf "%5d | %s", $i+1, $ra_lines->[$i];
++        print "\n" unless $ra_lines->[$i] =~ m{\n$}
++    }
++} # 1}}}
++sub set_constants {                          # {{{1
++    my ($rh_Language_by_Extension , # out
++        $rh_Language_by_Script    , # out
++        $rh_Language_by_File      , # out
++        $rhaa_Filters_by_Language , # out
++        $rh_Not_Code_Extension    , # out
++        $rh_Not_Code_Filename     , # out
++        $rh_Scale_Factor          , # out
++        $rh_Known_Binary_Archives , # out
++        $rh_EOL_continuation_re   , # out
++       ) = @_;
++# 1}}}
++%{$rh_Language_by_Extension} = (             # {{{1
++            'abap'        => 'ABAP'                  ,
++            'ac'          => 'm4'                    ,
++            'ada'         => 'Ada'                   ,
++            'adb'         => 'Ada'                   ,
++            'ads'         => 'Ada'                   ,
++            'adso'        => 'ADSO/IDSM'             ,
++            'ahk'         => 'AutoHotkey'            ,
++            'am'          => 'make'                  ,
++            'ample'       => 'AMPLE'                 ,
++            'as'          => 'ActionScript'          ,
++            'dofile'      => 'AMPLE'                 ,
++            'startup'     => 'AMPLE'                 ,
++            'asa'         => 'ASP'                   ,
++            'asax'        => 'ASP.Net'               ,
++            'ascx'        => 'ASP.Net'               ,
++            'asm'         => 'Assembly'              ,
++            'asmx'        => 'ASP.Net'               ,
++            'asp'         => 'ASP'                   ,
++            'aspx'        => 'ASP.Net'               ,
++            'master'      => 'ASP.Net'               ,
++            'sitemap'     => 'ASP.Net'               ,
++            'cshtml'      => 'Razor'                 ,
++            'awk'         => 'awk'                   ,
++            'bash'        => 'Bourne Again Shell'    ,
++            'bas'         => 'Visual Basic'          ,
++            'bat'         => 'DOS Batch'             ,
++            'BAT'         => 'DOS Batch'             ,
++            'build.xml'   => 'Ant'                   ,
++            'cbl'         => 'COBOL'                 ,
++            'CBL'         => 'COBOL'                 ,
++            'c'           => 'C'                     ,
++            'C'           => 'C++'                   ,
++            'cc'          => 'C++'                   ,
++            'ccs'         => 'CCS'                   ,
++            'cfc'         => 'ColdFusion CFScript'   ,
++            'cfm'         => 'ColdFusion'            ,
++            'cl'          => 'Lisp/OpenCL'           ,
++            'clj'         => 'Clojure'               ,
++            'cljs'        => 'ClojureScript'         ,
++            'cls'         => 'Visual Basic'          , # also Apex Class
++            'CMakeLists.txt' => 'CMake'              ,
++            'cmake'       => 'CMake'                 ,
++            'cob'         => 'COBOL'                 ,
++            'COB'         => 'COBOL'                 ,
++            'coffee'      => 'CoffeeScript'          ,
++            'component'   => 'Visualforce Component' ,
++            'config'      => 'ASP.Net'               ,
++            'cpp'         => 'C++'                   ,
++            'cs'          => 'C#'                    ,
++            'csh'         => 'C Shell'               ,
++            'css'         => "CSS"                   ,
++            'ctl'         => 'Visual Basic'          ,
++            'cxx'         => 'C++'                   ,
++            'd'           => 'D'                     ,
++            'da'          => 'DAL'                   ,
++            'dart'        => 'Dart'                  ,
++            'def'         => 'Teamcenter def'        ,
++            'dmap'        => 'NASTRAN DMAP'          ,
++            'dpr'         => 'Pascal'                ,
++            'dsr'         => 'Visual Basic'          ,
++            'dtd'         => 'DTD'                   ,
++            'ec'          => 'C'                     ,
++            'el'          => 'Lisp'                  ,
++            'erl'         => 'Erlang'                ,
++            'exp'         => 'Expect'                ,
++            'f77'         => 'Fortran 77'            ,
++            'F77'         => 'Fortran 77'            ,
++            'f90'         => 'Fortran 90'            ,
++            'F90'         => 'Fortran 90'            ,
++            'f95'         => 'Fortran 95'            ,
++            'F95'         => 'Fortran 95'            ,
++            'f'           => 'Fortran 77'            ,
++            'F'           => 'Fortran 77'            ,
++            'fmt'         => 'Oracle Forms'          ,
++            'focexec'     => 'Focus'                 ,
++            'frm'         => 'Visual Basic'          ,
++            'gnumakefile' => 'make'                  ,
++            'Gnumakefile' => 'make'                  ,
++            'go'          => 'Go'                    ,
++            'groovy'      => 'Groovy'                ,
++            'gant'        => 'Groovy'                ,
++            'h'           => 'C/C++ Header'          ,
++            'H'           => 'C/C++ Header'          ,
++            'hh'          => 'C/C++ Header'          ,
++            'hpp'         => 'C/C++ Header'          ,
++            'hrl'         => 'Erlang'                ,
++            'hs'          => 'Haskell'               , 
++            'htm'         => 'HTML'                  ,
++            'html'        => 'HTML'                  ,
++            'i3'          => 'Modula3'               ,
++            'idl'         => 'IDL'                   ,
++            'ism'         => 'InstallShield'         ,
++            'pro'         => 'IDL'                   ,
++            'ig'          => 'Modula3'               ,
++            'il'          => 'SKILL'                 ,
++            'ils'         => 'SKILL++'               ,
++            'inc'         => 'PHP/Pascal'            , # might be PHP or Pascal
++            'ino'         => 'Arduino Sketch'        ,
++            'pde'         => 'Arduino Sketch'        , # pre 1.0
++            'itk'         => 'Tcl/Tk'                ,
++            'java'        => 'Java'                  ,
++            'jcl'         => 'JCL'                   , # IBM Job Control Lang.
++            'jl'          => 'Lisp'                  ,
++            'js'          => 'Javascript'            ,
++            'jsf'         => 'JavaServer Faces'      ,
++            'xhtml'       => 'JavaServer Faces'      ,
++            'jsp'         => 'JSP'                   , # Java server pages
++            'ksc'         => 'Kermit'                ,
++            'ksh'         => 'Korn Shell'            ,
++            'lhs'         => 'Haskell'               ,
++            'l'           => 'lex'                   ,
++            'less'        => 'LESS'                  ,
++            'lsp'         => 'Lisp'                  ,
++            'lisp'        => 'Lisp'                  ,
++            'lua'         => 'Lua'                   ,
++            'm3'          => 'Modula3'               ,
++            'm4'          => 'm4'                    ,
++            'makefile'    => 'make'                  ,
++            'Makefile'    => 'make'                  ,
++            'met'         => 'Teamcenter met'        ,
++            'mg'          => 'Modula3'               , 
++#           'mli'         => 'ML'                    , # ML not implemented
++#           'ml'          => 'ML'                    , 
++            'ml'          => 'OCaml'                 , 
++            'mli'         => 'OCaml'                 , 
++            'mly'         => 'OCaml'                 , 
++            'mll'         => 'OCaml'                 , 
++            'm'           => 'MATLAB/Objective C/MUMPS' ,
++            'mm'          => 'Objective C++'         ,
++            'wdproj'      => 'MSBuild scripts'       ,
++            'csproj'      => 'MSBuild scripts'       ,
++            'mps'         => 'MUMPS'                 ,
++            'mth'         => 'Teamcenter mth'        ,
++            'oscript'     => 'LiveLink OScript'      ,
++            'pad'         => 'Ada'                   , # Oracle Ada preprocessor
++            'page'        => 'Visualforce Page'      ,
++            'pas'         => 'Pascal'                ,
++            'pcc'         => 'C++'                   , # Oracle C++ preprocessor
++            'perl'        => 'Perl'                  ,
++            'pfo'         => 'Fortran 77'            ,
++            'pgc'         => 'C'                     , # Postgres embedded C/C++
++            'php3'        => 'PHP'                   ,
++            'php4'        => 'PHP'                   ,
++            'php5'        => 'PHP'                   ,
++            'php'         => 'PHP'                   ,
++            'pig'         => 'Pig Latin'             ,
++            'plh'         => 'Perl'                  ,
++            'pl'          => 'Perl'                  ,
++            'PL'          => 'Perl'                  ,
++            'plx'         => 'Perl'                  ,
++            'pm'          => 'Perl'                  ,
++            'pom.xml'     => 'Maven'                 ,
++            'pom'         => 'Maven'                 ,
++            'p'           => 'Pascal'                ,
++            'pp'          => 'Pascal'                ,
++            'psql'        => 'SQL'                   ,
++            'py'          => 'Python'                ,
++            'pyx'         => 'Cython'                ,
++            'qml'         => 'QML'                   ,
++            'rb'          => 'Ruby'                  ,
++         #  'resx'        => 'ASP.Net'               ,
++            'rex'         => 'Oracle Reports'        ,
++            'rexx'        => 'Rexx'                  ,
++            'rhtml'       => 'Ruby HTML'             ,
++            'rs'          => 'Rust'                  ,
++            's'           => 'Assembly'              ,
++            'S'           => 'Assembly'              ,
++            'scala'       => 'Scala'                 ,
++            'sbl'         => 'Softbridge Basic'      ,
++            'SBL'         => 'Softbridge Basic'      ,
++            'sc'          => 'Lisp'                  ,
++            'scm'         => 'Lisp'                  ,
++            'sed'         => 'sed'                   ,
++            'ses'         => 'Patran Command Language'   ,
++            'pcl'         => 'Patran Command Language'   ,
++            'ps1'         => 'PowerShell'            ,
++            'sass'        => 'SASS'                  ,
++            'scss'        => 'SASS'                  ,
++            'sh'          => 'Bourne Shell'          ,
++            'smarty'      => 'Smarty'                ,
++            'sql'         => 'SQL'                   ,
++            'SQL'         => 'SQL'                   ,
++            'sproc.sql'   => 'SQL Stored Procedure'  ,
++            'spoc.sql'    => 'SQL Stored Procedure'  ,
++            'spc.sql'     => 'SQL Stored Procedure'  ,
++            'udf.sql'     => 'SQL Stored Procedure'  ,
++            'data.sql'    => 'SQL Data'              ,
++            'v'           => 'Verilog-SystemVerilog' ,
++            'sv'          => 'Verilog-SystemVerilog' ,
++            'svh'         => 'Verilog-SystemVerilog' ,
++            'tcl'         => 'Tcl/Tk'                ,
++            'tcsh'        => 'C Shell'               ,
++            'tk'          => 'Tcl/Tk'                ,
++            'tpl'         => 'Smarty'                ,
++            'trigger'     => 'Apex Trigger'          ,
++            'vala'        => 'Vala'                  ,
++            'vapi'        => 'Vala Header'           ,
++            'vhd'         => 'VHDL'                  ,
++            'VHD'         => 'VHDL'                  ,
++            'vhdl'        => 'VHDL'                  ,
++            'VHDL'        => 'VHDL'                  ,
++            'vba'         => 'Visual Basic'          ,
++            'VBA'         => 'Visual Basic'          ,
++         #  'vbp'         => 'Visual Basic'          , # .vbp - autogenerated
++            'vb'          => 'Visual Basic'          ,
++            'VB'          => 'Visual Basic'          ,
++         #  'vbw'         => 'Visual Basic'          , # .vbw - autogenerated
++            'vbs'         => 'Visual Basic'          ,
++            'VBS'         => 'Visual Basic'          ,
++            'webinfo'     => 'ASP.Net'               ,
++            'xml'         => 'XML'                   ,
++            'XML'         => 'XML'                   ,
++            'mxml'        => 'MXML'                  ,
++            'build'       => 'NAnt scripts'          ,
++            'vim'         => 'vim script'            ,
++            'xaml'        => 'XAML'                  ,
++            'xsd'         => 'XSD'                   ,
++            'XSD'         => 'XSD'                   ,
++            'xslt'        => 'XSLT'                  ,
++            'XSLT'        => 'XSLT'                  ,
++            'xsl'         => 'XSLT'                  ,
++            'XSL'         => 'XSLT'                  ,
++            'y'           => 'yacc'                  ,
++            'yaml'        => 'YAML'                  ,
++            'yml'         => 'YAML'                  ,
++            );
++# 1}}}
++%{$rh_Language_by_Script}    = (             # {{{1
++            'awk'      => 'awk'                   ,
++            'bash'     => 'Bourne Again Shell'    ,
++            'bc'       => 'bc'                    ,# calculator
++            'csh'      => 'C Shell'               ,
++            'dmd'      => 'D'                     ,
++            'idl'      => 'IDL'                   ,
++            'kermit'   => 'Kermit'                ,
++            'ksh'      => 'Korn Shell'            ,
++            'lua'      => 'Lua'                   ,
++            'make'     => 'make'                  ,
++            'octave'   => 'Octave'                ,
++            'perl5'    => 'Perl'                  ,
++            'perl'     => 'Perl'                  ,
++            'ruby'     => 'Ruby'                  ,
++            'sed'      => 'sed'                   ,
++            'sh'       => 'Bourne Shell'          ,
++            'tcl'      => 'Tcl/Tk'                ,
++            'tclsh'    => 'Tcl/Tk'                ,
++            'tcsh'     => 'C Shell'               ,
++            'wish'     => 'Tcl/Tk'                ,
++            );
++# 1}}}
++%{$rh_Language_by_File}      = (             # {{{1
++            'Makefile'       => 'make'               ,
++            'makefile'       => 'make'               ,
++            'gnumakefile'    => 'make'               ,
++            'Gnumakefile'    => 'make'               ,
++            'CMakeLists.txt' => 'CMake'              ,
++            'build.xml'      => 'Ant/XML'            ,
++            'pom.xml'        => 'Maven/XML'          ,
++            );
++# 1}}}
++%{$rhaa_Filters_by_Language} = (             # {{{1
++    'ABAP'               => [   [ 'remove_matches'      , '^\*'    ], ],
++    'ActionScript'       => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++
++    'ASP'                => [   [ 'remove_matches'      , '^\s*\47'], ],  # \47 = '
++    'ASP.Net'            => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'Ada'                => [   [ 'remove_matches'      , '^\s*--' ], ],
++    'ADSO/IDSM'          => [   [ 'remove_matches'      , '^\s*\*[\+\!]' ], ],
++    'AMPLE'              => [   [ 'remove_matches'      , '^\s*//' ], ],
++    'Ant/XML'            => [
++                                [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], 
++                            ],
++    'Ant'                => [
++                                [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], 
++                            ],
++    'Apex Trigger'       => [
++                                [ 'remove_matches'      , '^\s*//' ],
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ],
++                            ],
++    'Arduino Sketch'     => [   # same as C
++                                [ 'remove_matches'      , '^\s*//' ],
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ],
++                            ], 
++    'Assembly'           => [  
++                                [ 'remove_matches'      , '^\s*//' ],
++                                [ 'remove_matches'      , '^\s*;'  ],
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'remove_inline'       , ';.*$'   ],
++                            ],
++    'AutoHotkey'         => [   
++                                [ 'remove_matches'      , '^\s*;'  ],
++                                [ 'remove_inline'       , ';.*$'   ],
++                            ],
++    'awk'                => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'bc'                 => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'C'                  => [   
++                                [ 'remove_matches'      , '^\s*//' ], # C99
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ], # C99
++                            ], 
++    'C++'                => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'C/C++ Header'       => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Clojure'            => [   [ 'remove_matches'      , '^\s*;'  ], ],
++    'ClojureScript'      => [   [ 'remove_matches'      , '^\s*;'  ], ],
++    'CMake'              => [   
++                                [ 'remove_matches'      , '^\s*#'  ],
++                                [ 'remove_inline'       , '#.*$'   ], 
++                            ],
++    'Cython'             => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'docstring_to_C'                 ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'C#'                 => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'CCS'                => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'CSS'                => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'COBOL'              => [   [ 'remove_cobol_comments',         ], ],
++    'CoffeeScript'       => [   
++                                [ 'remove_matches'      , '^\s*#'  ],
++                                [ 'remove_inline'       , '#.*$'   ], 
++                            ],
++    'ColdFusion'         => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'ColdFusion CFScript'=> [
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Crystal Reports'    => [   [ 'remove_matches'      , '^\s*//' ], ],
++    'D'                  => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_between_general', '/+', '+/' ],
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'DAL'                => [   [ 'remove_between'      , '[]',    ], ],
++    'Dart'               => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'NASTRAN DMAP'       => [   
++                                [ 'remove_matches'      , '^\s*\$' ], 
++                                [ 'remove_inline'       , '\$.*$'  ], 
++                            ],
++    'DOS Batch'          => [   [ 'remove_matches'      , '^\s*rem', ], ],
++    'DTD'                => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'Erlang'             => [   
++                                [ 'remove_matches'      , '^\s*%'  ], 
++                                [ 'remove_inline'       , '%.*$'   ],
++                            ],
++    'Expect'             => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Focus'              => [   [ 'remove_matches'      , '^\s*\-\*'  ], ],
++    'Fortran 77'         => [   
++                                [ 'remove_f77_comments' ,          ], 
++                                [ 'remove_inline'       , '\!.*$'  ],
++                            ],
++    'Fortran 90'         => [   
++                                [ 'remove_f77_comments' ,          ],
++                                [ 'remove_f90_comments' ,          ], 
++                                [ 'remove_inline'       , '\!.*$'  ],
++                            ],
++    'Fortran 95'         => [   
++                                [ 'remove_f77_comments' ,          ],
++                                [ 'remove_f90_comments' ,          ], 
++                                [ 'remove_inline'       , '\!.*$'  ],
++                            ],
++    'Go'                 => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'Groovy'             => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'HTML'               => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'Haskell'            => [   [ 'remove_haskell_comments', '>filename<' ], ],
++    'IDL'                => [   [ 'remove_matches'      , '^\s*;'  ], ],
++    'InstallShield'      => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'JSP'                => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ],
++                                [ 'remove_jsp_comments' ,          ], 
++                                [ 'remove_matches'      , '^\s*//' ],
++                                [ 'add_newlines'        ,          ],
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'JavaServer Faces'   => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Java'               => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Javascript'         => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'JCL'                => [   [ 'remove_jcl_comments' ,          ], ],
++    'LESS'               => [
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Lisp'               => [   [ 'remove_matches'      , '^\s*;'  ], ],
++    'Lisp/OpenCL'        => [ [ 'die' ,          ], ], # never called
++    'LiveLink OScript'   => [   [ 'remove_matches'      , '^\s*//' ], ],
++#   'Lua'                => [   [ 'call_regexp_common'  , 'lua'    ], ],
++    'Lua'                => [   [ 'remove_matches'      , '^\s*\-\-' ], ],
++    'make'               => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'MATLAB'             => [   
++                                [ 'remove_matches'      , '^\s*%'  ], 
++                                [ 'remove_inline'       , '%.*$'   ],
++                            ], 
++    'Maven/XML'          => [
++                                [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], 
++                            ],
++    'Maven'              => [
++                                [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], 
++                            ],
++    'Modula3'            => [   [ 'call_regexp_common'  , 'Pascal' ], ],
++        # Modula 3 comments are (* ... *) so applying the Pascal filter
++        # which also treats { ... } as a comment is not really correct.
++    'Objective C'        => [   
++                                [ 'remove_matches'      , '^\s*//' ],
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ], 
++    'Objective C++'      => [   
++                                [ 'remove_matches'      , '^\s*//' ],
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ], 
++    'OCaml'              => [   
++                                [ 'call_regexp_common'  , 'Pascal' ], 
++                            ],
++    'OpenCL'             => [   
++                                [ 'remove_matches'      , '^\s*//' ], # C99
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ], # C99
++                            ],
++    'PHP/Pascal'               => [ [ 'die' ,          ], ], # never called
++    'MATLAB/Objective C/MUMPS' => [ [ 'die' ,          ], ], # never called
++    'MUMPS'              => [   [ 'remove_matches'      , '^\s*;'  ], ], 
++    'Octave'             => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Oracle Forms'       => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'Oracle Reports'     => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'Pascal'             => [   
++                                [ 'call_regexp_common'  , 'Pascal' ], 
++                                [ 'remove_matches'      , '^\s*//' ],
++                            ],
++    'Patran Command Language'=> [   
++                                [ 'remove_matches'      , '^\s*#'   ], 
++                                [ 'remove_matches'      , '^\s*\$#' ], 
++                                [ 'call_regexp_common'  , 'C'       ],
++                            ],
++    'Perl'               => [   [ 'remove_below'        , '^__(END|DATA)__'],
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_below_above'  , '^=head1', '^=cut'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Pig Latin'          => [   
++                                [ 'remove_matches'      , '^\s*--' ],
++                                [ 'remove_inline'       , '--.*$'  ],
++                                [ 'call_regexp_common'  , 'C'       ],
++                            ],
++    'PowerShell'         => [ 
++                                [ 'powershell_to_C'                ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Python'             => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'docstring_to_C'                 ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'PHP'                => [   
++                                [ 'remove_matches'      , '^\s*#'  ],
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                                [ 'remove_inline'       , '//.*$'  ],
++                            ],
++    'QML'                => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Razor'              => [
++                                [ 'remove_matches'      , '^\s*//' ],
++                                [ 'remove_between_general', '@*', '*@' ],
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '//.*$'  ],
++                            ], 
++    'Rexx'               => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'Ruby'               => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_below_above'  , '^=begin', '^=end' ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Ruby HTML'          => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'Rust'               => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'SASS'               => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Scala'              => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'SKILL'              => [   
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_matches'      , '^\s*;'  ],
++                            ],
++    'SKILL++'            => [   
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_matches'      , '^\s*;'  ],
++                            ],
++    'SQL'                => [   
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_matches'      , '^\s*--' ],
++                                [ 'remove_inline'       , '--.*$'  ],
++                            ],
++    'SQL Stored Procedure'=> [   
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_matches'      , '^\s*--' ],
++                                [ 'remove_inline'       , '--.*$'  ],
++                            ],
++    'SQL Data'           => [   
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_matches'      , '^\s*--' ],
++                                [ 'remove_inline'       , '--.*$'  ],
++                            ],
++    'sed'                => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Smarty'             => [   
++                                [ 'smarty_to_C'                    ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ], 
++    'Bourne Again Shell' => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Bourne Shell'       => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'm4'                 => [   [ 'remove_matches'      , '^dnl '  ], ], 
++    'C Shell'            => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Kermit'             => [  
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_matches'      , '^\s*;'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Korn Shell'         => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Tcl/Tk'             => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ],
++                            ], 
++    'Teamcenter def'     => [   [ 'remove_matches'      , '^\s*#'  ], ], 
++    'Teamcenter met'     => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'Teamcenter mth'     => [   [ 'remove_matches'      , '^\s*#'  ], ], 
++    'Softbridge Basic'   => [   [ 'remove_above'        , '^\s*Attribute\s+VB_Name\s+=' ],               
++                                [ 'remove_matches'      , '^\s*Attribute\s+'],
++                                [ 'remove_matches'      , '^\s*\47'], ],  # \47 = '
++    # http://www.altium.com/files/learningguides/TR0114%20VHDL%20Language%20Reference.pdf
++    'Vala'               => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Vala Header'        => [   
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'Verilog-SystemVerilog' => [
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                                [ 'call_regexp_common'  , 'C'      ],
++                            ],
++    'VHDL'               => [   
++                                [ 'remove_matches'      , '^\s*--' ],
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_inline'       , '--.*$'  ],
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'vim script'         => [   
++                                [ 'remove_matches'      , '^\s*"'  ], 
++                                [ 'remove_inline'       , '".*$'   ], 
++                            ],
++    'Visual Basic'       => [   [ 'remove_above'        , '^\s*Attribute\s+VB_Name\s+=' ],               
++                                [ 'remove_matches'      , '^\s*Attribute\s+'],
++                                [ 'remove_matches'      , '^\s*\47'], ],  # \47 = '
++    'Visualforce Component' => [
++                                [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], 
++                            ],
++    'Visualforce Page'   => [
++                                [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], 
++                            ],
++    'yacc'               => [   
++                                [ 'call_regexp_common'  , 'C'      ], 
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'remove_inline'       , '//.*$'  ], 
++                            ],
++    'YAML'               => [   
++                                [ 'remove_matches'      , '^\s*#'  ], 
++                                [ 'remove_inline'       , '#.*$'   ], 
++                            ],
++    'lex'                => [   [ 'call_regexp_common'  , 'C'      ], ],
++    'XAML'               => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'MXML'               => [   
++                                [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], 
++                                [ 'remove_matches'      , '^\s*//' ], 
++                                [ 'add_newlines'        ,          ], 
++                                [ 'call_regexp_common'  , 'C'      ], 
++                            ],
++    'XML'                => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'XSD'                => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'XSLT'               => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'NAnt scripts'       => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    'MSBuild scripts'    => [   [ 'remove_html_comments',          ],
++                                [ 'call_regexp_common'  , 'HTML'   ], ],
++    );
++# 1}}}
++%{$rh_EOL_continuation_re} = (               # {{{1
++    'ActionScript'       =>     '\\\\$'         ,
++    'Assembly'           =>     '\\\\$'         ,
++    'ASP'                =>     '\\\\$'         ,
++    'ASP.Net'            =>     '\\\\$'         ,
++    'Ada'                =>     '\\\\$'         ,
++    'awk'                =>     '\\\\$'         ,
++    'bc'                 =>     '\\\\$'         ,
++    'C'                  =>     '\\\\$'         ,
++    'C++'                =>     '\\\\$'         ,
++    'C/C++ Header'       =>     '\\\\$'         ,
++    'CMake'              =>     '\\\\$'         ,
++    'Cython'             =>     '\\\\$'         ,
++    'C#'                 =>     '\\\\$'         ,
++    'D'                  =>     '\\\\$'         ,
++    'Dart'               =>     '\\\\$'         ,
++    'Expect'             =>     '\\\\$'         ,
++    'Go'                 =>     '\\\\$'         ,
++    'Java'               =>     '\\\\$'         ,
++    'Javascript'         =>     '\\\\$'         ,
++    'LESS'               =>     '\\\\$'         ,
++    'Lua'                =>     '\\\\$'         ,
++    'make'               =>     '\\\\$'         ,
++    'MATLAB'             =>     '\.\.\.\s*$'    ,
++    'MXML'               =>     '\\\\$'         ,
++    'Objective C'        =>     '\\\\$'         ,
++    'Objective C++'      =>     '\\\\$'         ,
++    'OCaml'              =>     '\\\\$'         ,
++    'Octave'             =>     '\.\.\.\s*$'    ,
++    'Patran Command Language'=> '\\\\$'         ,
++    'PowerShell'         =>     '\\\\$'         ,
++    'Python'             =>     '\\\\$'         ,
++    'Ruby'               =>     '\\\\$'         ,
++    'sed'                =>     '\\\\$'         ,
++    'Bourne Again Shell' =>     '\\\\$'         ,
++    'Bourne Shell'       =>     '\\\\$'         ,
++    'C Shell'            =>     '\\\\$'         ,
++    'Kermit'             =>     '\\\\$'         ,
++    'Korn Shell'         =>     '\\\\$'         ,
++    'Tcl/Tk'             =>     '\\\\$'         ,
++    'lex'                =>     '\\\\$'         ,
++    'Vala'               =>     '\\\\$'         ,
++    'Vala Header'        =>     '\\\\$'         ,
++    );
++# 1}}}
++%{$rh_Not_Code_Extension}    = (             # {{{1
++   '1'       => 1,  # Man pages (documentation):
++   '2'       => 1,
++   '3'       => 1,
++   '4'       => 1,
++   '5'       => 1,
++   '6'       => 1,
++   '7'       => 1,
++   '8'       => 1,
++   '9'       => 1,
++   'a'       => 1,  # Static object code.
++   'ad'      => 1,  # X application default resource file.
++   'afm'     => 1,  # font metrics
++   'arc'     => 1,  # arc(1) archive
++   'arj'     => 1,  # arj(1) archive
++   'au'      => 1,  # Audio sound filearj(1) archive
++   'bak'     => 1,  # Backup files - we only want to count the "real" files.
++   'bdf'     => 1,
++   'bmp'     => 1,
++   'bz2'     => 1,  # bzip2(1) compressed file
++   'csv'     => 1,  # comma separated values
++   'desktop' => 1,
++   'dic'     => 1,
++   'doc'     => 1,
++   'elc'     => 1,
++   'eps'     => 1,
++   'fig'     => 1,
++   'gif'     => 1,
++   'gz'      => 1,
++   'hdf'     => 1,  # hierarchical data format
++   'in'      => 1,  # Debatable.
++   'jpg'     => 1,
++   'kdelnk'  => 1,
++   'man'     => 1,
++   'mf'      => 1,
++   'mp3'     => 1,
++   'n'       => 1,
++   'o'       => 1,  # Object code is generated from source code.
++   'pbm'     => 1,
++   'pdf'     => 1,
++   'pfb'     => 1,
++   'png'     => 1,
++   'po'      => 1,
++   'ps'      => 1,  # Postscript is _USUALLY_ generated automatically.
++   'sgm'     => 1,
++   'sgml'    => 1,
++   'so'      => 1,  # Dynamically-loaded object code.
++   'Tag'     => 1,
++   'tex'     => 1,
++   'text'    => 1,
++   'tfm'     => 1,
++   'tgz'     => 1,  # gzipped tarball
++   'tiff'    => 1,
++   'txt'     => 1, 
++   'vf'      => 1,
++   'wav'     => 1,
++   'xbm'     => 1,
++   'xpm'     => 1,
++   'Y'       => 1,  # file compressed with "Yabba"
++   'Z'       => 1,  # file compressed with "compress"
++   'zip'     => 1,  # zip archive
++); # 1}}}
++%{$rh_Not_Code_Filename}     = (             # {{{1
++   'AUTHORS'     => 1,
++   'BUGS'        => 1,
++   'BUGS'        => 1,
++   'Changelog'   => 1,
++   'ChangeLog'   => 1,
++   'ChangeLog'   => 1,
++   'Changes'     => 1,
++   'CHANGES'     => 1,
++   'COPYING'     => 1,
++   'COPYING'     => 1,
++   '.cvsignore'  => 1,
++   'Entries'     => 1,
++   'FAQ'         => 1,
++   'iconfig.h'   => 1, # Skip "iconfig.h" files; they're used in Imakefiles.
++   'INSTALL'     => 1,
++   'MAINTAINERS' => 1,
++   'MD5SUMS'     => 1,
++   'NEWS'        => 1,
++   'readme'      => 1,
++   'Readme'      => 1,
++   'README'      => 1,
++   'README.tk'   => 1, # used in kdemultimedia, it's confusing.
++   'Repository'  => 1,
++   'Root'        => 1, # CVS
++   'TODO'        => 1,
++);
++# 1}}}
++%{$rh_Scale_Factor}          = (             # {{{1
++    '1032/af'                      =>   5.00,
++    '1st generation default'       =>   0.25,
++    '2nd generation default'       =>   0.75,
++    '3rd generation default'       =>   1.00,
++    '4th generation default'       =>   4.00,
++    '5th generation default'       =>  16.00,
++    'aas macro'                    =>   0.88,
++    'abap/4'                       =>   5.00,
++    'ABAP'                         =>   5.00,
++    'accel'                        =>   4.21,
++    'access'                       =>   2.11,
++    'ActionScript'                 =>   1.36,
++    'actor'                        =>   3.81,
++    'acumen'                       =>   2.86,
++    'Ada'                          =>   0.52,
++    'Ada 83'                       =>   1.13,
++    'Ada 95'                       =>   1.63,
++    'adr/dl'                       =>   2.00,
++    'adr/ideal/pdl'                =>   4.00,
++    'ads/batch'                    =>   4.00,
++    'ads/online'                   =>   4.00,
++    'ADSO/IDSM'                    =>   3.00,
++    'advantage'                    =>   2.11,
++    'ai shell default'             =>   1.63,
++    'ai shells'                    =>   1.63,
++    'algol 68'                     =>   0.75,
++    'algol w'                      =>   0.75,
++    'ambush'                       =>   2.50,
++    'aml'                          =>   1.63,
++    'AMPLE'                        =>   2.00,
++    'Ant/XML'                      =>   1.90,
++    'Ant'                          =>   1.90,
++    'amppl ii'                     =>   1.25,
++    'ansi basic'                   =>   1.25,
++    'ansi cobol 74'                =>   0.75,
++    'ansi cobol 85'                =>   0.88,
++    'SQL'                          =>   6.15,
++    'SQL Stored Procedure'         =>   6.15,
++    'SQL Data'                     =>   1.00,
++    'answer/db'                    =>   6.15,
++    'apl 360/370'                  =>   2.50,
++    'apl default'                  =>   2.50,
++    'apl*plus'                     =>   2.50,
++    'applesoft basic'              =>   0.63,
++    'application builder'          =>   4.00,
++    'application manager'          =>   2.22,
++    'aps'                          =>   0.96,
++    'aps'                          =>   4.71,
++    'apt'                          =>   1.13,
++    'aptools'                      =>   4.00,
++    'arc'                          =>   1.63,
++    'ariel'                        =>   0.75,
++    'arity'                        =>   1.63,
++    'arity prolog'                 =>   1.25,
++    'art'                          =>   1.63,
++    'art enterprise'               =>   1.74,
++    'artemis'                      =>   2.00,
++    'artim'                        =>   1.74,
++    'as/set'                       =>   4.21,
++    'asi/inquiry'                  =>   6.15,
++    'ask windows'                  =>   1.74,
++'asa'                         =>   1.29,
++'ASP'                         =>   1.29,
++'ASP.Net'                     =>   1.29,
++'aspx'                        =>   1.29,
++#'resx'                        =>   1.29,
++'asax'                        =>   1.29,
++'ascx'                        =>   1.29,
++'asmx'                        =>   1.29,
++'config'                      =>   1.29,
++'webinfo'                     =>   1.29,
++'CCS'                         =>   5.33,
++
++    'Apex Trigger'                 =>   1.4 ,
++#   'assembler (basic)'            =>   0.25,
++    'Arduino Sketch'               =>   1.00,
++    'Assembly'                     =>   0.25,
++
++    'Assembly (macro)'             =>   0.51,
++    'associative default'          =>   1.25,
++    'autocoder'                    =>   0.25,
++    'AutoHotkey'                   =>   1.29,
++    'awk'                          =>   3.81,
++    'aztec c'                      =>   0.63,
++    'balm'                         =>   0.75,
++    'base sas'                     =>   1.51,
++    'basic'                        =>   0.75,
++    'basic a'                      =>   0.63,
++#   'basic assembly'               =>   0.25,
++    'bc'                           =>   1.50,
++    'berkeley pascal'              =>   0.88,
++    'better basic'                 =>   0.88,
++    'bliss'                        =>   0.75,
++    'bmsgen'                       =>   2.22,
++    'boeingcalc'                   =>  13.33,
++    'bteq'                         =>   6.15,
++
++    'C'                            =>   0.77,
++
++    'c set 2'                      =>   0.88,
++
++    'C#'                           =>   1.36,
++
++    'C++'                          =>   1.51,
++
++    'c86plus'                      =>   0.63,
++    'cadbfast'                     =>   2.00,
++    'caearl'                       =>   2.86,
++    'cast'                         =>   1.63,
++    'cbasic'                       =>   0.88,
++    'cdadl'                        =>   4.00,
++    'cellsim'                      =>   1.74,
++    'ColdFusion'                   =>   4.00,
++    'ColdFusion CFScript'          =>   4.00,
++    'chili'                        =>   0.75,
++    'chill'                        =>   0.75,
++    'cics'                         =>   1.74,
++    'clarion'                      =>   1.38,
++    'clascal'                      =>   1.00,
++    'cli'                          =>   2.50,
++    'clipper'                      =>   2.05,
++    'clipper db'                   =>   2.00,
++    'clos'                         =>   3.81,
++    'Clojure'                      =>   1.25,
++    'ClojureScript'                =>   1.25,
++    'clout'                        =>   2.00,
++    'CMake'                        =>   1.00,
++    'cms2'                         =>   0.75,
++    'cmsgen'                       =>   4.21,
++    'COBOL'                        =>   1.04,
++    'COBOL ii'                     =>   0.75,
++    'COBOL/400'                    =>   0.88,
++    'cobra'                        =>   4.00,
++    'codecenter'                   =>   2.22,
++    'cofac'                        =>   2.22,
++    'CoffeeScript'                 =>   2.00,
++    'cogen'                        =>   2.22,
++    'cognos'                       =>   2.22,
++    'cogo'                         =>   1.13,
++    'comal'                        =>   1.00,
++    'comit ii'                     =>   1.25,
++    'common lisp'                  =>   1.25,
++    'concurrent pascal'            =>   1.00,
++    'conniver'                     =>   1.25,
++    'cool:gen/ief'                 =>   2.58,
++    'coral 66'                     =>   0.75,
++    'corvet'                       =>   4.21,
++    'corvision'                    =>   5.33,
++    'cpl'                          =>   0.50,
++    'Crystal Reports'              =>   4.00,
++    'csl'                          =>   1.63,
++    'csp'                          =>   1.51,
++    'cssl'                         =>   1.74,
++    
++'CSS' => 1.0,
++    
++    'culprit'                      =>   1.57,
++    'cxpert'                       =>   1.63,
++    'cygnet'                       =>   4.21,
++    'D'                            =>   1.70,
++    'DAL'                          =>   1.50,
++    'Dart'                         =>   2.00,
++    'data base default'            =>   2.00,
++    'dataflex'                     =>   2.00,
++    'datatrieve'                   =>   4.00,
++    'dbase iii'                    =>   2.00,
++    'dbase iv'                     =>   1.54,
++    'dcl'                          =>   0.38,
++    'decision support default'     =>   2.22,
++    'decrally'                     =>   2.00,
++    'delphi'                       =>   2.76,
++    'dl/1'                         =>   2.00,
++    'NASTRAN DMAP'                 =>   2.35,
++    'dna4'                         =>   4.21,
++    'DOS Batch'                    =>   0.63,
++    'dsp assembly'                 =>   0.50,
++    'dtabl'                        =>   1.74,
++    'dtipt'                        =>   1.74,
++    'dyana'                        =>   1.13,
++    'dynamoiii'                    =>   1.74,
++    'easel'                        =>   2.76,
++    'easy'                         =>   1.63,
++    'easytrieve+'                  =>   2.35,
++    'eclipse'                      =>   1.63,
++    'eda/sql'                      =>   6.67,
++    'edscheme 3.4'                 =>   1.51,
++    'eiffel'                       =>   3.81,
++    'enform'                       =>   1.74,
++    'englishbased default'         =>   1.51,
++    'ensemble'                     =>   2.76,
++    'epos'                         =>   4.00,
++    'Erlang'                       =>   2.11,
++    'esf'                          =>   2.00,
++    'espadvisor'                   =>   1.63,
++    'espl/i'                       =>   1.13,
++    'euclid'                       =>   0.75,
++    'excel'                        =>   1.74,
++    'excel 12'                     =>  13.33,
++    'excel 34'                     =>  13.33,
++    'excel 5'                      =>  13.33,
++    'express'                      =>   2.22,
++    'exsys'                        =>   1.63,
++    'extended common lisp'         =>   1.43,
++    'eznomad'                      =>   2.22,
++    'facets'                       =>   4.00,
++    'factorylink iv'               =>   2.76,
++    'fame'                         =>   2.22,
++    'filemaker pro'                =>   2.22,
++    'flavors'                      =>   2.76,
++    'flex'                         =>   1.74,
++    'flexgen'                      =>   2.76,
++    'Focus'                        =>   1.90,
++    'foil'                         =>   1.51,
++    'forte'                        =>   4.44,
++    'forth'                        =>   1.25,
++    'Fortran 66'                   =>   0.63,
++    'Fortran 77'                   =>   0.75,
++    'Fortran 90'                   =>   1.00,
++    'Fortran 95'                   =>   1.13,
++    'Fortran II'                   =>   0.63,
++    'foundation'                   =>   2.76,
++    'foxpro'                       =>   2.29,
++    'foxpro 1'                     =>   2.00,
++    'foxpro 2.5'                   =>   2.35,
++    'framework'                    =>  13.33,
++    'g2'                           =>   1.63,
++    'gamma'                        =>   5.00,
++    'genascript'                   =>   2.96,
++    'gener/ol'                     =>   6.15,
++    'genexus'                      =>   5.33,
++    'genifer'                      =>   4.21,
++    'geode 2.0'                    =>   5.00,
++    'gfa basic'                    =>   2.35,
++    'gml'                          =>   1.74,
++    'golden common lisp'           =>   1.25,
++    'gpss'                         =>   1.74,
++    'guest'                        =>   2.86,
++    'guru'                         =>   1.63,
++    'Go'                           =>   2.50,
++    'Groovy'                       =>   4.10,
++    'gw basic'                     =>   0.82,
++    'Haskell'                      =>   2.11,
++    'high c'                       =>   0.63,
++    'hlevel'                       =>   1.38,
++    'hp basic'                     =>   0.63,
++
++'HTML'          => 1.90 ,
++'XML'           => 1.90 ,
++'MXML'          => 1.90 ,
++'XSLT'          => 1.90 ,
++'DTD'           => 1.90 ,
++'XSD'           => 1.90 ,
++'NAnt scripts'    => 1.90 ,
++'MSBuild scripts' => 1.90 , 
++
++    'HTML 2'                       =>   5.00,
++    'HTML 3'                       =>   5.33,
++    'huron'                        =>   5.00,
++    'ibm adf i'                    =>   4.00,
++    'ibm adf ii'                   =>   4.44,
++    'ibm advanced basic'           =>   0.82,
++    'ibm cics/vs'                  =>   2.00,
++    'ibm compiled basic'           =>   0.88,
++    'ibm vs cobol'                 =>   0.75,
++    'ibm vs cobol ii'              =>   0.88,
++    'ices'                         =>   1.13,
++    'icon'                         =>   1.00,
++    'ideal'                        =>   1.54,
++    'idms'                         =>   2.00,
++    'ief'                          =>   5.71,
++    'ief/cool:gen'                 =>   2.58,
++    'iew'                          =>   5.71,
++    'ifps/plus'                    =>   2.50,
++    'imprs'                        =>   2.00,
++    'informix'                     =>   2.58,
++    'ingres'                       =>   2.00,
++    'inquire'                      =>   6.15,
++    'insight2'                     =>   1.63,
++    'install/1'                    =>   5.00,
++    'InstallShield'                =>   1.90,
++    'intellect'                    =>   1.51,
++    'interlisp'                    =>   1.38,
++    'interpreted basic'            =>   0.75,
++    'interpreted c'                =>   0.63,
++    'iqlisp'                       =>   1.38,
++    'iqrp'                         =>   6.15,
++    'j2ee'                         =>   1.60,
++    'janus'                        =>   1.13,
++    'Java'                         =>   1.36,
++    'Javascript'                   =>   1.48,
++    'JavaServer Faces'             =>   1.5 ,
++    'JSP'                          =>   1.48,
++    'JCL'                          =>   1.67,
++    'joss'                         =>   0.75,
++    'jovial'                       =>   0.75,
++    'jsp'                          =>   1.36,
++    'kappa'                        =>   2.00,
++    'kbms'                         =>   1.63,
++    'kcl'                          =>   1.25,
++    'kee'                          =>   1.63,
++    'keyplus'                      =>   2.00,
++    'kl'                           =>   1.25,
++    'klo'                          =>   1.25,
++    'knowol'                       =>   1.63,
++    'krl'                          =>   1.38,
++    'Kermit'                       =>   2.00,
++    'Korn Shell'                   =>   3.81,
++    'ladder logic'                 =>   2.22,
++    'lambit/l'                     =>   1.25,
++    'lattice c'                    =>   0.63,
++    'LESS'                         =>   1.50,
++    'liana'                        =>   0.63,
++    'lilith'                       =>   1.13,
++    'linc ii'                      =>   5.71,
++    'Lisp'                         =>   1.25,
++    'LiveLink OScript'             =>   3.5 ,
++    'loglisp'                      =>   1.38,
++    'loops'                        =>   3.81,
++    'lotus 123 dos'                =>  13.33,
++    'lotus macros'                 =>   0.75,
++    'lotus notes'                  =>   3.64,
++    'lucid 3d'                     =>  13.33,
++    'lyric'                        =>   1.51,
++    'm4'                           =>   1.00,
++    'm'                            =>   5.00,
++    'macforth'                     =>   1.25,
++    'mach1'                        =>   2.00,
++    'machine language'             =>   0.13,
++    'maestro'                      =>   5.00,
++    'magec'                        =>   5.00,
++    'magik'                        =>   3.81,
++    'Lake'                         =>   3.81,
++    'make'                         =>   2.50,
++    'mantis'                       =>   2.96,
++    'mapper'                       =>   0.99,
++    'mark iv'                      =>   2.00,
++    'mark v'                       =>   2.22,
++    'mathcad'                      =>  16.00,
++    'Maven'                        =>   1.90,
++    'mdl'                          =>   2.22,
++    'mentor'                       =>   1.51,
++    'mesa'                         =>   0.75,
++    'microfocus cobol'             =>   1.00,
++    'microforth'                   =>   1.25,
++    'microsoft c'                  =>   0.63,
++    'microstep'                    =>   4.00,
++    'miranda'                      =>   2.00,
++    'model 204'                    =>   2.11,
++    'modula 2'                     =>   1.00,
++    'mosaic'                       =>  13.33,
++    # 'ms c ++ v. 7'                 =>   1.51,
++    'ms compiled basic'            =>   0.88,
++    'msl'                          =>   1.25,
++    'mulisp'                       =>   1.25,
++    'MUMPS'                        =>   4.21,
++    'Nastran'                      =>   1.13,
++    'natural'                      =>   1.54,
++    'natural 1'                    =>   1.51,
++    'natural 2'                    =>   1.74,
++    'natural construct'            =>   3.20,
++    'natural language'             =>   0.03,
++    'netron/cap'                   =>   4.21,
++    'nexpert'                      =>   1.63,
++    'nial'                         =>   1.63,
++    'nomad2'                       =>   2.00,
++    'nonprocedural default'        =>   2.22,
++    'notes vip'                    =>   2.22,
++    'nroff'                        =>   1.51,
++    'object assembler'             =>   1.25,
++    'object lisp'                  =>   2.76,
++    'object logo'                  =>   2.76,
++    'object pascal'                =>   2.76,
++    'object star'                  =>   5.00,
++    'Objective C'                  =>   2.96,
++    'Objective C++'                =>   2.96,
++    'objectoriented default'       =>   2.76,
++    'objectview'                   =>   3.20,
++    'OCaml'                        =>   3.00,
++    'ogl'                          =>   1.00,
++    'omnis 7'                      =>   2.00,
++    'oodl'                         =>   2.76,
++    'ops'                          =>   1.74,
++    'ops5'                         =>   1.38,
++    'oracle'                       =>   2.76,
++    'Oracle Reports'               =>   2.76,
++    'Oracle Forms'                 =>   2.67,
++    'Oracle Developer/2000'        =>   3.48,
++    'oscar'                        =>   0.75,
++    'pacbase'                      =>   1.67,
++    'pace'                         =>   2.00,
++    'paradox/pal'                  =>   2.22,
++    'Pascal'                       =>   0.88,
++    'Patran Command Language'      =>   2.50,
++    'pc focus'                     =>   2.22,
++    'pdl millenium'                =>   3.81,
++    'pdp11 ade'                    =>   1.51,
++    'peoplesoft'                   =>   2.50,
++    'Perl'                         =>   4.00,
++    'persistance object builder'   =>   3.81,
++    'Pig Latin'                    =>   1.00,
++    'pilot'                        =>   1.51,
++    'pl/1'                         =>   1.38,
++    'pl/m'                         =>   1.13,
++    'pl/s'                         =>   0.88,
++    'pl/sql'                       =>   2.58,
++    'planit'                       =>   1.51,
++    'planner'                      =>   1.25,
++    'planperfect 1'                =>  11.43,
++    'plato'                        =>   1.51,
++    'polyforth'                    =>   1.25,
++    'pop'                          =>   1.38,
++    'poplog'                       =>   1.38,
++    'power basic'                  =>   1.63,
++    'powerbuilder'                 =>   3.33,
++    'powerhouse'                   =>   5.71,
++    'PowerShell'                   =>   3.00,
++    'ppl (plus)'                   =>   2.00,
++    'problemoriented default'      =>   1.13,
++    'proc'                         =>   2.96,
++    'procedural default'           =>   0.75,
++    'professional pascal'          =>   0.88,
++    'program generator default'    =>   5.00,
++    'progress v4'                  =>   2.22,
++    'proiv'                        =>   1.38,
++    'prolog'                       =>   1.25,
++    'prose'                        =>   0.75,
++    'proteus'                      =>   0.75,
++    'qbasic'                       =>   1.38,
++    'qbe'                          =>   6.15,
++    'qmf'                          =>   5.33,
++    'QML'                          =>   1.25,
++    'qnial'                        =>   1.63,
++    'quattro'                      =>  13.33,
++    'quattro pro'                  =>  13.33,
++    'query default'                =>   6.15,
++    'quick basic 1'                =>   1.25,
++    'quick basic 2'                =>   1.31,
++    'quick basic 3'                =>   1.38,
++    'quick c'                      =>   0.63,
++    'quickbuild'                   =>   2.86,
++    'quiz'                         =>   5.33,
++    'rally'                        =>   2.00,
++    'ramis ii'                     =>   2.00,
++    'rapidgen'                     =>   2.86,
++    'ratfor'                       =>   0.88,
++    'rdb'                          =>   2.00,
++    'realia'                       =>   1.74,
++    'realizer 1.0'                 =>   2.00,
++    'realizer 2.0'                 =>   2.22,
++    'relate/3000'                  =>   2.00,
++    'reuse default'                =>  16.00,
++    'Razor'                        =>   2.00,
++    'Rexx'                         =>   1.19,
++    'Rexx (mvs)'                   =>   1.00,
++    'Rexx (os/2)'                  =>   1.74,
++    'rm basic'                     =>   0.88,
++    'rm cobol'                     =>   0.75,
++    'rm fortran'                   =>   0.75,
++    'rpg i'                        =>   1.00,
++    'rpg ii'                       =>   1.63,
++    'rpg iii'                      =>   1.63,
++    'rtexpert 1.4'                 =>   1.38,
++    'Rust'                         =>   1.00,
++    'sabretalk'                    =>   0.90,
++    'sail'                         =>   0.75,
++    'sapiens'                      =>   5.00,
++    'sas'                          =>   1.95,
++    'savvy'                        =>   6.15,
++    'sbasic'                       =>   0.88,
++    'Scala'                        =>   4.10,
++    'sceptre'                      =>   1.13,
++    'scheme'                       =>   1.51,
++    'screen painter default'       =>  13.33,
++    'sequal'                       =>   6.67,
++    'Bourne Shell'                 =>   3.81,
++    'Bourne Again Shell'           =>   3.81,
++    'ksh'                          =>   3.81,
++    'C Shell'                      =>   3.81,
++    'siebel tools '                =>   6.15,
++    'SASS'                         =>   1.5 ,
++    'simplan'                      =>   2.22,
++    'simscript'                    =>   1.74,
++    'simula'                       =>   1.74,
++    'simula 67'                    =>   1.74,
++    'simulation default'           =>   1.74,
++    'SKILL'                        =>   2.00,
++    'SKILL++'                      =>   2.00,
++    'slogan'                       =>   0.98,
++    'smalltalk'                    =>   2.50,
++    'smalltalk 286'                =>   3.81,
++    'smalltalk 80'                 =>   3.81,
++    'smalltalk/v'                  =>   3.81,
++    'Smarty'                       =>   3.50,
++    'snap'                         =>   1.00,
++    'snobol24'                     =>   0.63,
++    'softscreen'                   =>   5.71,
++    'Softbridge Basic'             =>   2.76,
++    'solo'                         =>   1.38,
++    'speakeasy'                    =>   2.22,
++    'spinnaker ppl'                =>   2.22,
++    'splus'                        =>   2.50,
++    'spreadsheet default'          =>  13.33,
++    'sps'                          =>   0.25,
++    'spss'                         =>   2.50,
++    'SQL'                          =>   2.29,
++    'sqlwindows'                   =>   6.67,
++    'statistical default'          =>   2.50,
++    'strategem'                    =>   2.22,
++    'stress'                       =>   1.13,
++    'strongly typed default'       =>   0.88,
++    'style'                        =>   1.74,
++    'superbase 1.3'                =>   2.22,
++    'surpass'                      =>  13.33,
++    'sybase'                       =>   2.00,
++    'symantec c++'                 =>   2.76,
++    'symbolang'                    =>   1.25,
++    'synchroworks'                 =>   4.44,
++    'synon/2e'                     =>   4.21,
++    'systemw'                      =>   2.22,
++    'tandem access language'       =>   0.88,
++    'Tcl/Tk'                       =>   4.00,
++    'Teamcenter def'               =>   1.00,
++    'Teamcenter met'               =>   1.00,
++    'Teamcenter mth'               =>   1.00,
++    'telon'                        =>   5.00,
++    'tessaract'                    =>   2.00,
++    'the twin'                     =>  13.33,
++    'themis'                       =>   6.15,
++    'tiief'                        =>   5.71,
++    'topspeed c++'                 =>   2.76,
++    'transform'                    =>   5.33,
++    'translisp plus'               =>   1.43,
++    'treet'                        =>   1.25,
++    'treetran'                     =>   1.25,
++    'trs80 basic'                  =>   0.63,
++    'true basic'                   =>   1.25,
++    'turbo c'                      =>   0.63,
++    # 'turbo c++'                    =>   1.51,
++    'turbo expert'                 =>   1.63,
++    'turbo pascal >5'              =>   1.63,
++    'turbo pascal 14'              =>   1.00,
++    'turbo pascal 45'              =>   1.13,
++    'turbo prolog'                 =>   1.00,
++    'turing'                       =>   1.00,
++    'tutor'                        =>   1.51,
++    'twaice'                       =>   1.63,
++    'ucsd pascal'                  =>   0.88,
++    'ufo/ims'                      =>   2.22,
++    'uhelp'                        =>   2.50,
++    'uniface'                      =>   5.00,
++    # 'unix shell scripts'           =>   3.81,
++    'Vala'                         =>   1.50,
++    'Vala Header'                  =>   1.40,
++    'vax acms'                     =>   1.38,
++    'vax ade'                      =>   2.00,
++    'vbscript'                     =>   2.35,
++    'vectran'                      =>   0.75,
++    'Verilog-SystemVerilog'        =>   1.51,
++    'VHDL'                         =>   4.21,
++    'vim script'                   =>   3.00,
++    'visible c'                    =>   1.63,
++    'visible cobol'                =>   2.00,
++    'visicalc 1'                   =>   8.89,
++    'visual 4.0'                   =>   2.76,
++    'visual basic'                 =>   1.90,
++    'visual basic 1'               =>   1.74,
++    'visual basic 2'               =>   1.86,
++    'visual basic 3'               =>   2.00,
++    'visual basic 4'               =>   2.22,
++    'visual basic 5'               =>   2.76,
++    'Visual Basic'                 =>   2.76,
++    'visual basic dos'             =>   2.00,
++    'visual c++'                   =>   2.35,
++    'visual cobol'                 =>   4.00,
++    'visual objects'               =>   5.00,
++    'visualage'                    =>   3.81,
++    'Visualforce Component'        =>   1.9 ,
++    'Visualforce Page'             =>   1.9 ,
++    'visualgen'                    =>   4.44,
++    'vpf'                          =>   0.84,
++    'vsrexx'                       =>   2.50,
++    'vulcan'                       =>   1.25,
++    'vz programmer'                =>   2.22,
++    'warp x'                       =>   2.00,
++    'watcom c'                     =>   0.63,
++    'watcom c/386'                 =>   0.63,
++    'waterloo c'                   =>   0.63,
++    'waterloo pascal'              =>   0.88,
++    'watfiv'                       =>   0.94,
++    'watfor'                       =>   0.88,
++    'web scripts'                  =>   5.33,
++    'whip'                         =>   0.88,
++    'wizard'                       =>   2.86,
++    'xlisp'                        =>   1.25,
++    'XAML'                         =>   1.90,
++    'yacc'                         =>   1.51,
++    'yacc++'                       =>   1.51,
++    'YAML'                         =>   0.90,
++    'zbasic'                       =>   0.88,
++    'zim'                          =>   4.21,
++    'zlisp'                        =>   1.25,
++
++'Expect'  => 2.00,
++'C/C++ Header'  => 1.00, 
++'inc'     => 1.00,
++'lex'     => 1.00,
++'MATLAB'  => 4.00,
++'Maven/XML' => 2.5,
++'IDL'     => 3.80,
++'Octave'  => 4.00,
++'ML'      => 3.00,
++'Modula3' => 2.00,
++'PHP'     => 3.50,
++'Python'  => 4.20,
++'Cython'  => 3.80,
++'Ruby'    => 4.20,
++'Ruby HTML' => 4.00,
++'sed'     => 4.00,
++'Lua'     => 4.00,
++'OpenCL'  => 1.50,
++);
++# 1}}}
++%{$rh_Known_Binary_Archives} = (             # {{{1
++            '.tar'     => 1 ,
++            '.tar.Z'   => 1 ,
++            '.tar.gz'  => 1 ,
++            '.tar.bz2' => 1 ,
++            '.zip'     => 1 ,
++            '.Zip'     => 1 ,
++            '.ZIP'     => 1 ,
++            '.ear'     => 1 ,  # Java
++            '.war'     => 1 ,  # contained within .ear
++            '.xz'      => 1 ,
++            );
++# 1}}}
++} # end sub set_constants()
++sub Install_Regexp_Common {                  # {{{1
++    # Installs portions of Damian Conway's & Abigail's Regexp::Common
++    # module, v2.120, into a temporary directory for the duration of
++    # this run.
++
++    my %Regexp_Common_Contents = ();
++$Regexp_Common_Contents{'Common'} = <<'EOCommon'; # {{{2
++package Regexp::Common;
++
++use 5.00473;
++use strict;
++
++local $^W = 1;
++
++use vars qw /$VERSION %RE %sub_interface $AUTOLOAD/;
++
++($VERSION) = q $Revision: 2.120 $ =~ /([\d.]+)/;
++
++
++sub _croak {
++    require Carp;
++    goto &Carp::croak;
++}
++
++sub _carp {
++    require Carp;
++    goto &Carp::carp;
++}
++
++sub new {
++    my ($class, @data) = @_;
++    my %self;
++    tie %self, $class, @data;
++    return \%self;
++}
++
++sub TIEHASH {
++    my ($class, @data) = @_;
++    bless \@data, $class;
++}
++
++sub FETCH {
++    my ($self, $extra) = @_;
++    return bless ref($self)->new(@$self, $extra), ref($self);
++}
++
++# Modification for cloc:  only need a few modules from Regexp::Common.
++my %imports = map {$_ => "Regexp::Common::$_"}
++              qw /balanced comment delimited /;
++#my %imports = map {$_ => "Regexp::Common::$_"}
++#              qw /balanced CC     comment   delimited lingua list
++#                  net      number profanity SEN       URI    whitespace
++#                  zip/;
++
++sub import {
++    shift;  # Shift off the class.
++    tie %RE, __PACKAGE__;
++    {
++        no strict 'refs';
++        *{caller() . "::RE"} = \%RE;
++    }
++
++    my $saw_import;
++    my $no_defaults;
++    my %exclude;
++    foreach my $entry (grep {!/^RE_/} @_) {
++        if ($entry eq 'pattern') {
++            no strict 'refs';
++            *{caller() . "::pattern"} = \&pattern;
++            next;
++        }
++        # This used to prevent $; from being set. We still recognize it,
++        # but we won't do anything.
++        if ($entry eq 'clean') {
++            next;
++        }
++        if ($entry eq 'no_defaults') {
++            $no_defaults ++;
++            next;
++        }
++        if (my $module = $imports {$entry}) {
++            $saw_import ++;
++            eval "require $module;";
++            die $@ if $@;
++            next;
++        }
++        if ($entry =~ /^!(.*)/ && $imports {$1}) {
++            $exclude {$1} ++;
++            next;
++        }
++        # As a last resort, try to load the argument.
++        my $module = $entry =~ /^Regexp::Common/
++                            ? $entry
++                            : "Regexp::Common::" . $entry;
++        eval "require $module;";
++        die $@ if $@;
++    }
++
++    unless ($saw_import || $no_defaults) {
++        foreach my $module (values %imports) {
++            next if $exclude {$module};
++            eval "require $module;";
++            die $@ if $@;
++        }
++    }
++
++    my %exported;
++    foreach my $entry (grep {/^RE_/} @_) {
++        if ($entry =~ /^RE_(\w+_)?ALL$/) {
++            my $m  = defined $1 ? $1 : "";
++            my $re = qr /^RE_${m}.*$/;
++            while (my ($sub, $interface) = each %sub_interface) {
++                next if $exported {$sub};
++                next unless $sub =~ /$re/;
++                {
++                    no strict 'refs';
++                    *{caller() . "::$sub"} = $interface;
++                }
++                $exported {$sub} ++;
++            }
++        }
++        else {
++            next if $exported {$entry};
++            _croak "Can't export unknown subroutine &$entry"
++                unless $sub_interface {$entry};
++            {
++                no strict 'refs';
++                *{caller() . "::$entry"} = $sub_interface {$entry};
++            }
++            $exported {$entry} ++;
++        }
++    }
++}
++
++sub AUTOLOAD { _croak "Can't $AUTOLOAD" }
++
++sub DESTROY {}
++
++my %cache;
++
++my $fpat = qr/^(-\w+)/;
++
++sub _decache {
++        my @args = @{tied %{$_[0]}};
++        my @nonflags = grep {!/$fpat/} @args;
++        my $cache = get_cache(@nonflags);
++        _croak "Can't create unknown regex: \$RE{"
++            . join("}{",@args) . "}"
++                unless exists $cache->{__VAL__};
++        _croak "Perl $] does not support the pattern "
++            . "\$RE{" . join("}{",@args)
++            . "}.\nYou need Perl $cache->{__VAL__}{version} or later"
++                unless ($cache->{__VAL__}{version}||0) <= $];
++        my %flags = ( %{$cache->{__VAL__}{default}},
++                      map { /$fpat\Q$;\E(.*)/ ? ($1 => $2)
++                          : /$fpat/           ? ($1 => undef)
++                          :                     ()
++                          } @args);
++        $cache->{__VAL__}->_clone_with(\@args, \%flags);
++}
++
++use overload q{""} => \&_decache;
++
++
++sub get_cache {
++        my $cache = \%cache;
++        foreach (@_) {
++                $cache = $cache->{$_}
++                      || ($cache->{$_} = {});
++        }
++        return $cache;
++}
++
++sub croak_version {
++        my ($entry, @args) = @_;
++}
++
++sub pattern {
++        my %spec = @_;
++        _croak 'pattern() requires argument: name => [ @list ]'
++                unless $spec{name} && ref $spec{name} eq 'ARRAY';
++        _croak 'pattern() requires argument: create => $sub_ref_or_string'
++                unless $spec{create};
++
++        if (ref $spec{create} ne "CODE") {
++                my $fixed_str = "$spec{create}";
++                $spec{create} = sub { $fixed_str }
++        }
++
++        my @nonflags;
++        my %default;
++        foreach ( @{$spec{name}} ) {
++                if (/$fpat=(.*)/) {
++                        $default{$1} = $2;
++                }
++                elsif (/$fpat\s*$/) {
++                        $default{$1} = undef;
++                }
++                else {
++                        push @nonflags, $_;
++                }
++        }
++
++        my $entry = get_cache(@nonflags);
++
++        if ($entry->{__VAL__}) {
++                _carp "Overriding \$RE{"
++                   . join("}{",@nonflags)
++                   . "}";
++        }
++
++        $entry->{__VAL__} = bless {
++                                create  => $spec{create},
++                                match   => $spec{match} || \&generic_match,
++                                subs    => $spec{subs}  || \&generic_subs,
++                                version => $spec{version},
++                                default => \%default,
++                            }, 'Regexp::Common::Entry';
++
++        foreach (@nonflags) {s/\W/X/g}
++        my $subname = "RE_" . join ("_", @nonflags);
++        $sub_interface{$subname} = sub {
++                push @_ => undef if @_ % 2;
++                my %flags = @_;
++                my $pat = $spec{create}->($entry->{__VAL__},
++                               {%default, %flags}, \@nonflags);
++                if (exists $flags{-keep}) { $pat =~ s/\Q(?k:/(/g; }
++                else { $pat =~ s/\Q(?k:/(?:/g; }
++                return exists $flags {-i} ? qr /(?i:$pat)/ : qr/$pat/;
++        };
++
++        return 1;
++}
++
++sub generic_match {$_ [1] =~  /$_[0]/}
++sub generic_subs  {$_ [1] =~ s/$_[0]/$_[2]/}
++
++sub matches {
++        my ($self, $str) = @_;
++        my $entry = $self -> _decache;
++        $entry -> {match} -> ($entry, $str);
++}
++
++sub subs {
++        my ($self, $str, $newstr) = @_;
++        my $entry = $self -> _decache;
++        $entry -> {subs} -> ($entry, $str, $newstr);
++        return $str;
++}
++
++
++package Regexp::Common::Entry;
++# use Carp;
++
++local $^W = 1;
++
++use overload
++    q{""} => sub {
++        my ($self) = @_;
++        my $pat = $self->{create}->($self, $self->{flags}, $self->{args});
++        if (exists $self->{flags}{-keep}) {
++            $pat =~ s/\Q(?k:/(/g;
++        }
++        else {
++            $pat =~ s/\Q(?k:/(?:/g;
++        }
++        if (exists $self->{flags}{-i})   { $pat = "(?i)$pat" }
++        return $pat;
++    };
++
++sub _clone_with {
++    my ($self, $args, $flags) = @_;
++    bless { %$self, args=>$args, flags=>$flags }, ref $self;
++}
++# 
++#    Copyright (c) 2001 - 2005, Damian Conway and Abigail. All Rights
++#  Reserved. This module is free software. It may be used, redistributed
++#      and/or modified under the terms of the Perl Artistic License
++#            (see http://www.perl.com/perl/misc/Artistic.html)
++EOCommon
++# 2}}}
++$Regexp_Common_Contents{'Common/comment'} = <<'EOC';   # {{{2
++# $Id: comment.pm,v 2.116 2005/03/16 00:00:02 abigail Exp $
++
++package Regexp::Common::comment;
++
++use strict;
++local $^W = 1;
++
++use Regexp::Common qw /pattern clean no_defaults/;
++use vars qw /$VERSION/;
++
++($VERSION) = q $Revision: 2.116 $ =~ /[\d.]+/g;
++
++my @generic = (
++    {languages => [qw /ABC Forth/],
++     to_eol    => ['\\\\']},   # This is for just a *single* backslash.
++
++    {languages => [qw /Ada Alan Eiffel lua/],
++     to_eol    => ['--']},
++
++    {languages => [qw /Advisor/],
++     to_eol    => ['#|//']},
++
++    {languages => [qw /Advsys CQL Lisp LOGO M MUMPS REBOL Scheme
++                       SMITH zonefile/],
++     to_eol    => [';']},
++
++    {languages => ['Algol 60'],
++     from_to   => [[qw /comment ;/]]},
++
++    {languages => [qw {ALPACA B C C-- LPC PL/I}],
++     from_to   => [[qw {/* */}]]},
++
++    {languages => [qw /awk fvwm2 Icon mutt Perl Python QML R Ruby shell Tcl/],
++     to_eol    => ['#']},
++
++    {languages => [[BASIC => 'mvEnterprise']],
++     to_eol    => ['[*!]|REM']},
++
++    {languages => [qw /Befunge-98 Funge-98 Shelta/],
++     id        => [';']},
++
++    {languages => ['beta-Juliet', 'Crystal Report', 'Portia'],
++     to_eol    => ['//']},
++
++    {languages => ['BML'],
++     from_to   => [['<?_c', '_c?>']],
++    },
++
++    {languages => [qw /C++/, 'C#', qw /Cg ECMAScript FPL Java JavaScript/],
++     to_eol    => ['//'],
++     from_to   => [[qw {/* */}]]},
++
++    {languages => [qw /CLU LaTeX slrn TeX/],
++     to_eol    => ['%']},
++
++    {languages => [qw /False/],
++     from_to   => [[qw !{ }!]]},
++
++    {languages => [qw /Fortran/],
++     to_eol    => ['!']},
++
++    {languages => [qw /Haifu/],
++     id        => [',']},
++
++    {languages => [qw /ILLGOL/],
++     to_eol    => ['NB']},
++
++    {languages => [qw /INTERCAL/],
++     to_eol    => [q{(?:(?:PLEASE(?:\s+DO)?|DO)\s+)?(?:NOT|N'T)}]},
++
++    {languages => [qw /J/],
++     to_eol    => ['NB[.]']},
++
++    {languages => [qw /Nickle/],
++     to_eol    => ['#'],
++     from_to   => [[qw {/* */}]]},
++
++    {languages => [qw /Oberon/],
++     from_to   => [[qw /(* *)/]]},
++     
++    {languages => [[qw /Pascal Delphi/], [qw /Pascal Free/], [qw /Pascal GPC/]],
++     to_eol    => ['//'],
++     from_to   => [[qw !{ }!], [qw !(* *)!]]},
++
++    {languages => [[qw /Pascal Workshop/]],
++     id        => [qw /"/],
++     from_to   => [[qw !{ }!], [qw !(* *)!], [qw !/* */!]]},
++
++    {languages => [qw /PEARL/],
++     to_eol    => ['!'],
++     from_to   => [[qw {/* */}]]},
++
++    {languages => [qw /PHP/],
++     to_eol    => ['#', '//'],
++     from_to   => [[qw {/* */}]]},
++
++    {languages => [qw !PL/B!],
++     to_eol    => ['[.;]']},
++
++    {languages => [qw !PL/SQL!],
++     to_eol    => ['--'],
++     from_to   => [[qw {/* */}]]},
++
++    {languages => [qw /Q-BAL/],
++     to_eol    => ['`']},
++
++    {languages => [qw /Smalltalk/],
++     id        => ['"']},
++
++    {languages => [qw /SQL/],
++     to_eol    => ['-{2,}']},
++
++    {languages => [qw /troff/],
++     to_eol    => ['\\\"']},
++
++    {languages => [qw /vi/],
++     to_eol    => ['"']},
++
++    {languages => [qw /*W/],
++     from_to   => [[qw {|| !!}]]},
++);
++
++my @plain_or_nested = (
++   [Caml         =>  undef,       "(*"  => "*)"],
++   [Dylan        =>  "//",        "/*"  => "*/"],
++   [Haskell      =>  "-{2,}",     "{-"  => "-}"],
++   [Hugo         =>  "!(?!\\\\)", "!\\" => "\\!"],
++   [SLIDE        =>  "#",         "(*"  => "*)"],
++);
++
++#
++# Helper subs.
++#
++
++sub combine      {
++    local $_ = join "|", @_;
++    if (@_ > 1) {
++        s/\(\?k:/(?:/g;
++        $_ = "(?k:$_)";
++    }
++    $_
++}
++
++sub to_eol  ($)  {"(?k:(?k:$_[0])(?k:[^\\n]*)(?k:\\n))"}
++sub id      ($)  {"(?k:(?k:$_[0])(?k:[^$_[0]]*)(?k:$_[0]))"}  # One char only!
++sub from_to      {
++    local $^W = 1;
++    my ($begin, $end) = @_;
++
++    my $qb  = quotemeta $begin;
++    my $qe  = quotemeta $end;
++    my $fe  = quotemeta substr $end   => 0, 1;
++    my $te  = quotemeta substr $end   => 1;
++
++    "(?k:(?k:$qb)(?k:(?:[^$fe]+|$fe(?!$te))*)(?k:$qe))";
++}
++
++
++my $count = 0;
++sub nested {
++    local $^W = 1;
++    my ($begin, $end) = @_;
++
++    $count ++;
++    my $r = '(??{$Regexp::Common::comment ['. $count . ']})';
++
++    my $qb  = quotemeta $begin;
++    my $qe  = quotemeta $end;
++    my $fb  = quotemeta substr $begin => 0, 1;
++    my $fe  = quotemeta substr $end   => 0, 1;
++
++    my $tb  = quotemeta substr $begin => 1;
++    my $te  = quotemeta substr $end   => 1;
++
++    use re 'eval';
++
++    my $re;
++    if ($fb eq $fe) {
++        $re = qr /(?:$qb(?:(?>[^$fb]+)|$fb(?!$tb)(?!$te)|$r)*$qe)/;
++    }
++    else {
++        local $"      =  "|";
++        my   @clauses =  "(?>[^$fb$fe]+)";
++        push @clauses => "$fb(?!$tb)" if length $tb;
++        push @clauses => "$fe(?!$te)" if length $te;
++        push @clauses =>  $r;
++        $re           =   qr /(?:$qb(?:@clauses)*$qe)/;
++    }
++
++    $Regexp::Common::comment [$count] = qr/$re/;
++}
++
++#
++# Process data.
++#
++
++foreach my $info (@plain_or_nested) {
++    my ($language, $mark, $begin, $end) = @$info;
++    pattern name    => [comment => $language],
++            create  =>
++                sub {my $re     = nested $begin => $end;
++                     my $prefix = defined $mark ? $mark . "[^\n]*\n|" : "";
++                     exists $_ [1] -> {-keep} ? qr /($prefix$re)/
++                                              : qr  /$prefix$re/
++                },
++            version => 5.006,
++            ;
++}
++
++
++foreach my $group (@generic) {
++    my $pattern = combine +(map {to_eol   $_} @{$group -> {to_eol}}),
++                           (map {from_to @$_} @{$group -> {from_to}}),
++                           (map {id       $_} @{$group -> {id}}),
++                  ;
++    foreach my $language  (@{$group -> {languages}}) {
++        pattern name    => [comment => ref $language ? @$language : $language],
++                create  => $pattern,
++                ;
++    }
++}
++                
++
++    
++#
++# Other languages.
++#
++
++# http://www.pascal-central.com/docs/iso10206.txt
++pattern name    => [qw /comment Pascal/],
++        create  => '(?k:' . '(?k:[{]|[(][*])'
++                          . '(?k:[^}*]*(?:[*][^)][^}*]*)*)'
++                          . '(?k:[}]|[*][)])'
++                          . ')'
++        ;
++
++# http://www.templetons.com/brad/alice/language/
++pattern name    =>  [qw /comment Pascal Alice/],
++        create  =>  '(?k:(?k:[{])(?k:[^}\n]*)(?k:[}]))'
++        ;
++
++
++# http://westein.arb-phys.uni-dortmund.de/~wb/a68s.txt
++pattern name    => [qw (comment), 'Algol 68'],
++        create  => q {(?k:(?:#[^#]*#)|}                           .
++                   q {(?:\bco\b(?:[^c]+|\Bc|\bc(?!o\b))*\bco\b)|} .
++                   q {(?:\bcomment\b(?:[^c]+|\Bc|\bc(?!omment\b))*\bcomment\b))}
++        ;
++
++
++# See rules 91 and 92 of ISO 8879 (SGML).
++# Charles F. Goldfarb: "The SGML Handbook".
++# Oxford: Oxford University Press. 1990. ISBN 0-19-853737-9.
++# Ch. 10.3, pp 390.
++pattern name    => [qw (comment HTML)],
++        create  => q {(?k:(?k:<!)(?k:(?:--(?k:[^-]*(?:-[^-]+)*)--\s*)*)(?k:>))},
++        ;
++
++
++pattern name    => [qw /comment SQL MySQL/],
++        create  => q {(?k:(?:#|-- )[^\n]*\n|} .
++                   q {/\*(?:(?>[^*;"']+)|"[^"]*"|'[^']*'|\*(?!/))*(?:;|\*/))},
++        ;
++
++# Anything that isn't <>[]+-.,
++# http://home.wxs.nl/~faase009/Ha_BF.html
++pattern name    => [qw /comment Brainfuck/],
++        create  => '(?k:[^<>\[\]+\-.,]+)'
++        ;
++
++# Squeak is a variant of Smalltalk-80.
++# http://www.squeak.
++# http://mucow.com/squeak-qref.html
++pattern name    => [qw /comment Squeak/],
++        create  => '(?k:(?k:")(?k:[^"]*(?:""[^"]*)*)(?k:"))'
++        ;
++
++#
++# Scores of less than 5 or above 17....
++# http://www.cliff.biffle.org/esoterica/beatnik.html
++@Regexp::Common::comment::scores = (1,  3,  3,  2,  1,  4,  2,  4,  1,  8,
++                                    5,  1,  3,  1,  1,  3, 10,  1,  1,  1,
++                                    1,  4,  4,  8,  4, 10);
++pattern name    =>  [qw /comment Beatnik/],
++        create  =>  sub {
++            use re 'eval';
++            my ($s, $x);
++            my $re = qr {\b([A-Za-z]+)\b
++                         (?(?{($s, $x) = (0, lc $^N);
++                              $s += $Regexp::Common::comment::scores
++                                    [ord (chop $x) - ord ('a')] while length $x;
++                              $s  >= 5 && $s < 18})XXX|)}x;
++            $re;
++        },
++        version  => 5.008,
++        ;
++
++
++# http://www.cray.com/craydoc/manuals/007-3692-005/html-007-3692-005/
++#  (Goto table of contents/3.3 Source Form)
++# Fortran, in fixed format. Comments start with a C, c or * in the first
++# column, or a ! anywhere, but the sixth column. Then end with a newline.
++pattern name    =>  [qw /comment Fortran fixed/],
++        create  =>  '(?k:(?k:(?:^[Cc*]|(?<!^.....)!))(?k:[^\n]*)(?k:\n))'
++        ;
++
++
++# http://www.csis.ul.ie/cobol/Course/COBOLIntro.htm
++# Traditionally, comments in COBOL were indicated with an asteriks in
++# the seventh column. Modern compilers may be more lenient.
++pattern name    =>  [qw /comment COBOL/],
++        create  =>  '(?<=^......)(?k:(?k:[*])(?k:[^\n]*)(?k:\n))',
++        version =>  '5.008',
++        ;
++
++1;
++#
++#    Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved.
++#      This module is free software. It may be used, redistributed
++#     and/or modified under the terms of the Perl Artistic License
++#           (see http://www.perl.com/perl/misc/Artistic.html)
++EOC
++# 2}}}
++$Regexp_Common_Contents{'Common/balanced'} = <<'EOB';   # {{{2
++package Regexp::Common::balanced; {
++
++use strict;
++local $^W = 1;
++
++use vars qw /$VERSION/;
++($VERSION) = q $Revision: 2.101 $ =~ /[\d.]+/g;
++
++use Regexp::Common qw /pattern clean no_defaults/;
++
++my %closer = ( '{'=>'}', '('=>')', '['=>']', '<'=>'>' );
++my $count = -1;
++my %cache;
++
++sub nested {
++    local $^W = 1;
++    my ($start, $finish) = @_;
++
++    return $Regexp::Common::balanced [$cache {$start} {$finish}]
++            if exists $cache {$start} {$finish};
++
++    $count ++;
++    my $r = '(??{$Regexp::Common::balanced ['. $count . ']})';
++
++    my @starts   = map {s/\\(.)/$1/g; $_} grep {length}
++                        $start  =~ /([^|\\]+|\\.)+/gs;
++    my @finishes = map {s/\\(.)/$1/g; $_} grep {length}
++                        $finish =~ /([^|\\]+|\\.)+/gs;
++
++    push @finishes => ($finishes [-1]) x (@starts - @finishes);
++
++    my @re;
++    local $" = "|";
++    foreach my $begin (@starts) {
++        my $end = shift @finishes;
++
++        my $qb  = quotemeta $begin;
++        my $qe  = quotemeta $end;
++        my $fb  = quotemeta substr $begin => 0, 1;
++        my $fe  = quotemeta substr $end   => 0, 1;
++
++        my $tb  = quotemeta substr $begin => 1;
++        my $te  = quotemeta substr $end   => 1;
++
++        use re 'eval';
++
++        my $add;
++        if ($fb eq $fe) {
++            push @re =>
++                   qr /(?:$qb(?:(?>[^$fb]+)|$fb(?!$tb)(?!$te)|$r)*$qe)/;
++        }
++        else {
++            my   @clauses =  "(?>[^$fb$fe]+)";
++            push @clauses => "$fb(?!$tb)" if length $tb;
++            push @clauses => "$fe(?!$te)" if length $te;
++            push @clauses =>  $r;
++            push @re      =>  qr /(?:$qb(?:@clauses)*$qe)/;
++        }
++    }
++
++    $cache {$start} {$finish} = $count;
++    $Regexp::Common::balanced [$count] = qr/@re/;
++}
++
++
++pattern name    => [qw /balanced -parens=() -begin= -end=/],
++        create  => sub {
++            my $flag = $_[1];
++            unless (defined $flag -> {-begin} && length $flag -> {-begin} &&
++                    defined $flag -> {-end}   && length $flag -> {-end}) {
++                my @open  = grep {index ($flag->{-parens}, $_) >= 0}
++                             ('[','(','{','<');
++                my @close = map {$closer {$_}} @open;
++                $flag -> {-begin} = join "|" => @open;
++                $flag -> {-end}   = join "|" => @close;
++            }
++            my $pat = nested @$flag {qw /-begin -end/};
++            return exists $flag -> {-keep} ? qr /($pat)/ : $pat;
++        },
++        version => 5.006,
++        ;
++
++}
++
++1;
++#
++#     Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved.
++#       This module is free software. It may be used, redistributed
++#      and/or modified under the terms of the Perl Artistic License
++#            (see http://www.perl.com/perl/misc/Artistic.html)
++EOB
++# 2}}}
++$Regexp_Common_Contents{'Common/delimited'} = <<'EOD';   # {{{2
++# $Id: delimited.pm,v 2.104 2005/03/16 00:22:45 abigail Exp $
++
++package Regexp::Common::delimited;
++
++use strict;
++local $^W = 1;
++
++use Regexp::Common qw /pattern clean no_defaults/;
++use vars qw /$VERSION/;
++
++($VERSION) = q $Revision: 2.104 $ =~ /[\d.]+/g;
++
++sub gen_delimited {
++
++    my ($dels, $escs) = @_;
++    # return '(?:\S*)' unless $dels =~ /\S/;
++    if (length $escs) {
++        $escs .= substr ($escs, -1) x (length ($dels) - length ($escs));
++    }
++    my @pat = ();
++    my $i;
++    for ($i=0; $i < length $dels; $i++) {
++        my $del = quotemeta substr ($dels, $i, 1);
++        my $esc = length($escs) ? quotemeta substr ($escs, $i, 1) : "";
++        if ($del eq $esc) {
++            push @pat,
++                 "(?k:$del)(?k:[^$del]*(?:(?:$del$del)[^$del]*)*)(?k:$del)";
++        }
++        elsif (length $esc) {
++            push @pat,
++                 "(?k:$del)(?k:[^$esc$del]*(?:$esc.[^$esc$del]*)*)(?k:$del)";
++        }
++        else {
++            push @pat, "(?k:$del)(?k:[^$del]*)(?k:$del)";
++        }
++    }
++    my $pat = join '|', @pat;
++    return "(?k:$pat)";
++}
++
++sub _croak {
++    require Carp;
++    goto &Carp::croak;
++}
++
++pattern name   => [qw( delimited -delim= -esc=\\ )],
++        create => sub {my $flags = $_[1];
++                       _croak 'Must specify delimiter in $RE{delimited}'
++                             unless length $flags->{-delim};
++                       return gen_delimited (@{$flags}{-delim, -esc});
++                  },
++        ;
++
++pattern name   => [qw( quoted -esc=\\ )],
++        create => sub {my $flags = $_[1];
++                       return gen_delimited (q{"'`}, $flags -> {-esc});
++                  },
++        ;
++
++
++1;
++#
++#     Copyright (c) 2001 - 2003, Damian Conway. All Rights Reserved.
++#       This module is free software. It may be used, redistributed
++#      and/or modified under the terms of the Perl Artistic License
++#            (see http://www.perl.com/perl/misc/Artistic.html)
++EOD
++# 2}}}
++    my $problems        = 0;
++    $HAVE_Rexexp_Common = 0;
++    my $dir             = "";
++    if ($opt_sdir) {
++        ++$TEMP_OFF;
++        $dir = "$opt_sdir/$TEMP_OFF";
++        File::Path::rmtree($dir) if     is_dir($dir);
++        File::Path::mkpath($dir) unless is_dir($dir);
++    } else {
++        # let File::Temp create a suitable temporary directory
++        $dir = tempdir( CLEANUP => 1 );  # 1 = delete on exit
++        $TEMP_INST{ $dir } = "Regexp::Common";
++    }
++    print "Using temp dir [$dir] to install Regexp::Common\n" if $opt_v;
++    my $Regexp_dir        = "$dir/Regexp";
++    my $Regexp_Common_dir = "$dir/Regexp/Common";
++    mkdir $Regexp_dir       ;
++    mkdir $Regexp_Common_dir;
++
++    foreach my $module_file (keys %Regexp_Common_Contents) {
++        my $OUT = new IO::File "$dir/Regexp/${module_file}.pm", "w";
++        if (defined $OUT) {
++            print $OUT $Regexp_Common_Contents{$module_file};
++            $OUT->close;
++        } else {
++            warn "Failed to install Regexp::${module_file}.pm\n";
++            $problems = 1;
++        }
++    }
++
++    push @INC, $dir;
++    eval "use Regexp::Common qw /comment RE_comment_HTML balanced/";
++    $HAVE_Rexexp_Common = 1 unless $problems;
++} # 1}}}
++sub Install_Algorithm_Diff {                 # {{{1
++    # Installs Tye McQueen's Algorithm::Diff module, v1.1902, into a 
++    # temporary directory for the duration of this run.
++
++my $Algorithm_Diff_Contents = <<'EOAlgDiff'; # {{{2
++package Algorithm::Diff;
++# Skip to first "=head" line for documentation.
++use strict;
++
++use integer;    # see below in _replaceNextLargerWith() for mod to make
++                # if you don't use this
++use vars qw( $VERSION @EXPORT_OK );
++$VERSION = 1.19_02;
++#          ^ ^^ ^^-- Incremented at will
++#          | \+----- Incremented for non-trivial changes to features
++#          \-------- Incremented for fundamental changes
++require Exporter;
++*import    = \&Exporter::import;
++@EXPORT_OK = qw(
++    prepare LCS LCSidx LCS_length
++    diff sdiff compact_diff
++    traverse_sequences traverse_balanced
++);
++
++# McIlroy-Hunt diff algorithm
++# Adapted from the Smalltalk code of Mario I. Wolczko, <mario@wolczko.com>
++# by Ned Konz, perl@bike-nomad.com
++# Updates by Tye McQueen, http://perlmonks.org/?node=tye
++
++# Create a hash that maps each element of $aCollection to the set of
++# positions it occupies in $aCollection, restricted to the elements
++# within the range of indexes specified by $start and $end.
++# The fourth parameter is a subroutine reference that will be called to
++# generate a string to use as a key.
++# Additional parameters, if any, will be passed to this subroutine.
++#
++# my $hashRef = _withPositionsOfInInterval( \@array, $start, $end, $keyGen );
++
++sub _withPositionsOfInInterval
++{
++    my $aCollection = shift;    # array ref
++    my $start       = shift;
++    my $end         = shift;
++    my $keyGen      = shift;
++    my %d;
++    my $index;
++    for ( $index = $start ; $index <= $end ; $index++ )
++    {
++        my $element = $aCollection->[$index];
++        my $key = &$keyGen( $element, @_ );
++        if ( exists( $d{$key} ) )
++        {
++            unshift ( @{ $d{$key} }, $index );
++        }
++        else
++        {
++            $d{$key} = [$index];
++        }
++    }
++    return wantarray ? %d : \%d;
++}
++
++# Find the place at which aValue would normally be inserted into the
++# array. If that place is already occupied by aValue, do nothing, and
++# return undef. If the place does not exist (i.e., it is off the end of
++# the array), add it to the end, otherwise replace the element at that
++# point with aValue.  It is assumed that the array's values are numeric.
++# This is where the bulk (75%) of the time is spent in this module, so
++# try to make it fast!
++
++sub _replaceNextLargerWith
++{
++    my ( $array, $aValue, $high ) = @_;
++    $high ||= $#$array;
++
++    # off the end?
++    if ( $high == -1 || $aValue > $array->[-1] )
++    {
++        push ( @$array, $aValue );
++        return $high + 1;
++    }
++
++    # binary search for insertion point...
++    my $low = 0;
++    my $index;
++    my $found;
++    while ( $low <= $high )
++    {
++        $index = ( $high + $low ) / 2;
++
++        # $index = int(( $high + $low ) / 2);  # without 'use integer'
++        $found = $array->[$index];
++
++        if ( $aValue == $found )
++        {
++            return undef;
++        }
++        elsif ( $aValue > $found )
++        {
++            $low = $index + 1;
++        }
++        else
++        {
++            $high = $index - 1;
++        }
++    }
++
++    # now insertion point is in $low.
++    $array->[$low] = $aValue;    # overwrite next larger
++    return $low;
++}
++
++# This method computes the longest common subsequence in $a and $b.
++
++# Result is array or ref, whose contents is such that
++#   $a->[ $i ] == $b->[ $result[ $i ] ]
++# foreach $i in ( 0 .. $#result ) if $result[ $i ] is defined.
++
++# An additional argument may be passed; this is a hash or key generating
++# function that should return a string that uniquely identifies the given
++# element.  It should be the case that if the key is the same, the elements
++# will compare the same. If this parameter is undef or missing, the key
++# will be the element as a string.
++
++# By default, comparisons will use "eq" and elements will be turned into keys
++# using the default stringizing operator '""'.
++
++# Additional parameters, if any, will be passed to the key generation
++# routine.
++
++sub _longestCommonSubsequence
++{
++    my $a        = shift;    # array ref or hash ref
++    my $b        = shift;    # array ref or hash ref
++    my $counting = shift;    # scalar
++    my $keyGen   = shift;    # code ref
++    my $compare;             # code ref
++
++    if ( ref($a) eq 'HASH' )
++    {                        # prepared hash must be in $b
++        my $tmp = $b;
++        $b = $a;
++        $a = $tmp;
++    }
++
++    # Check for bogus (non-ref) argument values
++    if ( !ref($a) || !ref($b) )
++    {
++        my @callerInfo = caller(1);
++        die 'error: must pass array or hash references to ' . $callerInfo[3];
++    }
++
++    # set up code refs
++    # Note that these are optimized.
++    if ( !defined($keyGen) )    # optimize for strings
++    {
++        $keyGen = sub { $_[0] };
++        $compare = sub { my ( $a, $b ) = @_; $a eq $b };
++    }
++    else
++    {
++        $compare = sub {
++            my $a = shift;
++            my $b = shift;
++            &$keyGen( $a, @_ ) eq &$keyGen( $b, @_ );
++        };
++    }
++
++    my ( $aStart, $aFinish, $matchVector ) = ( 0, $#$a, [] );
++    my ( $prunedCount, $bMatches ) = ( 0, {} );
++
++    if ( ref($b) eq 'HASH' )    # was $bMatches prepared for us?
++    {
++        $bMatches = $b;
++    }
++    else
++    {
++        my ( $bStart, $bFinish ) = ( 0, $#$b );
++
++        # First we prune off any common elements at the beginning
++        while ( $aStart <= $aFinish
++            and $bStart <= $bFinish
++            and &$compare( $a->[$aStart], $b->[$bStart], @_ ) )
++        {
++            $matchVector->[ $aStart++ ] = $bStart++;
++            $prunedCount++;
++        }
++
++        # now the end
++        while ( $aStart <= $aFinish
++            and $bStart <= $bFinish
++            and &$compare( $a->[$aFinish], $b->[$bFinish], @_ ) )
++        {
++            $matchVector->[ $aFinish-- ] = $bFinish--;
++            $prunedCount++;
++        }
++
++        # Now compute the equivalence classes of positions of elements
++        $bMatches =
++          _withPositionsOfInInterval( $b, $bStart, $bFinish, $keyGen, @_ );
++    }
++    my $thresh = [];
++    my $links  = [];
++
++    my ( $i, $ai, $j, $k );
++    for ( $i = $aStart ; $i <= $aFinish ; $i++ )
++    {
++        $ai = &$keyGen( $a->[$i], @_ );
++        if ( exists( $bMatches->{$ai} ) )
++        {
++            $k = 0;
++            for $j ( @{ $bMatches->{$ai} } )
++            {
++
++                # optimization: most of the time this will be true
++                if ( $k and $thresh->[$k] > $j and $thresh->[ $k - 1 ] < $j )
++                {
++                    $thresh->[$k] = $j;
++                }
++                else
++                {
++                    $k = _replaceNextLargerWith( $thresh, $j, $k );
++                }
++
++                # oddly, it's faster to always test this (CPU cache?).
++                if ( defined($k) )
++                {
++                    $links->[$k] =
++                      [ ( $k ? $links->[ $k - 1 ] : undef ), $i, $j ];
++                }
++            }
++        }
++    }
++
++    if (@$thresh)
++    {
++        return $prunedCount + @$thresh if $counting;
++        for ( my $link = $links->[$#$thresh] ; $link ; $link = $link->[0] )
++        {
++            $matchVector->[ $link->[1] ] = $link->[2];
++        }
++    }
++    elsif ($counting)
++    {
++        return $prunedCount;
++    }
++
++    return wantarray ? @$matchVector : $matchVector;
++}
++
++sub traverse_sequences
++{
++    my $a                 = shift;          # array ref
++    my $b                 = shift;          # array ref
++    my $callbacks         = shift || {};
++    my $keyGen            = shift;
++    my $matchCallback     = $callbacks->{'MATCH'} || sub { };
++    my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
++    my $finishedACallback = $callbacks->{'A_FINISHED'};
++    my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
++    my $finishedBCallback = $callbacks->{'B_FINISHED'};
++    my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );
++
++    # Process all the lines in @$matchVector
++    my $lastA = $#$a;
++    my $lastB = $#$b;
++    my $bi    = 0;
++    my $ai;
++
++    for ( $ai = 0 ; $ai <= $#$matchVector ; $ai++ )
++    {
++        my $bLine = $matchVector->[$ai];
++        if ( defined($bLine) )    # matched
++        {
++            &$discardBCallback( $ai, $bi++, @_ ) while $bi < $bLine;
++            &$matchCallback( $ai,    $bi++, @_ );
++        }
++        else
++        {
++            &$discardACallback( $ai, $bi, @_ );
++        }
++    }
++
++    # The last entry (if any) processed was a match.
++    # $ai and $bi point just past the last matching lines in their sequences.
++
++    while ( $ai <= $lastA or $bi <= $lastB )
++    {
++
++        # last A?
++        if ( $ai == $lastA + 1 and $bi <= $lastB )
++        {
++            if ( defined($finishedACallback) )
++            {
++                &$finishedACallback( $lastA, @_ );
++                $finishedACallback = undef;
++            }
++            else
++            {
++                &$discardBCallback( $ai, $bi++, @_ ) while $bi <= $lastB;
++            }
++        }
++
++        # last B?
++        if ( $bi == $lastB + 1 and $ai <= $lastA )
++        {
++            if ( defined($finishedBCallback) )
++            {
++                &$finishedBCallback( $lastB, @_ );
++                $finishedBCallback = undef;
++            }
++            else
++            {
++                &$discardACallback( $ai++, $bi, @_ ) while $ai <= $lastA;
++            }
++        }
++
++        &$discardACallback( $ai++, $bi, @_ ) if $ai <= $lastA;
++        &$discardBCallback( $ai, $bi++, @_ ) if $bi <= $lastB;
++    }
++
++    return 1;
++}
++
++sub traverse_balanced
++{
++    my $a                 = shift;              # array ref
++    my $b                 = shift;              # array ref
++    my $callbacks         = shift || {};
++    my $keyGen            = shift;
++    my $matchCallback     = $callbacks->{'MATCH'} || sub { };
++    my $discardACallback  = $callbacks->{'DISCARD_A'} || sub { };
++    my $discardBCallback  = $callbacks->{'DISCARD_B'} || sub { };
++    my $changeCallback    = $callbacks->{'CHANGE'};
++    my $matchVector = _longestCommonSubsequence( $a, $b, 0, $keyGen, @_ );
++
++    # Process all the lines in match vector
++    my $lastA = $#$a;
++    my $lastB = $#$b;
++    my $bi    = 0;
++    my $ai    = 0;
++    my $ma    = -1;
++    my $mb;
++
++    while (1)
++    {
++
++        # Find next match indices $ma and $mb
++        do {
++            $ma++;
++        } while(
++                $ma <= $#$matchVector
++            &&  !defined $matchVector->[$ma]
++        );
++
++        last if $ma > $#$matchVector;    # end of matchVector?
++        $mb = $matchVector->[$ma];
++
++        # Proceed with discard a/b or change events until
++        # next match
++        while ( $ai < $ma || $bi < $mb )
++        {
++
++            if ( $ai < $ma && $bi < $mb )
++            {
++
++                # Change
++                if ( defined $changeCallback )
++                {
++                    &$changeCallback( $ai++, $bi++, @_ );
++                }
++                else
++                {
++                    &$discardACallback( $ai++, $bi, @_ );
++                    &$discardBCallback( $ai, $bi++, @_ );
++                }
++            }
++            elsif ( $ai < $ma )
++            {
++                &$discardACallback( $ai++, $bi, @_ );
++            }
++            else
++            {
++
++                # $bi < $mb
++                &$discardBCallback( $ai, $bi++, @_ );
++            }
++        }
++
++        # Match
++        &$matchCallback( $ai++, $bi++, @_ );
++    }
++
++    while ( $ai <= $lastA || $bi <= $lastB )
++    {
++        if ( $ai <= $lastA && $bi <= $lastB )
++        {
++
++            # Change
++            if ( defined $changeCallback )
++            {
++                &$changeCallback( $ai++, $bi++, @_ );
++            }
++            else
++            {
++                &$discardACallback( $ai++, $bi, @_ );
++                &$discardBCallback( $ai, $bi++, @_ );
++            }
++        }
++        elsif ( $ai <= $lastA )
++        {
++            &$discardACallback( $ai++, $bi, @_ );
++        }
++        else
++        {
++
++            # $bi <= $lastB
++            &$discardBCallback( $ai, $bi++, @_ );
++        }
++    }
++
++    return 1;
++}
++
++sub prepare
++{
++    my $a       = shift;    # array ref
++    my $keyGen  = shift;    # code ref
++
++    # set up code ref
++    $keyGen = sub { $_[0] } unless defined($keyGen);
++
++    return scalar _withPositionsOfInInterval( $a, 0, $#$a, $keyGen, @_ );
++}
++
++sub LCS
++{
++    my $a = shift;                  # array ref
++    my $b = shift;                  # array ref or hash ref
++    my $matchVector = _longestCommonSubsequence( $a, $b, 0, @_ );
++    my @retval;
++    my $i;
++    for ( $i = 0 ; $i <= $#$matchVector ; $i++ )
++    {
++        if ( defined( $matchVector->[$i] ) )
++        {
++            push ( @retval, $a->[$i] );
++        }
++    }
++    return wantarray ? @retval : \@retval;
++}
++
++sub LCS_length
++{
++    my $a = shift;                          # array ref
++    my $b = shift;                          # array ref or hash ref
++    return _longestCommonSubsequence( $a, $b, 1, @_ );
++}
++
++sub LCSidx
++{
++    my $a= shift @_;
++    my $b= shift @_;
++    my $match= _longestCommonSubsequence( $a, $b, 0, @_ );
++    my @am= grep defined $match->[$_], 0..$#$match;
++    my @bm= @{$match}[@am];
++    return \@am, \@bm;
++}
++
++sub compact_diff
++{
++    my $a= shift @_;
++    my $b= shift @_;
++    my( $am, $bm )= LCSidx( $a, $b, @_ );
++    my @cdiff;
++    my( $ai, $bi )= ( 0, 0 );
++    push @cdiff, $ai, $bi;
++    while( 1 ) {
++        while(  @$am  &&  $ai == $am->[0]  &&  $bi == $bm->[0]  ) {
++            shift @$am;
++            shift @$bm;
++            ++$ai, ++$bi;
++        }
++        push @cdiff, $ai, $bi;
++        last   if  ! @$am;
++        $ai = $am->[0];
++        $bi = $bm->[0];
++        push @cdiff, $ai, $bi;
++    }
++    push @cdiff, 0+@$a, 0+@$b
++        if  $ai < @$a || $bi < @$b;
++    return wantarray ? @cdiff : \@cdiff;
++}
++
++sub diff
++{
++    my $a      = shift;    # array ref
++    my $b      = shift;    # array ref
++    my $retval = [];
++    my $hunk   = [];
++    my $discard = sub {
++        push @$hunk, [ '-', $_[0], $a->[ $_[0] ] ];
++    };
++    my $add = sub {
++        push @$hunk, [ '+', $_[1], $b->[ $_[1] ] ];
++    };
++    my $match = sub {
++        push @$retval, $hunk
++            if 0 < @$hunk;
++        $hunk = []
++    };
++    traverse_sequences( $a, $b,
++        { MATCH => $match, DISCARD_A => $discard, DISCARD_B => $add }, @_ );
++    &$match();
++    return wantarray ? @$retval : $retval;
++}
++
++sub sdiff
++{
++    my $a      = shift;    # array ref
++    my $b      = shift;    # array ref
++    my $retval = [];
++    my $discard = sub { push ( @$retval, [ '-', $a->[ $_[0] ], "" ] ) };
++    my $add = sub { push ( @$retval, [ '+', "", $b->[ $_[1] ] ] ) };
++    my $change = sub {
++        push ( @$retval, [ 'c', $a->[ $_[0] ], $b->[ $_[1] ] ] );
++    };
++    my $match = sub {
++        push ( @$retval, [ 'u', $a->[ $_[0] ], $b->[ $_[1] ] ] );
++    };
++    traverse_balanced(
++        $a,
++        $b,
++        {
++            MATCH     => $match,
++            DISCARD_A => $discard,
++            DISCARD_B => $add,
++            CHANGE    => $change,
++        },
++        @_
++    );
++    return wantarray ? @$retval : $retval;
++}
++
++########################################
++my $Root= __PACKAGE__;
++package Algorithm::Diff::_impl;
++use strict;
++
++sub _Idx()  { 0 } # $me->[_Idx]: Ref to array of hunk indices
++            # 1   # $me->[1]: Ref to first sequence
++            # 2   # $me->[2]: Ref to second sequence
++sub _End()  { 3 } # $me->[_End]: Diff between forward and reverse pos
++sub _Same() { 4 } # $me->[_Same]: 1 if pos 1 contains unchanged items
++sub _Base() { 5 } # $me->[_Base]: Added to range's min and max
++sub _Pos()  { 6 } # $me->[_Pos]: Which hunk is currently selected
++sub _Off()  { 7 } # $me->[_Off]: Offset into _Idx for current position
++sub _Min() { -2 } # Added to _Off to get min instead of max+1
++
++sub Die
++{
++    require Carp;
++    Carp::confess( @_ );
++}
++
++sub _ChkPos
++{
++    my( $me )= @_;
++    return   if  $me->[_Pos];
++    my $meth= ( caller(1) )[3];
++    Die( "Called $meth on 'reset' object" );
++}
++
++sub _ChkSeq
++{
++    my( $me, $seq )= @_;
++    return $seq + $me->[_Off]
++        if  1 == $seq  ||  2 == $seq;
++    my $meth= ( caller(1) )[3];
++    Die( "$meth: Invalid sequence number ($seq); must be 1 or 2" );
++}
++
++sub getObjPkg
++{
++    my( $us )= @_;
++    return ref $us   if  ref $us;
++    return $us . "::_obj";
++}
++
++sub new
++{
++    my( $us, $seq1, $seq2, $opts ) = @_;
++    my @args;
++    for( $opts->{keyGen} ) {
++        push @args, $_   if  $_;
++    }
++    for( $opts->{keyGenArgs} ) {
++        push @args, @$_   if  $_;
++    }
++    my $cdif= Algorithm::Diff::compact_diff( $seq1, $seq2, @args );
++    my $same= 1;
++    if(  0 == $cdif->[2]  &&  0 == $cdif->[3]  ) {
++        $same= 0;
++        splice @$cdif, 0, 2;
++    }
++    my @obj= ( $cdif, $seq1, $seq2 );
++    $obj[_End] = (1+@$cdif)/2;
++    $obj[_Same] = $same;
++    $obj[_Base] = 0;
++    my $me = bless \@obj, $us->getObjPkg();
++    $me->Reset( 0 );
++    return $me;
++}
++
++sub Reset
++{
++    my( $me, $pos )= @_;
++    $pos= int( $pos || 0 );
++    $pos += $me->[_End]
++        if  $pos < 0;
++    $pos= 0
++        if  $pos < 0  ||  $me->[_End] <= $pos;
++    $me->[_Pos]= $pos || !1;
++    $me->[_Off]= 2*$pos - 1;
++    return $me;
++}
++
++sub Base
++{
++    my( $me, $base )= @_;
++    my $oldBase= $me->[_Base];
++    $me->[_Base]= 0+$base   if  defined $base;
++    return $oldBase;
++}
++
++sub Copy
++{
++    my( $me, $pos, $base )= @_;
++    my @obj= @$me;
++    my $you= bless \@obj, ref($me);
++    $you->Reset( $pos )   if  defined $pos;
++    $you->Base( $base );
++    return $you;
++}
++
++sub Next {
++    my( $me, $steps )= @_;
++    $steps= 1   if  ! defined $steps;
++    if( $steps ) {
++        my $pos= $me->[_Pos];
++        my $new= $pos + $steps;
++        $new= 0   if  $pos  &&  $new < 0;
++        $me->Reset( $new )
++    }
++    return $me->[_Pos];
++}
++
++sub Prev {
++    my( $me, $steps )= @_;
++    $steps= 1   if  ! defined $steps;
++    my $pos= $me->Next(-$steps);
++    $pos -= $me->[_End]   if  $pos;
++    return $pos;
++}
++
++sub Diff {
++    my( $me )= @_;
++    $me->_ChkPos();
++    return 0   if  $me->[_Same] == ( 1 & $me->[_Pos] );
++    my $ret= 0;
++    my $off= $me->[_Off];
++    for my $seq ( 1, 2 ) {
++        $ret |= $seq
++            if  $me->[_Idx][ $off + $seq + _Min ]
++            <   $me->[_Idx][ $off + $seq ];
++    }
++    return $ret;
++}
++
++sub Min {
++    my( $me, $seq, $base )= @_;
++    $me->_ChkPos();
++    my $off= $me->_ChkSeq($seq);
++    $base= $me->[_Base] if !defined $base;
++    return $base + $me->[_Idx][ $off + _Min ];
++}
++
++sub Max {
++    my( $me, $seq, $base )= @_;
++    $me->_ChkPos();
++    my $off= $me->_ChkSeq($seq);
++    $base= $me->[_Base] if !defined $base;
++    return $base + $me->[_Idx][ $off ] -1;
++}
++
++sub Range {
++    my( $me, $seq, $base )= @_;
++    $me->_ChkPos();
++    my $off = $me->_ChkSeq($seq);
++    if( !wantarray ) {
++        return  $me->[_Idx][ $off ]
++            -   $me->[_Idx][ $off + _Min ];
++    }
++    $base= $me->[_Base] if !defined $base;
++    return  ( $base + $me->[_Idx][ $off + _Min ] )
++        ..  ( $base + $me->[_Idx][ $off ] - 1 );
++}
++
++sub Items {
++    my( $me, $seq )= @_;
++    $me->_ChkPos();
++    my $off = $me->_ChkSeq($seq);
++    if( !wantarray ) {
++        return  $me->[_Idx][ $off ]
++            -   $me->[_Idx][ $off + _Min ];
++    }
++    return
++        @{$me->[$seq]}[
++                $me->[_Idx][ $off + _Min ]
++            ..  ( $me->[_Idx][ $off ] - 1 )
++        ];
++}
++
++sub Same {
++    my( $me )= @_;
++    $me->_ChkPos();
++    return wantarray ? () : 0
++        if  $me->[_Same] != ( 1 & $me->[_Pos] );
++    return $me->Items(1);
++}
++
++my %getName;
++BEGIN {
++    %getName= (
++        same => \&Same,
++        diff => \&Diff,
++        base => \&Base,
++        min  => \&Min,
++        max  => \&Max,
++        range=> \&Range,
++        items=> \&Items, # same thing
++    );
++}
++
++sub Get
++{
++    my $me= shift @_;
++    $me->_ChkPos();
++    my @value;
++    for my $arg (  @_  ) {
++        for my $word (  split ' ', $arg  ) {
++            my $meth;
++            if(     $word !~ /^(-?\d+)?([a-zA-Z]+)([12])?$/
++                ||  not  $meth= $getName{ lc $2 }
++            ) {
++                Die( $Root, ", Get: Invalid request ($word)" );
++            }
++            my( $base, $name, $seq )= ( $1, $2, $3 );
++            push @value, scalar(
++                4 == length($name)
++                    ? $meth->( $me )
++                    : $meth->( $me, $seq, $base )
++            );
++        }
++    }
++    if(  wantarray  ) {
++        return @value;
++    } elsif(  1 == @value  ) {
++        return $value[0];
++    }
++    Die( 0+@value, " values requested from ",
++        $Root, "'s Get in scalar context" );
++}
++
++
++my $Obj= getObjPkg($Root);
++no strict 'refs';
++
++for my $meth (  qw( new getObjPkg )  ) {
++    *{$Root."::".$meth} = \&{$meth};
++    *{$Obj ."::".$meth} = \&{$meth};
++}
++for my $meth (  qw(
++    Next Prev Reset Copy Base Diff
++    Same Items Range Min Max Get
++    _ChkPos _ChkSeq
++)  ) {
++    *{$Obj."::".$meth} = \&{$meth};
++}
++
++1;
++# This version released by Tye McQueen (http://perlmonks.org/?node=tye).
++# 
++# =head1 LICENSE
++# 
++# Parts Copyright (c) 2000-2004 Ned Konz.  All rights reserved.
++# Parts by Tye McQueen.
++# 
++# This program is free software; you can redistribute it and/or modify it
++# under the same terms as Perl.
++# 
++# =head1 MAILING LIST
++# 
++# Mark-Jason still maintains a mailing list.  To join a low-volume mailing
++# list for announcements related to diff and Algorithm::Diff, send an
++# empty mail message to mjd-perl-diff-request@plover.com.
++# =head1 CREDITS
++# 
++# Versions through 0.59 (and much of this documentation) were written by:
++# 
++# Mark-Jason Dominus, mjd-perl-diff@plover.com
++# 
++# This version borrows some documentation and routine names from
++# Mark-Jason's, but Diff.pm's code was completely replaced.
++# 
++# This code was adapted from the Smalltalk code of Mario Wolczko
++# <mario@wolczko.com>, which is available at
++# ftp://st.cs.uiuc.edu/pub/Smalltalk/MANCHESTER/manchester/4.0/diff.st
++# 
++# C<sdiff> and C<traverse_balanced> were written by Mike Schilli
++# <m@perlmeister.com>.
++# 
++# The algorithm is that described in
++# I<A Fast Algorithm for Computing Longest Common Subsequences>,
++# CACM, vol.20, no.5, pp.350-353, May 1977, with a few
++# minor improvements to improve the speed.
++# 
++# Much work was done by Ned Konz (perl@bike-nomad.com).
++# 
++# The OO interface and some other changes are by Tye McQueen.
++# 
++EOAlgDiff
++# 2}}}
++    my $problems        = 0;
++    $HAVE_Algorith_Diff = 0;
++    my $dir             = "";
++    if ($opt_sdir) {
++        ++$TEMP_OFF;
++        $dir = "$opt_sdir/$TEMP_OFF";
++        File::Path::rmtree($dir) if     is_dir($dir);
++        File::Path::mkpath($dir) unless is_dir($dir);
++    } else {
++        # let File::Temp create a suitable temporary directory
++        $dir = tempdir( CLEANUP => 1 );  # 1 = delete on exit
++        $TEMP_INST{ $dir } = "Algorithm::Diff";
++    }
++    print "Using temp dir [$dir] to install Algorithm::Diff\n" if $opt_v;
++    my $Algorithm_dir      = "$dir/Algorithm";
++    my $Algorithm_Diff_dir = "$dir/Algorithm/Diff";
++    mkdir $Algorithm_dir     ;
++    mkdir $Algorithm_Diff_dir;
++
++    my $OUT = new IO::File "$dir/Algorithm/Diff.pm", "w";
++    if (defined $OUT) {
++        print $OUT $Algorithm_Diff_Contents;
++        $OUT->close;
++    } else {
++        warn "Failed to install Algorithm/Diff.pm\n";
++        $problems = 1;
++    }
++
++    push @INC, $dir;  # between this & Regexp::Common only need to do once
++    eval "use Algorithm::Diff qw / sdiff /";
++    $HAVE_Algorith_Diff = 1 unless $problems;
++} # 1}}}
++sub call_regexp_common {                     # {{{1
++    my ($ra_lines, $language ) = @_;
++    print "-> call_regexp_common\n" if $opt_v > 2;
++
++    Install_Regexp_Common() unless $HAVE_Rexexp_Common;
++
++    my $all_lines = join("", @{$ra_lines});
++
++    no strict 'vars';
++    # otherwise get:
++    #  Global symbol "%RE" requires explicit package name at cloc line xx.
++    if ($all_lines =~ $RE{comment}{$language}) {
++        # Suppress "Use of uninitialized value in regexp compilation" that
++        # pops up when $1 is undefined--happens if there's a bug in the $RE
++        # This Pascal comment will trigger it:
++        #         (* This is { another } test. **)
++        # Curiously, testing for "defined $1" breaks the substitution.
++        no warnings; 
++        # remove   comments
++        $all_lines =~ s/$1//g;
++    }
++    # a bogus use of %RE to avoid:
++    # Name "main::RE" used only once: possible typo at cloc line xx.
++    print scalar keys %RE if $opt_v < -20;
++#?#print "$all_lines\n";
++    print "<- call_regexp_common\n" if $opt_v > 2;
++    return split("\n", $all_lines);
++} # 1}}}
++sub plural_form {                            # {{{1
++    # For getting the right plural form on some English nouns.
++    my $n = shift @_;
++    if ($n == 1) { return ( 1, "" ); }
++    else         { return ($n, "s"); }
++} # 1}}}
++sub matlab_or_objective_C {                  # {{{1
++    # Decide if code is MATLAB, Objective C, or MUMPS
++    my ($file        , # in
++        $rh_Err      , # in   hash of error codes
++        $raa_errors  , # out
++        $rs_language , # out
++       ) = @_;
++
++    print "-> matlab_or_objective_C\n" if $opt_v > 2;
++    # matlab markers:
++    #   first line starts with "function"
++    #   some lines start with "%"
++    #   high marks for lines that start with [
++    #
++    # Objective C markers:
++    #   must have at least two brace characters, { }
++    #   has /* ... */ style comments
++    #   some lines start with @
++    #   some lines start with #include
++    #
++    # MUMPS:
++    #   has ; comment markers
++    #   do not match:  \w+\s*=\s*\w
++    #   lines begin with   \s*\.?\w+\s+\w
++    #   high marks for lines that start with \s*K\s+ or \s*Kill\s+
++
++    ${$rs_language} = "";
++    my $IN = new IO::File $file, "r";
++    if (!defined $IN) {
++        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
++        return;
++    }
++
++    my $DEBUG              = 0;
++
++    my $matlab_points      = 0;
++    my $objective_C_points = 0;
++    my $mumps_points       = 0;
++    my $has_braces         = 0;
++    while (<$IN>) {
++        ++$has_braces if m/[{}]/;
++        ++$mumps_points if $. == 1 and m{^[A-Z]};
++        if      (m{^\s*/\*}) {           #   /*
++            ++$objective_C_points;
++            --$matlab_points;
++printf ".m:  /*     obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{\w+\s*=\s*\[}) {      # matrix assignment, very matlab
++            $matlab_points += 5;
++printf ".m:  \\w=[   obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{^\s*\w+\s*=\s*}) {    # definitely not MUMPS
++            --$mumps_points;
++printf ".m:  \\w=    obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{^\s*\.?(\w)\s+(\w)} and $1 !~ /\d/ and $2 !~ /\d/) {
++            ++$mumps_points;
++printf ".m:  \\w \\w  obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{^\s*;}) {
++            ++$mumps_points;
++printf ".m:  ;      obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{^\s*#(include|import)}) {
++            # Objective C without a doubt
++            $objective_C_points = 1;
++            $matlab_points      = 0;
++printf ".m: #includ obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++            last;
++        } elsif (m{^\s*@(interface|implementation|protocol|public|protected|private|end)\s}o) {
++            # Objective C without a doubt
++            $objective_C_points = 1;
++            $matlab_points      = 0;
++printf ".m: keyword obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++            last;
++        } elsif (m{^\s*\[}) {             #   line starts with [  -- very matlab
++            $matlab_points += 5;
++printf ".m:  [      obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{^\sK(ill)?\s+}) {
++            $mumps_points  += 5;
++printf ".m:  Kill   obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{^\s*function}) {
++            --$objective_C_points;
++            ++$matlab_points;
++printf ".m:  funct  obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        } elsif (m{^\s*%}) {              #   %
++            # matlab commented line
++            --$objective_C_points;
++            ++$matlab_points;
++printf ".m:  pcent  obj C=% 2d  matlab=% 2d  mumps=% 2d\n", $objective_C_points, $matlab_points, $mumps_points if $DEBUG;
++        }
++    }
++    $IN->close;
++
++    print "<- matlab_or_objective_C(matlab=$matlab_points, C=$objective_C_points, mumps=$mumps_points)\n"
++        if $opt_v > 2;
++    $objective_C_points = -9.9e20 unless $has_braces >= 2;
++    if      (($matlab_points > $objective_C_points) and
++             ($matlab_points > $mumps_points)      ) {
++        ${$rs_language} = "MATLAB";
++    } elsif (($mumps_points > $objective_C_points) and
++             ($mumps_points > $matlab_points)      ) {
++        ${$rs_language} = "MUMPS";
++    } else {
++        ${$rs_language} = "Objective C";
++    }
++
++} # 1}}}
++sub Lisp_or_OpenCL {                         # {{{1
++    my ($file        , # in
++        $rh_Err      , # in   hash of error codes
++        $raa_errors  , # out
++       ) = @_;
++
++    print "-> Lisp_or_OpenCL\n" if $opt_v > 2;
++
++    my $lang = undef;
++    my $IN = new IO::File $file, "r";
++    if (!defined $IN) {
++        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
++        return $lang;
++    }
++    my $lisp_points   = 0;
++    my $opcl_points = 0;
++    while (<$IN>) {
++        ++$lisp_points if  /^\s*;/;
++        ++$lisp_points if  /\((def|eval|require|export|let|loop|dec|format)/;
++        ++$opcl_points if  /^\s*(int|float|const|{)/;
++    }
++    $IN->close;
++    # print "lisp_points=$lisp_points   opcl_points=$opcl_points\n";
++    if ($lisp_points > $opcl_points) {
++        $lang = "Lisp";
++    } else {
++        $lang = "OpenCL";
++    }
++
++    print "<- Lisp_or_OpenCL\n" if $opt_v > 2;
++    return $lang;
++} # 1}}}
++sub Ant_or_XML {                             # {{{1
++    my ($file        , # in
++        $rh_Err      , # in   hash of error codes
++        $raa_errors  , # out
++       ) = @_;
++
++    print "-> Ant_or_XML($file)\n" if $opt_v > 2;
++
++    my $lang = "XML";
++    my $IN = new IO::File $file, "r";
++    if (!defined $IN) {
++        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
++        return $lang;
++    }
++    my $Ant_points   = 0;
++    my $XML_points   = 1;
++    while (<$IN>) {
++        if (/^\s*<project\s+/) {
++            ++$Ant_points  ;
++            --$XML_points  ;
++        }
++        if (/xmlns:artifact="antlib:org.apache.maven.artifact.ant"/) {
++            ++$Ant_points  ;
++            --$XML_points  ;
++        }
++    }
++    $IN->close;
++
++    if ($XML_points >= $Ant_points) {
++        # tie or better goes to XML
++        $lang = "XML";
++    } else {
++        $lang = "Ant";
++    }
++
++    print "<- Ant_or_XML($lang)\n" if $opt_v > 2;
++    return $lang;
++} # 1}}}
++sub Maven_or_XML {                           # {{{1
++    my ($file        , # in
++        $rh_Err      , # in   hash of error codes
++        $raa_errors  , # out
++       ) = @_;
++
++    print "-> Maven_or_XML($file)\n" if $opt_v > 2;
++
++    my $lang = "XML";
++    my $IN = new IO::File $file, "r";
++    if (!defined $IN) {
++        push @{$raa_errors}, [$rh_Err->{'Unable to read'} , $file];
++        return $lang;
++    }
++    my $Mvn_points   = 0;
++    my $XML_points   = 1;
++    while (<$IN>) {
++        if (/^\s*<project\s+/) {
++            ++$Mvn_points  ;
++            --$XML_points  ;
++        }
++        if (m{xmlns="http://maven.apache.org/POM/}) {
++            ++$Mvn_points  ;
++            --$XML_points  ;
++        }
++    }
++    $IN->close;
++
++    if ($XML_points >= $Mvn_points) {
++        # tie or better goes to XML
++        $lang = "XML";
++    } else {
++        $lang = "Maven";
++    }
++
++    print "<- Maven_or_XML($lang)\n" if $opt_v > 2;
++    return $lang;
++} # 1}}}
++sub html_colored_text {                      # {{{1
++    # http://www.pagetutor.com/pagetutor/makapage/pics/net216-2.gif
++    my ($color, $text) = @_;
++#?#die "html_colored_text($text)";
++    if      ($color =~ /^red$/i)   {
++        $color = "#ff0000";
++    } elsif ($color =~ /^green$/i) {
++        $color = "#00ff00";
++    } elsif ($color =~ /^blue$/i)  {
++        $color = "#0000ff";
++    } elsif ($color =~ /^grey$/i)  {
++        $color = "#cccccc";
++    }
++#   return "" unless $text;
++    return '<font color="' . $color . '">' . html_metachars($text) . "</font>";
++} # 1}}}
++sub html_metachars {                         # {{{1
++    # Replace HTML metacharacters with their printable forms.
++    # Future:  use HTML-Encoder-0.00_04/lib/HTML/Encoder.pm
++    # from Fabiano Reese Righetti's HTML::Encoder module if 
++    # this subroutine proves to be too simplistic.
++    my ($string, ) = shift @_;
++
++    my  @in_chars    = split(//, $string);
++    my  @out_chars   = ();
++    foreach my $c (@in_chars) {
++        if      ($c eq '<') {
++            push @out_chars, '&lt;'
++        } elsif ($c eq '>') {
++            push @out_chars, '&gt;'
++        } elsif ($c eq '&') {
++            push @out_chars, '&amp;'
++        } else {
++            push @out_chars, $c;
++        }
++    }
++    return join "", @out_chars; 
++} # 1}}}
++sub test_alg_diff {                          # {{{1
++    my ($file_1 ,
++        $file_2 )
++       = @_;
++    my $fh_1 = new IO::File $file_1, "r";
++    die "Unable to read $file_1:  $!\n" unless defined $fh_1;
++    chomp(my @lines_1 = <$fh_1>);
++    $fh_1->close;
++
++    my $fh_2 = new IO::File $file_2, "r";
++    die "Unable to read $file_2:  $!\n" unless defined $fh_2;
++    chomp(my @lines_2 = <$fh_2>);
++    $fh_2->close;
++
++    my $n_no_change = 0;
++    my $n_modified  = 0;
++    my $n_added     = 0;
++    my $n_deleted   = 0;
++    my @min_sdiff   = ();
++my $NN = chr(27) . "[0m";  # normal
++my $BB = chr(27) . "[1m";  # bold
++
++    my @sdiffs = sdiff( \@lines_1, \@lines_2 );
++    foreach my $entry (@sdiffs) {
++        my ($out_1, $out_2) = ('', '');
++        if ($entry->[0] eq 'u') { 
++            ++$n_no_change; 
++          # $out_1 = $entry->[1];
++          # $out_2 = $entry->[2];
++            next; 
++        }
++#       push @min_sdiff, $entry;
++        if      ($entry->[0] eq 'c') { 
++            ++$n_modified;
++            ($out_1, $out_2) = diff_two_strings($entry->[1], $entry->[2]);
++            $out_1 =~ s/\cA(\w)/${BB}$1${NN}/g;
++            $out_2 =~ s/\cA(\w)/${BB}$1${NN}/g;
++          # $out_1 =~ s/\cA//g;
++          # $out_2 =~ s/\cA//g;
++        } elsif ($entry->[0] eq '+') { 
++            ++$n_added;
++            $out_1 = $entry->[1];
++            $out_2 = $entry->[2];
++        } elsif ($entry->[0] eq '-') { 
++            ++$n_deleted;
++            $out_1 = $entry->[1];
++            $out_2 = $entry->[2];
++        } elsif ($entry->[0] eq 'u') { 
++        } else { die "unknown entry->[0]=[$entry->[0]]\n"; }
++        printf "%-80s | %s\n", $out_1, $out_2;
++    }
++
++#   foreach my $entry (@min_sdiff) {
++#       printf "DIFF:  %s  %s  %s\n", @{$entry};
++#   }
++} # 1}}}
++sub write_comments_to_html {                 # {{{1
++    my ($filename      , # in
++        $rah_diff_L    , # in  see routine array_diff() for explanation
++        $rah_diff_R    , # in  see routine array_diff() for explanation
++        $rh_blank      , # in  location and counts of blank lines
++       ) = @_;
++
++    print "-> write_comments_to_html($filename)\n" if $opt_v > 2;
++    my $file = $filename . ".html";
++#use Data::Dumper;
++#print Dumper("rah_diff_L", $rah_diff_L, "rah_diff_R", $rah_diff_R);
++    my $OUT = new IO::File $file, "w";
++    if (!defined $OUT) {
++        warn "Unable to write to $file\n";
++        print "<- write_comments_to_html\n" if $opt_v > 2;
++        return;
++    }
++
++    my $approx_line_count = scalar @{$rah_diff_L};
++    my $n_digits = 1 + int(log($approx_line_count)/2.30258509299405); # log_10
++
++    my $html_out = html_header($filename);
++
++    my $comment_line_number = 0;
++    for (my $i = 0; $i < scalar @{$rah_diff_R}; $i++) {
++        if (defined $rh_blank->{$i}) {
++            foreach (1..$rh_blank->{$i}) {
++                $html_out .= "<!-- blank -->\n";
++            }
++        }
++        my $line_num = "";
++        my $pre      = "";
++        my $post     = '</span> &nbsp;';
++warn "undef rah_diff_R[$i]{type} " unless defined $rah_diff_R->[$i]{type};
++        if ($rah_diff_R->[$i]{type} eq 'nonexist') {
++            ++$comment_line_number;
++            $line_num = sprintf "\&nbsp; <span class=\"clinenum\"> %0${n_digits}d %s",
++                            $comment_line_number, $post;
++            $pre = '<span class="comment">';
++            $html_out .= $line_num;  
++            $html_out .= $pre .  
++                         html_metachars($rah_diff_L->[$i]{char}) . 
++                         $post . "\n";
++            next;
++        }
++        if      ($rah_diff_R->[$i]{type} eq 'code' and
++                 $rah_diff_R->[$i]{desc} eq 'same') {
++            # entire line remains as-is
++            $line_num = sprintf "\&nbsp; <span class=\"linenum\"> %0${n_digits}d %s",
++                            $rah_diff_R->[$i]{lnum}, $post;
++            $pre    = '<span class="normal">';
++            $html_out .= $line_num;  
++            $html_out .= $pre . 
++                         html_metachars($rah_diff_R->[$i]{char}) . $post;
++#XX     } elsif ($rah_diff_R->[$i]{type} eq 'code') { # code+comments
++#XX
++#XX         $line_num = '<span class="linenum">' .
++#XX                      $rah_diff_R->[$i]{lnum} . $post;
++#XX         $html_out .= $line_num;  
++#XX
++#XX         my @strings = @{$rah_diff_R->[$i]{char}{strings}}; 
++#XX         my @type    = @{$rah_diff_R->[$i]{char}{type}}; 
++#XX         for (my $i = 0; $i < scalar @strings; $i++) {
++#XX             if ($type[$i] eq 'u') {
++#XX                 $pre = '<span class="normal">';
++#XX             } else {
++#XX                 $pre = '<span class="comment">';
++#XX             }
++#XX             $html_out .= $pre .  html_metachars($strings[$i]) . $post;
++#XX         }
++# print Dumper(@strings, @type); die;
++
++        } elsif ($rah_diff_R->[$i]{type} eq 'comment') {
++            $line_num = '<span class="clinenum">' . $comment_line_number . $post;
++            # entire line is a comment
++            $pre    = '<span class="comment">';
++            $html_out .= $pre .
++                         html_metachars($rah_diff_R->[$i]{char}) . $post;
++        }
++#printf "%-30s %s %-30s\n", $line_1, $separator, $line_2;
++        $html_out .= "\n";
++    }
++
++    $html_out .= html_end();
++
++    my $out_file = "$filename.html";
++    open  OUT, ">$out_file" or die "Cannot write to $out_file $!\n";
++    print OUT $html_out;
++    close OUT;
++    print "Wrote $out_file\n" unless $opt_quiet;
++    $OUT->close;
++
++    print "<- write_comments_to_html\n" if $opt_v > 2;
++} # 1}}}
++sub array_diff {                             # {{{1
++    my ($file          , # in  only used for error reporting
++        $ra_lines_L    , # in  array of lines in Left  file (no blank lines)
++        $ra_lines_R    , # in  array of lines in Right file (no blank lines)
++        $mode          , # in  "comment" | "revision"
++        $rah_diff_L    , # out
++        $rah_diff_R    , # out
++        $raa_Errors    , # in/out
++       ) = @_;
++
++    # This routine operates in two ways:
++    # A. Computes diffs of the same file with and without comments.
++    #    This is used to classify lines as code, comments, or blank.
++    # B. Computes diffs of two revisions of a file.  This method
++    #    requires a prior run of method A using the older version
++    #    of the file because it needs lines to be classified.
++
++    # $rah_diff structure:
++    # An array with n entries where n equals the number of lines in 
++    # an sdiff of the two files.  Each entry in the array describes
++    # the contents of the corresponding line in file Left and file Right:
++    #  diff[]{type} = blank | code | code+comment | comment | nonexist
++    #        {lnum} = line number within the original file (1-based)
++    #        {desc} = same | added | removed | modified
++    #        {char} = the input line unless {desc} = 'modified' in
++    #                 which case
++    #        {char}{strings} = [ substrings ]
++    #        {char}{type}    = [ disposition (added, removed, etc)]
++    #
++
++    @{$rah_diff_L} = ();
++    @{$rah_diff_R} = ();
++
++    print "-> array_diff()\n" if $opt_v > 2;
++    my $COMMENT_MODE = 0;
++       $COMMENT_MODE = 1 if $mode eq "comment";
++
++#print "array_diff(mode=$mode)\n";
++#print Dumper("block left:" , $ra_lines_L);
++#print Dumper("block right:", $ra_lines_R);
++
++    my @sdiffs = ();
++    eval {
++        local $SIG{ALRM} = sub { die "alarm\n" };
++        alarm $opt_diff_timeout;
++        @sdiffs = sdiff($ra_lines_L, $ra_lines_R);
++        alarm 0;
++    };
++    if ($@) {
++        # timed out
++        die unless $@ eq "alarm\n"; # propagate unexpected errors
++        push @{$raa_Errors}, 
++             [ $Error_Codes{'Diff error, exceeded timeout'}, $file ];
++        if ($opt_v) {
++          warn "array_diff: diff timeout failure for $file--ignoring\n";
++        }
++        return;
++    }
++
++#use Data::Dumper::Simple;
++#print Dumper($ra_lines_L, $ra_lines_R, @sdiffs);
++#die;
++
++    my $n_L        = 0;
++    my $n_R        = 0;
++    my $n_sdiff    = 0;  # index to $rah_diff_L, $rah_diff_R
++    foreach my $triple (@sdiffs) {
++        my $flag   = $triple->[0];
++        my $line_L = $triple->[1];
++        my $line_R = $triple->[2];
++        $rah_diff_L->[$n_sdiff]{char} = $line_L;
++        $rah_diff_R->[$n_sdiff]{char} = $line_R;
++        if      ($flag eq 'u') {  # u = unchanged
++            ++$n_L;
++            ++$n_R;
++            if ($COMMENT_MODE) {
++                # line exists in both with & without comments, must be code
++                $rah_diff_L->[$n_sdiff]{type} = "code";
++                $rah_diff_R->[$n_sdiff]{type} = "code";
++            }
++            $rah_diff_L->[$n_sdiff]{desc} = "same";
++            $rah_diff_R->[$n_sdiff]{desc} = "same";
++            $rah_diff_L->[$n_sdiff]{lnum} = $n_L;
++            $rah_diff_R->[$n_sdiff]{lnum} = $n_R;
++        } elsif ($flag eq 'c') {  # c = changed
++# warn "per line sdiff() commented out\n"; if (0) {
++            ++$n_L;
++            ++$n_R;
++
++            if ($COMMENT_MODE) {
++                # line has text both with & without comments;
++                # count as code
++                $rah_diff_L->[$n_sdiff]{type} = "code";
++                $rah_diff_R->[$n_sdiff]{type} = "code";
++            }
++
++            my @chars_L = split '', $line_L;
++            my @chars_R = split '', $line_R;
++
++#XX         my @inline_sdiffs = sdiff( \@chars_L, \@chars_R );
++
++#use Data::Dumper::Simple; 
++#if ($n_R == 6 or $n_R == 1 or $n_R == 2) {
++#print "L=[$line_L]\n";
++#print "R=[$line_R]\n";
++#print Dumper(@chars_L, @chars_R, @inline_sdiffs);
++#}
++#XX         my @index = ();
++#XX         foreach my $il_triple (@inline_sdiffs) {
++#XX             # make an array of u|c|+|- corresponding
++#XX             # to each character
++#XX             push @index, $il_triple->[0];
++#XX         }
++#XX#print Dumper(@index); die;
++#XX          # expect problems if arrays @index and $inline_sdiffs[1];
++#XX          # (@{$inline_sdiffs->[1]} are the characters of line_L)
++#XX          # aren't the same length
++#XX          my $prev_type = $index[0];
++#XX          my @strings   = ();  # blocks of consecutive code or comment
++#XX          my @type      = ();  # u (=code) or c (=comment)
++#XX          my $j_str     = 0;
++#XX          $strings[$j_str] .= $chars_L[0];
++#XX          $type[$j_str] = $prev_type;
++#XX          for (my $i = 1; $i < scalar @chars_L; $i++) {
++#XX              if ($index[$i] ne $prev_type) {
++#XX                  ++$j_str;
++#XX#print "change at j_str=$j_str type=$index[$i]\n";
++#XX                  $type[$j_str] = $index[$i];
++#XX                  $prev_type    = $index[$i];
++#XX              }
++#XX              $strings[$j_str] .= $chars_L[$i];
++#XX          }
++# print Dumper(@strings, @type); die;
++#XX         delete $rah_diff_R->[$n_sdiff]{char};
++#XX         @{$rah_diff_R->[$n_sdiff]{char}{strings}} = @strings;
++#XX         @{$rah_diff_R->[$n_sdiff]{char}{type}}    = @type;
++            $rah_diff_L->[$n_sdiff]{desc} = "modified";
++            $rah_diff_R->[$n_sdiff]{desc} = "modified";
++            $rah_diff_L->[$n_sdiff]{lnum} = $n_L;
++            $rah_diff_R->[$n_sdiff]{lnum} = $n_R;
++#}
++
++        } elsif ($flag eq '+') {  # + = added
++            ++$n_R;
++            if ($COMMENT_MODE) {
++                # should never get here
++                @{$rah_diff_L} = ();
++                @{$rah_diff_R} = ();
++                push @{$raa_Errors}, 
++                     [ $Error_Codes{'Diff error (quoted comments?)'}, $file ];
++                if ($opt_v) {
++                  warn "array_diff: diff failure (diff says the\n";
++                  warn "comment-free file has added lines).\n";
++                  warn "$n_sdiff  $line_L\n";
++                }
++                last;
++            }
++            $rah_diff_L->[$n_sdiff]{type} = "nonexist";
++            $rah_diff_L->[$n_sdiff]{desc} = "removed";
++            $rah_diff_R->[$n_sdiff]{desc} = "added";
++            $rah_diff_R->[$n_sdiff]{lnum} = $n_R;
++        } elsif ($flag eq '-') {  # - = removed
++            ++$n_L;
++            if ($COMMENT_MODE) {
++                # line must be comment because blanks already gone
++                $rah_diff_L->[$n_sdiff]{type} = "comment";
++            }
++            $rah_diff_R->[$n_sdiff]{type} = "nonexist";
++            $rah_diff_R->[$n_sdiff]{desc} = "removed";
++            $rah_diff_L->[$n_sdiff]{desc} = "added";
++            $rah_diff_L->[$n_sdiff]{lnum} = $n_L;
++        }
++#printf "%-30s %s %-30s\n", $line_L, $separator, $line_R;
++        ++$n_sdiff;
++    }
++#use Data::Dumper::Simple;
++#print Dumper($rah_diff_L, $rah_diff_R);
++
++    print "<- array_diff\n" if $opt_v > 2;
++} # 1}}}
++sub remove_leading_dir {                     # {{{1 
++    my @filenames = @_;
++    #
++    #  Input should be a list of file names
++    #  with the same leading directory such as
++    # 
++    #      dir1/dir2/a.txt
++    #      dir1/dir2/b.txt
++    #      dir1/dir2/dir3/c.txt
++    #
++    #  Output is the same list minus the common
++    #  directory path:
++    # 
++    #      a.txt
++    #      b.txt
++    #      dir3/c.txt
++    #
++    print "-> remove_leading_dir()\n" if $opt_v > 2;
++    my @D = (); # a matrix:   [ [ dir1, dir2 ],         # dir1/dir2/a.txt
++                #               [ dir1, dir2 ],         # dir1/dir2/b.txt
++                #               [ dir1, dir2 , dir3] ]  # dir1/dir2/dir3/c.txt
++    if ($ON_WINDOWS) {
++        foreach my $F (@filenames) {
++            $F =~ s{\\}{/}g;
++            $F = ucfirst($F) if $F =~ /^\w:/;  # uppercase drive letter
++        }
++    }
++    if (scalar @filenames == 1) {
++        # special case:  with only one filename
++        # cannot determine a baseline, just remove first directory level
++        $filenames[0] =~ s{^.*?/}{};
++        print "-> $filenames[0]\n";
++        return $filenames[0];
++    }
++    foreach my $F (@filenames) {
++        my ($Vol, $Dir, $File) = File::Spec->splitpath($F);
++        my @x = File::Spec->splitdir( $Dir );
++        pop @x unless $x[$#x]; # last entry usually null, remove it
++        if ($ON_WINDOWS) {
++            if (defined($Vol) and $Vol) {
++                # put the drive letter, eg, C:, at the front
++                unshift @x, uc $Vol;
++            }
++        }
++#print "F=$F, Dir=$Dir  x=[", join("][", @x), "]\n";
++        push @D, [ @x ];
++    }
++
++    # now loop over columns until either they are all
++    # eliminated or a unique column is found
++
++#use Data::Dumper::Simple;
++#print Dumper("remove_leading_dir after ", @D);
++
++    my @common   = ();  # to contain the common leading directories
++    my $mismatch = 0;
++    while (!$mismatch) {
++        for (my $row = 1; $row < scalar @D; $row++) {
++#print "comparing $D[$row][0] to $D[0][0]\n";
++
++            if (!defined $D[$row][0] or !defined $D[0][0] or
++                ($D[$row][0] ne $D[0][0])) {
++                $mismatch = 1;
++                last;
++            }
++        }
++#print "mismatch=$mismatch\n";
++        if (!$mismatch) {
++            push @common, $D[0][0];
++            # all terms in the leading match; unshift the batch
++            foreach my $ra (@D) {
++                shift @{$ra};
++            }
++        }
++    }
++
++    push @common, " ";  # so that $leading will end with "/ "
++    my $leading = File::Spec->catdir( @common );
++       $leading =~ s{ $}{};  # now take back the bogus appended space
++#print "remove_leading_dir leading=[$leading]\n"; die;
++    if ($ON_WINDOWS) {
++       $leading =~ s{\\}{/}g;
++    }
++    foreach my $F (@filenames) {
++        $F =~ s{^$leading}{};
++    }
++
++    print "<- remove_leading_dir()\n" if $opt_v > 2;
++    return @filenames;
++
++} # 1}}}
++sub align_by_pairs {                         # {{{1 
++    my ($rh_file_list_L        , # in
++        $rh_file_list_R        , # in
++        $ra_added              , # out
++        $ra_removed            , # out
++        $ra_compare_list       , # out
++        ) = @_;
++    print "-> align_by_pairs()\n" if $opt_v > 2;
++    @{$ra_compare_list} = ();
++
++    my @files_L = sort keys %{$rh_file_list_L};
++    my @files_R = sort keys %{$rh_file_list_R};
++    return () unless @files_L or  @files_R;  # at least one must have stuff
++    if      ( @files_L and !@files_R) {
++        # left side has stuff, right side is empty; everything deleted
++        @{$ra_added   }     = ();
++        @{$ra_removed }     = @files_L;
++        @{$ra_compare_list} = ();
++        return;
++    } elsif (!@files_L and  @files_R) {
++        # left side is empty, right side has stuff; everything added
++        @{$ra_added   }     = @files_R;
++        @{$ra_removed }     = ();
++        @{$ra_compare_list} = ();
++        return;
++    }
++#use Data::Dumper::Simple;
++#print Dumper("align_by_pairs", @files_L, @files_R);
++#die;
++    if (scalar @files_L == 1 and scalar @files_R == 1) {
++        # The easy case:  compare two files.
++        push @{$ra_compare_list}, [ $files_L[0],  $files_R[0] ]; 
++        @{$ra_added  } = ();
++        @{$ra_removed} = ();
++        return;
++    }
++    # The harder case:  compare groups of files.  This only works
++    # if the groups are in different directories so the first step
++    # is to strip the leading directory names from file lists to
++    # make it possible to align by file names.
++    my @files_L_minus_dir = remove_leading_dir(@files_L);
++    my @files_R_minus_dir = remove_leading_dir(@files_R);
++
++    # Keys of the stripped_X arrays are canonical file names;
++    # should overlap mostly.  Keys in stripped_L but not in
++    # stripped_R are files that have been deleted.  Keys in
++    # stripped_R but not in stripped_L have been added.
++    my %stripped_L = ();
++       @stripped_L{ @files_L_minus_dir } = @files_L;
++    my %stripped_R = ();
++       @stripped_R{ @files_R_minus_dir } = @files_R;
++
++    my %common = ();
++    foreach my $f (keys %stripped_L) {
++        $common{$f}  = 1 if     defined $stripped_R{$f};
++    }
++
++    my %deleted = ();
++    foreach my $f (keys %stripped_L) {
++        $deleted{$stripped_L{$f}} = $f unless defined $stripped_R{$f};
++    }
++
++    my %added = ();
++    foreach my $f (keys %stripped_R) {
++        $added{$stripped_R{$f}}   = $f unless defined $stripped_L{$f};
++    }
++
++#use Data::Dumper::Simple;
++#print Dumper("align_by_pairs", %stripped_L, %stripped_R);
++#print Dumper("align_by_pairs", %common, %added, %deleted);
++    
++    foreach my $f (keys %common) {
++        push @{$ra_compare_list}, [ $stripped_L{$f},  
++                                    $stripped_R{$f} ]; 
++    }
++    @{$ra_added   } = keys %added  ;
++    @{$ra_removed } = keys %deleted;
++
++    print "<- align_by_pairs()\n" if $opt_v > 2;
++    return;
++#print Dumper("align_by_pairs", @files_L_minus_dir, @files_R_minus_dir);
++#die;
++} # 1}}}
++sub html_header {                            # {{{1
++    my ($title , ) = @_;
++
++    print "-> html_header\n" if $opt_v > 2;
++    return 
++'<html>
++<head>
++<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
++<meta name="GENERATOR" content="cloc http://cloc.sourceforge.net">
++' .
++"
++<!-- Created by $script v$VERSION -->
++<title>$title</title>
++" .
++'
++<style TYPE="text/css">
++<!--
++    body {
++        color: black;
++        background-color: white;
++        font-family: monospace
++    }
++
++    .whitespace {
++        background-color: gray;
++    }
++
++    .comment {
++        color: gray;
++        font-style: italic;
++    }
++
++    .clinenum {
++        color: red;
++    }
++
++    .linenum {
++        color: green;
++    }
++ -->
++</style>
++</head>
++<body>
++<pre><tt>
++';
++    print "<- html_header\n" if $opt_v > 2;
++} # 1}}}
++sub html_end {                               # {{{1
++return 
++'</tt></pre>
++</body>
++</html>
++';
++} # 1}}}
++sub die_unknown_lang {                       # {{{1
++    my ($lang, $option_name) = @_;
++    die "Unknown language '$lang' used with $option_name option.  " .
++        "The command\n  $script --show-lang\n" .
++        "will print all recognized languages.  Language names are " .
++        "case sensitive.\n" ;
++} # 1}}}
++sub unicode_file {                           # {{{1
++    my $file = shift @_; 
++
++    print "-> unicode_file($file)\n" if $opt_v > 2;
++    return 0 if (-s $file > 2_000_000);  
++    # don't bother trying to test binary files bigger than 2 MB
++
++    my $IN = new IO::File $file, "r";
++    if (!defined $IN) {
++        warn "Unable to read $file; ignoring.\n";
++        return 0;
++    }
++    my @lines = <$IN>;
++    $IN->close;
++
++    if (unicode_to_ascii( join('', @lines) )) {
++        print "<- unicode_file()\n" if $opt_v > 2;
++        return 1;
++    } else {
++        print "<- unicode_file()\n" if $opt_v > 2;
++        return 0;
++    }
++
++} # 1}}}
++sub unicode_to_ascii {                       # {{{1
++    my $string = shift @_; 
++
++    # A trivial attempt to convert UTF-16 little or big endian
++    # files into ASCII.  These files exhibit the following byte
++    # sequence:
++    #   byte   1:  255
++    #   byte   2:  254
++    #   byte   3:  ord of ASCII character
++    #   byte   4:    0
++    #   byte 3+i:  ord of ASCII character
++    #   byte 4+i:    0
++    # or
++    #   byte   1:  255
++    #   byte   2:  254
++    #   byte   3:    0
++    #   byte   4:  ord of ASCII character
++    #   byte 3+i:    0
++    #   byte 4+i:  ord of ASCII character
++
++    my $length  = length $string;
++#print "length=$length\n";
++    return '' if $length <= 3;
++    my @unicode = split(//, $string);
++
++    # check the first 100 characters for big or little endian UTF-16 encoding
++    my $max_peek = $length < 200 ? $length : 200;
++    my @view_1   = ();
++    for (my $i = 2; $i < $max_peek; $i += 2) { push @view_1, $unicode[$i] }
++    my @view_2   = ();
++    for (my $i = 3; $i < $max_peek; $i += 2) { push @view_2, $unicode[$i] }
++
++    my $points_1 = 0;
++    foreach my $C (@view_1) {
++        ++$points_1 if (32 <= ord($C) and ord($C) <= 127) or ord($C) == 13
++                                                          or ord($C) == 10
++                                                          or ord($C) ==  9;
++    }
++
++    my $points_2 = 0;
++    foreach my $C (@view_2) {
++        ++$points_2 if (32 <= ord($C) and ord($C) <= 127) or ord($C) == 13
++                                                          or ord($C) == 10
++                                                          or ord($C) ==  9;
++    }
++#print "points 1: $points_1\n";
++#print "points 2: $points_2\n";
++
++    my $offset = undef;
++    if    ($points_1 > 90) { $offset = 2; }
++    elsif ($points_2 > 90) { $offset = 3; }
++    else                   { return '' }  # neither big or little endian UTF-16
++
++    my @ascii              = ();
++    for (my $i = $offset; $i < $length; $i += 2) { push @ascii, $unicode[$i]; }
++    return join("", @ascii);
++} # 1}}}
++sub uncompress_archive_cmd {                 # {{{1
++    my ($archive_file, ) = @_;
++
++    # Wrap $archive_file in single or double quotes in the system
++    # commands below to avoid filename chicanery (including
++    # spaces in the names).
++
++    print "-> uncompress_archive_cmd($archive_file)\n" if $opt_v > 2;
++    my $extract_cmd = "";
++    my $missing     = "";
++    if ($opt_extract_with) {
++        ( $extract_cmd = $opt_extract_with ) =~ s/>FILE</$archive_file/g;
++    } elsif (basename($archive_file) eq "-" and !$ON_WINDOWS) {
++        $extract_cmd = "cat > -";
++    } elsif (($archive_file =~ /\.tar\.(gz|Z)$/ or 
++              $archive_file =~ /\.tgz$/       ) and !$ON_WINDOWS)    {
++        if (external_utility_exists("gzip --version")) {
++            if (external_utility_exists("tar --version")) {
++                $extract_cmd = "gzip -dc '$archive_file' | tar xf -";
++            } else {
++                $missing = "tar";
++            }
++        } else {
++            $missing = "gzip";
++        }
++    } elsif ($archive_file =~ /\.tar\.bz2$/ and !$ON_WINDOWS)    {
++        if (external_utility_exists("bzip2 --help")) {
++            if (external_utility_exists("tar --version")) {
++                $extract_cmd = "bzip2 -dc '$archive_file' | tar xf -";
++            } else {
++                $missing = "tar";
++            }
++        } else {
++            $missing = "bzip2";
++        }
++    } elsif ($archive_file =~ /\.tar\.xz$/ and !$ON_WINDOWS)    {
++        if (external_utility_exists("unxz --version")) {
++            if (external_utility_exists("tar --version")) {
++                $extract_cmd = "unxz -dc '$archive_file' | tar xf -";
++            } else {
++                $missing = "tar";
++            }
++        } else {
++            $missing = "bzip2";
++        }
++    } elsif ($archive_file =~ /\.tar$/ and !$ON_WINDOWS)    {
++        $extract_cmd = "tar xf '$archive_file'";
++    } elsif ($archive_file =~ /\.src\.rpm$/i and !$ON_WINDOWS) {
++        if (external_utility_exists("cpio --version")) {
++            if (external_utility_exists("rpm2cpio")) {
++                $extract_cmd = "rpm2cpio '$archive_file' | cpio -i";
++            } else {
++                $missing = "rpm2cpio";
++            }
++        } else {
++            $missing = "bzip2";
++        }
++    } elsif ($archive_file =~ /\.zip$/i and !$ON_WINDOWS)    {
++        if (external_utility_exists("unzip")) {
++            $extract_cmd = "unzip -qq -d . '$archive_file'";
++        } else {
++            $missing = "unzip";
++        }
++    } elsif ($ON_WINDOWS and $archive_file =~ /\.zip$/i) {
++        # zip on Windows, guess default Winzip install location
++        $extract_cmd = "";
++        my $WinZip = '"C:\\Program Files\\WinZip\\WinZip32.exe"';
++        if (external_utility_exists($WinZip)) {
++            $extract_cmd = "$WinZip -e -o \"$archive_file\" .";
++#print "trace 5 extract_cmd=[$extract_cmd]\n";
++        } else {
++#print "trace 6\n";
++            $missing = $WinZip;
++        }
++    }
++    print "<- uncompress_archive_cmd\n" if $opt_v > 2;
++    if ($missing) {
++        die "Unable to expand $archive_file because external\n",
++            "utility '$missing' is not available.\n",
++            "Another possibility is to use the --extract-with option.\n";
++    } else {
++        return $extract_cmd;
++    }
++}
++# 1}}}
++sub read_list_file {                         # {{{1
++    my ($file, ) = @_;
++
++    print "-> read_list_file($file)\n" if $opt_v > 2;
++    my $IN = new IO::File $file, "r";
++    if (!defined $IN) {
++        warn "Unable to read $file; ignoring.\n";
++        next;
++    }
++    my @entry = ();
++    while (<$IN>) {
++        next if /^\s*$/ or /^\s*#/; # skip empty or commented lines
++        chomp;
++        push @entry, $_;
++    }
++    $IN->close;
++
++    print "<- read_list_file\n" if $opt_v > 2;
++    return @entry;
++}
++# 1}}}
++sub external_utility_exists {                # {{{1
++    my $exe = shift @_;
++
++    my $success      = 0;
++    if ($ON_WINDOWS) {
++        $success = 1 unless system $exe . ' > nul';
++    } else {
++        $success = 1 unless system $exe . ' >/dev/null 2>&1';
++        if (!$success) {
++            $success = 1 unless system "which" . " $exe" . ' >/dev/null 2>&1';
++        }
++    }
++    
++    return $success;
++} # 1}}}
++sub write_xsl_file {                         # {{{1
++    my $OUT = new IO::File $CLOC_XSL, "w";
++    if (!defined $OUT) {
++        warn "Unable to write $CLOC_XSL  $!\n";
++        return;
++    }
++    my $XSL =             # <style>  </style> {{{2
++'<?xml version="1.0" encoding="US-ASCII"?>
++<!-- XLS file by Paul Schwann, January 2009.
++     Fixes for by-file and by-file-by-lang by d_uragan, November 2010.
++     -->
++<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
++  <xsl:output method="html"/>
++  <xsl:template match="/">
++    <html xmlns="http://www.w3.org/1999/xhtml">
++      <head>
++        <title>CLOC Results</title>
++      </head>
++      <style type="text/css">
++        table {
++          table-layout: auto;
++          border-collapse: collapse;
++          empty-cells: show;
++        }
++        td, th {
++          padding: 4px;
++        }
++        th {
++          background-color: #CCCCCC;
++        }
++        td {
++          text-align: center;
++        }
++        table, td, tr, th {
++          border: thin solid #999999;
++        }
++      </style>
++      <body>
++        <h3><xsl:value-of select="results/header"/></h3>
++';
++# 2}}}
++
++    if ($opt_by_file) {
++        $XSL .=             # <table> </table>{{{2
++'        <table>
++          <thead>
++            <tr>
++              <th>File</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>
++              <th>Language</th>
++';
++        $XSL .=
++'             <th>3<sup>rd</sup> Generation Equivalent</th>
++              <th>Scale</th>
++' if $opt_3;
++        $XSL .=
++'           </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="results/files/file">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>
++              <td><xsl:value-of select="@language"/></td>
++';
++        $XSL .=
++'             <td><xsl:value-of select="@factor"/></td>
++              <td><xsl:value-of select="@scaled"/></td>
++' if $opt_3;
++        $XSL .=
++'           </tr>
++          </xsl:for-each>
++            <tr>
++              <th>Total</th>
++              <th><xsl:value-of select="results/files/total/@blank"/></th>
++              <th><xsl:value-of select="results/files/total/@comment"/></th>
++              <th><xsl:value-of select="results/files/total/@code"/></th>
++              <th><xsl:value-of select="results/files/total/@language"/></th>
++';
++        $XSL .=
++'             <th><xsl:value-of select="results/files/total/@factor"/></th>
++              <th><xsl:value-of select="results/files/total/@scaled"/></th>
++' if $opt_3;
++        $XSL .=
++'           </tr>
++          </tbody>
++        </table>
++        <br/>
++';
++# 2}}}
++    }
++
++    if (!$opt_by_file or $opt_by_file_by_lang) {
++        $XSL .=             # <table> </table> {{{2
++'       <table>
++          <thead>
++            <tr>
++              <th>Language</th>
++              <th>Files</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>
++';
++        $XSL .=
++'             <th>Scale</th>
++              <th>3<sup>rd</sup> Generation Equivalent</th>
++' if $opt_3;
++        $XSL .=
++'           </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="results/languages/language">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@files_count"/></td>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>
++';
++        $XSL .=
++'             <td><xsl:value-of select="@factor"/></td>
++              <td><xsl:value-of select="@scaled"/></td>
++' if $opt_3;
++        $XSL .=
++'          </tr>
++          </xsl:for-each>
++            <tr>
++              <th>Total</th>
++              <th><xsl:value-of select="results/languages/total/@sum_files"/></th>
++              <th><xsl:value-of select="results/languages/total/@blank"/></th>
++              <th><xsl:value-of select="results/languages/total/@comment"/></th>
++              <th><xsl:value-of select="results/languages/total/@code"/></th>
++';
++        $XSL .=
++'             <th><xsl:value-of select="results/languages/total/@factor"/></th>
++              <th><xsl:value-of select="results/languages/total/@scaled"/></th>
++' if $opt_3;
++        $XSL .=
++'           </tr>
++          </tbody>
++        </table>
++';
++# 2}}}
++    }
++
++    $XSL.= <<'EO_XSL'; # {{{2
++      </body>
++    </html>
++  </xsl:template>
++</xsl:stylesheet>
++
++EO_XSL
++# 2}}}
++
++    my $XSL_DIFF = <<'EO_DIFF_XSL'; # {{{2
++<?xml version="1.0" encoding="US-ASCII"?>
++<!-- XLS file by Blazej Kroll, November 2010 -->
++<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
++  <xsl:output method="html"/>
++  <xsl:template match="/">
++    <html xmlns="http://www.w3.org/1999/xhtml">
++      <head>
++        <title>CLOC Results</title>
++      </head>
++      <style type="text/css">
++        table {
++          table-layout: auto;
++          border-collapse: collapse;
++          empty-cells: show;
++		  margin: 1em;
++        }
++        td, th {
++          padding: 4px;
++        }
++        th {
++          background-color: #CCCCCC;
++        }
++        td {
++          text-align: center;
++        }
++        table, td, tr, th {
++          border: thin solid #999999;
++        }
++      </style>
++      <body>
++        <h3><xsl:value-of select="results/header"/></h3>
++EO_DIFF_XSL
++# 2}}}
++
++    if ($opt_by_file) {
++        $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2
++		<table>
++          <thead>
++		  <tr><th colspan="4">Same</th>
++		  </tr>
++            <tr>
++              <th>File</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/same/file">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++		
++		<table>
++          <thead>
++		  <tr><th colspan="4">Modified</th>
++		  </tr>
++            <tr>
++              <th>File</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/modified/file">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++		
++		<table>
++          <thead>
++		  <tr><th colspan="4">Added</th>
++		  </tr>
++            <tr>
++              <th>File</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/added/file">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++		
++		<table>
++          <thead>
++		  <tr><th colspan="4">Removed</th>
++		  </tr>
++            <tr>
++              <th>File</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/removed/file">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++EO_DIFF_XSL
++# 2}}}
++    }
++
++    if (!$opt_by_file or $opt_by_file_by_lang) {
++        $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2
++		<table>
++          <thead>
++		  <tr><th colspan="5">Same</th>
++		  </tr>
++            <tr>
++              <th>Language</th>
++              <th>Files</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/same/language">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@files_count"/></td>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++		
++		<table>
++          <thead>
++		  <tr><th colspan="5">Modified</th>
++		  </tr>
++            <tr>
++              <th>Language</th>
++              <th>Files</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/modified/language">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@files_count"/></td>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++		
++		<table>
++          <thead>
++		  <tr><th colspan="5">Added</th>
++		  </tr>
++            <tr>
++              <th>Language</th>
++              <th>Files</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/added/language">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@files_count"/></td>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++		
++		<table>
++          <thead>
++		  <tr><th colspan="5">Removed</th>
++		  </tr>
++            <tr>
++              <th>Language</th>
++              <th>Files</th>
++              <th>Blank</th>
++              <th>Comment</th>
++              <th>Code</th>              
++            </tr>
++          </thead>
++          <tbody>
++          <xsl:for-each select="diff_results/removed/language">
++            <tr>
++              <th><xsl:value-of select="@name"/></th>
++              <td><xsl:value-of select="@files_count"/></td>
++              <td><xsl:value-of select="@blank"/></td>
++              <td><xsl:value-of select="@comment"/></td>
++              <td><xsl:value-of select="@code"/></td>              
++            </tr>
++          </xsl:for-each>            
++          </tbody>
++        </table>
++EO_DIFF_XSL
++# 2}}}
++
++    }
++    
++    $XSL_DIFF.= <<'EO_DIFF_XSL'; # {{{2
++      </body>
++    </html>
++  </xsl:template>
++</xsl:stylesheet>
++EO_DIFF_XSL
++# 2}}}
++    if ($opt_diff) {
++        print $OUT $XSL_DIFF;
++    } else {
++        print $OUT $XSL;
++    }
++    $OUT->close();
++} # 1}}}
++sub normalize_file_names {                   # {{{1 
++    my (@files, ) = @_;
++
++    # Returns a hash of file names reduced to a canonical form
++    # (fully qualified file names, all path separators changed to /,
++    # Windows file names lowercased).  Hash values are the original
++    # file name.
++
++    my %normalized = ();
++    foreach my $F (@files) {
++        my $F_norm = $F;
++        if ($ON_WINDOWS) {
++            $F_norm = lc $F_norm; # for case insensitive file name comparisons
++            $F_norm =~ s{\\}{/}g; # Windows directory separators to Unix
++            $F_norm =~ s{^\./}{}g;  # remove leading ./
++            if (($F_norm !~ m{^/}) and ($F_norm !~ m{^\w:/})) {
++                # looks like a relative path; prefix with cwd
++                $F_norm = lc "$cwd/$F_norm";
++            }
++        } else {
++            $F_norm =~ s{^\./}{}g;  # remove leading ./
++            if ($F_norm !~ m{^/}) {
++                # looks like a relative path; prefix with cwd
++                $F_norm = lc "$cwd/$F_norm";
++            }
++        }
++        $normalized{ $F_norm } = $F;
++    }
++    return %normalized;
++} # 1}}}
++sub combine_diffs {                          # {{{1
++    # subroutine by Andy (awalshe@sf.net)
++    # https://sourceforge.net/tracker/?func=detail&aid=3261017&group_id=174787&atid=870625
++    my ($ra_files) = @_;
++
++    my $res   = "$URL v $VERSION\n";
++    my $dl    = '-';
++    my $width = 79;
++    # columns are in this order
++    my @cols  = ('files', 'blank', 'comment', 'code');
++    my %HoH   = ();
++  
++    foreach my $file (@{$ra_files}) {
++        my $IN = new IO::File $file, "r";
++        if (!defined $IN) {
++            warn "Unable to read $file; ignoring.\n";
++            next;
++        }
++
++        my $sec;
++        while (<$IN>) {
++            next if /^(http|Language|-----)/;
++            if (/^[A-Za-z0-9]+/) {        # section title
++                $sec = $_;
++                chomp($sec);
++                $HoH{$sec} = () if ! exists $HoH{$sec};
++                next;
++            }
++  
++            if (/^\s(same|modified|added|removed)/) {  # calculated totals row
++                my @ar = grep { $_ ne '' } split(/ /, $_);
++                chomp(@ar);
++                my $ttl = shift @ar;
++                my $i = 0;
++                foreach(@ar) {
++                    my $t = "$ttl$dl$cols[$i]";
++                    $HoH{$sec}{$t} = 0 if ! exists $HoH{$sec}{$t};
++                    $HoH{$sec}{$t} += $_;
++                    $i++;
++                }
++            }
++        }
++        $IN->close;
++    }
++
++    # rows are in this order
++    my @rows = ('same', 'modified', 'added', 'removed');
++  
++    $res .= sprintf("%s\n", "-" x $width);
++    $res .= sprintf("%-19s %14s %14s %14s %14s\n", 'Language', 
++                    $cols[0], $cols[1], $cols[2], $cols[3]);
++    $res .= sprintf("%s\n", "-" x $width);
++  
++    for my $sec ( keys %HoH ) {
++        next if $sec =~ /SUM:/;
++        $res .= "$sec\n";
++        foreach (@rows) {
++            $res .= sprintf(" %-18s %14s %14s %14s %14s\n", 
++                            $_, $HoH{$sec}{"$_$dl$cols[0]"},
++                                $HoH{$sec}{"$_$dl$cols[1]"},
++                                $HoH{$sec}{"$_$dl$cols[2]"},
++                                $HoH{$sec}{"$_$dl$cols[3]"});
++        }
++    }
++    $res .= sprintf("%s\n", "-" x $width);
++    my $sec = 'SUM:';
++    $res .= "$sec\n";
++    foreach (@rows) {
++        $res .= sprintf(" %-18s %14s %14s %14s %14s\n", 
++                        $_, $HoH{$sec}{"$_$dl$cols[0]"},
++                            $HoH{$sec}{"$_$dl$cols[1]"},
++                            $HoH{$sec}{"$_$dl$cols[2]"},
++                            $HoH{$sec}{"$_$dl$cols[3]"});
++    }
++    $res .= sprintf("%s\n", "-" x $width);
++  
++    return $res;
++} # 1}}}
++sub get_time {                               # {{{1
++    if ($HAVE_Time_HiRes) {
++        return Time::HiRes::time();
++    } else {
++        return time();
++    }
++} # 1}}}
++# subroutines copied from SLOCCount
++my %lex_files    = ();  # really_is_lex()
++my %expect_files = ();  # really_is_expect()
++my %php_files    = ();  # really_is_php()
++sub really_is_lex {                          # {{{1
++# Given filename, returns TRUE if its contents really is lex.
++# lex file must have "%%", "%{", and "%}".
++# In theory, a lex file doesn't need "%{" and "%}", but in practice
++# they all have them, and requiring them avoid mislabeling a
++# non-lexfile as a lex file.
++
++ my $filename = shift;
++ chomp($filename);
++
++ my $is_lex = 0;      # Value to determine.
++ my $percent_percent = 0;
++ my $percent_opencurly = 0;
++ my $percent_closecurly = 0;
++
++ # Return cached result, if available:
++ if ($lex_files{$filename}) { return $lex_files{$filename};}
++
++ open(LEX_FILE, "<$filename") ||
++      die "Can't open $filename to determine if it's lex.\n";
++ while(<LEX_FILE>) {
++   $percent_percent++     if (m/^\s*\%\%/);
++   $percent_opencurly++   if (m/^\s*\%\{/);
++   $percent_closecurly++   if (m/^\s*\%\}/);
++ }
++ close(LEX_FILE);
++
++ if ($percent_percent && $percent_opencurly && $percent_closecurly)
++          {$is_lex = 1;}
++
++ $lex_files{$filename} = $is_lex; # Store result in cache.
++
++ return $is_lex;
++} # 1}}}
++sub really_is_expect {                       # {{{1
++# Given filename, returns TRUE if its contents really are Expect.
++# Many "exp" files (such as in Apache and Mesa) are just "export" data,
++# summarizing something else # (e.g., its interface).
++# Sometimes (like in RPM) it's just misc. data.
++# Thus, we need to look at the file to determine
++# if it's really an "expect" file.
++
++ my $filename = shift;
++ chomp($filename);
++
++# The heuristic is as follows: it's Expect _IF_ it:
++# 1. has "load_lib" command and either "#" comments or {}.
++# 2. {, }, and one of: proc, if, [...], expect
++
++ my $is_expect = 0;      # Value to determine.
++
++ my $begin_brace = 0;  # Lines that begin with curly braces.
++ my $end_brace = 0;    # Lines that begin with curly braces.
++ my $load_lib = 0;     # Lines with the Load_lib command.
++ my $found_proc = 0;
++ my $found_if = 0;
++ my $found_brackets = 0;
++ my $found_expect = 0;
++ my $found_pound = 0;
++
++ # Return cached result, if available:
++ if ($expect_files{$filename}) { return expect_files{$filename};}
++
++ open(EXPECT_FILE, "<$filename") ||
++      die "Can't open $filename to determine if it's expect.\n";
++ while(<EXPECT_FILE>) {
++
++   if (m/#/) {$found_pound++; s/#.*//;}
++   if (m/^\s*\{/) { $begin_brace++;}
++   if (m/\{\s*$/) { $begin_brace++;}
++   if (m/^\s*\}/) { $end_brace++;}
++   if (m/\};?\s*$/) { $end_brace++;}
++   if (m/^\s*load_lib\s+\S/) { $load_lib++;}
++   if (m/^\s*proc\s/) { $found_proc++;}
++   if (m/^\s*if\s/) { $found_if++;}
++   if (m/\[.*\]/) { $found_brackets++;}
++   if (m/^\s*expect\s/) { $found_expect++;}
++ }
++ close(EXPECT_FILE);
++
++ if ($load_lib && ($found_pound || ($begin_brace && $end_brace)))
++          {$is_expect = 1;}
++ if ( $begin_brace && $end_brace &&
++      ($found_proc || $found_if || $found_brackets || $found_expect))
++          {$is_expect = 1;}
++
++ $expect_files{$filename} = $is_expect; # Store result in cache.
++
++ return $is_expect;
++} # 1}}}
++sub really_is_pascal {                       # {{{1
++# Given filename, returns TRUE if its contents really are Pascal.
++
++# This isn't as obvious as it seems.
++# Many ".p" files are Perl files
++# (such as /usr/src/redhat/BUILD/ispell-3.1/dicts/czech/glob.p),
++# others are C extractions
++# (such as /usr/src/redhat/BUILD/linux/include/linux/umsdos_fs.p
++# and some files in linuxconf).
++# However, test files in "p2c" really are Pascal, for example.
++
++# Note that /usr/src/redhat/BUILD/ucd-snmp-4.1.1/ov/bitmaps/UCD.20.p
++# is actually C code.  The heuristics determine that they're not Pascal,
++# but because it ends in ".p" it's not counted as C code either.
++# I believe this is actually correct behavior, because frankly it
++# looks like it's automatically generated (it's a bitmap expressed as code).
++# Rather than guess otherwise, we don't include it in a list of
++# source files.  Let's face it, someone who creates C files ending in ".p"
++# and expects them to be counted by default as C files in SLOCCount needs
++# their head examined.  I suggest examining their head
++# with a sucker rod (see syslogd(8) for more on sucker rods).
++
++# This heuristic counts as Pascal such files such as:
++#  /usr/src/redhat/BUILD/teTeX-1.0/texk/web2c/tangleboot.p
++# Which is hand-generated.  We don't count woven documents now anyway,
++# so this is justifiable.
++
++ my $filename = shift;
++ chomp($filename);
++
++# The heuristic is as follows: it's Pascal _IF_ it has all of the following
++# (ignoring {...} and (*...*) comments):
++# 1. "^..program NAME" or "^..unit NAME",
++# 2. "procedure", "function", "^..interface", or "^..implementation",
++# 3. a "begin", and
++# 4. it ends with "end.",
++#
++# Or it has all of the following:
++# 1. "^..module NAME" and
++# 2. it ends with "end.".
++#
++# Or it has all of the following:
++# 1. "^..program NAME",
++# 2. a "begin", and
++# 3. it ends with "end.".
++#
++# The "end." requirements in particular filter out non-Pascal.
++#
++# Note (jgb): this does not detect Pascal main files in fpc, like
++# fpc-1.0.4/api/test/testterminfo.pas, which does not have "program" in
++# it
++
++ my $is_pascal = 0;      # Value to determine.
++
++ my $has_program = 0;
++ my $has_unit = 0;
++ my $has_module = 0;
++ my $has_procedure_or_function = 0;
++ my $found_begin = 0;
++ my $found_terminating_end = 0;
++ my $has_begin = 0;
++
++ open(PASCAL_FILE, "<$filename") ||
++      die "Can't open $filename to determine if it's pascal.\n";
++ while(<PASCAL_FILE>) {
++   s/\{.*?\}//g;  # Ignore {...} comments on this line; imperfect, but effective.
++   s/\(\*.*?\*\)//g;  # Ignore (*...*) comments on this line; imperfect, but effective.
++   if (m/\bprogram\s+[A-Za-z]/i)  {$has_program=1;}
++   if (m/\bunit\s+[A-Za-z]/i)     {$has_unit=1;}
++   if (m/\bmodule\s+[A-Za-z]/i)   {$has_module=1;}
++   if (m/\bprocedure\b/i)         { $has_procedure_or_function = 1; }
++   if (m/\bfunction\b/i)          { $has_procedure_or_function = 1; }
++   if (m/^\s*interface\s+/i)      { $has_procedure_or_function = 1; }
++   if (m/^\s*implementation\s+/i) { $has_procedure_or_function = 1; }
++   if (m/\bbegin\b/i) { $has_begin = 1; }
++   # Originally I said:
++   # "This heuristic fails if there are multi-line comments after
++   # "end."; I haven't seen that in real Pascal programs:"
++   # But jgb found there are a good quantity of them in Debian, specially in 
++   # fpc (at the end of a lot of files there is a multiline comment
++   # with the changelog for the file).
++   # Therefore, assume Pascal if "end." appears anywhere in the file.
++   if (m/end\.\s*$/i) {$found_terminating_end = 1;}
++#   elsif (m/\S/) {$found_terminating_end = 0;}
++ }
++ close(PASCAL_FILE);
++
++ # Okay, we've examined the entire file looking for clues;
++ # let's use those clues to determine if it's really Pascal:
++
++ if ( ( ($has_unit || $has_program) && $has_procedure_or_function &&
++     $has_begin && $found_terminating_end ) ||
++      ( $has_module && $found_terminating_end ) ||
++      ( $has_program && $has_begin && $found_terminating_end ) )
++          {$is_pascal = 1;}
++
++ return $is_pascal;
++} # 1}}}
++sub really_is_incpascal {                    # {{{1
++# Given filename, returns TRUE if its contents really are Pascal.
++# For .inc files (mainly seen in fpc)
++
++ my $filename = shift;
++ chomp($filename);
++
++# The heuristic is as follows: it is Pacal if any of the following:
++# 1. really_is_pascal returns true
++# 2. Any usual reserverd word is found (program, unit, const, begin...)
++
++ # If the general routine for Pascal files works, we have it
++ if (really_is_pascal($filename)) { 
++   return 1;
++ }
++
++ my $is_pascal = 0;      # Value to determine.
++ my $found_begin = 0;
++
++ open(PASCAL_FILE, "<$filename") ||
++      die "Can't open $filename to determine if it's pascal.\n";
++ while(<PASCAL_FILE>) {
++   s/\{.*?\}//g;  # Ignore {...} comments on this line; imperfect, but effective.
++   s/\(\*.*?\*\)//g;  # Ignore (*...*) comments on this line; imperfect, but effective.
++   if (m/\bprogram\s+[A-Za-z]/i)  {$is_pascal=1;}
++   if (m/\bunit\s+[A-Za-z]/i)     {$is_pascal=1;}
++   if (m/\bmodule\s+[A-Za-z]/i)   {$is_pascal=1;}
++   if (m/\bprocedure\b/i)         {$is_pascal = 1; }
++   if (m/\bfunction\b/i)          {$is_pascal = 1; }
++   if (m/^\s*interface\s+/i)      {$is_pascal = 1; }
++   if (m/^\s*implementation\s+/i) {$is_pascal = 1; }
++   if (m/\bconstant\s+/i)         {$is_pascal=1;}
++   if (m/\bbegin\b/i) { $found_begin = 1; }
++   if ((m/end\.\s*$/i) && ($found_begin = 1)) {$is_pascal = 1;}
++   if ($is_pascal) {
++     last;
++   }
++ }
++
++ close(PASCAL_FILE);
++ return $is_pascal;
++} # 1}}}
++sub really_is_php {                          # {{{1
++# Given filename, returns TRUE if its contents really is php.
++
++ my $filename = shift;
++ chomp($filename);
++
++ my $is_php = 0;      # Value to determine.
++ # Need to find a matching pair of surrounds, with ending after beginning:
++ my $normal_surround = 0;  # <?; bit 0 = <?, bit 1 = ?>
++ my $script_surround = 0;  # <script..>; bit 0 = <script language="php">
++ my $asp_surround = 0;     # <%; bit 0 = <%, bit 1 = %>
++
++ # Return cached result, if available:
++ if ($php_files{$filename}) { return $php_files{$filename};}
++
++ open(PHP_FILE, "<$filename") ||
++      die "Can't open $filename to determine if it's php.\n";
++ while(<PHP_FILE>) {
++   if (m/\<\?/)                           { $normal_surround |= 1; }
++   if (m/\?\>/ && ($normal_surround & 1)) { $normal_surround |= 2; }
++   if (m/\<script.*language="?php"?/i)    { $script_surround |= 1; }
++   if (m/\<\/script\>/i && ($script_surround & 1)) { $script_surround |= 2; }
++   if (m/\<\%/)                           { $asp_surround |= 1; }
++   if (m/\%\>/ && ($asp_surround & 1)) { $asp_surround |= 2; }
++ }
++ close(PHP_FILE);
++
++ if ( ($normal_surround == 3) || ($script_surround == 3) ||
++      ($asp_surround == 3)) {
++   $is_php = 1;
++ }
++
++ $php_files{$filename} = $is_php; # Store result in cache.
++
++ return $is_php;
++} # 1}}}
++__END__
++mode values (stat $item)[2]
++       Unix    Windows
++file:  33188   33206
++dir :  16832   16895
++link:  33261   33206
++pipe:   4544    null
+
+Property changes on: ../trunk-jpl/scripts/cloc-1.60.pl
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
Index: /issm/oecreview/Archive/17802-17983/ISSM-17912-17913.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17912-17913.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17912-17913.diff	(revision 17986)
@@ -0,0 +1,35 @@
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 17912)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 17913)
+@@ -59,7 +59,7 @@
+ 		string='   m1qn3inversion parameters:'
+ 		string="%s\n%s"%(string,fielddisplay(self,'iscontrol','is inversion activated?'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity'))
+-		string="%s\n%s"%(string,fielddisplay(self,'control_parameters','ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}'))
++		string="%s\n%s"%(string,fielddisplay(self,'control_parameters','ex: [''FrictionCoefficient''], or [''MaterialsRheologyBbar'']'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'nsteps','number of optimization searches'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'dxmin','convergence criterion: two points less than dxmin from eachother (sup-norm) are considered identical'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'epsrel','convergence criterion: ratio between current gradient and initial gradient'))
+@@ -117,8 +117,8 @@
+ 		md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1])
+ 		md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy','Thickness'])
+ 		md = checkfield(md,'fieldname','inversion.nsteps','numel',[1],'>=',0)
+-		md = checkfield(md,'fieldname','inversion.dxmin','numel',1,'>',0.)
+-		md = checkfield(md,'fieldname','inversion.epsrel','numel',1,'>',0.)
++		md = checkfield(md,'fieldname','inversion.dxmin','numel',[1],'>',0.)
++		md = checkfield(md,'fieldname','inversion.epsrel','numel',[1],'>',0.)
+ 		md = checkfield(md,'fieldname','inversion.cost_functions','size',[num_costfunc],'values',[101,102,103,104,105,201,501,502,503,504,505])
+ 		md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices,num_costfunc],'>=',0)
+ 		md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices,num_controls])
+@@ -142,8 +142,8 @@
+ 			return
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','incomplete_adjoint','format','Boolean')
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','nsteps','format','Integer')
+-		WriteData(fid,'object',obj,'class','inversion','fieldname','dxmin','format','Double')
+-		WriteData(fid,'object',obj,'class','inversion','fieldname','epsrel','format','Double')
++		WriteData(fid,'object',self,'class','inversion','fieldname','dxmin','format','Double')
++		WriteData(fid,'object',self,'class','inversion','fieldname','epsrel','format','Double')
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3)
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3)
Index: /issm/oecreview/Archive/17802-17983/ISSM-17913-17914.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17913-17914.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17913-17914.diff	(revision 17986)
@@ -0,0 +1,440 @@
+Index: ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim
+===================================================================
+--- ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17913)
++++ ../trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim	(revision 17914)
+@@ -411,14 +411,13 @@
+ "ISSM's objects begin
+ syn keyword cType BoolInput
+ syn keyword cType BoolParam
+-syn keyword cType classes
+ syn keyword cType Constraint
+ syn keyword cType Constraints
+ syn keyword cType Contour
+ syn keyword cType Contours
+ syn keyword cType ControlInput
++syn keyword cType DataSetParam
+ syn keyword cType DatasetInput
+-syn keyword cType DataSetParam
+ syn keyword cType Definition
+ syn keyword cType DependentObject
+ syn keyword cType DofIndexing
+@@ -431,20 +430,19 @@
+ syn keyword cType Element
+ syn keyword cType ElementHook
+ syn keyword cType ElementMatrix
++syn keyword cType ElementVector
+ syn keyword cType Elements
+-syn keyword cType ElementVector
+ syn keyword cType ExponentialVariogram
+ syn keyword cType ExternalResult
+ syn keyword cType FemModel
+ syn keyword cType FileParam
+ syn keyword cType Friction
+ syn keyword cType Gauss
+-syn keyword cType GaussianVariogram
+-syn keyword cType gaussobjects
+ syn keyword cType GaussPenta
+ syn keyword cType GaussSeg
+ syn keyword cType GaussTetra
+ syn keyword cType GaussTria
++syn keyword cType GaussianVariogram
+ syn keyword cType GenericExternalResult
+ syn keyword cType GenericOption
+ syn keyword cType GenericParam
+@@ -458,7 +456,6 @@
+ syn keyword cType IntParam
+ syn keyword cType IntVecParam
+ syn keyword cType IoModel
+-syn keyword cType krigingobjects
+ syn keyword cType Load
+ syn keyword cType Loads
+ syn keyword cType Massfluxatgate
+@@ -466,7 +463,6 @@
+ syn keyword cType Materials
+ syn keyword cType Matice
+ syn keyword cType Matpar
+-syn keyword cType matrixobjects
+ syn keyword cType MatrixParam
+ syn keyword cType Misfit
+ syn keyword cType Node
+@@ -475,8 +471,8 @@
+ syn keyword cType Observation
+ syn keyword cType Observations
+ syn keyword cType Option
++syn keyword cType OptionUtilities
+ syn keyword cType Options
+-syn keyword cType OptionUtilities
+ syn keyword cType Param
+ syn keyword cType Parameters
+ syn keyword cType Pengrid
+@@ -488,12 +484,12 @@
+ syn keyword cType Profiler
+ syn keyword cType Quadtree
+ syn keyword cType Results
++syn keyword cType RiftStruct
+ syn keyword cType Riftfront
+-syn keyword cType RiftStruct
+ syn keyword cType Seg
+ syn keyword cType SegInput
++syn keyword cType SegRef
+ syn keyword cType Segment
+-syn keyword cType SegRef
+ syn keyword cType SpcDynamic
+ syn keyword cType SpcStatic
+ syn keyword cType SpcTransient
+@@ -513,6 +509,10 @@
+ syn keyword cType VectorParam
+ syn keyword cType Vertex
+ syn keyword cType Vertices
++syn keyword cType classes
++syn keyword cType gaussobjects
++syn keyword cType krigingobjects
++syn keyword cType matrixobjects
+ syn keyword cType AdjointBalancethicknessAnalysis
+ syn keyword cType AdjointHorizAnalysis
+ syn keyword cType Analysis
+@@ -626,11 +626,6 @@
+ syn keyword cConstant GeometryHydrostaticRatioEnum
+ syn keyword cConstant HydrologyModelEnum
+ syn keyword cConstant HydrologyshreveEnum
+-syn keyword cConstant HydrologyshreveCREnum
+-syn keyword cConstant HydrologyshreveKnEnum
+-syn keyword cConstant HydrologyshreveNEnum
+-syn keyword cConstant HydrologyshrevePEnum
+-syn keyword cConstant HydrologyshreveQEnum
+ syn keyword cConstant HydrologyshreveSpcwatercolumnEnum
+ syn keyword cConstant HydrologyshreveStabilizationEnum
+ syn keyword cConstant HydrologydcEnum
+@@ -679,12 +674,22 @@
+ syn keyword cConstant InversionCostFunctionsEnum
+ syn keyword cConstant InversionGradientScalingEnum
+ syn keyword cConstant InversionIscontrolEnum
+-syn keyword cConstant InversionTaoEnum
++syn keyword cConstant InversionTypeEnum
+ syn keyword cConstant InversionIncompleteAdjointEnum
+ syn keyword cConstant InversionMaxParametersEnum
+ syn keyword cConstant InversionMaxiterPerStepEnum
++syn keyword cConstant InversionMaxiterEnum
++syn keyword cConstant InversionMaxstepsEnum
++syn keyword cConstant InversionFatolEnum
++syn keyword cConstant InversionFgtolEnum
++syn keyword cConstant InversionGatolEnum
++syn keyword cConstant InversionGgtolEnum
++syn keyword cConstant InversionGttolEnum
++syn keyword cConstant InversionAlgorithmEnum
+ syn keyword cConstant InversionMinParametersEnum
+ syn keyword cConstant InversionNstepsEnum
++syn keyword cConstant InversionDxminEnum
++syn keyword cConstant InversionEpsrelEnum
+ syn keyword cConstant InversionNumControlParametersEnum
+ syn keyword cConstant InversionNumCostFunctionsEnum
+ syn keyword cConstant InversionStepThresholdEnum
+@@ -738,8 +743,6 @@
+ syn keyword cConstant MaterialsMantleShearModulusEnum
+ syn keyword cConstant MaterialsMantleDensityEnum
+ syn keyword cConstant MeshAverageVertexConnectivityEnum
+-syn keyword cConstant MeshElementonbaseEnum
+-syn keyword cConstant MeshElementonsurfaceEnum
+ syn keyword cConstant MeshElements2dEnum
+ syn keyword cConstant MeshElementsEnum
+ syn keyword cConstant MeshLowerelementsEnum
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17913)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17914)
+@@ -138,6 +138,14 @@
+ 	InversionIncompleteAdjointEnum,
+ 	InversionMaxParametersEnum,
+ 	InversionMaxiterPerStepEnum,
++	InversionMaxiterEnum,
++	InversionMaxstepsEnum,
++	InversionFatolEnum,
++	InversionFgtolEnum,
++	InversionGatolEnum,
++	InversionGgtolEnum,
++	InversionGttolEnum,
++	InversionAlgorithmEnum,
+ 	InversionMinParametersEnum,
+ 	InversionNstepsEnum,
+ 	InversionDxminEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17913)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17914)
+@@ -146,6 +146,14 @@
+ 		case InversionIncompleteAdjointEnum : return "InversionIncompleteAdjoint";
+ 		case InversionMaxParametersEnum : return "InversionMaxParameters";
+ 		case InversionMaxiterPerStepEnum : return "InversionMaxiterPerStep";
++		case InversionMaxiterEnum : return "InversionMaxiter";
++		case InversionMaxstepsEnum : return "InversionMaxsteps";
++		case InversionFatolEnum : return "InversionFatol";
++		case InversionFgtolEnum : return "InversionFgtol";
++		case InversionGatolEnum : return "InversionGatol";
++		case InversionGgtolEnum : return "InversionGgtol";
++		case InversionGttolEnum : return "InversionGttol";
++		case InversionAlgorithmEnum : return "InversionAlgorithm";
+ 		case InversionMinParametersEnum : return "InversionMinParameters";
+ 		case InversionNstepsEnum : return "InversionNsteps";
+ 		case InversionDxminEnum : return "InversionDxmin";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17913)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17914)
+@@ -149,6 +149,14 @@
+ 	      else if (strcmp(name,"InversionIncompleteAdjoint")==0) return InversionIncompleteAdjointEnum;
+ 	      else if (strcmp(name,"InversionMaxParameters")==0) return InversionMaxParametersEnum;
+ 	      else if (strcmp(name,"InversionMaxiterPerStep")==0) return InversionMaxiterPerStepEnum;
++	      else if (strcmp(name,"InversionMaxiter")==0) return InversionMaxiterEnum;
++	      else if (strcmp(name,"InversionMaxsteps")==0) return InversionMaxstepsEnum;
++	      else if (strcmp(name,"InversionFatol")==0) return InversionFatolEnum;
++	      else if (strcmp(name,"InversionFgtol")==0) return InversionFgtolEnum;
++	      else if (strcmp(name,"InversionGatol")==0) return InversionGatolEnum;
++	      else if (strcmp(name,"InversionGgtol")==0) return InversionGgtolEnum;
++	      else if (strcmp(name,"InversionGttol")==0) return InversionGttolEnum;
++	      else if (strcmp(name,"InversionAlgorithm")==0) return InversionAlgorithmEnum;
+ 	      else if (strcmp(name,"InversionMinParameters")==0) return InversionMinParametersEnum;
+ 	      else if (strcmp(name,"InversionNsteps")==0) return InversionNstepsEnum;
+ 	      else if (strcmp(name,"InversionDxmin")==0) return InversionDxminEnum;
+@@ -251,7 +259,10 @@
+ 	      else if (strcmp(name,"RiftsNumrifts")==0) return RiftsNumriftsEnum;
+ 	      else if (strcmp(name,"RiftsRiftstruct")==0) return RiftsRiftstructEnum;
+ 	      else if (strcmp(name,"SettingsResultsOnNodes")==0) return SettingsResultsOnNodesEnum;
+-	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
++         else stage=3;
++   }
++   if(stage==3){
++	      if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
+ 	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+ 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+@@ -259,10 +270,7 @@
+ 	      else if (strcmp(name,"ProfilingCurrentMem")==0) return ProfilingCurrentMemEnum;
+ 	      else if (strcmp(name,"ProfilingCurrentFlops")==0) return ProfilingCurrentFlopsEnum;
+ 	      else if (strcmp(name,"ProfilingSolutionTime")==0) return ProfilingSolutionTimeEnum;
+-         else stage=3;
+-   }
+-   if(stage==3){
+-	      if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
++	      else if (strcmp(name,"MaxIterationConvergenceFlag")==0) return MaxIterationConvergenceFlagEnum;
+ 	      else if (strcmp(name,"SteadystateMaxiter")==0) return SteadystateMaxiterEnum;
+ 	      else if (strcmp(name,"SteadystateNumRequestedOutputs")==0) return SteadystateNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"SteadystateReltol")==0) return SteadystateReltolEnum;
+@@ -374,7 +382,10 @@
+ 	      else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
+ 	      else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
+ 	      else if (strcmp(name,"GiaSolution")==0) return GiaSolutionEnum;
+-	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
++         else stage=4;
++   }
++   if(stage==4){
++	      if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+ 	      else if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
+ 	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+@@ -382,10 +393,7 @@
+ 	      else if (strcmp(name,"LsfReinitializationAnalysis")==0) return LsfReinitializationAnalysisEnum;
+ 	      else if (strcmp(name,"Approximation")==0) return ApproximationEnum;
+ 	      else if (strcmp(name,"NoneApproximation")==0) return NoneApproximationEnum;
+-         else stage=4;
+-   }
+-   if(stage==4){
+-	      if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
++	      else if (strcmp(name,"SIAApproximation")==0) return SIAApproximationEnum;
+ 	      else if (strcmp(name,"SSAApproximation")==0) return SSAApproximationEnum;
+ 	      else if (strcmp(name,"SSAHOApproximation")==0) return SSAHOApproximationEnum;
+ 	      else if (strcmp(name,"SSAFSApproximation")==0) return SSAFSApproximationEnum;
+@@ -497,7 +505,10 @@
+ 	      else if (strcmp(name,"QmuVxMesh")==0) return QmuVxMeshEnum;
+ 	      else if (strcmp(name,"QmuVyMesh")==0) return QmuVyMeshEnum;
+ 	      else if (strcmp(name,"QmuVzMesh")==0) return QmuVzMeshEnum;
+-	      else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
++         else stage=5;
++   }
++   if(stage==5){
++	      if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
+ 	      else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
+ 	      else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
+ 	      else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
+@@ -505,10 +516,7 @@
+ 	      else if (strcmp(name,"SurfaceAverageVelMisfit")==0) return SurfaceAverageVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVelMisfit")==0) return SurfaceLogVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceLogVxVyMisfit")==0) return SurfaceLogVxVyMisfitEnum;
+-         else stage=5;
+-   }
+-   if(stage==5){
+-	      if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
++	      else if (strcmp(name,"SurfaceRelVelMisfit")==0) return SurfaceRelVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeX")==0) return SurfaceSlopeXEnum;
+ 	      else if (strcmp(name,"SurfaceSlopeY")==0) return SurfaceSlopeYEnum;
+ 	      else if (strcmp(name,"Temperature")==0) return TemperatureEnum;
+@@ -620,7 +628,10 @@
+ 	      else if (strcmp(name,"MaxAbsVx")==0) return MaxAbsVxEnum;
+ 	      else if (strcmp(name,"MinVy")==0) return MinVyEnum;
+ 	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
+-	      else if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
++         else stage=6;
++   }
++   if(stage==6){
++	      if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
+ 	      else if (strcmp(name,"MinVz")==0) return MinVzEnum;
+ 	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+ 	      else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
+@@ -628,10 +639,7 @@
+ 	      else if (strcmp(name,"IceVolumeAboveFloatation")==0) return IceVolumeAboveFloatationEnum;
+ 	      else if (strcmp(name,"TotalSmb")==0) return TotalSmbEnum;
+ 	      else if (strcmp(name,"Absolute")==0) return AbsoluteEnum;
+-         else stage=6;
+-   }
+-   if(stage==6){
+-	      if (strcmp(name,"Incremental")==0) return IncrementalEnum;
++	      else if (strcmp(name,"Incremental")==0) return IncrementalEnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+Index: ../trunk-jpl/src/m/enum/InversionGttolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionGttolEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionGttolEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionGttolEnum()
++%INVERSIONGTTOLENUM - Enum of InversionGttol
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionGttolEnum()
++
++macro=StringToEnum('InversionGttol');
+Index: ../trunk-jpl/src/m/enum/InversionFgtolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionFgtolEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionFgtolEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionFgtolEnum()
++%INVERSIONFGTOLENUM - Enum of InversionFgtol
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionFgtolEnum()
++
++macro=StringToEnum('InversionFgtol');
+Index: ../trunk-jpl/src/m/enum/InversionAlgorithmEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionAlgorithmEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionAlgorithmEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionAlgorithmEnum()
++%INVERSIONALGORITHMENUM - Enum of InversionAlgorithm
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionAlgorithmEnum()
++
++macro=StringToEnum('InversionAlgorithm');
+Index: ../trunk-jpl/src/m/enum/InversionFatolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionFatolEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionFatolEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionFatolEnum()
++%INVERSIONFATOLENUM - Enum of InversionFatol
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionFatolEnum()
++
++macro=StringToEnum('InversionFatol');
+Index: ../trunk-jpl/src/m/enum/InversionGgtolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionGgtolEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionGgtolEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionGgtolEnum()
++%INVERSIONGGTOLENUM - Enum of InversionGgtol
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionGgtolEnum()
++
++macro=StringToEnum('InversionGgtol');
+Index: ../trunk-jpl/src/m/enum/InversionMaxiterEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionMaxiterEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionMaxiterEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionMaxiterEnum()
++%INVERSIONMAXITERENUM - Enum of InversionMaxiter
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionMaxiterEnum()
++
++macro=StringToEnum('InversionMaxiter');
+Index: ../trunk-jpl/src/m/enum/InversionMaxstepsEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionMaxstepsEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionMaxstepsEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionMaxstepsEnum()
++%INVERSIONMAXSTEPSENUM - Enum of InversionMaxsteps
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionMaxstepsEnum()
++
++macro=StringToEnum('InversionMaxsteps');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17913)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17914)
+@@ -138,6 +138,14 @@
+ def InversionIncompleteAdjointEnum(): return StringToEnum("InversionIncompleteAdjoint")[0]
+ def InversionMaxParametersEnum(): return StringToEnum("InversionMaxParameters")[0]
+ def InversionMaxiterPerStepEnum(): return StringToEnum("InversionMaxiterPerStep")[0]
++def InversionMaxiterEnum(): return StringToEnum("InversionMaxiter")[0]
++def InversionMaxstepsEnum(): return StringToEnum("InversionMaxsteps")[0]
++def InversionFatolEnum(): return StringToEnum("InversionFatol")[0]
++def InversionFgtolEnum(): return StringToEnum("InversionFgtol")[0]
++def InversionGatolEnum(): return StringToEnum("InversionGatol")[0]
++def InversionGgtolEnum(): return StringToEnum("InversionGgtol")[0]
++def InversionGttolEnum(): return StringToEnum("InversionGttol")[0]
++def InversionAlgorithmEnum(): return StringToEnum("InversionAlgorithm")[0]
+ def InversionMinParametersEnum(): return StringToEnum("InversionMinParameters")[0]
+ def InversionNstepsEnum(): return StringToEnum("InversionNsteps")[0]
+ def InversionDxminEnum(): return StringToEnum("InversionDxmin")[0]
+Index: ../trunk-jpl/src/m/enum/InversionGatolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionGatolEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionGatolEnum.m	(revision 17914)
+@@ -0,0 +1,11 @@
++function macro=InversionGatolEnum()
++%INVERSIONGATOLENUM - Enum of InversionGatol
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionGatolEnum()
++
++macro=StringToEnum('InversionGatol');
Index: /issm/oecreview/Archive/17802-17983/ISSM-17914-17915.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17914-17915.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17914-17915.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17914)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17915)
+@@ -46,7 +46,7 @@
+ 	if datatype==1:
+ 	   #element plot
+ 		if is2d:
+-			tri=ax.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,edgecolors=edgecolor)
++			tri=ax.tripcolor(x,y,elements,data,colorlevels,cmap=cmap,norm=norm,alpha=alpha,edgecolors=edgecolor)
+ 		else:
+ 			raise ValueError('plot_unit error: 3D element plot not supported yet')
+ 		return 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17915-17916.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17915-17916.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17915-17916.diff	(revision 17986)
@@ -0,0 +1,30 @@
+Index: ../trunk-jpl/test/NightlyRun/test211.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.py	(revision 17915)
++++ ../trunk-jpl/test/NightlyRun/test211.py	(revision 17916)
+@@ -27,8 +27,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3']
+ field_tolerances=[\
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,\
+-	5e-07,5e-07,1e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,\
+-	1e-06,1e-06,5e-05,1e-06,1e-07,1e-07,1e-07,1e-07,5e-07,1e-05]
++	5e-07,5e-07,5e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,\
++	5e-06,5e-06,5e-05,5e-06,1e-07,5e-07,5e-07,5e-07,1e-06,5e-05]
+ field_values=[\
+ 	md.results.TransientSolution[0].Vx,\
+ 	md.results.TransientSolution[0].Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test211.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test211.m	(revision 17915)
++++ ../trunk-jpl/test/NightlyRun/test211.m	(revision 17916)
+@@ -14,8 +14,8 @@
+ 	'Vx3','Vy3','Vz3','Vel3','Pressure3','Bed3','Surface3','Thickness3','Temperature3','BasalforcingsMeltingRate3'};
+ field_tolerances={...
+ 	2e-08,2e-08,1e-06,2e-08,1e-08,1e-08,1e-08,1e-08,1e-08,1e-08,...
+-	5e-07,5e-07,1e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,...
+-	1e-06,1e-06,5e-05,1e-06,1e-07,1e-07,1e-07,1e-07,5e-07,1e-05};
++	5e-07,5e-07,5e-05,1e-07,1e-08,1e-08,1e-08,1e-08,5e-08,2e-06,...
++	5e-06,5e-06,5e-05,5e-06,5e-07,5e-07,5e-07,1e-07,1e-06,5e-05};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17916-17917.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17916-17917.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17916-17917.diff	(revision 17986)
@@ -0,0 +1,43 @@
+Index: ../trunk-jpl/test/NightlyRun/test404.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.py	(revision 17916)
++++ ../trunk-jpl/test/NightlyRun/test404.py	(revision 17917)
+@@ -18,7 +18,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[2e-07,4e-07,2e-06,1e-06,1e-07]
++field_tolerances=[5e-07,4e-07,2e-06,1e-06,1e-07]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17916)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17917)
+@@ -74,9 +74,9 @@
+ 	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+ 	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+ 	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+-	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+-	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+-	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10};
++	5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10,...
++	5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10,...
++	5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10};
+ field_values={...
+ 	(md.results.TransientSolution(1).Vx),...
+ 	(md.results.TransientSolution(1).Vy),...
+Index: ../trunk-jpl/test/NightlyRun/test404.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test404.m	(revision 17916)
++++ ../trunk-jpl/test/NightlyRun/test404.m	(revision 17917)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={2e-07,5e-07,2e-06,1e-06,1e-07};
++field_tolerances={5e-07,5e-07,2e-06,1e-06,1e-07};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17917-17918.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17917-17918.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17917-17918.diff	(revision 17986)
@@ -0,0 +1,658 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17917)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17918)
+@@ -141,15 +141,14 @@
+ 	InversionMaxiterEnum,
+ 	InversionMaxstepsEnum,
+ 	InversionFatolEnum,
+-	InversionFgtolEnum,
++	InversionFrtolEnum,
+ 	InversionGatolEnum,
+-	InversionGgtolEnum,
++	InversionGrtolEnum,
+ 	InversionGttolEnum,
+ 	InversionAlgorithmEnum,
+ 	InversionMinParametersEnum,
+ 	InversionNstepsEnum,
+ 	InversionDxminEnum,
+-	InversionEpsrelEnum,
+ 	InversionNumControlParametersEnum,
+ 	InversionNumCostFunctionsEnum,
+ 	InversionStepThresholdEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17917)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17918)
+@@ -149,15 +149,14 @@
+ 		case InversionMaxiterEnum : return "InversionMaxiter";
+ 		case InversionMaxstepsEnum : return "InversionMaxsteps";
+ 		case InversionFatolEnum : return "InversionFatol";
+-		case InversionFgtolEnum : return "InversionFgtol";
++		case InversionFrtolEnum : return "InversionFrtol";
+ 		case InversionGatolEnum : return "InversionGatol";
+-		case InversionGgtolEnum : return "InversionGgtol";
++		case InversionGrtolEnum : return "InversionGrtol";
+ 		case InversionGttolEnum : return "InversionGttol";
+ 		case InversionAlgorithmEnum : return "InversionAlgorithm";
+ 		case InversionMinParametersEnum : return "InversionMinParameters";
+ 		case InversionNstepsEnum : return "InversionNsteps";
+ 		case InversionDxminEnum : return "InversionDxmin";
+-		case InversionEpsrelEnum : return "InversionEpsrel";
+ 		case InversionNumControlParametersEnum : return "InversionNumControlParameters";
+ 		case InversionNumCostFunctionsEnum : return "InversionNumCostFunctions";
+ 		case InversionStepThresholdEnum : return "InversionStepThreshold";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17917)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17918)
+@@ -152,15 +152,14 @@
+ 	      else if (strcmp(name,"InversionMaxiter")==0) return InversionMaxiterEnum;
+ 	      else if (strcmp(name,"InversionMaxsteps")==0) return InversionMaxstepsEnum;
+ 	      else if (strcmp(name,"InversionFatol")==0) return InversionFatolEnum;
+-	      else if (strcmp(name,"InversionFgtol")==0) return InversionFgtolEnum;
++	      else if (strcmp(name,"InversionFrtol")==0) return InversionFrtolEnum;
+ 	      else if (strcmp(name,"InversionGatol")==0) return InversionGatolEnum;
+-	      else if (strcmp(name,"InversionGgtol")==0) return InversionGgtolEnum;
++	      else if (strcmp(name,"InversionGrtol")==0) return InversionGrtolEnum;
+ 	      else if (strcmp(name,"InversionGttol")==0) return InversionGttolEnum;
+ 	      else if (strcmp(name,"InversionAlgorithm")==0) return InversionAlgorithmEnum;
+ 	      else if (strcmp(name,"InversionMinParameters")==0) return InversionMinParametersEnum;
+ 	      else if (strcmp(name,"InversionNsteps")==0) return InversionNstepsEnum;
+ 	      else if (strcmp(name,"InversionDxmin")==0) return InversionDxminEnum;
+-	      else if (strcmp(name,"InversionEpsrel")==0) return InversionEpsrelEnum;
+ 	      else if (strcmp(name,"InversionNumControlParameters")==0) return InversionNumControlParametersEnum;
+ 	      else if (strcmp(name,"InversionNumCostFunctions")==0) return InversionNumCostFunctionsEnum;
+ 	      else if (strcmp(name,"InversionStepThreshold")==0) return InversionStepThresholdEnum;
+@@ -259,11 +258,11 @@
+ 	      else if (strcmp(name,"RiftsNumrifts")==0) return RiftsNumriftsEnum;
+ 	      else if (strcmp(name,"RiftsRiftstruct")==0) return RiftsRiftstructEnum;
+ 	      else if (strcmp(name,"SettingsResultsOnNodes")==0) return SettingsResultsOnNodesEnum;
++	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
+-	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
++	      if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+ 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+@@ -382,11 +381,11 @@
+ 	      else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
+ 	      else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
+ 	      else if (strcmp(name,"GiaSolution")==0) return GiaSolutionEnum;
++	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+-	      else if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
++	      if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
+ 	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
+@@ -505,11 +504,11 @@
+ 	      else if (strcmp(name,"QmuVxMesh")==0) return QmuVxMeshEnum;
+ 	      else if (strcmp(name,"QmuVyMesh")==0) return QmuVyMeshEnum;
+ 	      else if (strcmp(name,"QmuVzMesh")==0) return QmuVzMeshEnum;
++	      else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
+-	      else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
++	      if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
+ 	      else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
+ 	      else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceArea")==0) return SurfaceAreaEnum;
+@@ -628,11 +627,11 @@
+ 	      else if (strcmp(name,"MaxAbsVx")==0) return MaxAbsVxEnum;
+ 	      else if (strcmp(name,"MinVy")==0) return MinVyEnum;
+ 	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
++	      else if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
+-	      else if (strcmp(name,"MinVz")==0) return MinVzEnum;
++	      if (strcmp(name,"MinVz")==0) return MinVzEnum;
+ 	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+ 	      else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
+ 	      else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp	(revision 17917)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp	(revision 17918)
+@@ -29,7 +29,6 @@
+ 		/*How many controls and how many responses?*/
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionNumControlParametersEnum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionNumCostFunctionsEnum));
+-		parameters->AddObject(iomodel->CopyConstantObject(InversionNstepsEnum));
+ 		parameters->AddObject(iomodel->CopyConstantObject(InversionIncompleteAdjointEnum));
+ 
+ 		/*What solution type?*/
+@@ -49,6 +48,7 @@
+ 		/*Inversion type specifics*/
+ 		switch(inversiontype){
+ 			case 0:/*Brent Search*/
++				parameters->AddObject(iomodel->CopyConstantObject(InversionNstepsEnum));
+ 				parameters->AddObject(iomodel->CopyConstantObject(InversionCostFunctionThresholdEnum));
+ 				iomodel->FetchData(&cm_jump,&nsteps,NULL,InversionStepThresholdEnum);
+ 				iomodel->FetchData(&optscal,NULL,NULL,InversionGradientScalingEnum);
+@@ -58,10 +58,20 @@
+ 				parameters->AddObject(new DoubleVecParam(InversionMaxiterPerStepEnum,maxiter,nsteps));
+ 				break;
+ 			case 1:/*TAO*/
++				parameters->AddObject(iomodel->CopyConstantObject(InversionFatolEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionFrtolEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionGatolEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionGrtolEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionGttolEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionMaxstepsEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionMaxiterEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionAlgorithmEnum));
+ 				break;
+ 			case 2:/*M1QN3*/
+ 				parameters->AddObject(iomodel->CopyConstantObject(InversionDxminEnum));
+-				parameters->AddObject(iomodel->CopyConstantObject(InversionEpsrelEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionGttolEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionMaxstepsEnum));
++				parameters->AddObject(iomodel->CopyConstantObject(InversionMaxiterEnum));
+ 				break;
+ 			default:
+ 				_error_("not supported");
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17917)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17918)
+@@ -29,8 +29,8 @@
+ 
+ 	/*Intermediaries*/
+ 	long         omode;
+-	double       f,dxmin,epsrel; 
+-	int          nsteps,maxiter;
++	double       f,dxmin,gttol; 
++	int          maxsteps,maxiter;
+ 	int          intn,num_controls,solution_type;
+ 	IssmDouble  *X  = NULL;
+ 	IssmDouble  *G  = NULL;
+@@ -38,11 +38,11 @@
+ 	/*Recover some parameters*/
+ 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+ 	femmodel->parameters->FindParam(&num_controls,InversionNumControlParametersEnum);
+-	femmodel->parameters->FindParam(&nsteps,InversionNstepsEnum);
++	femmodel->parameters->FindParam(&maxsteps,InversionMaxstepsEnum);
++	femmodel->parameters->FindParam(&maxiter,InversionMaxiterEnum);
+ 	femmodel->parameters->FindParam(&dxmin,InversionDxminEnum);
+-	femmodel->parameters->FindParam(&epsrel,InversionEpsrelEnum);
++	femmodel->parameters->FindParam(&gttol,InversionGttolEnum);
+ 	femmodel->parameters->SetParam(false,SaveResultsEnum);
+-	maxiter=nsteps*10;
+ 
+ 	/*Initialize M1QN3 parameters*/
+ 	if(VerboseControl())_printf0_("   Initialize M1QN3 parameters\n");
+@@ -59,7 +59,7 @@
+ 	long      io           = 6;         /*Channel number for the output*/
+ 
+ 	/*Optimization criterions*/
+-	long      niter        = long(nsteps); /*Maximum number of iterations*/
++	long      niter        = long(maxsteps); /*Maximum number of iterations*/
+ 	long      nsim         = long(maxiter);/*Maximum number of function calls*/
+ 
+ 	/*Get initial guess*/
+@@ -89,7 +89,7 @@
+ 	indic = 4; //adjoint and gradient required
+ 	m1qn3_(costfuncion,prosca,&ctonbe_,&ctcabe_,
+ 				&n,X,&f,G,&dxmin,&f1,
+-				&epsrel,normtype,&impres,&io,imode,&omode,&niter,&nsim,iz,dz,&ndz,
++				&gttol,normtype,&impres,&io,imode,&omode,&niter,&nsim,iz,dz,&ndz,
+ 				&reverse,&indic,izs,rzs,(void*)femmodel);
+ 
+ 	switch(int(omode)){
+Index: ../trunk-jpl/src/c/cores/controltao_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controltao_core.cpp	(revision 17917)
++++ ../trunk-jpl/src/c/cores/controltao_core.cpp	(revision 17918)
+@@ -25,10 +25,12 @@
+ 	/*TAO*/
+ 	int                 ierr;
+ 	int                 num_controls,solution_type;
+-	int                 nsteps,maxiter;
++	int                 maxsteps,maxiter;
++	IssmDouble          fatol,frtol,gatol,grtol,gttol;
+ 	AppCtx              user;
+ 	TaoSolver           tao = 0;
+ 	int                *control_list = NULL;
++	char               *algorithm    = NULL;
+ 	Vector<IssmDouble> *X            = NULL;
+ 	Vector<IssmDouble> *G            = NULL;
+ 	Vector<IssmDouble> *XL           = NULL;
+@@ -44,9 +46,15 @@
+ 	femmodel->parameters->FindParam(&solution_type,SolutionTypeEnum);
+ 	femmodel->parameters->FindParam(&num_controls,InversionNumControlParametersEnum);
+ 	femmodel->parameters->FindParam(&control_list,NULL,InversionControlParametersEnum);
+-	femmodel->parameters->FindParam(&nsteps,InversionNstepsEnum);
++	femmodel->parameters->FindParam(&maxsteps,InversionMaxstepsEnum);
++	femmodel->parameters->FindParam(&maxiter,InversionMaxiterEnum);
++	femmodel->parameters->FindParam(&fatol,InversionFatolEnum);
++	femmodel->parameters->FindParam(&frtol,InversionFrtolEnum);
++	femmodel->parameters->FindParam(&gatol,InversionGatolEnum);
++	femmodel->parameters->FindParam(&grtol,InversionGrtolEnum);
++	femmodel->parameters->FindParam(&gttol,InversionGttolEnum);
++	femmodel->parameters->FindParam(&algorithm,InversionAlgorithmEnum);
+ 	femmodel->parameters->SetParam(false,SaveResultsEnum);
+-	maxiter=nsteps*10;
+ 
+ 	/*Prepare Toolkit*/
+ 	ToolkitsOptionsFromAnalysis(femmodel->parameters,DefaultAnalysisEnum);
+@@ -55,15 +63,13 @@
+ 	TaoCreate(IssmComm::GetComm(),&tao);
+ 	if(VerboseControl()) _printf0_("   Initializing the Toolkit for Advanced Optimization (TAO)\n");
+ 	TaoSetFromOptions(tao);
+-	TaoSetType(tao,"tao_blmvm");
+-	//TaoSetType(tao,"tao_cg");
+-	//TaoSetType(tao,"tao_lmvm");
++	TaoSetType(tao,algorithm);
+ 
+ 	/*Prepare all TAO parameters*/
+ 	TaoSetMonitor(tao,IssmMonitor,&user,NULL);
+ 	TaoSetMaximumFunctionEvaluations(tao,maxiter);
+-	TaoSetMaximumIterations(tao,nsteps);
+-	TaoSetTolerances(tao,0.,0.,0.,0.,0.);
++	TaoSetMaximumIterations(tao,maxsteps);
++	TaoSetTolerances(tao,fatol,frtol,gatol,grtol,gttol);
+ 
+ 	GetVectorFromControlInputsx(&X, femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"value");
+ 	GetVectorFromControlInputsx(&XL,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,"lowerbound");
+@@ -100,6 +106,7 @@
+ 
+ 	/*Clean up and return*/
+ 	xDelete<int>(control_list);
++	xDelete<char>(algorithm);
+ 	xDelete<double>(user.J);
+ 	delete X;
+ 	TaoDestroy(&tao);
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 17917)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.py	(revision 17918)
+@@ -21,9 +21,10 @@
+ 			self.iscontrol                   = 0
+ 			self.incomplete_adjoint          = 0
+ 			self.control_parameters          = float('NaN')
+-			self.nsteps                      = 0
++			self.maxsteps                    = 0
++			self.maxiter                     = 0
+ 			self.dxmin                       = 0.
+-			self.epsrel                      = 0.
++			self.gttol                       = 0.
+ 			self.cost_functions              = float('NaN')
+ 			self.cost_functions_coefficients = float('NaN')
+ 			self.min_parameters              = float('NaN')
+@@ -42,7 +43,7 @@
+ 			self.iscontrol                   = inv.iscontrol
+ 			self.incomplete_adjoint          = inv.incomplete_adjoint
+ 			self.control_parameters          = inv.control_parameters
+-			self.nsteps                      = inv.nsteps
++			self.maxsteps                    = inv.nsteps
+ 			self.cost_functions              = inv.cost_functions
+ 			self.cost_functions_coefficients = inv.cost_functions_coefficients
+ 			self.min_parameters              = inv.min_parameters
+@@ -60,9 +61,10 @@
+ 		string="%s\n%s"%(string,fielddisplay(self,'iscontrol','is inversion activated?'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'control_parameters','ex: [''FrictionCoefficient''], or [''MaterialsRheologyBbar'']'))
+-		string="%s\n%s"%(string,fielddisplay(self,'nsteps','number of optimization searches'))
++		string="%s\n%s"%(string,fielddisplay(self,'maxsteps','maximum number of iterations (gradient computation)'))
++		string="%s\n%s"%(string,fielddisplay(self,'maxiter','maximum number of Function evaluation (forward run)'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'dxmin','convergence criterion: two points less than dxmin from eachother (sup-norm) are considered identical'))
+-		string="%s\n%s"%(string,fielddisplay(self,'epsrel','convergence criterion: ratio between current gradient and initial gradient'))
++		string="%s\n%s"%(string,fielddisplay(self,'gttol','||g(X)||/||g(X0)|| (g(X0): gradient at initial guess X0)'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'cost_functions','indicate the type of response for each optimization step'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter'))
+ 		string="%s\n%s"%(string,fielddisplay(self,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex'))
+@@ -92,15 +94,16 @@
+ 		#drag and B are supported yet)
+ 		self.control_parameters='FrictionCoefficient'
+ 
+-		#number of steps in the control methods
+-		self.nsteps=20
++		#number of iterations
++		self.maxsteps=20
++		self.maxiter=40
+ 
+ 		#several responses can be used:
+ 		self.cost_functions=101
+ 
+ 		#m1qn3 parameters
+ 		self.dxmin  = 0.1
+-		self.epsrel = 1e-4
++		self.gttol = 1e-4
+ 
+ 		return self
+ 	#}}}
+@@ -116,9 +119,10 @@
+ 		md = checkfield(md,'fieldname','inversion.iscontrol','values',[0,1])
+ 		md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0,1])
+ 		md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',['BalancethicknessThickeningRate','FrictionCoefficient','MaterialsRheologyBbar','DamageDbar','Vx','Vy','Thickness'])
+-		md = checkfield(md,'fieldname','inversion.nsteps','numel',[1],'>=',0)
++		md = checkfield(md,'fieldname','inversion.maxsteps','numel',[1],'>=',0)
++		md = checkfield(md,'fieldname','inversion.maxiter','numel',[1],'>=',0)
+ 		md = checkfield(md,'fieldname','inversion.dxmin','numel',[1],'>',0.)
+-		md = checkfield(md,'fieldname','inversion.epsrel','numel',[1],'>',0.)
++		md = checkfield(md,'fieldname','inversion.gttol','numel',[1],'>',0.)
+ 		md = checkfield(md,'fieldname','inversion.cost_functions','size',[num_costfunc],'values',[101,102,103,104,105,201,501,502,503,504,505])
+ 		md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices,num_costfunc],'>=',0)
+ 		md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices,num_controls])
+@@ -141,9 +145,10 @@
+ 		if not self.iscontrol:
+ 			return
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','incomplete_adjoint','format','Boolean')
+-		WriteData(fid,'object',self,'class','inversion','fieldname','nsteps','format','Integer')
++		WriteData(fid,'object',self,'class','inversion','fieldname','maxsteps','format','Integer')
++		WriteData(fid,'object',self,'class','inversion','fieldname','maxiter','format','Integer')
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','dxmin','format','Double')
+-		WriteData(fid,'object',self,'class','inversion','fieldname','epsrel','format','Double')
++		WriteData(fid,'object',self,'class','inversion','fieldname','gttol','format','Double')
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3)
+ 		WriteData(fid,'object',self,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3)
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17917)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17918)
+@@ -8,9 +8,10 @@
+ 		iscontrol                   = 0
+ 		incomplete_adjoint          = 0
+ 		control_parameters          = NaN
+-		nsteps                      = 0
++		maxsteps                    = 0
++		maxiter                     = 0
+ 		dxmin                       = 0;
+-		epsrel                      = 0;
++		gttol                       = 0;
+ 		cost_functions              = NaN
+ 		cost_functions_coefficients = NaN
+ 		min_parameters              = NaN
+@@ -42,15 +43,16 @@
+ 			%drag and B are supported yet)
+ 			self.control_parameters={'FrictionCoefficient'};
+ 
+-			%number of steps in the control methods
+-			self.nsteps=20;
++			%number of iterations
++			self.maxsteps=20;
++			self.maxiter=40;
+ 
+ 			%several responses can be used:
+-			self.cost_functions=101*ones(self.nsteps,1);
++			self.cost_functions=101;
+ 
+ 			%m1qn3 parameters
+ 			self.dxmin  = 0.1;
+-			self.epsrel = 1e-4;
++			self.gttol = 1e-4;
+ 
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+@@ -69,9 +71,10 @@
+ 			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
+ 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
+ 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'MaterialsRheologyZbar' 'Vx' 'Vy' 'Thickness'});
+-			md = checkfield(md,'fieldname','inversion.nsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.maxsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.maxiter','numel',1,'>=',0);
+ 			md = checkfield(md,'fieldname','inversion.dxmin','numel',1,'>',0);
+-			md = checkfield(md,'fieldname','inversion.epsrel','numel',1,'>',0);
++			md = checkfield(md,'fieldname','inversion.gttol','numel',1,'>',0);
+ 			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
+ 			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
+ 			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
+@@ -91,9 +94,10 @@
+ 			fielddisplay(obj,'iscontrol','is inversion activated?');
+ 			fielddisplay(obj,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity');
+ 			fielddisplay(obj,'control_parameters','ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}');
+-			fielddisplay(obj,'nsteps','number of optimization searches');
++			fielddisplay(obj,'maxsteps','maximum number of iterations (gradient computation)');
++			fielddisplay(obj,'maxiter','maximum number of Function evaluation (forward run)');
+ 			fielddisplay(obj,'dxmin','convergence criterion: two points less than dxmin from eachother (sup-norm) are considered identical');
+-			fielddisplay(obj,'epsrel','convergence criterion: ratio between current gradient and initial gradient');
++			fielddisplay(obj,'gttol','convergence criterion: ||g(X)||/||g(X0)|| (g(X0): gradient at initial guess X0)');
+ 			fielddisplay(obj,'cost_functions','indicate the type of response for each optimization step');
+ 			fielddisplay(obj,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter');
+ 			fielddisplay(obj,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex');
+@@ -121,9 +125,10 @@
+ 			WriteData(fid,'enum',InversionTypeEnum(),'data',2,'format','Integer');
+ 			if ~obj.iscontrol, return; end
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','incomplete_adjoint','format','Boolean');
+-			WriteData(fid,'object',obj,'class','inversion','fieldname','nsteps','format','Integer');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','maxsteps','format','Integer');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','maxiter','format','Integer');
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','dxmin','format','Double');
+-			WriteData(fid,'object',obj,'class','inversion','fieldname','epsrel','format','Double');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','gttol','format','Double');
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3);
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3);
+Index: ../trunk-jpl/src/m/classes/taoinversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17917)
++++ ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17918)
+@@ -8,7 +8,14 @@
+ 		iscontrol                   = 0
+ 		incomplete_adjoint          = 0
+ 		control_parameters          = NaN
+-		nsteps                      = 0
++		maxsteps                    = 0
++		maxiter                     = 0
++		fatol                       = 0
++		frtol                       = 0
++		gatol                       = 0
++		grtol                       = 0
++		gttol                       = 0
++		algorithm                   = ''
+ 		cost_functions              = NaN
+ 		cost_functions_coefficients = NaN
+ 		min_parameters              = NaN
+@@ -25,23 +32,7 @@
+ 				case 0
+ 					obj=setdefaultparameters(obj);
+ 				case 1
+-					if isa(varargin{1},'inversion'),
+-						disp('converting inversion to taoinversion');
+-						in=varargin{1};
+-						obj.iscontrol                   = in.iscontrol;
+-						obj.incomplete_adjoint          = in.incomplete_adjoint;
+-						obj.control_parameters          = in.control_parameters;
+-						obj.nsteps                      = in.nsteps;
+-						obj.cost_functions              = in.cost_functions(1,:); %Keep first line only
+-						obj.cost_functions_coefficients = in.cost_functions_coefficients;
+-						obj.min_parameters              = in.min_parameters;
+-						obj.max_parameters              = in.max_parameters;
+-						obj.vx_obs                      = in.vx_obs;
+-						obj.vy_obs                      = in.vy_obs;
+-						obj.vz_obs                      = in.vz_obs;
+-						obj.vel_obs                     = in.vel_obs;
+-						obj.thickness_obs               = in.thickness_obs;
+-					end
++					obj=structtoobj(obj,varargin{1});
+ 				otherwise
+ 					error('constructor not supported');
+ 			end
+@@ -55,11 +46,22 @@
+ 			%drag and B are supported yet)
+ 			obj.control_parameters={'FrictionCoefficient'};
+ 
+-			%number of steps in the control methods
+-			obj.nsteps=20;
++			%number of iterations and steps
++			obj.maxsteps=20;
++			obj.maxiter =30;
+ 
++			%default tolerances
++			obj.fatol = 0;
++			obj.frtol = 0;
++			obj.gatol = 0;
++			obj.grtol = 0;
++			obj.gttol = 1e-4;
++
++			%minimization algorithm
++			obj.algorithm = 'tao_blmvm';
++
+ 			%several responses can be used:
+-			obj.cost_functions=101*ones(obj.nsteps,1);
++			obj.cost_functions=101;
+ 
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+@@ -78,7 +80,14 @@
+ 			md = checkfield(md,'fieldname','inversion.incomplete_adjoint','values',[0 1]);
+ 			md = checkfield(md,'fieldname','inversion.control_parameters','cell',1,'values',...
+ 				{'BalancethicknessThickeningRate' 'FrictionCoefficient' 'MaterialsRheologyBbar' 'MaterialsRheologyZbar' 'Vx' 'Vy' 'Thickness'});
+-			md = checkfield(md,'fieldname','inversion.nsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.maxsteps','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.maxiter','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.fatol','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.frtol','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.gatol','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.grtol','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.gttol','numel',1,'>=',0);
++			md = checkfield(md,'fieldname','inversion.algorithm','values',{'tao_blmvm','tao_cg','tao_lmvm'});
+ 			md = checkfield(md,'fieldname','inversion.cost_functions','size',[1 num_costfunc],'values',[101:105 201 501:506]);
+ 			md = checkfield(md,'fieldname','inversion.cost_functions_coefficients','size',[md.mesh.numberofvertices num_costfunc],'>=',0);
+ 			md = checkfield(md,'fieldname','inversion.min_parameters','size',[md.mesh.numberofvertices num_controls]);
+@@ -98,7 +107,14 @@
+ 			fielddisplay(obj,'iscontrol','is inversion activated?');
+ 			fielddisplay(obj,'incomplete_adjoint','1: linear viscosity, 0: non-linear viscosity');
+ 			fielddisplay(obj,'control_parameters','ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''}');
+-			fielddisplay(obj,'nsteps','number of optimization searches');
++			fielddisplay(obj,'maxsteps','maximum number of iterations (gradient computation)');
++			fielddisplay(obj,'maxiter','maximum number of Function evaluation (forward run)');
++			fielddisplay(obj,'fatol','convergence criterion: f(X)-f(X*) (X: current iteration, X*: "true" solution, f: cost function)');
++			fielddisplay(obj,'frtol','convergence criterion: |f(X)-f(X*)|/|f(X*)|');
++			fielddisplay(obj,'gatol','convergence criterion: ||g(X)|| (g: gradient of the cost function)');
++			fielddisplay(obj,'grtol','convergence criterion: ||g(X)||/|f(X)|');
++			fielddisplay(obj,'gttol','convergence criterion: ||g(X)||/||g(X0)|| (g(X0): gradient at initial guess X0)');
++			fielddisplay(obj,'algorithm','minimization algorithm: ''tao_blmvm'', ''tao_cg'', ''tao_lmvm''');
+ 			fielddisplay(obj,'cost_functions','indicate the type of response for each optimization step');
+ 			fielddisplay(obj,'cost_functions_coefficients','cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter');
+ 			fielddisplay(obj,'min_parameters','absolute minimum acceptable value of the inversed parameter on each vertex');
+@@ -126,7 +142,14 @@
+ 			WriteData(fid,'enum',InversionTypeEnum(),'data',1,'format','Integer');
+ 			if ~obj.iscontrol, return; end
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','incomplete_adjoint','format','Boolean');
+-			WriteData(fid,'object',obj,'class','inversion','fieldname','nsteps','format','Integer');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','maxsteps','format','Integer');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','maxiter','format','Integer');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','fatol','format','Double');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','frtol','format','Double');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','gatol','format','Double');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','grtol','format','Double');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','gttol','format','Double');
++			WriteData(fid,'object',obj,'class','inversion','fieldname','algorithm','format','String');
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','cost_functions_coefficients','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','min_parameters','format','DoubleMat','mattype',3);
+ 			WriteData(fid,'object',obj,'class','inversion','fieldname','max_parameters','format','DoubleMat','mattype',3);
+Index: ../trunk-jpl/src/m/enum/InversionFgtolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionFgtolEnum.m	(revision 17917)
++++ ../trunk-jpl/src/m/enum/InversionFgtolEnum.m	(revision 17918)
+@@ -1,11 +0,0 @@
+-function macro=InversionFgtolEnum()
+-%INVERSIONFGTOLENUM - Enum of InversionFgtol
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=InversionFgtolEnum()
+-
+-macro=StringToEnum('InversionFgtol');
+Index: ../trunk-jpl/src/m/enum/InversionGgtolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionGgtolEnum.m	(revision 17917)
++++ ../trunk-jpl/src/m/enum/InversionGgtolEnum.m	(revision 17918)
+@@ -1,11 +0,0 @@
+-function macro=InversionGgtolEnum()
+-%INVERSIONGGTOLENUM - Enum of InversionGgtol
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=InversionGgtolEnum()
+-
+-macro=StringToEnum('InversionGgtol');
+Index: ../trunk-jpl/src/m/enum/InversionEpsrelEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionEpsrelEnum.m	(revision 17917)
++++ ../trunk-jpl/src/m/enum/InversionEpsrelEnum.m	(revision 17918)
+@@ -1,11 +0,0 @@
+-function macro=InversionEpsrelEnum()
+-%INVERSIONEPSRELENUM - Enum of InversionEpsrel
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=InversionEpsrelEnum()
+-
+-macro=StringToEnum('InversionEpsrel');
+Index: ../trunk-jpl/src/m/enum/InversionFrtolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionFrtolEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionFrtolEnum.m	(revision 17918)
+@@ -0,0 +1,11 @@
++function macro=InversionFrtolEnum()
++%INVERSIONFRTOLENUM - Enum of InversionFrtol
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionFrtolEnum()
++
++macro=StringToEnum('InversionFrtol');
+Index: ../trunk-jpl/src/m/enum/InversionGrtolEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/InversionGrtolEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/InversionGrtolEnum.m	(revision 17918)
+@@ -0,0 +1,11 @@
++function macro=InversionGrtolEnum()
++%INVERSIONGRTOLENUM - Enum of InversionGrtol
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=InversionGrtolEnum()
++
++macro=StringToEnum('InversionGrtol');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17917)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17918)
+@@ -141,15 +141,14 @@
+ def InversionMaxiterEnum(): return StringToEnum("InversionMaxiter")[0]
+ def InversionMaxstepsEnum(): return StringToEnum("InversionMaxsteps")[0]
+ def InversionFatolEnum(): return StringToEnum("InversionFatol")[0]
+-def InversionFgtolEnum(): return StringToEnum("InversionFgtol")[0]
++def InversionFrtolEnum(): return StringToEnum("InversionFrtol")[0]
+ def InversionGatolEnum(): return StringToEnum("InversionGatol")[0]
+-def InversionGgtolEnum(): return StringToEnum("InversionGgtol")[0]
++def InversionGrtolEnum(): return StringToEnum("InversionGrtol")[0]
+ def InversionGttolEnum(): return StringToEnum("InversionGttol")[0]
+ def InversionAlgorithmEnum(): return StringToEnum("InversionAlgorithm")[0]
+ def InversionMinParametersEnum(): return StringToEnum("InversionMinParameters")[0]
+ def InversionNstepsEnum(): return StringToEnum("InversionNsteps")[0]
+ def InversionDxminEnum(): return StringToEnum("InversionDxmin")[0]
+-def InversionEpsrelEnum(): return StringToEnum("InversionEpsrel")[0]
+ def InversionNumControlParametersEnum(): return StringToEnum("InversionNumControlParameters")[0]
+ def InversionNumCostFunctionsEnum(): return StringToEnum("InversionNumCostFunctions")[0]
+ def InversionStepThresholdEnum(): return StringToEnum("InversionStepThreshold")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17918-17919.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17918-17919.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17918-17919.diff	(revision 17986)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/m/plot/plotmodel.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17918)
++++ ../trunk-jpl/src/m/plot/plotmodel.py	(revision 17919)
+@@ -53,7 +53,7 @@
+ 	#Go through plots
+ 	if numberofplots:
+ 		
+-		if not hold: # TODO need to also check whether figurenumber is a new plot so that old plots are not mistakenly cleared
++		if plt.fignum_exists(figurenumber): 
+ 			plt.cla()
+ 
+ 		#if figsize specified
+Index: ../trunk-jpl/src/m/plot/applyoptions.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17918)
++++ ../trunk-jpl/src/m/plot/applyoptions.py	(revision 17919)
+@@ -106,6 +106,10 @@
+ 	#}}}
+ 
+ 	#xticklabels,yticklabels,zticklabels {{{
++	if options.getfieldvalue('ticklabels','off')=='off' or options.getfieldvalue('ticklabels',0)==0:
++		options.addfielddefault('xticklabels',[])
++		options.addfielddefault('yticklabels',[])
++		# TODO check if ax has a z-axis (e.g. is 3D)
+ 	if options.exist('xticklabels'):
+ 		xticklabels=options.getfieldvalue('xticklabels')
+ 		ax.set_xticklabels(xticklabels)
Index: /issm/oecreview/Archive/17802-17983/ISSM-17919-17920.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17919-17920.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17919-17920.diff	(revision 17986)
@@ -0,0 +1,157 @@
+Index: ../trunk-jpl/src/m/classes/inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.m	(revision 17919)
++++ ../trunk-jpl/src/m/classes/inversion.m	(revision 17920)
+@@ -24,81 +24,56 @@
+ 		thickness_obs               = NaN
+ 	end
+ 	methods
+-         function createxml(obj,fid) % {{{
+-            fprintf(fid, '<!-- inversion -->\n');            
+-                    
+-            % inversion parameters
+-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />');                    
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="iscontrol" type="',class(obj.iscontrol),'" default="',convert2str(obj.iscontrol),'">','     <section name="inversion" />','     <help> is inversion activated? </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="incomplete_adjoint" type="',class(obj.incomplete_adjoint),'" default="',convert2str(obj.incomplete_adjoint),'">','     <section name="inversion" />','     <help> 1: linear viscosity, 0: non-linear viscosity </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="control_parameters" type="',class(obj.control_parameters),'" default="',convert2str(obj.control_parameters),'">','     <section name="inversion" />','     <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>','  </parameter>');
+-                
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="nsteps" type="',class(obj.nsteps),'" default="',convert2str(obj.nsteps),'">','     <section name="inversion" />','     <help> number of optimization searches </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions" type="',class(obj.cost_functions),'" default="',convert2str(obj.cost_functions),'">','     <section name="inversion" />','     <help> indicate the type of response for each optimization step  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions_coefficients" type="',class(obj.cost_functions_coefficients),'" default="',convert2str(obj.cost_functions_coefficients),'">','     <section name="inversion" />','     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>','  </parameter>');
+-                
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_function_threshold" type="',class(obj.cost_function_threshold),'" default="',convert2str(obj.cost_function_threshold),'">','     <section name="inversion" />','     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter_per_step" type="',class(obj.maxiter_per_step),'" default="',convert2str(obj.maxiter_per_step),'">','     <section name="inversion" />','     <help> maximum iterations during each optimization step  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gradient_scaling" type="',class(obj.gradient_scaling),'" default="',convert2str(obj.gradient_scaling),'">','     <section name="inversion" />','     <help> scaling factor on gradient direction during optimization, for each optimization step </help>','  </parameter>');
+-               
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="step_threshold" type="',class(obj.step_threshold),'" default="',convert2str(obj.step_threshold),'">','     <section name="inversion" />','     <help> decrease threshold for misfit, default is 30% </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_parameters" type="',class(obj.min_parameters),'" default="',convert2str(obj.min_parameters),'">','     <section name="inversion" />','     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="max_parameters" type="',class(obj.max_parameters),'" default="',convert2str(obj.max_parameters),'">','     <section name="inversion" />','     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
+-               
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vx_obs" type="',class(obj.vx_obs),'" default="',convert2str(obj.vx_obs),'">','     <section name="inversion" />','     <help> observed velocity x component [m/yr] </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vy_obs" type="',class(obj.vy_obs),'" default="',convert2str(obj.vy_obs),'">','     <section name="inversion" />','     <help> observed velocity y component [m/yr]  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vel_obs" type="',class(obj.vel_obs),'" default="',convert2str(obj.vel_obs),'">','     <section name="inversion" />','     <help> observed velocity magnitude [m/yr] </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="thickness_obs" type="',class(obj.thickness_obs),'" default="',convert2str(obj.thickness_obs),'">','     <section name="inversion" />','     <help> observed thickness [m]) </help>','  </parameter>');
+-               
+-            fprintf(fid,'%s\n%s\n','</frame>');    
+-            
+-            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />');                    
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-                
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-               
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">','     <section name="inversion" />','     <help> </help>','  </parameter>');
+-               
+-            fprintf(fid,'%s\n%s\n','</frame>');    
+-        
+-        end % }}}       
++		function createxml(obj,fid) % {{{
++			fprintf(fid, '<!-- inversion -->\n');            
++
++			% inversion parameters
++			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />');                    
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="iscontrol" type="',class(obj.iscontrol),'" default="',convert2str(obj.iscontrol),'">','     <section name="inversion" />','     <help> is inversion activated? </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="incomplete_adjoint" type="',class(obj.incomplete_adjoint),'" default="',convert2str(obj.incomplete_adjoint),'">','     <section name="inversion" />','     <help> 1: linear viscosity, 0: non-linear viscosity </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="control_parameters" type="',class(obj.control_parameters),'" default="',convert2str(obj.control_parameters),'">','     <section name="inversion" />','     <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>','  </parameter>');
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="nsteps" type="',class(obj.nsteps),'" default="',convert2str(obj.nsteps),'">','     <section name="inversion" />','     <help> number of optimization searches </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions" type="',class(obj.cost_functions),'" default="',convert2str(obj.cost_functions),'">','     <section name="inversion" />','     <help> indicate the type of response for each optimization step  </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions_coefficients" type="',class(obj.cost_functions_coefficients),'" default="',convert2str(obj.cost_functions_coefficients),'">','     <section name="inversion" />','     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>','  </parameter>');
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_function_threshold" type="',class(obj.cost_function_threshold),'" default="',convert2str(obj.cost_function_threshold),'">','     <section name="inversion" />','     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter_per_step" type="',class(obj.maxiter_per_step),'" default="',convert2str(obj.maxiter_per_step),'">','     <section name="inversion" />','     <help> maximum iterations during each optimization step  </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gradient_scaling" type="',class(obj.gradient_scaling),'" default="',convert2str(obj.gradient_scaling),'">','     <section name="inversion" />','     <help> scaling factor on gradient direction during optimization, for each optimization step </help>','  </parameter>');
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="step_threshold" type="',class(obj.step_threshold),'" default="',convert2str(obj.step_threshold),'">','     <section name="inversion" />','     <help> decrease threshold for misfit, default is 30% </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_parameters" type="',class(obj.min_parameters),'" default="',convert2str(obj.min_parameters),'">','     <section name="inversion" />','     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="max_parameters" type="',class(obj.max_parameters),'" default="',convert2str(obj.max_parameters),'">','     <section name="inversion" />','     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vx_obs" type="',class(obj.vx_obs),'" default="',convert2str(obj.vx_obs),'">','     <section name="inversion" />','     <help> observed velocity x component [m/yr] </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vy_obs" type="',class(obj.vy_obs),'" default="',convert2str(obj.vy_obs),'">','     <section name="inversion" />','     <help> observed velocity y component [m/yr]  </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vel_obs" type="',class(obj.vel_obs),'" default="',convert2str(obj.vel_obs),'">','     <section name="inversion" />','     <help> observed velocity magnitude [m/yr] </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="thickness_obs" type="',class(obj.thickness_obs),'" default="',convert2str(obj.thickness_obs),'">','     <section name="inversion" />','     <help> observed thickness [m]) </help>','  </parameter>');
++
++			fprintf(fid,'%s\n%s\n','</frame>');    
++
++			fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />');                    
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">','     <section name="inversion" />','     <help> </help>','  </parameter>');
++
++			fprintf(fid,'%s\n%s\n','</frame>');    
++
++		end % }}}       
+ 		function obj = inversion(varargin) % {{{
+ 			switch nargin
+ 				case 0
+ 					obj=setdefaultparameters(obj);
+ 				case 1
+-					if isa(varargin{1},'taoinversion'),
+-						disp('converting taoinversion');
+-						in=varargin{1};
+-						obj=inversion();
+-						obj.iscontrol                   = in.iscontrol;
+-						obj.incomplete_adjoint          = in.incomplete_adjoint;
+-						obj.control_parameters          = in.control_parameters;
+-						obj.nsteps                      = in.nsteps;
+-						obj.maxiter_per_step            = 10*ones(in.nsteps,1);
+-						obj.cost_functions              = in.cost_functions;
+-						obj.cost_functions_coefficients = in.cost_functions_coefficients;
+-						obj.gradient_scaling            = 100*ones(in.nsteps,1);
+-						obj.cost_function_threshold     = NaN;
+-						obj.min_parameters              = in.min_parameters;
+-						obj.max_parameters              = in.max_parameters;
+-						obj.step_threshold              = .99*ones(in.nsteps,1);
+-						obj.vx_obs                      = in.vx_obs;
+-						obj.vy_obs                      = in.vy_obs;
+-						obj.vz_obs                      = in.vz_obs;
+-						obj.vel_obs                     = in.vel_obs;
+-						obj.thickness_obs               = in.thickness_obs;
+-					elseif isa(varargin{1},'inversion'),
+-						obj = varargin{1};
+-					else
+-						error('constructor not supported');
+-					end
++					obj=structtoobj(inversion(),varargin{1});
+ 				otherwise
+ 					error('constructor not supported');
+ 			end
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17919)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17920)
+@@ -29,7 +29,7 @@
+ 				case 0
+ 					obj=setdefaultparameters(obj);
+ 				case 1
+-					obj=structtoobj(obj,varargin{1});
++					obj=structtoobj(m1qn3inversion(),varargin{1});
+ 				otherwise
+ 					error('constructor not supported');
+ 			end
+Index: ../trunk-jpl/src/m/classes/taoinversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17919)
++++ ../trunk-jpl/src/m/classes/taoinversion.m	(revision 17920)
+@@ -32,7 +32,7 @@
+ 				case 0
+ 					obj=setdefaultparameters(obj);
+ 				case 1
+-					obj=structtoobj(obj,varargin{1});
++					obj=structtoobj(taoinversion(),varargin{1});
+ 				otherwise
+ 					error('constructor not supported');
+ 			end
Index: /issm/oecreview/Archive/17802-17983/ISSM-17920-17921.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17920-17921.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17920-17921.diff	(revision 17986)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/interp/averaging.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.py	(revision 17920)
++++ ../trunk-jpl/src/m/interp/averaging.py	(revision 17921)
+@@ -78,9 +78,8 @@
+ 		average_node=average_node/weights
+ 		average_node = csc_matrix(average_node)
+ 	else:
+-		average_node=data
++		average_node=csc_matrix(data.reshape(-1,1))
+ 
+-	
+ 	#loop over iteration
+ 	for i in npy.arange(1,iterations+1):
+ 		average_el=npy.asarray(npy.dot(average_node.todense()[index].reshape(numberofelements,rep),npy.vstack(summation))).reshape(-1,)
Index: /issm/oecreview/Archive/17802-17983/ISSM-17921-17922.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17921-17922.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17921-17922.diff	(revision 17986)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/interp/averaging.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/averaging.py	(revision 17921)
++++ ../trunk-jpl/src/m/interp/averaging.py	(revision 17922)
+@@ -85,6 +85,7 @@
+ 		average_el=npy.asarray(npy.dot(average_node.todense()[index].reshape(numberofelements,rep),npy.vstack(summation))).reshape(-1,)
+ 		average_node=csc_matrix( (npy.tile(areas*average_el.reshape(-1),(rep,1)).reshape(-1,),(line,npy.zeros(linesize,))), shape=(numberofnodes,1))
+ 		average_node=average_node/weights
++		average_node=csc_matrix(average_node)
+ 	
+ 	#return output as a full matrix (C code do not like sparse matrices)
+ 	average=npy.asarray(average_node.todense()).reshape(-1,)
Index: /issm/oecreview/Archive/17802-17983/ISSM-17922-17923.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17922-17923.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17922-17923.diff	(revision 17986)
@@ -0,0 +1,235 @@
+Index: ../trunk-jpl/scripts/archive.sh
+===================================================================
+--- ../trunk-jpl/scripts/archive.sh	(revision 17922)
++++ ../trunk-jpl/scripts/archive.sh	(revision 17923)
+@@ -1,22 +0,0 @@
+-#!/bin/bash
+-#This bash routine  will create a tar file for the ISSM
+-#code. Just run the following command: 
+-
+-#Some local script functions 
+-function today_date {
+-suffix=`date | awk '{printf("%s-%s-%s",$2,$3,$6);}'` 
+-echo $suffix;
+-}
+-
+-#Cleanup code 
+-cd $ISSM_DIR
+-make clean
+-make distclean
+-
+-#Get rid of externalpackages
+-rm -rf externalpackages
+-
+-#Create tar file, with today's date in the title;
+-cd $ISSM_DIR/..
+-today=`today_date`
+-tar zcvf issm-3.0-$today.tar.gz  `basename $ISSM_DIR`
+Index: ../trunk-jpl/scripts/Update.sh
+===================================================================
+--- ../trunk-jpl/scripts/Update.sh	(revision 17922)
++++ ../trunk-jpl/scripts/Update.sh	(revision 17923)
+@@ -1,98 +0,0 @@
+-#!/bin/bash
+-FILE=$1
+-if [ $# -ne 1 ];
+-then
+-	echo "Usage: ./Update.sh filename "  1>&2
+-	exit 1
+-fi
+-if [ ! -f $FILE ]; then
+-	echo "File $FILE does not exist or is empty. Exiting."  1>&2
+-	exit 1
+-fi
+-
+-cat $FILE | sed -e "s/md\.name/md.miscellaneous.name/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.spcvx/md.diagnostic.spcvx/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.spcvy/md.diagnostic.spcvy/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.spcvz/md.diagnostic.spcvz/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.spctemperature/md.thermal.spctemperature/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.spcthickness/md.balancethickness.spcthickness/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.bamg/md.private.bamg/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.numberofgrids/md.mesh.numberofvertices/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.vx_obs/md.inversion.vx_obs/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.vy_obs/md.inversion.vy_obs/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.vel_obs/md.inversion.vel_obs/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.vx/md.initialization.vx/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.vy/md.initialization.vy/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.vz/md.initialization.vz/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.vel/md.initialization.vel/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.temperature/md.initialization.temperature/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.pressure/md.initialization.pressure/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.thickness_obs/md.inversion.thickness_obs/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.thickness/md.geometry.thickness/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.bed/md.geometry.bed/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.bathymetry/md.geometry.bathymetry/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.surface_mass_balance/md.surfaceforcings.mass_balance/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.surface=/md.geometry.surface=/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.surface /md.geometry.surface /g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.surface,/md.geometry.surface,/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.surface;/md.geometry.surface;/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.x/md.mesh.x/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.yts/md.constants.yts/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.y/md.mesh.y/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.z/md.mesh.z/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.lat/md.mesh.lat/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.long/md.mesh.long/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.hemisphere/md.mesh.hemisphere/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.numberofnodes/md.mesh.numberofvertices/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.numberofelements/md.mesh.numberofelements/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.drag_coefficient/md.friction.coefficient/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.drag_p/md.friction.p/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.drag_q/md.friction.q/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/setelementstype/setflowequation/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/geography(md/setmask(md/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.rheology_B/md.materials.rheology_B/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.rho_ice/md.materials.rho_ice/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.rho_water/md.materials.rho_water/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.nodeonbed/md.mesh.vertexonbed/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.nodeonboundary/md.mesh.vertexonboundary/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.petscoptions/md.solver/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.dhdt/md.balancethickness.thickening_rate/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.eps_rel/md.diagnostic.reltol/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.eps_res/md.diagnostic.restol/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.eps_abs/md.diagnostic.abstol/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.eps_cm/md.inversion.cost_function_threshold/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.cm_responses/md.inversion.cost_functions/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.nsteps/md.inversion.nsteps/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.weights/md.inversion.cost_functions_coefficients/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.optscal/md.inversion.gradient_scaling/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.cm_jump/md.inversion.step_threshold/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.control_type/md.inversion.control_parameters/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.waitonlock/md.settings.waitonlock/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.cm_min/md.inversion.min_parameters/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.cm_max/md.inversion.max_parameters/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.maxiter/md.inversion.maxiter_per_step/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.control_type/md.inversion.control_parameters/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.control_type/md.inversion.control_parameters/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.min_thermal_constraints/md.thermal.penalty_threshold/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.control_analysis/md.inversion.iscontrol/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/SurfaceAbsVelMisfitEnum/101/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/SurfaceRelVelMisfitEnum/102/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/SurfaceLogVelMisfitEnum/103/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/SurfaceLogVxVyMisfitEnum/104/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/SurfaceAverageVelMisfitEnum/105/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/ThicknessAbsMisfitEnum/201/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/DragCoefficientAbsGradientEnum/501/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/RheologyBbarAbsGradientEnum/502/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/ThicknessAbsGradientEnum/503/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/DragCoefficientEnum/{'FrictionCoefficient'}/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.elementoniceshelf/md.mask.elementonfloatingice/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.nodeoniceshelf/md.mask.vertexonfloatingice/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.elementonicesheet/md.mask.elementongroundedice/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.nodeonicesheet/md.mask.vertexongroundedice/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.elements/md.mesh.elements/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.rheology_n/md.materials.rheology_n/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.gl_migration/md.groundingline.migration/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.hydrostatic_adjustment/md.prognostic.hydrostatic_adjustment/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.rheology_law/md.materials.rheology_law/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.basal_melting_rate/md.basalforcings.melting_rate/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+-cat $FILE | sed -e "s/md\.geothermalflux/md.basalforcings.geothermalflux/g" > $FILE$$.bak && mv $FILE$$.bak $FILE
+Index: ../trunk-jpl/scripts/sync.sh
+===================================================================
+--- ../trunk-jpl/scripts/sync.sh	(revision 17922)
++++ ../trunk-jpl/scripts/sync.sh	(revision 17923)
+@@ -1,100 +0,0 @@
+-#!/bin/bash
+-
+-#This shell tries to synchronize the current cielo root directory on another 
+-#machine. 
+-
+-echo "Watch out, this script should be run in top level directory of cielo"
+-
+-echo -n "Platform (cosmos,mustang,gemini,pleiades)?: "
+-read platform 
+-
+-
+-if [[ "$platform" ==  "cosmos" ]]
+-then
+-	echo "Synchronizing cielo with cosmos"
+-	#first cleanup the archive
+-	cl
+-	clb
+-	cls
+-	#then tar the archive
+-	present_directory=`pwd`;
+-	cd ../
+-	rm -rf trunk.tar.gz
+-	tar zcvf trunk.tar.gz trunk
+-
+-	#send archive to cosmos
+-	scp  trunk.tar.gz larour@cosmos.jpl.nasa.gov:/home/larour
+-
+-	#run synchronization script on cosmos
+-	ssh larour@cosmos.jpl.nasa.gov './sync_cosmos.sh'
+-
+-	rm -rf trunk.tar.gz
+-elif [[ "$platform" ==  "mustang" ]]
+-then
+-	
+-	echo "Synchronizing cielo with mustang"
+-	#first cleanup the archive
+-	cl
+-	clb
+-	cls
+-	#then tar the archive
+-	present_directory=`pwd`;
+-	cd ../
+-	rm -rf trunk.tar.gz
+-	tar zcvf trunk.tar.gz trunk
+-
+-	#send archive to mustang
+-	scp  trunk.tar.gz larour@mustang.jpl.nasa.gov:/proj/ice/larour/Ice/
+-
+-	#run synchronization script on cosmos
+-	ssh larour@mustang.jpl.nasa.gov './sync_mustang.sh'
+-
+-	rm -rf trunk.tar.gz
+-elif [[ "$platform" ==  "gemini" ]]
+-then
+-	echo "Synchronizing cielo with gemini"
+-
+-	rm -rf Synchronisation
+-	mkdir Synchronisation
+-	cd Synchronisation
+-	svn co svn+ssh://mustang.jpl.nasa.gov/proj/ice/issm/issm/trunk
+-
+-	#then tar the archive
+-	tar zcvf trunk.tar.gz trunk/
+-
+-	#send archive to cosmos
+-	scp  trunk.tar.gz larour@gemini.jpl.nasa.gov:/home/larour
+-
+-	#run synchronization script on cosmos
+-	ssh larour@gemini.jpl.nasa.gov './sync_gemini.sh' 
+-
+-	#exit 
+-	cd ..
+-	rm -rf Synchronisation
+-
+-elif [[ "$platform" ==  "pleiades" ]]
+-then
+-	echo "Synchronizing issm with pleiades"
+-
+-	rm -rf Synchronisation
+-	mkdir Synchronisation
+-	cd Synchronisation
+-	svn co svn+ssh://mustang.jpl.nasa.gov/proj/ice/issm/issm/trunk
+-
+-	#then tar the archive
+-	tar zcvf trunk.tar.gz trunk/
+-
+-	#send archive to cosmos
+-	scp  trunk.tar.gz elarour@pfe:/home1/elarour
+-
+-	#run synchronization script on cosmos
+-	ssh elarour@pfe './sync_pleiades.sh'
+-
+-	#exit 
+-	cd ..
+-	rm -rf Synchronisation
+-
+-else
+-	echo "This platform not supported yet"
+-	exit
+-fi
Index: /issm/oecreview/Archive/17802-17983/ISSM-17923-17924.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17923-17924.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17923-17924.diff	(revision 17986)
@@ -0,0 +1,364 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17924)
+@@ -31,8 +31,6 @@
+ 
+ 	int    stabilization,finiteelement,smb_model;
+ 	bool   dakota_analysis;
+-	bool   issmbgradients;
+-	bool   ispdd;
+ 	bool   isdelta18o;
+ 	bool   isgroundingline;
+ 	bool   islevelset;
+Index: ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp	(revision 17924)
+@@ -118,7 +118,6 @@
+ 	}
+ 
+ 	/*Intermediaries */
+-	int         input_enum;
+ 	IssmDouble  Jdet,thickness,slope[2];
+ 	IssmDouble  taud_y,norms,normv,vx,vy;
+ 	IssmDouble *xyz_list  = NULL;
+Index: ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp	(revision 17924)
+@@ -111,7 +111,7 @@
+ 	
+ 	/*Intermediaries */
+ 	const int dim = 2;
+-	int        i,row,col,stabilization;
++	int        row,col,stabilization;
+ 	IssmDouble Jdet,D_scalar;
+ 	IssmDouble dtau = 1.;
+ 	IssmDouble mu = 1.;
+@@ -398,7 +398,7 @@
+ void LsfReinitializationAnalysis::SetDistanceOnIntersectedElements(FemModel* femmodel){/*{{{*/
+ 
+ 	/* Intermediaries */
+-	int i,k;
++	int i;
+ 	IssmDouble dmaxp,dmaxm,val;
+ 	Element* element;
+ 
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17924)
+@@ -3197,7 +3197,7 @@
+ 
+ 	/*Intermediaries*/
+ 	bool        mainlyfloating;
+-	int         i,dim,domaintype,epssize;
++	int         dim,domaintype;
+ 	int         migration_style,point1;
+ 	IssmDouble  alpha2,Jdet,fraction1,fraction2;
+ 	IssmDouble  gllevelset,phi=1.;
+@@ -5259,7 +5259,7 @@
+ ElementVector* StressbalanceAnalysis::CreatePVectorCouplingHOFSFriction(Element* element){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int         i,j,approximation;
++	int         i,approximation;
+ 	int         dim=3;
+ 	IssmDouble  Jdet,Jdet2d,FSreconditioning;
+ 	IssmDouble	bed_normal[3];
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp	(revision 17924)
+@@ -148,7 +148,7 @@
+ 	/*Intermediaries*/
+ 	bool isv1,isv2;
+ 	int  facenbv,v1,v2;
+-	int  id_edge,id_element,id_face;
++	int  id_edge,id_element;
+ 	int  elementnbe;
+ 
+ 	/*Mesh dependent variables*/
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp	(revision 17924)
+@@ -18,10 +18,10 @@
+ void CreateParameters(Parameters* parameters,IoModel* iomodel,char* rootpath,FILE* toolkitsoptionsfid,const int solution_type){
+ 
+ 	int         i,j,m,k;
+-	int         numoutputs,domaintype,materialtype,smb_model;
++	int         numoutputs,materialtype,smb_model;
+ 	char**      requestedoutputs = NULL;
+ 	IssmDouble  time;
+-	bool        ispdd,isdelta18o;
++	bool        isdelta18o;
+ 
+ 	/*parameters for mass flux:*/
+ 	int          mass_flux_num_profiles     = 0;
+Index: ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp	(revision 17924)
+@@ -32,7 +32,6 @@
+ void IoModelToConstraintsx(Constraints* constraints,IoModel* iomodel,IssmDouble* spcdata,int M,int N,int analysis_type,int finite_element,int dof){
+ 
+ 	/*intermediary: */
+-	bool        isnan;
+ 	int         i,j,count,elementnbv,numfacevertices;
+ 	IssmDouble  value;
+ 	IssmDouble *times            = NULL;
+@@ -40,7 +39,7 @@
+ 	bool        spcpresent       = false;
+ 
+ 	/*Higher-order finite elements*/
+-	int   v1,v2,v3,v4;
++	int   v1,v2;
+ 	bool *my_edges = NULL;
+ 	bool *my_faces = NULL;
+ 	bool *boundaryedge = NULL;
+Index: ../trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp	(revision 17924)
+@@ -199,7 +199,7 @@
+ 	/*Variables*/
+ 	ISSM_MPI_Comm  comm;
+ 	int            num_procs;
+-	int            i,j;
++	int            i;
+ 	int            nnz,local_nnz;
+ 	int           *irn_loc    = NULL;
+ 	int           *jcn_loc    = NULL;
+@@ -216,9 +216,9 @@
+ 	comm      = IssmComm::GetComm();
+ 
+ 	/*First, some checks*/
+-	if (Kff_M!=Kff_N)_error_("stiffness matrix Kff should be square");
+-	if (uf_M!=Kff_M || uf_M!=pf_M)_error_("solution vector should be the same size as stiffness matrix Kff and load vector pf");
+-	if (uf_m!=Kff_m || uf_m!=pf_m)_error_("solution vector should be locally the same size as stiffness matrix Kff and load vector pf");
++	if(Kff_M!=Kff_N)_error_("stiffness matrix Kff should be square");
++	if(uf_M!=Kff_M || uf_M!=pf_M)_error_("solution vector should be the same size as stiffness matrix Kff and load vector pf");
++	if(uf_m!=Kff_m || uf_m!=pf_m)_error_("solution vector should be locally the same size as stiffness matrix Kff and load vector pf");
+ 
+ 	/*Initialize matrix */
+ 	/*figure out number of non-zero entries: */
+Index: ../trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h
+===================================================================
+--- ../trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h	(revision 17923)
++++ ../trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h	(revision 17924)
+@@ -140,15 +140,12 @@
+ 		/*FUNCTION Echo{{{*/
+ 		void Echo(void){
+ 
+-			int my_rank;
+-			int i,j,k;
+-
+ 			/*Do a synchronized dump across all the rows: */
+-			my_rank=IssmComm::GetRank();
+-			for(i=0;i<IssmComm::GetSize();i++){
+-				if (my_rank==i){
++			int my_rank=IssmComm::GetRank();
++			for(int i=0;i<IssmComm::GetSize();i++){
++				if(my_rank==i){
+ 					_printf_("cpu " << i << " #rows: " << this->m << "\n");
+-					for (j=0;j<this->m;j++){
++					for(int j=0;j<this->m;j++){
+ 						_printf_("row " << j << ":");
+ 						this->matrix[j]->Echo();
+ 						_printf_("\n");
+@@ -189,7 +186,6 @@
+ 			int           this_row_numvalues;
+ 			int*          this_row_cols       = NULL;
+ 			int*          this_row_mods       = NULL;
+-			doubletype*   this_row_values     = NULL;
+ 			int*          numvalues_perrow    = NULL;
+ 			int           row;
+ 			
+@@ -377,7 +373,7 @@
+ 
+ 			doubletype norm,local_norm;
+ 			doubletype absolute;
+-			int i,j;
++			int i;
+ 
+ 			switch(mode){
+ 				case NORM_INF:
+@@ -420,9 +416,6 @@
+ 		/*FUNCTION MatMult{{{*/
+ 		void MatMult(IssmAbsVec<doubletype>* Xin,IssmAbsVec<doubletype>* AXin){
+ 
+-			int         i,j;
+-			doubletype *X_serial  = NULL;
+-
+ 			/*A check on the types: */
+ 			if(IssmVecTypeFromToolkitOptions()!=MpiEnum)_error_("MatMult operation only possible with 'mpi' vectors");
+ 
+@@ -431,11 +424,11 @@
+ 			IssmMpiVec<doubletype>* AX=(IssmMpiVec<doubletype>*)AXin;
+ 
+ 			/*Serialize input Xin: */
+-			X_serial=X->ToMPISerial();
++			doubletype* X_serial=X->ToMPISerial();
+ 
+ 			/*Every cpu has a serial version of the input vector. Use it to do the Matrix-Vector multiply 
+ 			 *locally and plug it into AXin: */
+-			for(i=0;i<this->m;i++){
++			for(int i=0;i<this->m;i++){
+ 				AX->vector[i]=this->matrix[i]->Mult(X_serial);
+ 			}
+ 
+Index: ../trunk-jpl/src/c/cores/transient_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/cores/transient_core.cpp	(revision 17924)
+@@ -19,16 +19,15 @@
+ void transient_core(FemModel* femmodel){
+ 
+ 	/*parameters: */
+-	int    i;
+ 	IssmDouble starttime,finaltime,dt,yts;
+-	bool   isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset,isdamageevolution,ishydrology;
+-	bool   save_results,dakota_analysis;
+-	bool   time_adapt=false;
+-	int    output_frequency;
+-	int    domaintype,groundingline_migration,smb_model;
+-	int    numoutputs         = 0;
+-  Analysis *analysis = NULL;
+-	char** requested_outputs = NULL;
++	bool       isstressbalance,ismasstransport,isFS,isthermal,isgroundingline,isgia,islevelset,isdamageevolution,ishydrology;
++	bool       save_results,dakota_analysis;
++	bool       time_adapt=false;
++	int        output_frequency;
++	int        domaintype,groundingline_migration;
++	int        numoutputs         = 0;
++	Analysis  *analysis = NULL;
++	char**     requested_outputs = NULL;
+ 
+ 
+ 	/*intermediary: */
+Index: ../trunk-jpl/src/c/cores/masstransport_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/cores/masstransport_core.cpp	(revision 17924)
+@@ -12,10 +12,9 @@
+ void masstransport_core(FemModel* femmodel){
+ 
+ 	/*parameters: */
+-	int    i;
+ 	int    numoutputs,domaintype;
+ 	bool   save_results;
+-	bool   issmbgradients,ispdd,isdelta18o,isFS,isfreesurface,dakota_analysis;
++	bool   isFS,isfreesurface,dakota_analysis;
+ 	int    solution_type;
+ 	char** requested_outputs = NULL;
+ 
+Index: ../trunk-jpl/src/c/cores/steadystate_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/steadystate_core.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/cores/steadystate_core.cpp	(revision 17924)
+@@ -20,7 +20,6 @@
+ void steadystate_core(FemModel* femmodel){
+ 
+ 	/*intermediary: */
+-	int i;
+ 	int step; 
+ 	Vector<IssmDouble>* ug     = NULL;
+ 	Vector<IssmDouble>* ug_old = NULL;
+Index: ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17924)
+@@ -127,8 +127,7 @@
+ void simul(long* indic,long* n,double* X,double* pf,double* G,long izs[1],float rzs[1],void* dzs){
+ 
+ 	/*Recover Femmodel*/
+-	double      f;
+-	int         intn,solution_type;
++	int         solution_type;
+ 	FemModel   *femmodel  = (FemModel*)dzs;
+ 
+ 	/*Recover responses*/
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17924)
+@@ -20,7 +20,6 @@
+ /*FUNCTION Matpar::Matpar(int matpar_mid,IoModel* iomodel){{{*/
+ Matpar::Matpar(int matpar_mid, IoModel* iomodel){
+ 
+-	bool ispdd;
+ 	bool isefficientlayer;
+ 	int  hydrology_model,smb_model;
+ 	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+Index: ../trunk-jpl/src/c/classes/kriging/Observations.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/classes/kriging/Observations.cpp	(revision 17924)
+@@ -352,7 +352,6 @@
+ 	/*Intermediaries*/
+ 	int           i,j,n_obs;
+ 	IssmPDouble   prediction,error;
+-	IssmPDouble   numerator,denominator,ratio;
+ 	IssmPDouble  *x      = NULL;
+ 	IssmPDouble  *y      = NULL;
+ 	IssmPDouble  *obs    = NULL;
+Index: ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/classes/Loads/Riftfront.cpp	(revision 17924)
+@@ -38,11 +38,8 @@
+ 	int    riftfront_node_ids[2];
+ 	int    riftfront_elem_ids[2];
+ 	int    riftfront_matpar_id;
+-	int    riftfront_type;
+-	int    riftfront_fill;
+ 	IssmDouble riftfront_friction;
+ 	IssmDouble riftfront_fractionincrement;
+-	bool   riftfront_shelf;
+ 	int    penalty_lock;
+ 
+ 	/*intermediary: */
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17924)
+@@ -592,7 +592,7 @@
+ void Element::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){/*{{{*/
+ 
+ 	/*Intermediaries*/
+-	int        i,t,row;
++	int        i,t;
+ 	IssmDouble time;
+ 
+ 	/*Branch on type of vector: nodal or elementary: */
+Index: ../trunk-jpl/src/c/classes/IoModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17923)
++++ ../trunk-jpl/src/c/classes/IoModel.cpp	(revision 17924)
+@@ -285,7 +285,6 @@
+ /*FUNCTION IoModel::StartTrace{{{*/
+ void IoModel::StartTrace(void){
+ 
+-	int  i;
+ 	bool autodiff = false;
+ 	bool keep=false;
+ 	IssmDouble gcTriggerRatio;
+Index: ../trunk-jpl/src/c/classes/Massfluxatgate.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 17923)
++++ ../trunk-jpl/src/c/classes/Massfluxatgate.h	(revision 17924)
+@@ -30,9 +30,9 @@
+ 		/*Massfluxatgate constructors, destructors :*/
+ 		/*FUNCTION Massfluxatgate() {{{*/
+ 		Massfluxatgate(){
+-			this->name     = 0;
+-			this->numsegments     = 0;
+-			this->segments   = 0;
++			this->name        = 0;
++			this->numsegments = 0;
++			this->segments    = 0;
+ 		}
+ 		/*}}}*/
+ 		/*FUNCTION Massfluxatgate(char* name, int numsegments, doubletype* segments) {{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17924-17925.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17924-17925.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17924-17925.diff	(revision 17986)
@@ -0,0 +1,372 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17924)
++++ ../trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp	(revision 17925)
+@@ -404,7 +404,7 @@
+ 			slope2=slope[0]*slope[0]+slope[1]*slope[1];
+ 			constant_part=-2.*pow(rho_ice*gravity,n)*pow(slope2,((n-1.)/2.));
+ 
+-			z = element->GetZcoord(gauss);
++			z = element->GetZcoord(xyz_list,gauss);
+ 			element->JacobianDeterminantLine(&Jdet,&xyz_list_line[0][0],gauss);
+ 
+ 			if(element->IsOnSurface()){
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17924)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17925)
+@@ -2334,9 +2334,9 @@
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctions(basis, gauss);
+ 
+-		x_coord=element->GetXcoord(gauss);
+-		y_coord=element->GetYcoord(gauss);
+-		if(dim==3) z_coord=element->GetZcoord(gauss);
++		x_coord=element->GetXcoord(xyz_list,gauss);
++		y_coord=element->GetYcoord(xyz_list,gauss);
++		if(dim==3) z_coord=element->GetZcoord(xyz_list,gauss);
+ 		else z_coord=0.;
+ 
+ 		forcex=fx(x_coord,y_coord,z_coord,FSANALYTICAL);
+@@ -2471,8 +2471,8 @@
+ 
+ 		gauss->GaussPoint(ig);
+ 		surface_input->GetInputValue(&surface,gauss);
+-		if(dim==3) z=element->GetZcoord(gauss);
+-		else       z=element->GetYcoord(gauss);
++		if(dim==3) z=element->GetZcoord(xyz_list,gauss);
++		else       z=element->GetYcoord(xyz_list,gauss);
+ 		element->NodalFunctions(basis,gauss);
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 
+@@ -3091,9 +3091,9 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		x_coord=element->GetXcoord(gauss);
+-		y_coord=element->GetYcoord(gauss);
+-		if(dim==3) z_coord=element->GetZcoord(gauss);
++		x_coord=element->GetXcoord(xyz_list,gauss);
++		y_coord=element->GetYcoord(xyz_list,gauss);
++		if(dim==3) z_coord=element->GetZcoord(xyz_list,gauss);
+ 		else z_coord=0.;
+ 
+ 		alpha2=alpha(x_coord,y_coord,z_coord,FSANALYTICAL);
+@@ -3152,9 +3152,9 @@
+ 		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 		element->NodalFunctionsVelocity(vbasis,gauss);
+ 
+-		x_coord=element->GetXcoord(gauss);
+-		y_coord=element->GetYcoord(gauss);
+-		if(dim==3) z_coord=element->GetZcoord(gauss);
++		x_coord=element->GetXcoord(xyz_list,gauss);
++		y_coord=element->GetYcoord(xyz_list,gauss);
++		if(dim==3) z_coord=element->GetZcoord(xyz_list,gauss);
+ 		else z_coord=0.;
+ 
+ 		forcex=fx(x_coord,y_coord,z_coord,FSANALYTICAL);
+@@ -3669,8 +3669,8 @@
+ 		element->JacobianDeterminantSurface(&Jdet,xyz_list_front,gauss);
+ 		element->NodalFunctionsVelocity(vbasis,gauss);
+ 		surface_input->GetInputValue(&surface,gauss);
+-		if(dim==3) z=element->GetZcoord(gauss);
+-		else       z=element->GetYcoord(gauss);
++		if(dim==3) z=element->GetZcoord(xyz_list,gauss);
++		else       z=element->GetYcoord(xyz_list,gauss);
+ 		pressure = rho_water*gravity*min(0.,z);//0 if the gaussian point is above water level
+ 
+ 		for (int i=0;i<vnumnodes;i++){
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17925)
+@@ -90,6 +90,9 @@
+ 		void       GetVerticesCoordinates(IssmDouble** xyz_list);
+ 		void       GetVerticesSidList(int* sidlist);
+ 		void       GetVerticesConnectivityList(int* connectivitylist);
++		IssmDouble GetXcoord(IssmDouble* xyz_list,Gauss* gauss);
++		IssmDouble GetYcoord(IssmDouble* xyz_list,Gauss* gauss);
++		IssmDouble GetZcoord(IssmDouble* xyz_list,Gauss* gauss);
+ 		bool       HasNodeOnBase();
+ 		bool       HasNodeOnSurface();
+ 		int        Id();
+@@ -193,9 +196,7 @@
+ 		virtual Node*  GetNode(int node_number)=0;
+ 		virtual void   GetVerticesCoordinatesBase(IssmDouble** xyz_list)=0;
+ 		virtual void   GetVerticesCoordinatesTop(IssmDouble** xyz_list)=0;
+-		virtual IssmDouble GetXcoord(Gauss* gauss)=0;
+-		virtual IssmDouble GetYcoord(Gauss* gauss)=0;
+-		virtual IssmDouble GetZcoord(Gauss* gauss)=0;
++
+ 		virtual int    GetElementType(void)=0;
+ 
+ 		virtual IssmDouble SurfaceArea(void)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17925)
+@@ -985,34 +985,6 @@
+ 	return this->nodes[node_number];
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::GetXcoord {{{*/
+-IssmDouble Tria::GetXcoord(Gauss* gauss){
+-
+-	IssmDouble x;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble x_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(int i=0;i<NUMVERTICES;i++) x_list[i]=xyz_list[i][0];
+-	TriaRef::GetInputValue(&x,x_list,gauss,P1Enum);
+-
+-	return x;
+-}
+-/*}}}*/
+-/*FUNCTION Tria::GetYcoord {{{*/
+-IssmDouble Tria::GetYcoord(Gauss* gauss){
+-
+-	IssmDouble y;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble y_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(int i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
+-	TriaRef::GetInputValue(&y,y_list,gauss,P1Enum);
+-
+-	return y;
+-}
+-/*}}}*/
+ /*FUNCTION Tria::InputDepthAverageAtBase {{{*/
+ void  Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17925)
+@@ -183,9 +183,6 @@
+ 		IssmDouble     GetArea(void);
+ 		void           GetAreaCoordinates(IssmDouble *area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints);
+ 		int            GetElementType(void);
+-		IssmDouble     GetXcoord(Gauss* gauss);
+-		IssmDouble     GetYcoord(Gauss* gauss);
+-		IssmDouble     GetZcoord(Gauss* gauss){_error_("not implemented");};
+ 		void           NormalSection(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalTop(IssmDouble* normal,IssmDouble* xyz_list);
+ 		void           NormalBase(IssmDouble* normal,IssmDouble* xyz_list);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17925)
+@@ -1055,51 +1055,6 @@
+ 	return tau_parameter;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetXcoord {{{*/
+-IssmDouble Penta::GetXcoord(Gauss* gauss){
+-
+-	int    i;
+-	IssmDouble x;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble x_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) x_list[i]=xyz_list[i][0];
+-	PentaRef::GetInputValue(&x,x_list,gauss,P1Enum);
+-
+-	return x;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetYcoord {{{*/
+-IssmDouble Penta::GetYcoord(Gauss* gauss){
+-
+-	int    i;
+-	IssmDouble y;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble y_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) y_list[i]=xyz_list[i][1];
+-	PentaRef::GetInputValue(&y,y_list,gauss,P1Enum);
+-
+-	return y;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetZcoord {{{*/
+-IssmDouble Penta::GetZcoord(Gauss* gauss){
+-
+-	int    i;
+-	IssmDouble z;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble z_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2];
+-	PentaRef::GetInputValue(&z,z_list,gauss,P1Enum);
+-
+-	return z;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::ZeroLevelsetCoordinates{{{*/
+ void Penta::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
+ 	/*Compute portion of the element that is grounded*/ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17925)
+@@ -79,9 +79,6 @@
+ 		int    GetNumberOfNodes(void);
+ 		int    GetNumberOfVertices(void);
+ 		void   GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type);
+-		IssmDouble GetXcoord(Gauss* gauss);
+-		IssmDouble GetYcoord(Gauss* gauss);
+-		IssmDouble GetZcoord(Gauss* gauss);
+ 		void   GetVerticesCoordinatesBase(IssmDouble** pxyz_list);
+ 		void   GetVerticesCoordinatesTop(IssmDouble** pxyz_list);
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17925)
+@@ -271,51 +271,6 @@
+ 	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
+-/*FUNCTION Tetra::GetXcoord {{{*/
+-IssmDouble Tetra::GetXcoord(Gauss* gauss){
+-
+-	int    i;
+-	IssmDouble z;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble z_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][0];
+-	TetraRef::GetInputValue(&z,&z_list[0],(GaussTetra*)gauss,P1Enum);
+-
+-	return z;
+-}
+-/*}}}*/
+-/*FUNCTION Tetra::GetYcoord {{{*/
+-IssmDouble Tetra::GetYcoord(Gauss* gauss){
+-
+-	int    i;
+-	IssmDouble z;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble z_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][1];
+-	TetraRef::GetInputValue(&z,&z_list[0],(GaussTetra*)gauss,P1Enum);
+-
+-	return z;
+-}
+-/*}}}*/
+-/*FUNCTION Tetra::GetZcoord {{{*/
+-IssmDouble Tetra::GetZcoord(Gauss* gauss){
+-
+-	int    i;
+-	IssmDouble z;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble z_list[NUMVERTICES];
+-
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	for(i=0;i<NUMVERTICES;i++) z_list[i]=xyz_list[i][2];
+-	TetraRef::GetInputValue(&z,&z_list[0],(GaussTetra*)gauss,P1Enum);
+-
+-	return z;
+-}
+-/*}}}*/
+ /*FUNCTION Tetra::HasFaceOnBase{{{*/
+ bool Tetra::HasFaceOnBase(){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17925)
+@@ -109,9 +109,6 @@
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+-		IssmDouble  GetXcoord(Gauss* gauss){_error_("Not implemented");};
+-		IssmDouble  GetYcoord(Gauss* gauss){_error_("Not implemented");};
+-		IssmDouble  GetZcoord(Gauss* gauss){_error_("not implemented yet");};
+ 		int         GetElementType(void){_error_("not implemented yet");};
+ 		Gauss*      NewGauss(void);
+ 		Gauss*      NewGauss(int order);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17925)
+@@ -114,9 +114,6 @@
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
+ 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
+ 		Node*       GetNode(int node_number){_error_("Not implemented");};
+-		IssmDouble  GetXcoord(Gauss* gauss);
+-		IssmDouble  GetYcoord(Gauss* gauss);
+-		IssmDouble  GetZcoord(Gauss* gauss);
+ 		int         GetElementType(void);
+ 		Gauss*      NewGauss(void);
+ 		Gauss*      NewGauss(int order);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17924)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17925)
+@@ -573,6 +573,48 @@
+ 	for(int i=0;i<numvertices;i++) connectivity[i]=this->vertices[i]->Connectivity();
+ }
+ /*}}}*/
++IssmDouble Element::GetXcoord(IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++
++	/*output*/
++	IssmDouble x;
++
++	/*Create list of x*/
++	int         numvertices = this->GetNumberOfVertices();
++	IssmDouble* x_list      = xNew<IssmDouble>(numvertices);
++
++	for(int i=0;i<numvertices;i++) x_list[i]=xyz_list[i*3+0];
++	ValueP1OnGauss(&x,x_list,gauss);
++
++	return x;
++}/*}}}*/
++IssmDouble Element::GetYcoord(IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++
++	/*output*/
++	IssmDouble y;
++
++	/*Create list of y*/
++	int         numvertices = this->GetNumberOfVertices();
++	IssmDouble* y_list      = xNew<IssmDouble>(numvertices);
++
++	for(int i=0;i<numvertices;i++) y_list[i]=xyz_list[i*3+1];
++	ValueP1OnGauss(&y,y_list,gauss);
++
++	return y;
++}/*}}}*/
++IssmDouble Element::GetZcoord(IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
++
++	/*output*/
++	IssmDouble z;
++
++	/*Create list of z*/
++	int         numvertices = this->GetNumberOfVertices();
++	IssmDouble* z_list      = xNew<IssmDouble>(numvertices);
++
++	for(int i=0;i<numvertices;i++) z_list[i]=xyz_list[i*3+2];
++	ValueP1OnGauss(&z,z_list,gauss);
++
++	return z;
++}/*}}}*/
+ bool Element::HasNodeOnBase(){/*{{{*/
+ 	return (this->inputs->Max(MeshVertexonbaseEnum)>0.);
+ }/*}}}*/
+@@ -1099,7 +1141,7 @@
+ 	/*Get tau_perp*/
+ 	surface_input->GetInputValue(&s,gauss);
+ 	surface_input->GetInputDerivativeValue(&slope[0],xyz_list,gauss);
+-	z=GetZcoord(gauss);
++	z=this->GetZcoord(xyz_list,gauss);
+ 	tau_perp = matpar->GetRhoIce() * matpar->GetG() * fabs(s-z)*sqrt(slope[0]*slope[0]+slope[1]*slope[1]);
+ 
+ 	/* Get eps_b*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17925-17926.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17925-17926.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17925-17926.diff	(revision 17986)
@@ -0,0 +1,801 @@
+Index: ../trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.cpp	(revision 17926)
+@@ -1,37 +0,0 @@
+-/*!\file ComputeStrainRatex
+- * \brief: compute pressure according to each element
+- */
+-
+-#include "./ComputeStrainRatex.h"
+-
+-#include "../../shared/shared.h"
+-#include "../../toolkits/toolkits.h"
+-
+-void	ComputeStrainRatex(Vector<IssmDouble>** peps,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
+-
+-	/*Intermediary*/
+-	int      numberofelements;
+-	Element* element=NULL;
+-
+-	/*output: */
+-	Vector<IssmDouble>* eps=NULL;
+-
+-	/*Recover numberofelements: */
+-	parameters->FindParam(&numberofelements,MeshNumberofelementsEnum);
+-
+-	/*Allocate eps on numberofelements (only 1 dof): */
+-	eps=new Vector<IssmDouble>(numberofelements);
+-
+-	/*Compute basal stress for each element: */
+-	for(int i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->ComputeStrainRate(eps);
+-	}
+-
+-	/*Assemble vector: */
+-	eps->Assemble();
+-
+-	/*Assign output pointers: */
+-	*peps=eps;
+-
+-}
+Index: ../trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h	(revision 17925)
++++ ../trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h	(revision 17926)
+@@ -1,13 +0,0 @@
+-/*!\file:  ComputeStrainRate.h
+- * \brief header file pressure computation
+- */ 
+-
+-#ifndef _COMPUTESTRAINRATEX_H
+-#define _COMPUTESTRAINRATEX_H
+-
+-#include "../../classes/classes.h"
+-
+-/* local prototypes: */
+-void	ComputeStrainRatex(Vector<IssmDouble>** eps_g,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
+-
+-#endif  /* _COMPUTESTRAINRATEX_H */
+Index: ../trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp	(revision 17926)
+@@ -1,37 +0,0 @@
+-/*!\file ComputeBasalStressx
+- * \brief: compute pressure according to each element
+- */
+-
+-#include "./ComputeBasalStressx.h"
+-
+-#include "../../shared/shared.h"
+-#include "../../toolkits/toolkits.h"
+-
+-void	ComputeBasalStressx( Vector<IssmDouble>** psigma,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
+-
+-	/*Intermediary*/
+-	IssmDouble numberofelements;
+-	Element*   element=NULL;
+-
+-	/*output: */
+-	Vector<IssmDouble>* sigma=NULL;
+-
+-	/*Recover numberofelements: */
+-	parameters->FindParam(&numberofelements,MeshNumberofelementsEnum);
+-
+-	/*Allocate sigma on numberofelements: */
+-	sigma=new Vector<IssmDouble>(reCast<int>(numberofelements));
+-
+-	/*Compute basal stress for each element: */
+-	for(int i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		element->ComputeBasalStress(sigma);
+-	}
+-
+-	/*Assemble vector: */
+-	sigma->Assemble();
+-
+-	/*Assign output pointers: */
+-	*psigma=sigma;
+-
+-}
+Index: ../trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h	(revision 17925)
++++ ../trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h	(revision 17926)
+@@ -1,13 +0,0 @@
+-/*!\file:  ComputeBasalStressx.h
+- * \brief header file pressure computation
+- */ 
+-
+-#ifndef _COMPUTEBASALSTRESSX_H
+-#define _COMPUTEBASALSTRESSX_H
+-
+-#include "../../classes/classes.h"
+-
+-/* local prototypes: */
+-void	ComputeBasalStressx( Vector<IssmDouble>** pp_g,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
+-
+-#endif  /* _COMPUTEBASALSTRESSX_H */
+Index: ../trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp	(revision 17926)
+@@ -1,66 +0,0 @@
+-/*!\file Reducevectorgtosx
+- * \brief reduce petsc vector from g set to s set (single point constraints), using the nodeset partitioning 
+- * vectors.
+- */
+-
+-#include "./Reducevectorgtosx.h"
+-
+-void Reducevectorgtosx(Vector<IssmDouble>** pys, Vector<IssmDouble>* yg, Nodes* nodes,Parameters* parameters){
+-
+-	/*output: */
+-	Vector<IssmDouble>* ys=NULL;
+-
+-	/*variables: */
+-	int i;
+-	int configuration_type;
+-	int ssize;
+-	IssmDouble* yg_serial=NULL;
+-
+-	/*first figure out ssize: */
+-	parameters->FindParam(&configuration_type,ConfigurationTypeEnum);
+-	ssize=nodes->NumberOfDofs(configuration_type,SsetEnum);
+-
+-	int analysis_type;
+-	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+-	int slocalsize = nodes->NumberOfDofsLocal(analysis_type,SsetEnum);
+-
+-	bool oldalloc = false;
+-
+-	if(ssize==0){
+-		ys=NULL;
+-	}
+-	else{
+-		/*allocate: */
+-		if(oldalloc)
+-		 ys=new Vector<IssmDouble>(ssize);
+-		else
+-		 ys=new Vector<IssmDouble>(slocalsize,ssize);
+-
+-		if(nodes->NumberOfNodes(configuration_type)){ 
+-
+-			/*serialize yg, so nodes can index into it: */
+-			yg_serial=yg->ToMPISerial();
+-
+-			/*Go throygh all nodes, and ask them to retrieve values from yg, and plyg them into ys: */
+-			for(i=0;i<nodes->Size();i++){
+-
+-				Node* node=(Node*)nodes->GetObjectByOffset(i);
+-
+-				/*Check that this node corresponds to our analysis currently being carried out: */
+-				if (node->InAnalysis(configuration_type)){
+-
+-					/*For this object, reduce values for enum set Fset: */
+-					node->VecReduce(ys,yg_serial,SsetEnum);
+-				}
+-			}
+-		}
+-		/*Assemble vector: */
+-		ys->Assemble();
+-	}
+-
+-	/*Free ressources:*/
+-	xDelete<IssmDouble>(yg_serial);
+-
+-	/*Assign output pointers:*/
+-	*pys=ys;
+-}
+Index: ../trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h	(revision 17925)
++++ ../trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h	(revision 17926)
+@@ -1,14 +0,0 @@
+-/*!\file:  Reducevectorgtosx.h
+- * \brief reduce petsc vector from g set to s set (single point constraints), using the nodeset partitioning 
+- * vectors.
+- */ 
+-
+-#ifndef _REDUCEVECTORGTOSX_H
+-#define _REDUCEVECTORGTOSX_H
+-
+-#include "../../classes/classes.h"
+-
+-/* local prototypes: */
+-void Reducevectorgtosx(Vector<IssmDouble>** pys, Vector<IssmDouble>* yg, Nodes* nodes,Parameters* parameters);
+-
+-#endif  /* _REDUCEVECTORGTOSX_H */
+Index: ../trunk-jpl/src/c/modules/modules.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/modules.h	(revision 17925)
++++ ../trunk-jpl/src/c/modules/modules.h	(revision 17926)
+@@ -13,8 +13,6 @@
+ #include "./BamgConvertMeshx/BamgConvertMeshx.h"
+ #include "./BamgTriangulatex/BamgTriangulatex.h"
+ #include "./Chacox/Chacox.h"
+-#include "./ComputeBasalStressx/ComputeBasalStressx.h"
+-#include "./ComputeStrainRatex/ComputeStrainRatex.h"
+ #include "./ConfigureObjectsx/ConfigureObjectsx.h"
+ #include "./ContourToMeshx/ContourToMeshx.h"
+ #include "./ContourToNodesx/ContourToNodesx.h"
+@@ -78,7 +76,6 @@
+ #include "./PointCloudFindNeighborsx/PointCloudFindNeighborsx.h"
+ #include "./PropagateFlagsFromConnectivityx/PropagateFlagsFromConnectivityx.h"
+ #include "./Reduceloadx/Reduceloadx.h"
+-#include "./Reducevectorgtosx/Reducevectorgtosx.h"
+ #include "./Reducevectorgtofx/Reducevectorgtofx.h"
+ #include "./ResetConstraintsx/ResetConstraintsx.h"
+ #include "./ResetFSBasalBoundaryConditionx/ResetFSBasalBoundaryConditionx.h"
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17925)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17926)
+@@ -318,10 +318,6 @@
+ 					./modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp\
+ 					./modules/ConfigureObjectsx/ConfigureObjectsx.h\
+ 					./modules/ConfigureObjectsx/ConfigureObjectsx.cpp\
+-					./modules/ComputeBasalStressx/ComputeBasalStressx.h\
+-					./modules/ComputeBasalStressx/ComputeBasalStressx.cpp\
+-					./modules/ComputeStrainRatex/ComputeStrainRatex.h\
+-					./modules/ComputeStrainRatex/ComputeStrainRatex.cpp\
+ 					./modules/SpcNodesx/SpcNodesx.h\
+ 					./modules/SpcNodesx/SpcNodesx.cpp\
+ 					./modules/SurfaceMassBalancex/SurfaceMassBalancex.h\
+@@ -838,8 +834,6 @@
+ 			./modules/ContourToMeshx/ContourToMeshx.h\
+ 			./modules/ContourToNodesx/ContourToNodesx.cpp\
+ 			./modules/ContourToNodesx/ContourToNodesx.h\
+-			./modules/Reducevectorgtosx/Reducevectorgtosx.cpp\
+-			./modules/Reducevectorgtosx/Reducevectorgtosx.h\
+ 			./modules/NodeConnectivityx/NodeConnectivityx.cpp\
+ 			./modules/NodeConnectivityx/NodeConnectivityx.h\
+ 			./modules/ElementConnectivityx/ElementConnectivityx.cpp\
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.cpp	(revision 17926)
+@@ -484,39 +484,6 @@
+ 	*pmu_prime=mu_prime;
+ }
+ /*}}}*/
+-/*FUNCTION Matice::GetViscosityDerivativeEpsSquareFS{{{*/
+-void  Matice::GetViscosityDerivativeEpsSquareFS(IssmDouble* pmu_prime, IssmDouble* epsilon){
+-
+-	/*output: */
+-	IssmDouble mu_prime;
+-	IssmDouble mu,n,eff2;
+-
+-	/*input strain rate: */
+-	IssmDouble exx,eyy,exy,exz,eyz,ezz;
+-
+-	if((epsilon[0]==0) && (epsilon[1]==0) && (epsilon[2]==0) && 
+-				(epsilon[3]==0) && (epsilon[4]==0) && (epsilon[5]==0)){
+-		mu_prime=0.5*pow(10.,14);
+-	}
+-	else{
+-		/*Retrive strain rate components: */
+-		exx=epsilon[0];
+-		eyy=epsilon[1];
+-		ezz=epsilon[2];
+-		exy=epsilon[3];
+-		exz=epsilon[4];
+-		eyz=epsilon[5];
+-		eff2 = exx*exx + eyy*eyy + exx*eyy + exy*exy + exz*exz + eyz*eyz;
+-
+-		GetViscosity(&mu,sqrt(eff2));
+-		n=GetN();
+-		mu_prime=(1-n)/(2*n) * mu/eff2;
+-	}
+-
+-	/*Assign output pointers:*/
+-	*pmu_prime=mu_prime;
+-}
+-/*}}}*/
+ /*FUNCTION Matice::GetViscosity2dDerivativeEpsSquare{{{*/
+ void  Matice::GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* epsilon){
+ 
+Index: ../trunk-jpl/src/c/classes/Materials/Material.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Materials/Material.h	(revision 17926)
+@@ -29,7 +29,6 @@
+ 		virtual void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosityDComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0;
+-		virtual void       GetViscosityDerivativeEpsSquareFS(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0;
+ 		virtual void       GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon)=0;
+ 		virtual IssmDouble GetA()=0;
+ 		virtual IssmDouble GetAbar()=0;
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17926)
+@@ -275,31 +275,11 @@
+ 	return g;
+ }
+ /*}}}*/
+-/*FUNCTION Matpar::GetHeatCapacity {{{*/
+-IssmDouble Matpar::GetHeatCapacity(){
+-	return heatcapacity;
+-}
+-/*}}}*/
+-/*FUNCTION Matpar::GetLatentHeat {{{*/
+-IssmDouble Matpar::GetLatentHeat(){
+-	return latentheat;
+-}
+-/*}}}*/
+ /*FUNCTION Matpar::GetMeltingPoint {{{*/
+ IssmDouble Matpar::GetMeltingPoint(){
+ 	return meltingpoint;
+ }
+ /*}}}*/
+-/*FUNCTION Matpar::GetReferenceTemperature {{{*/
+-IssmDouble Matpar::GetReferenceTemperature(){
+-	return referencetemperature;
+-}
+-/*}}}*/
+-/*FUNCTION Matpar::GetMixedLayerCapacity {{{*/
+-IssmDouble Matpar::GetMixedLayerCapacity(){
+-	return mixed_layer_capacity;
+-}
+-/*}}}*/
+ /*FUNCTION Matpar::GetRhoIce {{{*/
+ IssmDouble Matpar::GetRhoIce(){
+ 
+@@ -316,11 +296,6 @@
+ 	return rho_freshwater;
+ }
+ /*}}}*/
+-/*FUNCTION Matpar::GetMuWater {{{*/
+-IssmDouble Matpar::GetMuWater(){
+-	return mu_water;
+-}
+-/*}}}*/
+ /*FUNCTION Matpar::GetDesFac {{{*/
+ IssmDouble Matpar::GetDesFac(){
+ 	return desfac;
+@@ -331,53 +306,6 @@
+ 	return s0p;
+ }
+ /*}}}*/
+-/*FUNCTION Matpar::GetThermalConductivity {{{*/
+-IssmDouble Matpar::GetThermalConductivity(){
+-	return thermalconductivity;
+-}
+-/*}}}*/
+-/*FUNCTION Matpar::GetTemperateIceConductivity {{{*/
+-IssmDouble Matpar::GetTemperateIceConductivity(){
+-	return temperateiceconductivity;
+-}
+-/*}}}*/
+-/*FUNCTION Matpar::GetThermalExchangeVelocity {{{*/
+-IssmDouble Matpar::GetThermalExchangeVelocity(){
+-	return thermal_exchange_velocity;
+-}
+-/*}}}*/
+-/*FUNCTION Matpar::GetSedimentStoring {{{*/
+-IssmDouble Matpar::GetSedimentStoring(){
+-	return this->rho_freshwater * this->g * this->sediment_porosity * this->sediment_thickness *
+-    (this->water_compressibility + (this->sediment_compressibility / this->sediment_porosity));		 
+-}		 
+-/*}}}*/ 
+-/*FUNCTION Matpar::GetEplSpecificStoring {{{*/
+-IssmDouble Matpar::GetEplSpecificStoring(){
+-	return this->rho_freshwater * this->g * this->epl_porosity * 
+-    (this->water_compressibility + (this->epl_compressibility / this->epl_porosity));		 
+-}		 	 
+-/*}}}*/ 
+-/*FUNCTION Matpar::GetSedimentThickness {{{*/
+-IssmDouble Matpar::GetSedimentThickness(){
+-	return sediment_thickness;		 
+-}		 
+-/*}}}*/	
+-/*FUNCTION Matpar::GetEplInitialThickness {{{*/
+-IssmDouble Matpar::GetEplInitialThickness(){
+-	return epl_init_thickness;		 
+-}		 
+-/*}}}*/	
+-/*FUNCTION Matpar::GetEplMaxThickness {{{*/
+-IssmDouble Matpar::GetEplMaxThickness(){
+-	return epl_max_thickness;		 
+-}		 
+-/*}}}*/	
+-/*FUNCTION Matpar::GetEplConductivity {{{*/
+-IssmDouble Matpar::GetEplConductivity(){
+-	return epl_conductivity;		 
+-}		 
+-/*}}}*/			 
+ /*FUNCTION Matpar::TMeltingPoint {{{*/
+ IssmDouble Matpar::TMeltingPoint(IssmDouble pressure){
+ 	return meltingpoint-beta*pressure;
+Index: ../trunk-jpl/src/c/classes/Materials/Matice.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Materials/Matice.h	(revision 17926)
+@@ -58,7 +58,6 @@
+ 		void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon);
+ 		void       GetViscosityDComplement(IssmDouble*, IssmDouble*);
+ 		void       GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon);
+-		void       GetViscosityDerivativeEpsSquareFS(IssmDouble* pmu_prime, IssmDouble* pepsilon);
+ 		void       GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon);
+ 		IssmDouble GetA();
+ 		IssmDouble GetAbar();
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.h	(revision 17926)
+@@ -79,7 +79,6 @@
+ 		void       GetViscosityComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosityDComplement(IssmDouble* pviscosity_complement, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosityDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");};
+-		void       GetViscosityDerivativeEpsSquareFS(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");};
+ 		void       GetViscosity2dDerivativeEpsSquare(IssmDouble* pmu_prime, IssmDouble* pepsilon){_error_("not supported");};
+ 		IssmDouble GetA(){_error_("not supported");};
+ 		IssmDouble GetAbar(){_error_("not supported");};
+@@ -95,22 +94,8 @@
+ 		IssmDouble GetRhoIce();
+ 		IssmDouble GetRhoWater();
+ 		IssmDouble GetRhoFreshwater();
+-		IssmDouble GetMuWater();
+-		IssmDouble GetMixedLayerCapacity();
+-		IssmDouble GetThermalExchangeVelocity();
+-		IssmDouble GetHeatCapacity();
+-		IssmDouble GetThermalConductivity();
+-		IssmDouble GetTemperateIceConductivity();
+-		IssmDouble GetLatentHeat();
+ 		IssmDouble GetBeta();
+ 		IssmDouble GetMeltingPoint();
+-		IssmDouble GetReferenceTemperature();
+-		IssmDouble GetSedimentStoring();
+-		IssmDouble GetEplSpecificStoring();
+-		IssmDouble GetSedimentThickness();
+-		IssmDouble GetEplConductivity();
+-		IssmDouble GetEplInitialThickness();
+-		IssmDouble GetEplMaxThickness();
+ 		IssmDouble TMeltingPoint(IssmDouble pressure);
+ 		IssmDouble PureIceEnthalpy(IssmDouble pressure);
+ 		IssmDouble GetEnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure);
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17926)
+@@ -173,8 +173,6 @@
+ 		virtual void   NormalBase(IssmDouble* normal,IssmDouble* xyz_list)=0;
+ 
+ 		virtual Element* GetUpperElement(void)=0;
+-		virtual Element* GetLowerElement(void)=0;
+-		virtual Element* GetSurfaceElement(void)=0;
+ 		virtual Element* GetBasalElement(void)=0;
+ 
+ 		virtual void   JacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss)=0;
+@@ -248,7 +246,6 @@
+ 		virtual bool   IsFaceOnBoundary(void)=0;
+ 		virtual void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum)=0;
+ 		virtual void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum)=0;
+-		virtual void   GetNormalFromLSF(IssmDouble *pnormal)=0;
+ 
+ 		virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
+ 		virtual void   MinVel(IssmDouble* pminvel)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17926)
+@@ -913,38 +913,6 @@
+ 
+ 	xDelete<int>(indicesfront);
+ }/*}}}*/
+-void  Tria::GetNormalFromLSF(IssmDouble *pnormal){/*{{{*/
+-
+-	/* Intermediaries */
+-	int         i;
+-	const int   dim=2;
+-	IssmDouble* xyz_list = NULL;
+-	IssmDouble  dlevelset[dim], norm_dlevelset;
+-	IssmDouble  normal[dim]={0.};
+-
+-	/*Retrieve all inputs and parameters*/
+-	Input* levelset_input=this->GetInput(MaskIceLevelsetEnum); _assert_(levelset_input);
+-	this->GetVerticesCoordinates(&xyz_list);
+-	
+-	IssmDouble counter=0.;
+-	Gauss* gauss = this->NewGauss(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-		/* Get normal on node */
+-		levelset_input->GetInputDerivativeValue(&dlevelset[0],xyz_list,gauss);
+-		norm_dlevelset=0.;
+-		for(i=0;i<dim;i++) norm_dlevelset+=dlevelset[i]*dlevelset[i]; 
+-		norm_dlevelset=sqrt(norm_dlevelset)+1.e-14;
+-		for(i=0;i<dim;i++) normal[i]+=dlevelset[i]/norm_dlevelset;
+-		counter++;
+-	}
+-	_assert_(counter>0.);
+-	for(i=0;i<dim;i++) normal[i] = normal[i]/counter;
+-	
+-	pnormal=&normal[0];
+-
+-	delete gauss;
+-	xDelete<IssmDouble>(xyz_list);
+-}/*}}}*/
+ /*FUNCTION Tria::GetNodeIndex {{{*/
+ int Tria::GetNodeIndex(Node* node){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17926)
+@@ -64,8 +64,6 @@
+ 		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating);
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+-	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+-	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
+@@ -109,7 +107,6 @@
+ 		void   VerticalSegmentIndices(int** pindices,int* pnumseg){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void	    GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+-	    void        GetNormalFromLSF(IssmDouble *pnormal);
+ 		bool        IsZeroLevelset(int levelset_enum);
+ 		bool		IsIcefront(void);
+ 		bool		IsFaceOnBoundary(void);
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17926)
+@@ -798,24 +798,6 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsMINI{{{*/
+-void PentaRef::GetNodalFunctionsMINI(IssmDouble* l1l7, Gauss* gauss_in){
+-	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+-
+-	/*Cast gauss to GaussPenta*/
+-	_assert_(gauss_in->Enum()==GaussPentaEnum);
+-	GaussPenta* gauss = dynamic_cast<GaussPenta*>(gauss_in);
+-
+-	l1l7[0]=gauss->coord1*(1.0-gauss->coord4)/2.0;
+-	l1l7[1]=gauss->coord2*(1.0-gauss->coord4)/2.0;
+-	l1l7[2]=gauss->coord3*(1.0-gauss->coord4)/2.0;
+-	l1l7[3]=gauss->coord1*(1.0+gauss->coord4)/2.0;
+-	l1l7[4]=gauss->coord2*(1.0+gauss->coord4)/2.0;
+-	l1l7[5]=gauss->coord3*(1.0+gauss->coord4)/2.0;
+-	l1l7[6]=27*gauss->coord1*gauss->coord2*gauss->coord3*(1.0+gauss->coord4)*(1.0-gauss->coord4);
+-
+-}
+-/*}}}*/
+ /*FUNCTION PentaRef::GetNodalFunctionsMINIDerivatives{{{*/
+ void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dbasismini,IssmDouble* xyz_list, Gauss* gauss){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17926)
+@@ -140,53 +140,6 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::BasalFrictionCreateInput {{{*/
+-void Penta::BasalFrictionCreateInput(void){
+-
+-	/*Intermediaries */
+-	int         count;
+-	IssmDouble  basalfriction[NUMVERTICES];
+-	IssmDouble  alpha2                       ,vx,vy;
+-	Friction   *friction                   = NULL;
+-	GaussPenta *gauss                      = NULL;
+-
+-	/* Basal friction can only be found at the base of an ice sheet: */
+-	if (!IsOnBase() || IsFloating()){
+-		//empty friction: 
+-		this->inputs->AddInput(new PentaInput(BasalFrictionEnum,&basalfriction[0],P1Enum));
+-		return;
+-	}
+-
+-	/*Retrieve all inputs and parameters*/
+-	Input* vx_input=inputs->GetInput(VxEnum);                         _assert_(vx_input);
+-	Input* vy_input=inputs->GetInput(VyEnum);                         _assert_(vy_input);
+-	Input* vz_input=inputs->GetInput(VzEnum);                         _assert_(vz_input);
+-
+-	/*Build friction element, needed later: */
+-	friction=new Friction(this,3);
+-
+-	/* Start looping on the number of gauss 2d (nodes on the bedrock) */
+-	gauss=new GaussPenta(0,1,2,2);
+-	count=0;
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		basalfriction[count]=alpha2*(pow(vx,2.0)+pow(vy,2.0));
+-		count++;
+-	}
+-
+-	/*Create PentaVertex input, which will hold the basal friction:*/
+-	this->inputs->AddInput(new PentaInput(BasalFrictionEnum,&basalfriction[0],P1Enum));
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	delete friction;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::ComputeBasalStress {{{*/
+ void  Penta::ComputeBasalStress(Vector<IssmDouble>* sigma_b){
+ 
+@@ -739,22 +692,6 @@
+ 	return upper_element;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetLowerElement{{{*/
+-Element* Penta::GetLowerElement(void){
+-
+-	/*Output*/
+-	Element* lower_element=this->GetLowerPenta();
+-	return lower_element;
+-}
+-/*}}}*/
+-/*FUNCTION Penta::GetSurfaceElement{{{*/
+-Element* Penta::GetSurfaceElement(void){
+-
+-	/*Output*/
+-	Element* element=this->GetSurfacePenta();
+-	return element;
+-}
+-/*}}}*/
+ /*FUNCTION Penta::GetBasalElement{{{*/
+ Element* Penta::GetBasalElement(void){
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.h	(revision 17926)
+@@ -28,7 +28,6 @@
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss);
+ 		void GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement);
+ 		void GetNodalFunctionsP1(IssmDouble* l1l6, Gauss* gauss);
+-		void GetNodalFunctionsMINI(IssmDouble* l1l7, Gauss* gauss);
+ 		void GetNodalFunctionsP1Derivatives(IssmDouble* dh1dh6,IssmDouble* xyz_list, Gauss* gauss);
+ 		void GetNodalFunctionsMINIDerivatives(IssmDouble* dh1dh7,IssmDouble* xyz_list, Gauss* gauss);
+ 		void GetNodalFunctionsP1DerivativesReference(IssmDouble* dl1dl6,Gauss* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17926)
+@@ -48,33 +48,6 @@
+ /*}}}*/
+ 
+ /*Reference Element numerics*/
+-/*FUNCTION SegRef::GetBprimeMasstransport{{{*/
+-void SegRef::GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, GaussSeg* gauss){
+-	/*Compute B'  matrix. B'=[B1' B2' B3'] where Bi' is of size 3*NDOF2. 
+-	 * For node i, Bi' can be expressed in the actual coordinate system
+-	 * by: 
+-	 *       Bi_prime=[ dN/dx ]
+-	 * where N is the finiteelement function for node i.
+-	 *
+-	 * We assume B' has been allocated already, of size: 3x(NDOF2*numnodes)
+-	 */
+-
+-	/*Fetch number of nodes for this finite element*/
+-	int numnodes = this->NumberofNodes();
+-
+-	/*Get nodal functions derivatives*/
+-	IssmDouble* dbasis=xNew<IssmDouble>(2*numnodes);
+-	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
+-
+-	/*Build B': */
+-	for(int i=0;i<numnodes;i++){
+-		Bprime[i] = dbasis[i];
+-	}
+-
+-	/*Clean-up*/
+-	xDelete<IssmDouble>(dbasis);
+-}
+-/*}}}*/
+ /*FUNCTION SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){{{*/
+ void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17926)
+@@ -51,7 +51,6 @@
+ 		void  InputUpdateFromIoModel(int index, IoModel* iomodel);
+ 		/*}}}*/
+ 		/*Element virtual functions definitions: {{{*/
+-		void   BasalFrictionCreateInput(void);
+ 		IssmDouble CharacteristicLength(void){_error_("not implemented yet");};
+ 		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+ 		void   ComputeStrainRate();
+@@ -70,8 +69,6 @@
+ 		Penta* GetSurfacePenta(void);
+ 		Penta* GetBasalPenta(void);
+ 		Element* GetUpperElement(void);
+-		Element* GetLowerElement(void);
+-		Element* GetSurfaceElement(void);
+ 		Element* GetBasalElement(void);
+ 		void   GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
+ 		IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
+@@ -94,7 +91,6 @@
+ 		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
+ 		void   ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+-		void   GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
+ 		void   ReduceMatrices(ElementMatrix* Ke,ElementVector* pe);
+ 		void   ResetFSBasalBoundaryCondition(void);
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.h	(revision 17926)
+@@ -21,7 +21,6 @@
+ 
+ 		/*Management*/
+ 		void SetElementType(int type,int type_counter);
+-		void GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, GaussSeg* gauss);
+ 		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussSeg* gauss);
+ 		void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussSeg* gauss);
+ 		void GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussSeg* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.h	(revision 17926)
+@@ -21,7 +21,6 @@
+ 
+ 		/*Management*/
+ 		void SetElementType(int type,int type_counter);
+-		void GetBprimeMasstransport(IssmDouble* Bprime, IssmDouble* xyz_list, GaussTetra* gauss);
+ 		void GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss);
+ 		void GetJacobianDeterminantFace(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17926)
+@@ -65,8 +65,6 @@
+ 		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+-	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+-	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node){_error_("not implemented yet");};
+ 		int         GetNumberOfNodes(void);
+@@ -126,7 +124,6 @@
+ 		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented");};
+ 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum);
+-		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+ 
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17925)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17926)
+@@ -68,8 +68,6 @@
+ 		void        FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){_error_("not implemented yet");};
+ 		int         FiniteElement(void);
+ 		Element*    GetUpperElement(void){_error_("not implemented yet");};
+-	  	Element*    GetLowerElement(void){_error_("not implemented yet");};
+-	  	Element*    GetSurfaceElement(void){_error_("not implemented yet");};
+ 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+ 		int         GetNodeIndex(Node* node);
+ 		int         GetNumberOfNodes(void);
+@@ -131,8 +129,6 @@
+ 		bool   IsFaceOnBoundary(void){_error_("not implemented yet");};
+ 		void        ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum);
+ 		void		   GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){_error_("not implemented yet");};
+-		void        GetNormalFromLSF(IssmDouble *pnormal){_error_("not implemented yet");};
+-
+ 		void        GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution,int enum_type){_error_("not implemented yet");};
+ 		void        InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");};
+ 		void        InputExtrude(int enum_type){_error_("not implemented"); /*For penta only*/};
Index: /issm/oecreview/Archive/17802-17983/ISSM-17926-17927.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17926-17927.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17926-17927.diff	(revision 17986)
@@ -0,0 +1,52 @@
+Index: ../trunk-jpl/test/NightlyRun/test322.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.m	(revision 17926)
++++ ../trunk-jpl/test/NightlyRun/test322.m	(revision 17927)
+@@ -22,7 +22,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy'};
+-field_tolerances={1e-05,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,5e-08,5e-08,5e-08};
++field_tolerances={5e-05,1e-08,1e-09,1e-09,1e-09,1e-09,1e-09,5e-08,5e-08,5e-08};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Gradient1),...
+ 	(md.results.StressbalanceSolution.J),...
+Index: ../trunk-jpl/test/NightlyRun/test513.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.py	(revision 17926)
++++ ../trunk-jpl/test/NightlyRun/test513.py	(revision 17927)
+@@ -35,7 +35,7 @@
+ 
+ # Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate']
+-field_tolerances=[2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,2e-6,2e-06]
++field_tolerances=[2e-10,2e-10,1e-10,1e-10,3e-6,3e-6,3e-6,3e-6,2e-6,2e-06]
+ field_values=[\
+ 	md.results.SteadystateSolution.Gradient1,\
+ 	md.results.SteadystateSolution.J,\
+Index: ../trunk-jpl/test/NightlyRun/test513.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test513.m	(revision 17926)
++++ ../trunk-jpl/test/NightlyRun/test513.m	(revision 17927)
+@@ -24,7 +24,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy','Vz','Temperature','BasalforcingsMeltingRate'};
+-field_tolerances={2e-10,2e-10,1e-10,1e-10,2e-6,1e-6,2e-6,2e-6,2e-6,2e-06};
++field_tolerances={2e-10,2e-10,1e-10,1e-10,3e-6,3e-6,3e-6,3e-6,2e-6,2e-06};
+ field_values={...
+ 	(md.results.SteadystateSolution.Gradient1),...
+ 	md.results.SteadystateSolution.J,...
+Index: ../trunk-jpl/test/NightlyRun/test322.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test322.py	(revision 17926)
++++ ../trunk-jpl/test/NightlyRun/test322.py	(revision 17927)
+@@ -34,7 +34,7 @@
+ 
+ #Fields and tolerances to track changes
+ field_names     =['Gradient','Misfits','FrictionCoefficient','Pressure','Vel','Vx','Vy']
+-field_tolerances=[1e-05,1e-08,1e-09,1e-09,5e-08,5e-08,5e-08]
++field_tolerances=[5e-05,1e-08,1e-09,1e-09,5e-08,5e-08,5e-08]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Gradient1,\
+ 	md.results.StressbalanceSolution.J,\
Index: /issm/oecreview/Archive/17802-17983/ISSM-17927-17928.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17927-17928.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17927-17928.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/classes/friction.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.py	(revision 17927)
++++ ../trunk-jpl/src/m/classes/friction.py	(revision 17928)
+@@ -21,7 +21,7 @@
+ 
+ 		#}}}
+ 	def __repr__(self): # {{{
+-		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="Basal shear stress parameters: Sigma_b = coefficient^2 * Neff ^r * |u_b|^(s-1) * u_b,\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p)"
+ 
+ 		string="%s\n%s"%(string,fielddisplay(self,"coefficient","friction coefficient [SI]"))
+ 		string="%s\n%s"%(string,fielddisplay(self,"p","p exponent"))
+Index: ../trunk-jpl/src/m/classes/friction.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.m	(revision 17927)
++++ ../trunk-jpl/src/m/classes/friction.m	(revision 17928)
+@@ -39,7 +39,7 @@
+ 			md = checkfield(md,'fieldname','friction.p','NaN',1,'size',[md.mesh.numberofelements 1]);
+ 		end % }}}
+ 		function disp(obj) % {{{
+-			disp(sprintf('Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p'));
++			disp(sprintf('Basal shear stress parameters: Sigma_b = coefficient^2 * Neff ^r * |u_b|^(s-1) * u_b\n(effective stress Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p)'));
+ 			fielddisplay(obj,'coefficient','friction coefficient [SI]');
+ 			fielddisplay(obj,'p','p exponent');
+ 			fielddisplay(obj,'q','q exponent');
Index: /issm/oecreview/Archive/17802-17983/ISSM-17928-17929.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17928-17929.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17928-17929.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17928)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17929)
+@@ -44,7 +44,7 @@
+ void Friction::GetAlpha2(IssmDouble* palpha2, Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
+ 
+ 	/*This routine calculates the basal friction coefficient 
+-	  alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p**/
++	  alpha2= drag^2 * Neff ^r * | vel | ^(s-1), with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p**/
+ 
+ 	/*diverse: */
+ 	IssmDouble  r,s;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17929-17930.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17929-17930.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17929-17930.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/test/NightlyRun/test220.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test220.py	(revision 17929)
++++ ../trunk-jpl/test/NightlyRun/test220.py	(revision 17930)
+@@ -20,7 +20,7 @@
+ # Fields and tolerances to track changes
+ 
+ field_names     =['Vx','Vy','Vz','Vel','Pressure']
+-field_tolerances=[1e-09,1e-09,1e-06,1e-09,1e-09]
++field_tolerances=[1e-09,1e-09,5e-06,1e-09,1e-09]
+ field_values=[\
+ 	md.results.StressbalanceSolution.Vx,\
+ 	md.results.StressbalanceSolution.Vy,\
+Index: ../trunk-jpl/test/NightlyRun/test220.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test220.m	(revision 17929)
++++ ../trunk-jpl/test/NightlyRun/test220.m	(revision 17930)
+@@ -8,7 +8,7 @@
+ 
+ %Fields and tolerances to track changes
+ field_names     ={'Vx','Vy','Vz','Vel','Pressure'};
+-field_tolerances={1e-09,1e-09,1e-06,1e-09,1e-09};
++field_tolerances={1e-09,1e-09,5e-06,1e-09,1e-09};
+ field_values={...
+ 	(md.results.StressbalanceSolution.Vx),...
+ 	(md.results.StressbalanceSolution.Vy),...
Index: /issm/oecreview/Archive/17802-17983/ISSM-17930-17931.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17930-17931.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17930-17931.diff	(revision 17986)
@@ -0,0 +1,676 @@
+Index: ../trunk-jpl/src/m/classes/balancethickness.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/balancethickness.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/balancethickness.m	(revision 17931)
+@@ -16,7 +16,12 @@
+             
+ 			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="spcthickness" type="',   	class(obj.spcthickness),'" default="',        convert2str(obj.spcthickness),'">',	'     <section name="balancethickness" />','     <help> thickness constraints (NaN means no constraint) [m] </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="thickening_rate" type="', 	class(obj.thickening_rate),'" default="',            convert2str(obj.thickening_rate),'">',     '     <section name="balancethickness" />','     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="stabilization" type="',      class(obj.stabilization),'" default="',          convert2str(obj.stabilization),'">',	'     <section name="balancethickness" />','     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>','</parameter>');
++            
++            % balancethickness drop-down (1,2, or 3)
++            fprintf(fid,'%s\n%s\n%s\n',        '<parameter key ="stabilization" type="alternative" optional="false">','     <section name="balancethickness" />','     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>');
++            fprintf(fid,'%s\n','       <option value="1" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="2" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="3" type="string" default="false"> </option>','</parameter>');
+ 
+         end % }}}
+ 		function obj = balancethickness(varargin) % {{{
+Index: ../trunk-jpl/src/m/classes/inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/inversion.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/inversion.m	(revision 17931)
+@@ -24,50 +24,55 @@
+ 		thickness_obs               = NaN
+ 	end
+ 	methods
+-		function createxml(obj,fid) % {{{
+-			fprintf(fid, '<!-- inversion -->\n');            
+-
+-			% inversion parameters
+-			fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />');                    
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="iscontrol" type="',class(obj.iscontrol),'" default="',convert2str(obj.iscontrol),'">','     <section name="inversion" />','     <help> is inversion activated? </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="incomplete_adjoint" type="',class(obj.incomplete_adjoint),'" default="',convert2str(obj.incomplete_adjoint),'">','     <section name="inversion" />','     <help> 1: linear viscosity, 0: non-linear viscosity </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="control_parameters" type="',class(obj.control_parameters),'" default="',convert2str(obj.control_parameters),'">','     <section name="inversion" />','     <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>','  </parameter>');
+-
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="nsteps" type="',class(obj.nsteps),'" default="',convert2str(obj.nsteps),'">','     <section name="inversion" />','     <help> number of optimization searches </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions" type="',class(obj.cost_functions),'" default="',convert2str(obj.cost_functions),'">','     <section name="inversion" />','     <help> indicate the type of response for each optimization step  </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions_coefficients" type="',class(obj.cost_functions_coefficients),'" default="',convert2str(obj.cost_functions_coefficients),'">','     <section name="inversion" />','     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>','  </parameter>');
+-
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_function_threshold" type="',class(obj.cost_function_threshold),'" default="',convert2str(obj.cost_function_threshold),'">','     <section name="inversion" />','     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter_per_step" type="',class(obj.maxiter_per_step),'" default="',convert2str(obj.maxiter_per_step),'">','     <section name="inversion" />','     <help> maximum iterations during each optimization step  </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gradient_scaling" type="',class(obj.gradient_scaling),'" default="',convert2str(obj.gradient_scaling),'">','     <section name="inversion" />','     <help> scaling factor on gradient direction during optimization, for each optimization step </help>','  </parameter>');
+-
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="step_threshold" type="',class(obj.step_threshold),'" default="',convert2str(obj.step_threshold),'">','     <section name="inversion" />','     <help> decrease threshold for misfit, default is 30% </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_parameters" type="',class(obj.min_parameters),'" default="',convert2str(obj.min_parameters),'">','     <section name="inversion" />','     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="max_parameters" type="',class(obj.max_parameters),'" default="',convert2str(obj.max_parameters),'">','     <section name="inversion" />','     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
+-
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vx_obs" type="',class(obj.vx_obs),'" default="',convert2str(obj.vx_obs),'">','     <section name="inversion" />','     <help> observed velocity x component [m/yr] </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vy_obs" type="',class(obj.vy_obs),'" default="',convert2str(obj.vy_obs),'">','     <section name="inversion" />','     <help> observed velocity y component [m/yr]  </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vel_obs" type="',class(obj.vel_obs),'" default="',convert2str(obj.vel_obs),'">','     <section name="inversion" />','     <help> observed velocity magnitude [m/yr] </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="thickness_obs" type="',class(obj.thickness_obs),'" default="',convert2str(obj.thickness_obs),'">','     <section name="inversion" />','     <help> observed thickness [m]) </help>','  </parameter>');
+-
+-			fprintf(fid,'%s\n%s\n','</frame>');    
+-
+-			fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />');                    
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">','     <section name="inversion" />','     <help> </help>','  </parameter>');
+-
+-			fprintf(fid,'%s\n%s\n','</frame>');    
+-
+-		end % }}}       
++         function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- inversion -->\n');            
++                    
++            % inversion parameters
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="inversion parameters">','<section name="inversion" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="iscontrol" type="',class(obj.iscontrol),'" default="',convert2str(obj.iscontrol),'">','     <section name="inversion" />','     <help> is inversion activated? </help>','  </parameter>');
++            
++            % incompleteadjoing drop-down (0 or 1)
++            fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="incomplete_adjoint" type="alternative" optional="false">','     <section name="inversion" />','     <help> 1: linear viscosity, 0: non-linear viscosity </help>');
++            fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="1" type="string" default="false"> </option>','</parameter>');
++            
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="control_parameters" type="',class(obj.control_parameters),'" default="',convert2str(obj.control_parameters),'">','     <section name="inversion" />','     <help> ex: {''FrictionCoefficient''}, or {''MaterialsRheologyBbar''} </help>','  </parameter>');
++                
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="nsteps" type="',class(obj.nsteps),'" default="',convert2str(obj.nsteps),'">','     <section name="inversion" />','     <help> number of optimization searches </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions" type="',class(obj.cost_functions),'" default="',convert2str(obj.cost_functions),'">','     <section name="inversion" />','     <help> indicate the type of response for each optimization step  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_functions_coefficients" type="',class(obj.cost_functions_coefficients),'" default="',convert2str(obj.cost_functions_coefficients),'">','     <section name="inversion" />','     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>','  </parameter>');
++                
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cost_function_threshold" type="',class(obj.cost_function_threshold),'" default="',convert2str(obj.cost_function_threshold),'">','     <section name="inversion" />','     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter_per_step" type="',class(obj.maxiter_per_step),'" default="',convert2str(obj.maxiter_per_step),'">','     <section name="inversion" />','     <help> maximum iterations during each optimization step  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="gradient_scaling" type="',class(obj.gradient_scaling),'" default="',convert2str(obj.gradient_scaling),'">','     <section name="inversion" />','     <help> scaling factor on gradient direction during optimization, for each optimization step </help>','  </parameter>');
++               
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="step_threshold" type="',class(obj.step_threshold),'" default="',convert2str(obj.step_threshold),'">','     <section name="inversion" />','     <help> decrease threshold for misfit, default is 30% </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_parameters" type="',class(obj.min_parameters),'" default="',convert2str(obj.min_parameters),'">','     <section name="inversion" />','     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="max_parameters" type="',class(obj.max_parameters),'" default="',convert2str(obj.max_parameters),'">','     <section name="inversion" />','     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>','  </parameter>');
++               
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vx_obs" type="',class(obj.vx_obs),'" default="',convert2str(obj.vx_obs),'">','     <section name="inversion" />','     <help> observed velocity x component [m/yr] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vy_obs" type="',class(obj.vy_obs),'" default="',convert2str(obj.vy_obs),'">','     <section name="inversion" />','     <help> observed velocity y component [m/yr]  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vel_obs" type="',class(obj.vel_obs),'" default="',convert2str(obj.vel_obs),'">','     <section name="inversion" />','     <help> observed velocity magnitude [m/yr] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="thickness_obs" type="',class(obj.thickness_obs),'" default="',convert2str(obj.thickness_obs),'">','     <section name="inversion" />','     <help> observed thickness [m]) </help>','  </parameter>');
++               
++            fprintf(fid,'%s\n%s\n','</frame>');    
++            
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Available cost functions">','<section name="inversion" />');                    
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAbsVelMisfit" type="','string','" default="','101','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceRelVelMisfit" type="','string','" default="','102','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVelMisfit" type="','string','" default="','103','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++                
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceLogVxVyMisfit" type="','string','" default="','104','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="SurfaceAverageVelMisfit" type="','string','" default="','105','">','     <section name="inversion" />','     <help>   </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsMisfit" type="','string','" default="','106','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++               
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="DragCoefficientAbsGradient" type="','string','" default="','107','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="RheologyBbarAbsGradient" type="','string','" default="','108','">','     <section name="inversion" />','     <help>  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="ThicknessAbsGradient" type="','string','" default="','109','">','     <section name="inversion" />','     <help> </help>','  </parameter>');
++               
++            fprintf(fid,'%s\n%s\n','</frame>');    
++        
++        end % }}}       
+ 		function obj = inversion(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/mesh3dprisms.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/mesh3dprisms.m	(revision 17931)
+@@ -41,6 +41,59 @@
+ 		extractedelements           = NaN
+ 	end
+ 	methods
++           function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- 3D prism Mesh -->\n');
++            
++            % Elements and verticies of the original 2d mesh
++            fprintf(fid,'%s\n%s\n%s\n','       <frame key="1" label="Elements and vertices of the orginal 2d mesh">','       <section name="mesh3dprisms" />');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements2d" type="',class(obj.numberofelements2d),'" default="',convert2str(obj.numberofelements2d),'">','              <help> number of elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices2d" type="',class(obj.numberofvertices2d),'" default="',convert2str(obj.numberofvertices2d),'">','              <help> number of vertices </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements2d" type="',class(obj.elements2d),'" default="',convert2str(obj.elements2d),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x2d" type="',class(obj.x2d),'" default="',convert2str(obj.x2d),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y2d" type="',class(obj.y2d),'" default="',convert2str(obj.y2d),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','       </frame>');
++            
++            % Elements and vertices of the extruded 3d mesh
++            fprintf(fid,'%s\n%s\n%s\n','       <frame key="2" label="Elements and vertices of the orginal 3d mesh">','       <section name="mesh3dprisms" />');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements" type="',class(obj.numberofelements),'" default="',convert2str(obj.numberofelements),'">','              <help> number of elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices" type="',class(obj.numberofvertices),'" default="',convert2str(obj.numberofvertices),'">','              <help> number of vertices </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements" type="',class(obj.elements),'" default="',convert2str(obj.elements),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(obj.x),'" default="',convert2str(obj.x),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="z" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh3dprisms" />','     <help> vertices z coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','       </frame>');
++     
++            % properties
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Properties">','<section name="mesh3dprisms" />');             
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberoflayers" type="',class(obj.numberoflayers),'" default="',convert2str(obj.numberoflayers),'">','     <section name="mesh3dprisms" />','     <help> number of extrusion layers </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbase" type="',class(obj.vertexonbase),'" default="',convert2str(obj.vertexonbase),'">','     <section name="mesh3dprisms" />','     <help> lower vertices flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontbase" type="',class(obj.elementontbase),'" default="',convert2str(obj.elementontbase),'">','     <section name="mesh3dprisms" />','     <help> lower elements flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonsurface" type="',class(obj.vertexonsurface),'" default="',convert2str(obj.vertexonsurface),'">','     <section name="mesh3dprisms" />','     <help> upper vertices flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontsurface" type="',class(obj.elementontsurface),'" default="',convert2str(obj.elementontsurface),'">','     <section name="mesh3dprisms" />','     <help> upper elements flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="uppervertex" type="',class(obj.uppervertex),'" default="',convert2str(obj.uppervertex),'">','     <section name="mesh3dprisms" />','     <help> upper vertex list (NaN for vertex on the upper surface) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="upperelements" type="',class(obj.upperelements),'" default="',convert2str(obj.upperelements),'">','     <section name="mesh3dprisms" />','     <help> upper element list (NaN for element on the upper layer) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowervertex" type="',class(obj.lowervertex),'" default="',convert2str(obj.lowervertex),'">','     <section name="mesh3dprisms" />','     <help> lower vertex list (NaN for vertex on the lower surface) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowerelements" type="',class(obj.lowerelements),'" default="',convert2str(obj.lowerelements),'">','     <section name="mesh3dprisms" />','     <help> element list (NaN for element on the lower layer) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(obj.vertexonboundary),'" default="',convert2str(obj.vertexonboundary),'">','     <section name="mesh3dprisms" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(obj.vertexconnectivity),'" default="',convert2str(obj.vertexconnectivity),'">','     <section name="mesh3dprisms" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(obj.elementconnectivity),'" default="',convert2str(obj.elementconnectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(obj.average_vertex_connectivity),'" default="',convert2str(obj.average_vertex_connectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            % Extracted model
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Extracted Model">','<section name="mesh3dprisms" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedvertices" type="',class(obj.extractedvertices),'" default="',convert2str(obj.extractedvertices),'">','     <section name="mesh3dprisms" />','     <help> vertices extracted from the model </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedelements" type="',class(obj.extractedelements),'" default="',convert2str(obj.extractedelements),'">','     <section name="mesh3dprisms" />','     <help> elements extracted from the model </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            % Projection
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="5" label="Projection">','<section name="mesh3dprisms" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(obj.lat),'" default="',convert2str(obj.lat),'">','     <section name="mesh3dprisms" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(obj.long),'" default="',convert2str(obj.long),'">','     <section name="mesh3dprisms" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="hemisphere" type="',class(obj.hemisphere),'" default="',convert2str(obj.hemisphere),'">','     <section name="mesh3dprisms" />','     <help> Indicate hemisphere ''n'' or ''s'' </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        
++        end % }}}cd
+ 		function self = mesh3dprisms(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/debug.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/debug.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/debug.m	(revision 17931)
+@@ -13,9 +13,14 @@
+         function createxml(obj,fid) % {{{
+             fprintf(fid, '\n\n');
+             fprintf(fid, '%s\n', '<!-- Debug -->');
+-			 fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="valgrind" type="',              class(obj.valgrind),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.valgrind),'" type="string" default="true"></option>','     <help> use Valgrind to debug (0 or 1) </help>','</parameter>');
+-             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="gprof" type="',              class(obj.gprof),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.gprof),'" type="string" default="true"></option>','     <help> use gnu-profiler to find out where the time is spent </help>','</parameter>');
+-             fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n',    '<parameter key ="profiling" type="',              class(obj.profiling),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.profiling),'" type="string" default="true"></option>','     <help> enables profiling (memory, flops, time) </help>','</parameter>');
++            
++            %valgrind drop-down (0 or 1)
++			fprintf(fid,'%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="valgrind" type="alternative" optional="false">','     <section name="debug" />','     <help> use Valgrind to debug (0 or 1) </help>');
++            fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="1" type="string" default="false"> </option>','</parameter>');
++          
++            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n%s\n',    '<parameter key ="gprof" type="',              class(obj.gprof),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.gprof),'" type="string" default="true"></option>','     <help> use gnu-profiler to find out where the time is spent </help>','</parameter>');
++            fprintf(fid,'%s%s%s\n%s\n%s%s%s\n%s\n',    '<parameter key ="profiling" type="',              class(obj.profiling),'" optional="false">',              '     <section name="debug" />','        <option value="',convert2str(obj.profiling),'" type="string" default="true"></option>','     <help> enables profiling (memory, flops, time) </help>','</parameter>');
+         end % }}}
+ 		function obj = debug(varargin) % {{{
+ 			switch nargin
+Index: ../trunk-jpl/src/m/classes/geometry.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/geometry.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/geometry.m	(revision 17931)
+@@ -32,14 +32,15 @@
+ 		end% }}}
+ 	end
+ 	methods
+-        function createxml(obj,fid) % {{{
++        %function createxml(obj,fid)
++        function createxml(obj, fid)% {{{
+             fprintf(fid, '\n\n');
+             fprintf(fid, '%s\n', '<!-- geometry -->');
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Geometry parameters">','<section name="geometry" />'); 
+ 			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="surface" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> surface elevation [m] </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thickness" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> ice thickness [m] </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="bed" type="','path','" optional="','false','">','     <section name="geometry" />','     <help> bed elevation [m] </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="bathymetry" type="',class(obj.bathymetry),'" default="',convert2str(obj.bathymetry),'">','     <section name="geometry" />','     <help> bathymetry elevation [m] </help>','</parameter>');
++            %fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="bathymetry" type="',class(obj.bathymetry),'" default="',convert2str(obj.bathymetry),'">','     <section name="geometry" />','     <help> bathymetry elevation [m] </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','<parameter key ="hydrostatic_ratio" type="',class(obj.hydrostatic_ratio),'" default="',convert2str(obj.hydrostatic_ratio),'">','     <section name="geometry" />','     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>','</parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');
+         end % }}}
+Index: ../trunk-jpl/src/m/classes/thermal.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/thermal.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/thermal.m	(revision 17931)
+@@ -21,15 +21,21 @@
+                     
+             % thermal solution parameters
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Thermal solution parameters">','<section name="thermal" />');                    
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="spctemperature" type="',class(obj.spctemperature),'" default="',convert2str(obj.spctemperature),'">','     <section name="thermal" />','     <help> temperature constraints (NaN means no constraint) [K] </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_threshold" type="',class(obj.penalty_threshold),'" default="',convert2str(obj.penalty_threshold),'">','     <section name="thermal" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="stabilization" type="',class(obj.stabilization),'" default="',convert2str(obj.stabilization),'">','     <section name="thermal" />','     <help> maximum number of non linear iterations </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter" type="',class(obj.maxiter),'" default="',convert2str(obj.maxiter),'">','     <section name="thermal" />','     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_lock" type="',class(obj.penalty_lock),'" default="',convert2str(obj.penalty_lock),'">','     <section name="thermal" />','     <help> threshold to declare convergence of thermal solution (default is 0)  </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_factor" type="',class(obj.penalty_factor),'" default="',convert2str(obj.penalty_factor),'">','     <section name="thermal" />','     <help> scaling exponent (default is 3) </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isenthalpy" type="',class(obj.isenthalpy),'" default="',convert2str(obj.isenthalpy),'">','     <section name="thermal" />','     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdynamicbasalspc" type="',class(obj.isdynamicbasalspc),'" default="',convert2str(obj.isdynamicbasalspc),'">','     <section name="thermal" />','     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','     <section name="thermal" />','     <help> additional outputs requested </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="spctemperature" type="',class(obj.spctemperature),'" default="',convert2str(obj.spctemperature),'">','     <section name="thermal" />','     <help> temperature constraints (NaN means no constraint) [K] </help>','  </parameter>');
++                
++            % penalty_threshold drop-down (0, 1, or 2)
++            fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="penalty_threshold" type="alternative"  optional="false">','     <section name="thermal" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>');
++            fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="1" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="2" type="string" default="false"> </option>','</parameter>');
++
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="stabilization" type="',class(obj.stabilization),'" default="',convert2str(obj.stabilization),'">','     <section name="thermal" />','     <help> maximum number of non linear iterations </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="maxiter" type="',class(obj.maxiter),'" default="',convert2str(obj.maxiter),'">','     <section name="thermal" />','     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_lock" type="',class(obj.penalty_lock),'" default="',convert2str(obj.penalty_lock),'">','     <section name="thermal" />','     <help> threshold to declare convergence of thermal solution (default is 0)  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="penalty_factor" type="',class(obj.penalty_factor),'" default="',convert2str(obj.penalty_factor),'">','     <section name="thermal" />','     <help> scaling exponent (default is 3) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isenthalpy" type="',class(obj.isenthalpy),'" default="',convert2str(obj.isenthalpy),'">','     <section name="thermal" />','     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdynamicbasalspc" type="',class(obj.isdynamicbasalspc),'" default="',convert2str(obj.isdynamicbasalspc),'">','     <section name="thermal" />','     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','     <section name="thermal" />','     <help> additional outputs requested </help>','  </parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');    
+         
+         end % }}}
+Index: ../trunk-jpl/src/m/classes/settings.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/settings.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/settings.m	(revision 17931)
+@@ -23,7 +23,12 @@
+             fprintf(fid, '%s\n', '<!-- settings -->');
+ 			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="results_on_nodes" type="',      class(obj.results_on_nodes),'" default="',        convert2str(obj.results_on_nodes),'">',	'     <section name="settings" />','     <help> results are output for all the nodes of each element </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="io_gather" type="',          class(obj.io_gather),'" default="',           convert2str(obj.io_gather),'">',     '     <section name="settings" />','     <help> I/O gathering strategy for result outputs (default 1) </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="lowmem" type="',        class(obj.lowmem),'" default="',         convert2str(obj.lowmem),'">',	'     <section name="settings" />','     <help> is the memory limited ? (0 or 1) </help>','</parameter>');
++            
++            % lowmen drop-down (0 or 1)
++            fprintf(fid,'%s\n%s\n%s\n%s\n',	'<parameter key ="lowmem" type="alternative" optional="true">',	'     <section name="settings" />','     <help> is the memory limited ? (0 or 1) </help>');
++            fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="1" type="string" default="false"> </option>','</parameter>');
++
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="output_frequency" type="',          class(obj.output_frequency),'" default="',           convert2str(obj.output_frequency),'">',	'     <section name="settings" />','     <help> frequency at which results are saved in all solutions with multiple time_steps </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="waitonlock" type="',  	class(obj.waitonlock),'" default="',      convert2str(obj.waitonlock),'">',     '     <section name="settings" />','     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="upload_server" type="',         class(obj.upload_server),'" default="',          convert2str(obj.upload_server),'">',	'     <section name="settings" />','     <help> server hostname where model should be uploaded </help>','</parameter>');
+Index: ../trunk-jpl/src/m/classes/gia.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/gia.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/gia.m	(revision 17931)
+@@ -17,7 +17,11 @@
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="gia parameters">','<section name="gia" />');                    
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="mantle_viscosity" type="',class(obj.mantle_viscosity),'" default="',convert2str(obj.mantle_viscosity),'">','     <section name="gia" />','     <help> mantle viscosity[Pa s] </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lithosphere_thickness" type="',class(obj.lithosphere_thickness),'" default="',convert2str(obj.lithosphere_thickness),'">','     <section name="gia" />','     <help> lithosphere thickness (km) </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="cross_section_shape" type="',class(obj.cross_section_shape),'" default="',convert2str(obj.cross_section_shape),'">','     <section name="gia" />','     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>','  </parameter>');
++            %cross_section_shape drop-down (1 o r 2)
++            fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="cross_section_shape" type="alternative" optional="false">','     <section name="gia" />','     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>');
++            fprintf(fid,'%s\n','       <option value="1" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="2" type="string" default="false"> </option>','</parameter>');
++            
+             fprintf(fid,'%s\n%s\n','</frame>');    
+         
+         end % }}}
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17931)
+@@ -15,7 +15,13 @@
+             
+             % Convergence criteria          
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Grounding line migration parameters">','<section name="groundingline" />');  
+-			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="migration" type="',      class(obj.migration),'" default="',        convert2str(obj.migration),'">',	'     <section name="groundingline" />','     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>','</parameter>');
++			
++            % migration (SoftMigration, AggressiveMigration, or None)drop-down
++            fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="migration" type="alternative" optional="false">','     <section name="groundingline" />','     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>');
++            fprintf(fid,'%s\n','       <option value="SoftMigration" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="AggressiveMigration" type="string" default="false"> </option>');
++            fprintf(fid, '%s\n%s\n','       <option value="None" type="string" default="false"></option>','</parameter>');
++
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',    '<parameter key ="melting_rate" type="',          class(obj.melting_rate),'" default="',            convert2str(obj.melting_rate),'">',     '     <section name="groundingline" />','     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>','</parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');
+         end % }}}
+Index: ../trunk-jpl/src/m/classes/mesh3dtetras.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/mesh3dtetras.m	(revision 17931)
+@@ -39,6 +39,59 @@
+ 		extractedelements           = NaN
+ 	end
+ 	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- 3D Tetra Mesh -->\n');
++            
++            % Elements and verticies of the original 2d mesh
++            fprintf(fid,'%s\n%s\n%s\n','       <frame key="1" label="Elements and vertices of the orginal 2d mesh">','       <section name="mesh3dprisms" />');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements2d" type="',class(obj.numberofelements2d),'" default="',convert2str(obj.numberofelements2d),'">','              <help> number of elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices2d" type="',class(obj.numberofvertices2d),'" default="',convert2str(obj.numberofvertices2d),'">','              <help> number of vertices </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements2d" type="',class(obj.elements2d),'" default="',convert2str(obj.elements2d),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x2d" type="',class(obj.x2d),'" default="',convert2str(obj.x2d),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y2d" type="',class(obj.y2d),'" default="',convert2str(obj.y2d),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','       </frame>');
++            
++            % Elements and vertices of the extruded 3d mesh
++            fprintf(fid,'%s\n%s\n%s\n','       <frame key="2" label="Elements and vertices of the orginal 3d mesh">','       <section name="mesh3dprisms" />');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements" type="',class(obj.numberofelements),'" default="',convert2str(obj.numberofelements),'">','              <help> number of elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices" type="',class(obj.numberofvertices),'" default="',convert2str(obj.numberofvertices),'">','              <help> number of vertices </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements" type="',class(obj.elements),'" default="',convert2str(obj.elements),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(obj.x),'" default="',convert2str(obj.x),'">','     <section name="mesh3dprisms" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh3dprisms" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="z" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh3dprisms" />','     <help> vertices z coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','       </frame>');
++     
++            % properties
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Properties">','<section name="mesh3dprisms" />');             
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberoflayers" type="',class(obj.numberoflayers),'" default="',convert2str(obj.numberoflayers),'">','     <section name="mesh3dprisms" />','     <help> number of extrusion layers </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbase" type="',class(obj.vertexonbase),'" default="',convert2str(obj.vertexonbase),'">','     <section name="mesh3dprisms" />','     <help> lower vertices flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontbase" type="',class(obj.elementontbase),'" default="',convert2str(obj.elementontbase),'">','     <section name="mesh3dprisms" />','     <help> lower elements flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonsurface" type="',class(obj.vertexonsurface),'" default="',convert2str(obj.vertexonsurface),'">','     <section name="mesh3dprisms" />','     <help> upper vertices flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementontsurface" type="',class(obj.elementontsurface),'" default="',convert2str(obj.elementontsurface),'">','     <section name="mesh3dprisms" />','     <help> upper elements flags list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="uppervertex" type="',class(obj.uppervertex),'" default="',convert2str(obj.uppervertex),'">','     <section name="mesh3dprisms" />','     <help> upper vertex list (NaN for vertex on the upper surface) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="upperelements" type="',class(obj.upperelements),'" default="',convert2str(obj.upperelements),'">','     <section name="mesh3dprisms" />','     <help> upper element list (NaN for element on the upper layer) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowervertex" type="',class(obj.lowervertex),'" default="',convert2str(obj.lowervertex),'">','     <section name="mesh3dprisms" />','     <help> lower vertex list (NaN for vertex on the lower surface) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowerelements" type="',class(obj.lowerelements),'" default="',convert2str(obj.lowerelements),'">','     <section name="mesh3dprisms" />','     <help> element list (NaN for element on the lower layer) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(obj.vertexonboundary),'" default="',convert2str(obj.vertexonboundary),'">','     <section name="mesh3dprisms" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(obj.vertexconnectivity),'" default="',convert2str(obj.vertexconnectivity),'">','     <section name="mesh3dprisms" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(obj.elementconnectivity),'" default="',convert2str(obj.elementconnectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(obj.average_vertex_connectivity),'" default="',convert2str(obj.average_vertex_connectivity),'">','     <section name="mesh3dprisms" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            % Extracted model
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Extracted Model">','<section name="mesh3dprisms" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedvertices" type="',class(obj.extractedvertices),'" default="',convert2str(obj.extractedvertices),'">','     <section name="mesh3dprisms" />','     <help> vertices extracted from the model </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="extractedelements" type="',class(obj.extractedelements),'" default="',convert2str(obj.extractedelements),'">','     <section name="mesh3dprisms" />','     <help> elements extracted from the model </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++            
++            % Projection
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="5" label="Projection">','<section name="mesh3dprisms" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(obj.lat),'" default="',convert2str(obj.lat),'">','     <section name="mesh3dprisms" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(obj.long),'" default="',convert2str(obj.long),'">','     <section name="mesh3dprisms" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="hemisphere" type="',class(obj.hemisphere),'" default="',convert2str(obj.hemisphere),'">','     <section name="mesh3dprisms" />','     <help> Indicate hemisphere ''n'' or ''s'' </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        
++        end % }}}cd
+ 		function self = mesh3dtetras(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/mesh2dvertical.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/mesh2dvertical.m	(revision 17931)
+@@ -28,6 +28,39 @@
+ 		average_vertex_connectivity = 0;
+ 	end
+ 	methods
++                function createxml(obj,fid) % {{{
++            fprintf(fid, '<!-- 2d Mesh (Vertical) -->\n');
++            
++            %elements and vertices
++            fprintf(fid,'%s\n%s\n%s\n','       <frame key="1" label="Elements and vertices">','       <section name="mesh" />');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements" type="',class(obj.numberofelements),'" default="',convert2str(obj.numberofelements),'">','              <help> number of elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices" type="',class(obj.numberofvertices),'" default="',convert2str(obj.numberofvertices),'">','              <help> number of vertices </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements" type="',class(obj.elements),'" default="',convert2str(obj.elements),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(obj.x),'" default="',convert2str(obj.x),'">','     <section name="mesh" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="edges" type="',class(obj.edges),'" default="',convert2str(obj.edges),'">','     <section name="mesh" />','     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofedges" type="',class(obj.numberofedges),'" default="',convert2str(obj.numberofedges),'">','     <section name="mesh" />','     <help> number of edges of the 2d mesh </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','       </frame>');
++     
++            % properties
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Properties">','<section name="mesh" />');             
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(obj.vertexonboundary),'" default="',convert2str(obj.vertexonboundary),'">','     <section name="mesh" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbase" type="',class(obj.vertexonbase),'" default="',convert2str(obj.vertexonbase),'">','     <section name="mesh" />','     <help> vertices on the bed of the domain flag list </help>','  </parameter>');            
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segments" type="',class(obj.segments),'" default="',convert2str(obj.segments),'">','     <section name="mesh" />','     <help> edges on domain boundary (vertex1 vertex2 element) </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segmentmarkers" type="',class(obj.segmentmarkers),'" default="',convert2str(obj.segmentmarkers),'">','     <section name="mesh" />','     <help> number associated to each segment </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexconnectivity" type="',class(obj.vertexconnectivity),'" default="',convert2str(obj.vertexconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to vertex_i </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementconnectivity" type="',class(obj.elementconnectivity),'" default="',convert2str(obj.elementconnectivity),'">','     <section name="mesh" />','     <help> list of vertices connected to element_i </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="average_vertex_connectivity" type="',class(obj.average_vertex_connectivity),'" default="',convert2str(obj.average_vertex_connectivity),'">','     <section name="mesh" />','     <help> average number of vertices connected to one vertex </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++
++            %projection
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="3" label="Projection">','<section name="mesh" />'); 
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(obj.lat),'" default="',convert2str(obj.lat),'">','     <section name="mesh" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(obj.long),'" default="',convert2str(obj.long),'">','     <section name="mesh" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="hemisphere" type="',class(obj.hemisphere),'" default="',convert2str(obj.hemisphere),'">','     <section name="mesh" />','     <help> Indicate hemisphere ''n'' or ''s'' </help>','  </parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        
++        end % }}}
+ 		function obj = mesh2dvertical(varargin) % {{{
+ 			switch nargin
+ 				case 0
+Index: ../trunk-jpl/src/m/classes/matice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/matice.m	(revision 17931)
+@@ -54,8 +54,15 @@
+              
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(obj.rheology_B),'" default="',convert2str(obj.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(obj.rheology_n),'" default="',convert2str(obj.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="',class(obj.rheology_law),'" default="',convert2str(obj.rheology_law),'">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>','</parameter>');
+              
++             % rheology_law drop-down
++             fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="alternative" optional="false">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>');
++             fprintf(fid,'%s\n','       <option value="None" type="string" default="true"> </option>');
++             fprintf(fid,'%s\n','       <option value="Paterson" type="string" default="false"> </option>');
++             fprintf(fid,'%s\n','       <option value="Arrhenius" type="string" default="false"> </option>');
++             fprintf(fid,'%s\n%s\n','       <option value="LliboutryDuval" type="string" default="false"> </option>','</parameter>');
++             
++             
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(obj.lithosphere_shear_modulus),'" default="',convert2str(obj.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(obj.lithosphere_density),'" default="',convert2str(obj.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(obj.mantle_shear_modulus),'" default="',convert2str(obj.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
+Index: ../trunk-jpl/src/m/classes/transient.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/transient.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/transient.m	(revision 17931)
+@@ -26,7 +26,7 @@
+                 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isthermal" type="',class(obj.isthermal),'" default="',convert2str(obj.isthermal),'">','     <section name="transient" />','     <help> indicates whether a thermal solution is used in the transient </help>','  </parameter>');
+                 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isgroundingline" type="',class(obj.isgroundingline),'" default="',convert2str(obj.isgroundingline),'">','     <section name="transient" />','     <help> indicates whether a groundingline migration is used in the transient </help>','  </parameter>');
+                 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isgia" type="',class(obj.isgia),'" default="',convert2str(obj.isgia),'">','     <section name="transient" />','     <help> indicates whether a postglacial rebound model is used in the transient </help>','  </parameter>');
+-                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdamage" type="',class(obj.isdamage),'" default="',convert2str(obj.isdamage),'">','     <section name="transient" />','     <help> indicates whether damage evolution is used in the transient </help>','  </parameter>');
++                fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isdamageevolution" type="',class(obj.isdamageevolution),'" default="',convert2str(obj.isdamageevolution),'">','     <section name="transient" />','     <help> indicates whether damage evolution is used in the transient </help>','  </parameter>');
+                 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="islevelset" type="',class(obj.islevelset),'" default="',convert2str(obj.islevelset),'">','     <section name="transient" />','     <help> LEVEL SET DESCRIPTION...  </help>','  </parameter>');
+                 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="requested_outputs" type="',class(obj.requested_outputs),'" default="',convert2str(obj.requested_outputs),'">','     <section name="transient" />','     <help> list of additional outputs requested </help>','  </parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');    
+Index: ../trunk-jpl/src/m/classes/timestepping.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/timestepping.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/timestepping.m	(revision 17931)
+@@ -18,7 +18,10 @@
+ 			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="start_time" type="',              class(obj.start_time),'" default="',                  convert2str(obj.start_time),'">',              '     <section name="timestepping" />','     <help> simulation starting time [yr] </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="final_time" type="',            class(obj.final_time),'" default="',                convert2str(obj.final_time),'">',   '     <section name="timestepping" />','     <help> final time to stop the simulation [yr] </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="time_step" type="',      class(obj.time_step),'" default="',          convert2str(obj.time_step),'">',            '     <section name="timestepping" />','     <help> length of time steps [yr] </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="time_adapt" type="',     class(obj.time_adapt),'" default="',         convert2str(obj.time_adapt),'">',            '     <section name="timestepping" />','     <help> use cfl condition to define time step ? (0 or 1)  </help>','</parameter>');
++            % time_adapt 0 or 1 drop down
++            fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="time_adapt" type="alternative" optional="false">','     <section name="timestepping" />','     <help> use cfl condition to define time step ? (0 or 1)  </help>');
++            fprintf(fid, '%s\n',   '       <option value="0" type="string" default="true"></option>');
++            fprintf(fid, '%s\n%s\n',   '       <option value="1" type="string" default="false"></option>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="cfl_coefficient" type="',       class(obj.cfl_coefficient),'" default="',              convert2str(obj.cfl_coefficient),'">',              '     <section name="timestepping" />','     <help> coefficient applied to cfl condition </help>','</parameter>');
+             
+         end % }}}
+Index: ../trunk-jpl/src/m/classes/mesh2d.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/mesh2d.m	(revision 17931)
+@@ -104,58 +104,21 @@
+ 			fielddisplay(obj,'hemisphere','Indicate hemisphere ''n'' or ''s'' ');
+ 		end % }}}
+         function createxml(obj,fid) % {{{
+-            fprintf(fid, '<!-- mesh -->\n');
++            fprintf(fid, '<!-- 2D tria Mesh (horizontal) -->\n');
+             
+-            % drop-down 
+-            fprintf(fid,'%s%s%s%s%s\n%s\n','<parameter key ="Dimension" type="','alternative','" optional="','false','">','     <section name="mesh" />');
+-            
+-                % dimension=0
+-                fprintf(fid,'%s%s%s%s%s\n%s\n','     <option value="0" type="','string','" default="','true','">','        <help> dimension is 0 </help>');
+-                % footer for dim=0
+-                fprintf(fid,'%s\n%s\n','     </option>');
+-
+-                % dimension=3
+-                fprintf(fid,'%s%s%s\n%s\n','     <option value="3" type="','string','">','        <help> dimension is 3 </help>');
+-
+-                    fprintf(fid,'       <!-- Elements and vertices of the original 2d mesh -->\n');
+-                    %fprintf(fid,'%s\n%s\n%s\n','       <frame key="dim=3" label="Elements and vertices of the original 2d mesh">','       <section name="mesh" />');
+-                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="x2d" type="',class(obj.x2d),'" default="',convert2str(obj.x2d),'">','              <help> vertices x coordinate [m] </help>','          </parameter>');
+-                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="y2d" type="',class(obj.y2d),'" default="',convert2str(obj.y2d),'">','              <help> vertices y coordinate [m] </help>','          </parameter>');
+-                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="elements2d" type="',class(obj.elements2d),'" default="',convert2str(obj.elements2d),'">','              <help> vertex indices of the mesh elements </help>','          </parameter>');
+-                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofvertices2d" type="',class(obj.numberofvertices2d),'" default="',convert2str(obj.numberofvertices2d),'">','              <help> number of vertices </help>','          </parameter>');
+-                    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','          <parameter key ="numberofelements2d" type="',class(obj.numberofelements2d),'" default="',convert2str(obj.numberofelements2d),'">','              <help> number of elements </help>','          </parameter>');
+-                    %fprintf(fid,'%s\n%s\n','       </frame>');
+-                % footer for dim=3
+-                fprintf(fid,'%s\n%s\n','     </option>');   
+-            
+-            % footer for drop-down
+-            fprintf(fid,'%s\n%s\n%s','     <help> select a mesh dimension 0(default) or 3 </help>','</parameter>');
+-            
+-                    
+-            % elements and vertices
+-            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Elements and vertices">','<section name="mesh" />');                    
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofelements" type="',class(obj.numberofelements),'" default="',convert2str(obj.numberofelements),'">','     <section name="mesh" />','     <help> number of elements </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofvertices" type="',class(obj.numberofvertices),'" default="',convert2str(obj.numberofvertices),'">','     <section name="mesh" />','     <help> number of verticies </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elements" type="',class(obj.elements),'" default="',convert2str(obj.elements),'">','     <section name="mesh" />','     <help> vertex indices of the mesh elements </help>','  </parameter>');
++            %elements and vertices
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Elements and vertices">','<section name="mesh" />');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="numberofelements" type="',class(obj.numberofelements),'" default="',convert2str(obj.numberofelements),'">','     <section name="mesh" />','     <help> number of elements </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="numberofvertices" type="',class(obj.numberofvertices),'" default="',convert2str(obj.numberofvertices),'">','     <section name="mesh" />','     <help> number of vertices </help>','  </parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="elements" type="',class(obj.elements),'" default="',convert2str(obj.elements),'">','     <section name="mesh" />','     <help> vertex indices of the mesh elements </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="x" type="',class(obj.x),'" default="',convert2str(obj.x),'">','     <section name="mesh" />','     <help> vertices x coordinate [m] </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="y" type="',class(obj.y),'" default="',convert2str(obj.y),'">','     <section name="mesh" />','     <help> vertices y coordinate [m] </help>','  </parameter>');
+-		    fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="z" type="',class(obj.z),'" default="',convert2str(obj.z),'">','     <section name="mesh" />','     <help> vertices z coordinate [m] </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="edges" type="',class(obj.edges),'" default="',convert2str(obj.edges),'">','     <section name="mesh" />','     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberofedges" type="',class(obj.numberofedges),'" default="',convert2str(obj.numberofedges),'">','     <section name="mesh" />','     <help> number of edges of the 2d mesh </help>','  </parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');
+-            
++     
+             % properties
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="2" label="Properties">','<section name="mesh" />');             
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="selected dimension" type="',class(obj.dimension),'" default="',convert2str(obj.dimension),'">','     <section name="mesh" />','     <help> mesh dimension </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="numberoflayers" type="',class(obj.numberoflayers),'" default="',convert2str(obj.numberoflayers),'">','     <section name="mesh" />','     <help> number of extrusion layers </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonbed" type="',class(obj.vertexonbed),'" default="',convert2str(obj.vertexonbed),'">','     <section name="mesh" />','     <help> lower vertices flags list </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementonbed" type="',class(obj.elementonbed),'" default="',convert2str(obj.elementonbed),'">','     <section name="mesh" />','     <help> lower elements flags list </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonsurface" type="',class(obj.vertexonsurface),'" default="',convert2str(obj.vertexonsurface),'">','     <section name="mesh" />','     <help> upper vertices flags list </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="elementonsurface" type="',class(obj.elementonsurface),'" default="',convert2str(obj.elementonsurface),'">','     <section name="mesh" />','     <help> upper element flag list </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="uppervertex" type="',class(obj.uppervertex),'" default="',convert2str(obj.uppervertex),'">','     <section name="mesh" />','     <help> upper vertex list (NaN for vertex on the upper surface) </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="upperelements" type="',class(obj.upperelements),'" default="',convert2str(obj.upperelements),'">','     <section name="mesh" />','     <help> upper element list (NaN for element on the upper layer) </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowervertex" type="',class(obj.lowervertex),'" default="',convert2str(obj.lowervertex),'">','     <section name="mesh" />','     <help> lower vertex list (NaN for vertex on the lower surface) </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lowerelements" type="',class(obj.lowerelements),'" default="',convert2str(obj.lowerelements),'">','     <section name="mesh" />','     <help> lower element list (NaN for element on the lower layer </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="vertexonboundary" type="',class(obj.vertexonboundary),'" default="',convert2str(obj.vertexonboundary),'">','     <section name="mesh" />','     <help> vertices on the boundary of the domain flag list </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segments" type="',class(obj.segments),'" default="',convert2str(obj.segments),'">','     <section name="mesh" />','     <help> edges on domain boundary (vertex1 vertex2 element) </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="segmentmarkers" type="',class(obj.segmentmarkers),'" default="',convert2str(obj.segmentmarkers),'">','     <section name="mesh" />','     <help> number associated to each segment </help>','  </parameter>');
+@@ -174,7 +137,11 @@
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="4" label="Projection">','<section name="mesh" />'); 
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="lat" type="',class(obj.lat),'" default="',convert2str(obj.lat),'">','     <section name="mesh" />','     <help> vertices latitude [degrees] </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="long" type="',class(obj.long),'" default="',convert2str(obj.long),'">','     <section name="mesh" />','     <help> verticies longitude [degrees] </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n','  <parameter key ="hemisphere" type="',class(obj.hemisphere),'" default="',convert2str(obj.hemisphere),'">','     <section name="mesh" />','     <help> Indicate hemisphere ''n'' or ''s'' </help>','  </parameter>');
++            % choice (hemisphere) 'n' or 's'
++            fprintf(fid,'%s\n%s\n%s\n','  <parameter key ="hemisphere" type="alternative" optional="false">','     <section name="mesh" />','     <help> Indicate hemisphere ''n'' or ''s'' </help>');
++            fprintf(fid,'%s\n','       <option value="n" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="s" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','  </parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');
+         
+         end % }}}
+Index: ../trunk-jpl/src/m/classes/stressbalance.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/stressbalance.m	(revision 17931)
+@@ -34,7 +34,13 @@
+ 			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="restol" type="',      class(obj.restol),'" default="',        convert2str(obj.restol),'">',	'     <section name="stressbalance" />','     <help> mechanical equilibrium residual convergence criterion </help>','</parameter>');
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="reltol" type="',          class(obj.reltol),'" default="',            convert2str(obj.reltol),'">',     '     <section name="stressbalance" />','     <help> velocity relative convergence criterion, NaN: not applied </help>','</parameter>');
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',	'<parameter key ="abstol" type="',        class(obj.abstol),'" default="',          convert2str(obj.abstol),'">',	'     <section name="stressbalance" />','     <help> velocity absolute convergence criterion, NaN: not applied </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isnewton" type="',          class(obj.isnewton),'" default="',            convert2str(obj.isnewton),'">',	'     <section name="stressbalance" />','     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>','</parameter>');
++             
++             %is newton drop-down (0,1,or 2)
++             fprintf(fid,'%s\n%s\n%s\n%s\n',    '<parameter key ="isnewton" type="alternative" optional="false">',	'     <section name="stressbalance" />','     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>');
++             fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
++             fprintf(fid,'%s\n','       <option value="1" type="string" default="false"> </option>');
++             fprintf(fid,'%s\n%s\n','       <option value="2" type="string" default="false"> </option>','</parameter>');
++    
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="maxiter" type="',  	class(obj.maxiter),'" default="',       convert2str(obj.maxiter),'">',     '     <section name="stressbalance" />','     <help> maximum number of nonlinear iterations </help>','</parameter>');
+              fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="viscosity_overshoot" type="',         class(obj.viscosity_overshoot),'" default="',           convert2str(obj.viscosity_overshoot),'">',	'     <section name="stressbalance" />','     <help> over-shooting constant new=new+C*(new-old) </help>','</parameter>');
+             fprintf(fid,'%s\n%s\n','</frame>');
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17931)
+@@ -1094,7 +1094,7 @@
+ 			md.debug            = debug();
+ 			md.verbose          = verbose();
+ 			md.settings         = settings();
+-			md.toolkits         = toolkits();
++			%md.toolkits         = toolkits();
+ 			md.cluster          = generic();
+ 			md.balancethickness = balancethickness();
+ 			md.stressbalance    = stressbalance();
+Index: ../trunk-jpl/src/m/classes/flowequation.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/flowequation.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/flowequation.m	(revision 17931)
+@@ -69,9 +69,31 @@
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="isHO" type="',     class(obj.isHO),'" default="',         convert2str(obj.isHO),'">',            '     <section name="flowequation" />','     <help> is the Higher-Order (HO) approximation used ? </help>','</parameter>');
+             
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="isFS" type="',       class(obj.isFS),'" default="',              convert2str(obj.isFS),'">',              '     <section name="flowequation" />','     <help> are the Full-FS (FS) equations used ? </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="fe_SSA" type="',             class(obj.fe_SSA),'" default="',   convert2str(obj.fe_SSA),'">',   '     <section name="flowequation" />','     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="fe_HO" type="',        class(obj.fe_HO),'" default="',            convert2str(obj.fe_HO),'">',            '     <section name="flowequation" />','     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>','</parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="fe_FS" type="',   class(obj.fe_FS),'" default="',            convert2str(obj.fe_FS),'">',            '     <section name="flowequation" />','     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>','</parameter>');
++            
++            % fe_SSA drop-down (P1, P1bubble, P1bubblecondensed, P2)
++            fprintf(fid,'%s\n%s\n%s\n%s\n',    '<parameter key ="fe_SSA" type="alternative" optional="false">','     <section name="flowequation" />','     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>');
++            fprintf(fid,'%s\n','       <option value="P1" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="P1bubble" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','       <option value="P1bubblecondensed" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="P2" type="string" default="false"> </option>','</parameter>');
++            
++            %fe_HO drop-down (P1, P1bubble, P1bubblecondensed, P1xP2, P2xP1, P2)
++            fprintf(fid,'%s\n%s\n%s\n%s\n',        '<parameter key ="fe_HO" type="alternative" optional="false">','     <section name="flowequation" />','     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>');
++            fprintf(fid,'%s\n','       <option value="P1" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="P1bubble" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','       <option value="P1bubblecondensed" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','       <option value="P1xP2" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','       <option value="P2xP1" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="P2" type="string" default="false"> </option>','</parameter>');
++            
++            % fe_FS drop-down (P1P1, P1P1GLS, MINIcondensed, MINI, TaylowHood)
++            fprintf(fid,'%s\n%s\n%s\n%s\n',        '<parameter key ="fe_FS" type="alternative" optional="false">','     <section name="flowequation" />','     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>');
++            fprintf(fid,'%s\n','       <option value="P1P1" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="P1P1GLS" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','       <option value="MINIcondensed" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','       <option value="MINI" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="TaylorHood" type="string" default="false"> </option>','</parameter>');
++            
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="vertex_equation" type="',      class(obj.vertex_equation),'" default="',            convert2str(obj.vertex_equation),'">',            '     <section name="flowequation" />','     <help> flow equation for each vertex </help>','</parameter>');
+        
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="element_equation" type="',            class(obj.element_equation),'" default="',              convert2str(obj.element_equation),'">',              '     <section name="flowequation" />','     <help> flow equation for each element </help>','</parameter>');
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17931)
+@@ -71,7 +71,13 @@
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="spcdamage" type="',      class(obj.spcdamage),'" default="',          num2str(obj.spcdamage),'">',            '     <section name="damage" />','     <help> damage constraints (NaN means no constraint) </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="max_damage" type="',     class(obj.max_damage),'" default="',         num2str(obj.max_damage),'">',            '     <section name="damage" />','     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>','</parameter>');
+              
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="stabilization" type="',       class(obj.stabilization),'" default="',              num2str(obj.stabilization),'">',              '     <section name="damage" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>','</parameter>');
++            % stabilization (0,1, or 2) drop-down
++            fprintf(fid,'%s\n%s\n%s\n%s\n',    '<parameter key ="stabilization" type="alternative" optional="false">','     <section name="damage" />','     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>');
++            fprintf(fid, '%s\n', '       <option value="0" type="string" default="true"></option>');
++            fprintf(fid, '%s\n', '       <option value="1" type="string" default="false"></option>');
++            fprintf(fid, '%s\n', '       <option value="2" type="string" default="false"></option>');
++            fprintf(fid, '%s\n','</parameter>');
++            
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="maxiter" type="',             class(obj.maxiter),'" default="',   num2str(obj.maxiter),'">',   '     <section name="damage" />','     <help> maximum number of non linear iterations </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_lock" type="',        class(obj.penalty_lock),'" default="',            num2str(obj.penalty_lock),'">',            '     <section name="damage" />','     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>','</parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',        '<parameter key ="penalty_threshold" type="',   class(obj.penalty_threshold),'" default="',            num2str(obj.penalty_threshold),'">',            '     <section name="damage" />','     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>','</parameter>');
+Index: ../trunk-jpl/src/m/classes/masstransport.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/masstransport.m	(revision 17930)
++++ ../trunk-jpl/src/m/classes/masstransport.m	(revision 17931)
+@@ -51,8 +51,19 @@
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="calvingrate" type="',class(obj.calvingrate),'" default="',convert2str(obj.calvingrate),'">','     <section name="masstransport" />','     <help> calving rate at given location [m/a] </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="isfreesurface" type="',class(obj.isfreesurface),'" default="',convert2str(obj.isfreesurface),'">','     <section name="masstransport" />','     <help> do we use free surfaces (FS only) are mass conservation </help>','  </parameter>');
+             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="min_thickness" type="',class(obj.min_thickness),'" default="',convert2str(obj.min_thickness),'">','     <section name="masstransport" />','     <help> minimum ice thickness allowed [m] </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="hydrostatic_adjustment" type="',class(obj.hydrostatic_adjustment),'" default="',convert2str(obj.hydrostatic_adjustment),'">','     <section name="masstransport" />','     <help> adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute''  </help>','  </parameter>');
+-            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','  <parameter key ="stabilization" type="',class(obj.stabilization),'" default="',convert2str(obj.stabilization),'">','     <section name="masstransport" />','     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>','  </parameter>');
++            
++            % hydrostatic_adjustment drop-down (incremental or absolute )
++            fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="hydrostatic_adjustment" type="alternative" optional ="false">','     <section name="masstransport" />','     <help> adjustment of ice shelves surface and bed elevations: ''Incremental'' or ''Absolute''  </help>');
++            fprintf(fid,'%s\n','       <option value="Incremental" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="Absolute" type="string" default="false"> </option>','</parameter>');
++            
++            %stabilization drop-down (0, 1, 2, or 3)
++            fprintf(fid,'%s\n%s\n%s\n%s\n','  <parameter key ="stabilization" type="alternative" optional="false">','     <section name="masstransport" />','     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>');
++            fprintf(fid,'%s\n','       <option value="0" type="string" default="true"> </option>');
++            fprintf(fid,'%s\n','       <option value="1" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n','       <option value="2" type="string" default="false"> </option>');
++            fprintf(fid,'%s\n%s\n','       <option value="3" type="string" default="false"> </option>','</parameter>');
++
+             fprintf(fid,'%s\n%s\n','</frame>');    
+             
+             %Penalty options
Index: /issm/oecreview/Archive/17802-17983/ISSM-17931-17932.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17931-17932.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17931-17932.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17931)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17932)
+@@ -1094,7 +1094,7 @@
+ 			md.debug            = debug();
+ 			md.verbose          = verbose();
+ 			md.settings         = settings();
+-			%md.toolkits         = toolkits();
++			md.toolkits         = toolkits();
+ 			md.cluster          = generic();
+ 			md.balancethickness = balancethickness();
+ 			md.stressbalance    = stressbalance();
Index: /issm/oecreview/Archive/17802-17983/ISSM-17932-17933.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17932-17933.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17932-17933.diff	(revision 17986)
@@ -0,0 +1,590 @@
+Index: ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17932)
++++ ../trunk-jpl/src/c/analyses/EnumToAnalysis.cpp	(revision 17933)
+@@ -16,6 +16,9 @@
+ 		#ifdef _HAVE_ADJOINTBALANCETHICKNESS_
+ 		case AdjointBalancethicknessAnalysisEnum : return new AdjointBalancethicknessAnalysis();
+ 		#endif
++		#ifdef _HAVE_ADJOINTBALANCETHICKNESS2_
++		case AdjointBalancethickness2AnalysisEnum : return new AdjointBalancethickness2Analysis();
++		#endif
+ 		#ifdef _HAVE_ADJOINTHORIZ_
+ 		case AdjointHorizAnalysisEnum : return new AdjointHorizAnalysis();
+ 		#endif
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp	(revision 0)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp	(revision 17933)
+@@ -0,0 +1,160 @@
++#include "./AdjointBalancethickness2Analysis.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++
++/*Model processor*/
++int  AdjointBalancethickness2Analysis::DofsPerNode(int** doflist,int domaintype,int approximation){/*{{{*/
++	return 1;
++}/*}}}*/
++void AdjointBalancethickness2Analysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void AdjointBalancethickness2Analysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void AdjointBalancethickness2Analysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void AdjointBalancethickness2Analysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void AdjointBalancethickness2Analysis::CreateLoads(Loads* loads, IoModel* iomodel){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++
++/*Finite Element Analysis*/
++void           AdjointBalancethickness2Analysis::Core(FemModel* femmodel){/*{{{*/
++	_error_("not implemented");
++}/*}}}*/
++ElementVector* AdjointBalancethickness2Analysis::CreateDVector(Element* element){/*{{{*/
++	/*Default, return NULL*/
++	return NULL;
++}/*}}}*/
++ElementMatrix* AdjointBalancethickness2Analysis::CreateJacobianMatrix(Element* element){/*{{{*/
++_error_("Not implemented");
++}/*}}}*/
++ElementMatrix* AdjointBalancethickness2Analysis::CreateKMatrix(Element* element){/*{{{*/
++
++	_error_("not implemented");
++	Balancethickness2Analysis* analysis = new Balancethickness2Analysis();
++	ElementMatrix* Ke = analysis->CreateKMatrix(element);
++	delete analysis;
++
++	/*Transpose and return Ke*/
++	Ke->Transpose();
++	return Ke;
++}/*}}}*/
++ElementVector* AdjointBalancethickness2Analysis::CreatePVector(Element* element){/*{{{*/
++
++	_error_("not implemented");
++	/*Intermediaries*/
++	int      domaintype;
++	Element* basalelement;
++
++	/*Get basal element*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DhorizontalEnum:
++			basalelement = element;
++			break;
++		case Domain3DEnum:
++			if(!element->IsOnBase()) return NULL;
++			basalelement = element->SpawnBasalElement();
++			break;
++		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
++	}
++
++	/*Intermediaries */
++	int         num_responses,i;
++	IssmDouble  dH[2];
++	IssmDouble  vx,vy,vel,Jdet;
++	IssmDouble  thickness,thicknessobs,weight;
++	int        *responses = NULL;
++	IssmDouble *xyz_list  = NULL;
++
++	/*Fetch number of nodes and dof for this finite element*/
++	int numnodes = basalelement->GetNumberOfNodes();
++
++	/*Initialize Element vector and vectors*/
++	ElementVector* pe     = basalelement->NewElementVector(SSAApproximationEnum);
++	IssmDouble*    basis  = xNew<IssmDouble>(numnodes);
++	IssmDouble*    dbasis = xNew<IssmDouble>(2*numnodes);
++
++	/*Retrieve all inputs and parameters*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++	basalelement->FindParam(&num_responses,InversionNumCostFunctionsEnum);
++	basalelement->FindParam(&responses,NULL,InversionCostFunctionsEnum);
++	Input* thickness_input    = basalelement->GetInput(ThicknessEnum);                          _assert_(thickness_input);
++	Input* thicknessobs_input = basalelement->GetInput(InversionThicknessObsEnum);              _assert_(thicknessobs_input);
++	Input* weights_input      = basalelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input           = basalelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vy_input           = basalelement->GetInput(VyEnum);                                 _assert_(vy_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++		gauss->GaussPoint(ig);
++
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++		basalelement->NodalFunctions(basis,gauss);
++		basalelement->NodalFunctionsDerivatives(dbasis,xyz_list,gauss);
++
++		thickness_input->GetInputValue(&thickness, gauss);
++		thickness_input->GetInputDerivativeValue(&dH[0],xyz_list,gauss);
++		thicknessobs_input->GetInputValue(&thicknessobs, gauss);
++
++		/*Loop over all requested responses*/
++		for(int resp=0;resp<num_responses;resp++){
++			weights_input->GetInputValue(&weight,gauss,responses[resp]);
++
++			switch(responses[resp]){
++				case ThicknessAbsMisfitEnum:
++					for(i=0;i<numnodes;i++) pe->values[i]+=(thicknessobs-thickness)*weight*Jdet*gauss->weight*basis[i];
++					break;
++				case ThicknessAbsGradientEnum:
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*dH[0]*dbasis[0*numnodes+i]*Jdet*gauss->weight;
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*dH[1]*dbasis[1*numnodes+i]*Jdet*gauss->weight;
++					break;
++				case ThicknessAlongGradientEnum:
++					vx_input->GetInputValue(&vx,gauss);
++					vy_input->GetInputValue(&vy,gauss);
++					vel = sqrt(vx*vx+vy*vy);
++					vx  = vx/(vel+1.e-9);
++					vy  = vy/(vel+1.e-9);
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*(dH[0]*vx+dH[1]*vy)*(dbasis[0*numnodes+i]*vx+dbasis[1*numnodes+i]*vy)*Jdet*gauss->weight;
++					break;
++				case ThicknessAcrossGradientEnum:
++					vx_input->GetInputValue(&vx,gauss);
++					vy_input->GetInputValue(&vy,gauss);
++					vel = sqrt(vx*vx+vy*vy);
++					vx  = vx/(vel+1.e-9);
++					vy  = vy/(vel+1.e-9);
++					for(i=0;i<numnodes;i++) pe->values[i]+= - weight*(dH[0]*(-vy)+dH[1]*vx)*(dbasis[0*numnodes+i]*(-vy)+dbasis[1*numnodes+i]*vx)*Jdet*gauss->weight;
++					break;
++				default:
++					_error_("response " << EnumToStringx(responses[resp]) << " not supported yet");
++			}
++		}
++	}
++
++	/*Clean up and return*/
++	xDelete<int>(responses);
++	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(basis);
++	xDelete<IssmDouble>(dbasis);
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	delete gauss;
++	return pe;
++}/*}}}*/
++void AdjointBalancethickness2Analysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
++	_error_("not implemented yet");
++}/*}}}*/
++void AdjointBalancethickness2Analysis::InputUpdateFromSolution(IssmDouble* solution,Element* element){/*{{{*/
++	element->InputUpdateFromSolutionOneDof(solution,AdjointEnum);
++}/*}}}*/
++void AdjointBalancethickness2Analysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
++	/*Default, do nothing*/
++	return;
++}/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17932)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17933)
+@@ -37,7 +37,7 @@
+ 	for(int i=0;i<iomodel->numberofelements;i++){
+ 		if(iomodel->my_elements[i]){
+ 			Element* element=(Element*)elements->GetObjectByOffset(counter);
+-			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
++			element->Update(i,iomodel,analysis_counter,analysis_type,P2Enum);
+ 			counter++;
+ 		}
+ 	}
+@@ -59,6 +59,8 @@
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ 	iomodel->FetchDataToInput(elements,FlowequationElementEquationEnum);
++	iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
++	iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+ 	iomodel->FetchDataToInput(elements,PressureEnum);
+@@ -85,14 +87,14 @@
+ void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+ 	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+-	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,P1Enum);
++	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,P2Enum);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void ThermalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+ 	/*Only 3d mesh supported*/
+ 	if(iomodel->domaintype==Domain3DEnum){
+-		IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,P1Enum);
++		IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,P2Enum);
+ 	}
+ 
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.h	(revision 0)
++++ ../trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.h	(revision 17933)
+@@ -0,0 +1,32 @@
++/*! \file AdjointBalancethickness2Analysis.h 
++ *  \brief: header file for generic external result object
++ */
++
++#ifndef _AdjointBalancethickness2Analysis_
++#define _AdjointBalancethickness2Analysis_
++
++/*Headers*/
++#include "./Analysis.h"
++
++class AdjointBalancethickness2Analysis: public Analysis{
++
++	public:
++		/*Model processing*/
++		int  DofsPerNode(int** doflist,int domaintype,int approximation);
++		void UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum);
++		void UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type);
++		void CreateNodes(Nodes* nodes,IoModel* iomodel);
++		void CreateConstraints(Constraints* constraints,IoModel* iomodel);
++		void CreateLoads(Loads* loads, IoModel* iomodel);
++
++		/*Finite element Analysis*/
++		void           Core(FemModel* femmodel);
++		ElementVector* CreateDVector(Element* element);
++		ElementMatrix* CreateJacobianMatrix(Element* element);
++		ElementMatrix* CreateKMatrix(Element* element);
++		ElementVector* CreatePVector(Element* element);
++		void GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element);
++		void InputUpdateFromSolution(IssmDouble* solution,Element* element);
++		void UpdateConstraints(FemModel* femmodel);
++};
++#endif
+Index: ../trunk-jpl/src/c/analyses/analyses.h
+===================================================================
+--- ../trunk-jpl/src/c/analyses/analyses.h	(revision 17932)
++++ ../trunk-jpl/src/c/analyses/analyses.h	(revision 17933)
+@@ -8,6 +8,7 @@
+ #include "./Analysis.h"
+ 
+ #include "./AdjointBalancethicknessAnalysis.h"
++#include "./AdjointBalancethickness2Analysis.h"
+ #include "./AdjointHorizAnalysis.h"
+ #include "./BalancethicknessAnalysis.h"
+ #include "./Balancethickness2Analysis.h"
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17932)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17933)
+@@ -328,6 +328,7 @@
+ 	AnalysisTypeEnum,
+ 	ConfigurationTypeEnum,
+ 	AdjointBalancethicknessAnalysisEnum,
++	AdjointBalancethickness2AnalysisEnum,
+ 	AdjointHorizAnalysisEnum,
+ 	AnalysisCounterEnum,
+ 	DefaultAnalysisEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17932)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17933)
+@@ -331,6 +331,7 @@
+ 		case AnalysisTypeEnum : return "AnalysisType";
+ 		case ConfigurationTypeEnum : return "ConfigurationType";
+ 		case AdjointBalancethicknessAnalysisEnum : return "AdjointBalancethicknessAnalysis";
++		case AdjointBalancethickness2AnalysisEnum : return "AdjointBalancethickness2Analysis";
+ 		case AdjointHorizAnalysisEnum : return "AdjointHorizAnalysis";
+ 		case AnalysisCounterEnum : return "AnalysisCounter";
+ 		case DefaultAnalysisEnum : return "DefaultAnalysis";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17932)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17933)
+@@ -337,6 +337,7 @@
+ 	      else if (strcmp(name,"AnalysisType")==0) return AnalysisTypeEnum;
+ 	      else if (strcmp(name,"ConfigurationType")==0) return ConfigurationTypeEnum;
+ 	      else if (strcmp(name,"AdjointBalancethicknessAnalysis")==0) return AdjointBalancethicknessAnalysisEnum;
++	      else if (strcmp(name,"AdjointBalancethickness2Analysis")==0) return AdjointBalancethickness2AnalysisEnum;
+ 	      else if (strcmp(name,"AdjointHorizAnalysis")==0) return AdjointHorizAnalysisEnum;
+ 	      else if (strcmp(name,"AnalysisCounter")==0) return AnalysisCounterEnum;
+ 	      else if (strcmp(name,"DefaultAnalysis")==0) return DefaultAnalysisEnum;
+@@ -381,11 +382,11 @@
+ 	      else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
+ 	      else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
+ 	      else if (strcmp(name,"GiaSolution")==0) return GiaSolutionEnum;
+-	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
++	      if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
++	      else if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
+ 	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+ 	      else if (strcmp(name,"ExtrapolationAnalysis")==0) return ExtrapolationAnalysisEnum;
+@@ -504,11 +505,11 @@
+ 	      else if (strcmp(name,"QmuVxMesh")==0) return QmuVxMeshEnum;
+ 	      else if (strcmp(name,"QmuVyMesh")==0) return QmuVyMeshEnum;
+ 	      else if (strcmp(name,"QmuVzMesh")==0) return QmuVzMeshEnum;
+-	      else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
++	      if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
++	      else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
+ 	      else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
+ 	      else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
+ 	      else if (strcmp(name,"SurfaceArea")==0) return SurfaceAreaEnum;
+@@ -627,11 +628,11 @@
+ 	      else if (strcmp(name,"MaxAbsVx")==0) return MaxAbsVxEnum;
+ 	      else if (strcmp(name,"MinVy")==0) return MinVyEnum;
+ 	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
+-	      else if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"MinVz")==0) return MinVzEnum;
++	      if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
++	      else if (strcmp(name,"MinVz")==0) return MinVzEnum;
+ 	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+ 	      else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
+ 	      else if (strcmp(name,"IceVolume")==0) return IceVolumeEnum;
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 17932)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 17933)
+@@ -15,8 +15,8 @@
+ 	int       counter;
+ 	Element  *element = NULL;
+ 	Material *material = NULL;
+-	int    num_control_type;
+-	bool   control_analysis;
++	int       num_control_type;
++	bool      control_analysis;
+ 
+ 	/*Fetch parameters: */
+ 	iomodel->Constant(&control_analysis,InversionIscontrolEnum);
+@@ -31,16 +31,24 @@
+ 	iomodel->FetchDataToInput(elements,InversionThicknessObsEnum,0.);
+ 
+ 	iomodel->FetchData(5,InversionControlParametersEnum,InversionCostFunctionsEnum,InversionCostFunctionsCoefficientsEnum,InversionMinParametersEnum,InversionMaxParametersEnum);
++
+ 	for(i=0;i<num_control_type;i++){
+-		switch(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])){
+-			case BalancethicknessThickeningRateEnum: iomodel->FetchData(1,BalancethicknessThickeningRateEnum); break;
+-			case VxEnum:   iomodel->FetchData(1,VxEnum); break;
+-			case VyEnum:   iomodel->FetchData(1,VyEnum); break;
+-			case ThicknessEnum:             iomodel->FetchData(1,ThicknessEnum); break;
+-			case FrictionCoefficientEnum:   iomodel->FetchData(1,FrictionCoefficientEnum); break;
+-			case MaterialsRheologyBbarEnum: iomodel->FetchData(1,MaterialsRheologyBEnum); break;
+-			case DamageDbarEnum: iomodel->FetchData(1,DamageDEnum); break;
+-			default: _error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
++		int control = reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i]);
++		switch(control){
++			/*List of supported controls*/
++			case BalancethicknessThickeningRateEnum: 
++			case VxEnum:
++			case VyEnum:
++			case ThicknessEnum:
++			case FrictionCoefficientEnum:
++			case MaterialsRheologyBbarEnum:
++			case DamageDbarEnum:
++			case BalancethicknessNuxEnum:
++			case BalancethicknessNuyEnum:
++				iomodel->FetchData(1,control); 
++				break;
++			default:
++				_error_("Control " << EnumToStringx(control) << " not implemented yet");
+ 		}
+ 	}
+ 
+Index: ../trunk-jpl/src/c/Makefile.am
+===================================================================
+--- ../trunk-jpl/src/c/Makefile.am	(revision 17932)
++++ ../trunk-jpl/src/c/Makefile.am	(revision 17933)
+@@ -420,6 +420,7 @@
+ 					./cores/gradient_core.cpp\
+ 					./cores/adjointstressbalance_core.cpp\
+ 					./cores/adjointbalancethickness_core.cpp\
++					./cores/adjointbalancethickness2_core.cpp\
+ 					./cores/AdjointCorePointerFromSolutionEnum.cpp\
+ 					./solutionsequences/solutionsequence_adjoint_linear.cpp\
+ 					./cores/hydrology_core.cpp\
+@@ -514,6 +515,9 @@
+ if ADJOINTBALANCETHICKNESS
+ issm_sources += ./analyses/AdjointBalancethicknessAnalysis.cpp
+ endif
++if ADJOINTBALANCETHICKNESS2
++issm_sources += ./analyses/AdjointBalancethickness2Analysis.cpp
++endif
+ if ADJOINTHORIZ
+ issm_sources += ./analyses/AdjointHorizAnalysis.cpp
+ endif
+Index: ../trunk-jpl/src/c/cores/adjointbalancethickness2_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/adjointbalancethickness2_core.cpp	(revision 0)
++++ ../trunk-jpl/src/c/cores/adjointbalancethickness2_core.cpp	(revision 17933)
+@@ -0,0 +1,39 @@
++/*!\file:  adjointbalancethickness2_core.cpp
++ * \brief compute inverse method adjoint state
++ */ 
++
++#include "./cores.h"
++#include "../toolkits/toolkits.h"
++#include "../classes/classes.h"
++#include "../shared/shared.h"
++#include "../modules/modules.h"
++#include "../solutionsequences/solutionsequences.h"
++
++void adjointbalancethickness2_core(FemModel* femmodel){
++
++	/*parameters: */
++	bool save_results;
++
++	/*retrieve parameters:*/
++	femmodel->parameters->FindParam(&save_results,SaveResultsEnum);
++
++	/*compute thickness2 */
++	if(VerboseSolution()) _printf0_("   computing thickness2\n");
++	femmodel->SetCurrentConfiguration(Balancethickness2AnalysisEnum);
++	solutionsequence_linear(femmodel);
++
++	/*Call SurfaceAreax, because some it might be needed by PVector*/
++	SurfaceAreax(NULL,femmodel);
++
++	/*compute adjoint*/
++	if(VerboseSolution()) _printf0_("   computing adjoint\n");
++	femmodel->SetCurrentConfiguration(Balancethickness2AnalysisEnum,AdjointBalancethickness2AnalysisEnum);
++	solutionsequence_adjoint_linear(femmodel);
++
++	/*Save results*/
++	if(save_results){
++		if(VerboseSolution()) _printf0_("   saving results\n");
++		int outputs[1] = {AdjointEnum};
++		femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],1);
++	}
++}
+Index: ../trunk-jpl/src/c/cores/AdjointCorePointerFromSolutionEnum.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/AdjointCorePointerFromSolutionEnum.cpp	(revision 17932)
++++ ../trunk-jpl/src/c/cores/AdjointCorePointerFromSolutionEnum.cpp	(revision 17933)
+@@ -31,6 +31,9 @@
+ 		case BalancethicknessSolutionEnum:
+ 			adjointcore=&adjointbalancethickness_core;
+ 			break;
++		case Balancethickness2SolutionEnum:
++			adjointcore=&adjointbalancethickness2_core;
++			break;
+ 		case BalancethicknessSoftSolutionEnum:
+ 			adjointcore=&dummy_core;
+ 			break;
+Index: ../trunk-jpl/src/c/cores/cores.h
+===================================================================
+--- ../trunk-jpl/src/c/cores/cores.h	(revision 17932)
++++ ../trunk-jpl/src/c/cores/cores.h	(revision 17933)
+@@ -17,6 +17,7 @@
+ /*cores: */
+ void adjointstressbalance_core(FemModel* femmodel);
+ void adjointbalancethickness_core(FemModel* femmodel);
++void adjointbalancethickness2_core(FemModel* femmodel);
+ void gradient_core(FemModel* femmodel,int n=0,bool orthogonalize=false);
+ void stressbalance_core(FemModel* femmodel);
+ void hydrology_core(FemModel* femmodel);
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17932)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17933)
+@@ -1018,47 +1018,34 @@
+ 	/*Control Inputs*/
+ 	if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+ 		for(i=0;i<num_control_type;i++){
+-			switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){
++			int control = reCast<int>(iomodel->Data(InversionControlParametersEnum)[i]);
++			switch(control){
++				/*yts conversion*/
+ 				case BalancethicknessThickeningRateEnum:
+-					if (iomodel->Data(BalancethicknessThickeningRateEnum)){
+-						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[tria_vertex_ids[j]-1];
+-						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						this->inputs->AddInput(new ControlInput(BalancethicknessThickeningRateEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-					}
+-					break;
+ 				case VxEnum:
+-					if (iomodel->Data(VxEnum)){
+-						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(VxEnum)[tria_vertex_ids[j]-1];
+-						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						this->inputs->AddInput(new ControlInput(VxEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-					}
+-					break;
+ 				case VyEnum:
+-					if (iomodel->Data(VyEnum)){
+-						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(VyEnum)[tria_vertex_ids[j]-1];
++					if(iomodel->Data(control)){
++						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(control)[tria_vertex_ids[j]-1];
+ 						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+ 						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						this->inputs->AddInput(new ControlInput(VyEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(control,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
++
++				/*No yts conversion*/
+ 				case ThicknessEnum:
+-					if (iomodel->Data(ThicknessEnum)){
+-						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(ThicknessEnum)[tria_vertex_ids[j]-1];
+-						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+-						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+-						this->inputs->AddInput(new ControlInput(ThicknessEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-					}
+-					break;
+ 				case FrictionCoefficientEnum:
+-					if (iomodel->Data(FrictionCoefficientEnum)){
+-						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[tria_vertex_ids[j]-1];
++				case BalancethicknessNuxEnum:
++				case BalancethicknessNuyEnum:
++					if(iomodel->Data(control)){
++						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(control)[tria_vertex_ids[j]-1];
+ 						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+ 						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+-						this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(control,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
++
++				/*Special cases (depth averaged quantities)*/
+ 				case MaterialsRheologyBbarEnum:
+ 					if(iomodel->Data(MaterialsRheologyBEnum)){
+ 						for(j=0;j<3;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[tria_vertex_ids[j]-1];
+@@ -1076,7 +1063,7 @@
+ 					}
+ 					break;
+ 				default:
+-					_error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
++					_error_("Control " << EnumToStringx(control) << " not implemented yet");
+ 			}
+ 		}
+ 	}
+Index: ../trunk-jpl/src/m/enum/AdjointBalancethickness2AnalysisEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/AdjointBalancethickness2AnalysisEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/AdjointBalancethickness2AnalysisEnum.m	(revision 17933)
+@@ -0,0 +1,11 @@
++function macro=AdjointBalancethickness2AnalysisEnum()
++%ADJOINTBALANCETHICKNESS2ANALYSISENUM - Enum of AdjointBalancethickness2Analysis
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=AdjointBalancethickness2AnalysisEnum()
++
++macro=StringToEnum('AdjointBalancethickness2Analysis');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17932)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17933)
+@@ -323,6 +323,7 @@
+ def AnalysisTypeEnum(): return StringToEnum("AnalysisType")[0]
+ def ConfigurationTypeEnum(): return StringToEnum("ConfigurationType")[0]
+ def AdjointBalancethicknessAnalysisEnum(): return StringToEnum("AdjointBalancethicknessAnalysis")[0]
++def AdjointBalancethickness2AnalysisEnum(): return StringToEnum("AdjointBalancethickness2Analysis")[0]
+ def AdjointHorizAnalysisEnum(): return StringToEnum("AdjointHorizAnalysis")[0]
+ def AnalysisCounterEnum(): return StringToEnum("AnalysisCounter")[0]
+ def DefaultAnalysisEnum(): return StringToEnum("DefaultAnalysis")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17933-17934.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17933-17934.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17933-17934.diff	(revision 17986)
@@ -0,0 +1,828 @@
+Index: ../trunk-jpl/m4/analyses.m4
+===================================================================
+--- ../trunk-jpl/m4/analyses.m4	(revision 17933)
++++ ../trunk-jpl/m4/analyses.m4	(revision 17934)
+@@ -10,810 +10,452 @@
+ [
+ 
+ dnl with-AdjointBalancethickness{{{
+-
+ AC_ARG_WITH([AdjointBalancethickness],
+-
+ 	AS_HELP_STRING([--with-AdjointBalancethickness = YES], [compile with AdjointBalancethickness capabilities (default is yes)]),
+-
+ 	[ADJOINTBALANCETHICKNESS=$withval],[ADJOINTBALANCETHICKNESS=yes])
+-
+ AC_MSG_CHECKING(for AdjointBalancethickness capability compilation)
+ 
+-
+ HAVE_ADJOINTBALANCETHICKNESS=no 
+-
+ if test "x$ADJOINTBALANCETHICKNESS" = "xyes"; then
+-
+ 	HAVE_ADJOINTBALANCETHICKNESS=yes
+-
+ 	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS_],[1],[with AdjointBalancethicknesscapability])
+-
+ fi
+-
+ AM_CONDITIONAL([ADJOINTBALANCETHICKNESS], [test x$HAVE_ADJOINTBALANCETHICKNESS = xyes])
+-
+ AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS)
++dnl }}}
++dnl with-AdjointBalancethickness2{{{
++AC_ARG_WITH([AdjointBalancethickness2],
++	AS_HELP_STRING([--with-AdjointBalancethickness2 = YES], [compile with AdjointBalancethickness2 capabilities (default is yes)]),
++	[ADJOINTBALANCETHICKNESS2=$withval],[ADJOINTBALANCETHICKNESS2=yes])
++AC_MSG_CHECKING(for AdjointBalancethickness2 capability compilation)
+ 
++HAVE_ADJOINTBALANCETHICKNESS2=no 
++if test "x$ADJOINTBALANCETHICKNESS2" = "xyes"; then
++	HAVE_ADJOINTBALANCETHICKNESS2=yes
++	AC_DEFINE([_HAVE_ADJOINTBALANCETHICKNESS2_],[1],[with AdjointBalancethickness2capability])
++fi
++AM_CONDITIONAL([ADJOINTBALANCETHICKNESS2], [test x$HAVE_ADJOINTBALANCETHICKNESS2 = xyes])
++AC_MSG_RESULT($HAVE_ADJOINTBALANCETHICKNESS2)
+ dnl }}}
+ dnl with-AdjointHoriz{{{
+-
+ AC_ARG_WITH([AdjointHoriz],
+-
+ 	AS_HELP_STRING([--with-AdjointHoriz = YES], [compile with AdjointHoriz capabilities (default is yes)]),
+-
+ 	[ADJOINTHORIZ=$withval],[ADJOINTHORIZ=yes])
+-
+ AC_MSG_CHECKING(for AdjointHoriz capability compilation)
+ 
+-
+ HAVE_ADJOINTHORIZ=no 
+-
+ if test "x$ADJOINTHORIZ" = "xyes"; then
+-
+ 	HAVE_ADJOINTHORIZ=yes
+-
+ 	AC_DEFINE([_HAVE_ADJOINTHORIZ_],[1],[with AdjointHorizcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([ADJOINTHORIZ], [test x$HAVE_ADJOINTHORIZ = xyes])
+-
+ AC_MSG_RESULT($HAVE_ADJOINTHORIZ)
+-
+ dnl }}}
+ dnl with-Balancethickness{{{
+-
+ AC_ARG_WITH([Balancethickness],
+-
+ 	AS_HELP_STRING([--with-Balancethickness = YES], [compile with Balancethickness capabilities (default is yes)]),
+-
+ 	[BALANCETHICKNESS=$withval],[BALANCETHICKNESS=yes])
+-
+ AC_MSG_CHECKING(for Balancethickness capability compilation)
+ 
+-
+ HAVE_BALANCETHICKNESS=no 
+-
+ if test "x$BALANCETHICKNESS" = "xyes"; then
+-
+ 	HAVE_BALANCETHICKNESS=yes
+-
+ 	AC_DEFINE([_HAVE_BALANCETHICKNESS_],[1],[with Balancethicknesscapability])
+-
+ fi
+-
+ AM_CONDITIONAL([BALANCETHICKNESS], [test x$HAVE_BALANCETHICKNESS = xyes])
+-
+ AC_MSG_RESULT($HAVE_BALANCETHICKNESS)
+-
+ dnl }}}
+ dnl with-Balancethickness2{{{
+-
+ AC_ARG_WITH([Balancethickness2],
+-
+ 	AS_HELP_STRING([--with-Balancethickness2 = YES], [compile with Balancethickness2 capabilities (default is yes)]),
+-
+ 	[BALANCETHICKNESS2=$withval],[BALANCETHICKNESS2=yes])
+-
+ AC_MSG_CHECKING(for Balancethickness2 capability compilation)
+ 
+-
+ HAVE_BALANCETHICKNESS2=no 
+-
+ if test "x$BALANCETHICKNESS2" = "xyes"; then
+-
+ 	HAVE_BALANCETHICKNESS2=yes
+-
+ 	AC_DEFINE([_HAVE_BALANCETHICKNESS2_],[1],[with Balancethickness2capability])
+-
+ fi
+-
+ AM_CONDITIONAL([BALANCETHICKNESS2], [test x$HAVE_BALANCETHICKNESS2 = xyes])
+-
+ AC_MSG_RESULT($HAVE_BALANCETHICKNESS2)
+-
+ dnl }}}
+ dnl with-BalancethicknessSoft{{{
+-
+ AC_ARG_WITH([BalancethicknessSoft],
+-
+ 	AS_HELP_STRING([--with-BalancethicknessSoft = YES], [compile with BalancethicknessSoft capabilities (default is yes)]),
+-
+ 	[BALANCETHICKNESSSOFT=$withval],[BALANCETHICKNESSSOFT=yes])
+-
+ AC_MSG_CHECKING(for BalancethicknessSoft capability compilation)
+ 
+-
+ HAVE_BALANCETHICKNESSSOFT=no 
+-
+ if test "x$BALANCETHICKNESSSOFT" = "xyes"; then
+-
+ 	HAVE_BALANCETHICKNESSSOFT=yes
+-
+ 	AC_DEFINE([_HAVE_BALANCETHICKNESSSOFT_],[1],[with BalancethicknessSoftcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([BALANCETHICKNESSSOFT], [test x$HAVE_BALANCETHICKNESSSOFT = xyes])
+-
+ AC_MSG_RESULT($HAVE_BALANCETHICKNESSSOFT)
+-
+ dnl }}}
+ dnl with-Balancevelocity{{{
+-
+ AC_ARG_WITH([Balancevelocity],
+-
+ 	AS_HELP_STRING([--with-Balancevelocity = YES], [compile with Balancevelocity capabilities (default is yes)]),
+-
+ 	[BALANCEVELOCITY=$withval],[BALANCEVELOCITY=yes])
+-
+ AC_MSG_CHECKING(for Balancevelocity capability compilation)
+ 
+-
+ HAVE_BALANCEVELOCITY=no 
+-
+ if test "x$BALANCEVELOCITY" = "xyes"; then
+-
+ 	HAVE_BALANCEVELOCITY=yes
+-
+ 	AC_DEFINE([_HAVE_BALANCEVELOCITY_],[1],[with Balancevelocitycapability])
+-
+ fi
+-
+ AM_CONDITIONAL([BALANCEVELOCITY], [test x$HAVE_BALANCEVELOCITY = xyes])
+-
+ AC_MSG_RESULT($HAVE_BALANCEVELOCITY)
+-
+ dnl }}}
+ dnl with-L2ProjectionEPL{{{
+-
+ AC_ARG_WITH([L2ProjectionEPL],
+-
+ 	AS_HELP_STRING([--with-L2ProjectionEPL = YES], [compile with L2ProjectionEPL capabilities (default is yes)]),
+-
+ 	[L2PROJECTIONEPL=$withval],[L2PROJECTIONEPL=yes])
+-
+ AC_MSG_CHECKING(for L2ProjectionEPL capability compilation)
+ 
+-
+ HAVE_L2PROJECTIONEPL=no 
+-
+ if test "x$L2PROJECTIONEPL" = "xyes"; then
+-
+ 	HAVE_L2PROJECTIONEPL=yes
+-
+ 	AC_DEFINE([_HAVE_L2PROJECTIONEPL_],[1],[with L2ProjectionEPLcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([L2PROJECTIONEPL], [test x$HAVE_L2PROJECTIONEPL = xyes])
+-
+ AC_MSG_RESULT($HAVE_L2PROJECTIONEPL)
+-
+ dnl }}}
+ dnl with-L2ProjectionBase{{{
+-
+ AC_ARG_WITH([L2ProjectionBase],
+-
+ 	AS_HELP_STRING([--with-L2ProjectionBase = YES], [compile with L2ProjectionBase capabilities (default is yes)]),
+-
+ 	[L2PROJECTIONBASE=$withval],[L2PROJECTIONBASE=yes])
+-
+ AC_MSG_CHECKING(for L2ProjectionBase capability compilation)
+ 
+-
+ HAVE_L2PROJECTIONBASE=no 
+-
+ if test "x$L2PROJECTIONBASE" = "xyes"; then
+-
+ 	HAVE_L2PROJECTIONBASE=yes
+-
+ 	AC_DEFINE([_HAVE_L2PROJECTIONBASE_],[1],[with L2ProjectionBasecapability])
+-
+ fi
+-
+ AM_CONDITIONAL([L2PROJECTIONBASE], [test x$HAVE_L2PROJECTIONBASE = xyes])
+-
+ AC_MSG_RESULT($HAVE_L2PROJECTIONBASE)
+-
+ dnl }}}
+ dnl with-DamageEvolution{{{
+-
+ AC_ARG_WITH([DamageEvolution],
+-
+ 	AS_HELP_STRING([--with-DamageEvolution = YES], [compile with DamageEvolution capabilities (default is yes)]),
+-
+ 	[DAMAGEEVOLUTION=$withval],[DAMAGEEVOLUTION=yes])
+-
+ AC_MSG_CHECKING(for DamageEvolution capability compilation)
+ 
+-
+ HAVE_DAMAGEEVOLUTION=no 
+-
+ if test "x$DAMAGEEVOLUTION" = "xyes"; then
+-
+ 	HAVE_DAMAGEEVOLUTION=yes
+-
+ 	AC_DEFINE([_HAVE_DAMAGEEVOLUTION_],[1],[with DamageEvolutioncapability])
+-
+ fi
+-
+ AM_CONDITIONAL([DAMAGEEVOLUTION], [test x$HAVE_DAMAGEEVOLUTION = xyes])
+-
+ AC_MSG_RESULT($HAVE_DAMAGEEVOLUTION)
+-
+ dnl }}}
+ dnl with-Stressbalance{{{
+-
+ AC_ARG_WITH([Stressbalance],
+-
+ 	AS_HELP_STRING([--with-Stressbalance = YES], [compile with Stressbalance capabilities (default is yes)]),
+-
+ 	[STRESSBALANCE=$withval],[STRESSBALANCE=yes])
+-
+ AC_MSG_CHECKING(for Stressbalance capability compilation)
+ 
+-
+ HAVE_STRESSBALANCE=no 
+-
+ if test "x$STRESSBALANCE" = "xyes"; then
+-
+ 	HAVE_STRESSBALANCE=yes
+-
+ 	AC_DEFINE([_HAVE_STRESSBALANCE_],[1],[with Stressbalancecapability])
+-
+ fi
+-
+ AM_CONDITIONAL([STRESSBALANCE], [test x$HAVE_STRESSBALANCE = xyes])
+-
+ AC_MSG_RESULT($HAVE_STRESSBALANCE)
+-
+ dnl }}}
+ dnl with-StressbalanceSIA{{{
+-
+ AC_ARG_WITH([StressbalanceSIA],
+-
+ 	AS_HELP_STRING([--with-StressbalanceSIA = YES], [compile with StressbalanceSIA capabilities (default is yes)]),
+-
+ 	[STRESSBALANCESIA=$withval],[STRESSBALANCESIA=yes])
+-
+ AC_MSG_CHECKING(for StressbalanceSIA capability compilation)
+ 
+-
+ HAVE_STRESSBALANCESIA=no 
+-
+ if test "x$STRESSBALANCESIA" = "xyes"; then
+-
+ 	HAVE_STRESSBALANCESIA=yes
+-
+ 	AC_DEFINE([_HAVE_STRESSBALANCESIA_],[1],[with StressbalanceSIAcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([STRESSBALANCESIA], [test x$HAVE_STRESSBALANCESIA = xyes])
+-
+ AC_MSG_RESULT($HAVE_STRESSBALANCESIA)
+-
+ dnl }}}
+ dnl with-StressbalanceVertical{{{
+-
+ AC_ARG_WITH([StressbalanceVertical],
+-
+ 	AS_HELP_STRING([--with-StressbalanceVertical = YES], [compile with StressbalanceVertical capabilities (default is yes)]),
+-
+ 	[STRESSBALANCEVERTICAL=$withval],[STRESSBALANCEVERTICAL=yes])
+-
+ AC_MSG_CHECKING(for StressbalanceVertical capability compilation)
+ 
+-
+ HAVE_STRESSBALANCEVERTICAL=no 
+-
+ if test "x$STRESSBALANCEVERTICAL" = "xyes"; then
+-
+ 	HAVE_STRESSBALANCEVERTICAL=yes
+-
+ 	AC_DEFINE([_HAVE_STRESSBALANCEVERTICAL_],[1],[with StressbalanceVerticalcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([STRESSBALANCEVERTICAL], [test x$HAVE_STRESSBALANCEVERTICAL = xyes])
+-
+ AC_MSG_RESULT($HAVE_STRESSBALANCEVERTICAL)
+-
+ dnl }}}
+ dnl with-Enthalpy{{{
+-
+ AC_ARG_WITH([Enthalpy],
+-
+ 	AS_HELP_STRING([--with-Enthalpy = YES], [compile with Enthalpy capabilities (default is yes)]),
+-
+ 	[ENTHALPY=$withval],[ENTHALPY=yes])
+-
+ AC_MSG_CHECKING(for Enthalpy capability compilation)
+ 
+-
+ HAVE_ENTHALPY=no 
+-
+ if test "x$ENTHALPY" = "xyes"; then
+-
+ 	HAVE_ENTHALPY=yes
+-
+ 	AC_DEFINE([_HAVE_ENTHALPY_],[1],[with Enthalpycapability])
+-
+ fi
+-
+ AM_CONDITIONAL([ENTHALPY], [test x$HAVE_ENTHALPY = xyes])
+-
+ AC_MSG_RESULT($HAVE_ENTHALPY)
+-
+ dnl }}}
+ dnl with-HydrologyShreve{{{
+-
+ AC_ARG_WITH([HydrologyShreve],
+-
+ 	AS_HELP_STRING([--with-HydrologyShreve = YES], [compile with HydrologyShreve capabilities (default is yes)]),
+-
+ 	[HYDROLOGYSHREVE=$withval],[HYDROLOGYSHREVE=yes])
+-
+ AC_MSG_CHECKING(for HydrologyShreve capability compilation)
+ 
+-
+ HAVE_HYDROLOGYSHREVE=no 
+-
+ if test "x$HYDROLOGYSHREVE" = "xyes"; then
+-
+ 	HAVE_HYDROLOGYSHREVE=yes
+-
+ 	AC_DEFINE([_HAVE_HYDROLOGYSHREVE_],[1],[with HydrologyShrevecapability])
+-
+ fi
+-
+ AM_CONDITIONAL([HYDROLOGYSHREVE], [test x$HAVE_HYDROLOGYSHREVE = xyes])
+-
+ AC_MSG_RESULT($HAVE_HYDROLOGYSHREVE)
+-
+ dnl }}}
+ dnl with-HydrologyDCInefficient{{{
+-
+ AC_ARG_WITH([HydrologyDCInefficient],
+-
+ 	AS_HELP_STRING([--with-HydrologyDCInefficient = YES], [compile with HydrologyDCInefficient capabilities (default is yes)]),
+-
+ 	[HYDROLOGYDCINEFFICIENT=$withval],[HYDROLOGYDCINEFFICIENT=yes])
+-
+ AC_MSG_CHECKING(for HydrologyDCInefficient capability compilation)
+ 
+-
+ HAVE_HYDROLOGYDCINEFFICIENT=no 
+-
+ if test "x$HYDROLOGYDCINEFFICIENT" = "xyes"; then
+-
+ 	HAVE_HYDROLOGYDCINEFFICIENT=yes
+-
+ 	AC_DEFINE([_HAVE_HYDROLOGYDCINEFFICIENT_],[1],[with HydrologyDCInefficientcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([HYDROLOGYDCINEFFICIENT], [test x$HAVE_HYDROLOGYDCINEFFICIENT = xyes])
+-
+ AC_MSG_RESULT($HAVE_HYDROLOGYDCINEFFICIENT)
+-
+ dnl }}}
+ dnl with-HydrologyDCEfficient{{{
+-
+ AC_ARG_WITH([HydrologyDCEfficient],
+-
+ 	AS_HELP_STRING([--with-HydrologyDCEfficient = YES], [compile with HydrologyDCEfficient capabilities (default is yes)]),
+-
+ 	[HYDROLOGYDCEFFICIENT=$withval],[HYDROLOGYDCEFFICIENT=yes])
+-
+ AC_MSG_CHECKING(for HydrologyDCEfficient capability compilation)
+ 
+-
+ HAVE_HYDROLOGYDCEFFICIENT=no 
+-
+ if test "x$HYDROLOGYDCEFFICIENT" = "xyes"; then
+-
+ 	HAVE_HYDROLOGYDCEFFICIENT=yes
+-
+ 	AC_DEFINE([_HAVE_HYDROLOGYDCEFFICIENT_],[1],[with HydrologyDCEfficientcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([HYDROLOGYDCEFFICIENT], [test x$HAVE_HYDROLOGYDCEFFICIENT = xyes])
+-
+ AC_MSG_RESULT($HAVE_HYDROLOGYDCEFFICIENT)
+-
+ dnl }}}
+ dnl with-Melting{{{
+-
+ AC_ARG_WITH([Melting],
+-
+ 	AS_HELP_STRING([--with-Melting = YES], [compile with Melting capabilities (default is yes)]),
+-
+ 	[MELTING=$withval],[MELTING=yes])
+-
+ AC_MSG_CHECKING(for Melting capability compilation)
+ 
+-
+ HAVE_MELTING=no 
+-
+ if test "x$MELTING" = "xyes"; then
+-
+ 	HAVE_MELTING=yes
+-
+ 	AC_DEFINE([_HAVE_MELTING_],[1],[with Meltingcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([MELTING], [test x$HAVE_MELTING = xyes])
+-
+ AC_MSG_RESULT($HAVE_MELTING)
+-
+ dnl }}}
+ dnl with-Masstransport{{{
+-
+ AC_ARG_WITH([Masstransport],
+-
+ 	AS_HELP_STRING([--with-Masstransport = YES], [compile with Masstransport capabilities (default is yes)]),
+-
+ 	[MASSTRANSPORT=$withval],[MASSTRANSPORT=yes])
+-
+ AC_MSG_CHECKING(for Masstransport capability compilation)
+ 
+-
+ HAVE_MASSTRANSPORT=no 
+-
+ if test "x$MASSTRANSPORT" = "xyes"; then
+-
+ 	HAVE_MASSTRANSPORT=yes
+-
+ 	AC_DEFINE([_HAVE_MASSTRANSPORT_],[1],[with Masstransportcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([MASSTRANSPORT], [test x$HAVE_MASSTRANSPORT = xyes])
+-
+ AC_MSG_RESULT($HAVE_MASSTRANSPORT)
+-
+ dnl }}}
+ dnl with-FreeSurfaceBase{{{
+-
+ AC_ARG_WITH([FreeSurfaceBase],
+-
+ 	AS_HELP_STRING([--with-FreeSurfaceBase = YES], [compile with FreeSurfaceBase capabilities (default is yes)]),
+-
+ 	[FREESURFACEBASE=$withval],[FREESURFACEBASE=yes])
+-
+ AC_MSG_CHECKING(for FreeSurfaceBase capability compilation)
+ 
+-
+ HAVE_FREESURFACEBASE=no 
+-
+ if test "x$FREESURFACEBASE" = "xyes"; then
+-
+ 	HAVE_FREESURFACEBASE=yes
+-
+ 	AC_DEFINE([_HAVE_FREESURFACEBASE_],[1],[with FreeSurfaceBasecapability])
+-
+ fi
+-
+ AM_CONDITIONAL([FREESURFACEBASE], [test x$HAVE_FREESURFACEBASE = xyes])
+-
+ AC_MSG_RESULT($HAVE_FREESURFACEBASE)
+-
+ dnl }}}
+ dnl with-FreeSurfaceTop{{{
+-
+ AC_ARG_WITH([FreeSurfaceTop],
+-
+ 	AS_HELP_STRING([--with-FreeSurfaceTop = YES], [compile with FreeSurfaceTop capabilities (default is yes)]),
+-
+ 	[FREESURFACETOP=$withval],[FREESURFACETOP=yes])
+-
+ AC_MSG_CHECKING(for FreeSurfaceTop capability compilation)
+ 
+-
+ HAVE_FREESURFACETOP=no 
+-
+ if test "x$FREESURFACETOP" = "xyes"; then
+-
+ 	HAVE_FREESURFACETOP=yes
+-
+ 	AC_DEFINE([_HAVE_FREESURFACETOP_],[1],[with FreeSurfaceTopcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([FREESURFACETOP], [test x$HAVE_FREESURFACETOP = xyes])
+-
+ AC_MSG_RESULT($HAVE_FREESURFACETOP)
+-
+ dnl }}}
+ dnl with-ExtrudeFromBase{{{
+-
+ AC_ARG_WITH([ExtrudeFromBase],
+-
+ 	AS_HELP_STRING([--with-ExtrudeFromBase = YES], [compile with ExtrudeFromBase capabilities (default is yes)]),
+-
+ 	[EXTRUDEFROMBASE=$withval],[EXTRUDEFROMBASE=yes])
+-
+ AC_MSG_CHECKING(for ExtrudeFromBase capability compilation)
+ 
+-
+ HAVE_EXTRUDEFROMBASE=no 
+-
+ if test "x$EXTRUDEFROMBASE" = "xyes"; then
+-
+ 	HAVE_EXTRUDEFROMBASE=yes
+-
+ 	AC_DEFINE([_HAVE_EXTRUDEFROMBASE_],[1],[with ExtrudeFromBasecapability])
+-
+ fi
+-
+ AM_CONDITIONAL([EXTRUDEFROMBASE], [test x$HAVE_EXTRUDEFROMBASE = xyes])
+-
+ AC_MSG_RESULT($HAVE_EXTRUDEFROMBASE)
+-
+ dnl }}}
+ dnl with-ExtrudeFromTop{{{
+-
+ AC_ARG_WITH([ExtrudeFromTop],
+-
+ 	AS_HELP_STRING([--with-ExtrudeFromTop = YES], [compile with ExtrudeFromTop capabilities (default is yes)]),
+-
+ 	[EXTRUDEFROMTOP=$withval],[EXTRUDEFROMTOP=yes])
+-
+ AC_MSG_CHECKING(for ExtrudeFromTop capability compilation)
+ 
+-
+ HAVE_EXTRUDEFROMTOP=no 
+-
+ if test "x$EXTRUDEFROMTOP" = "xyes"; then
+-
+ 	HAVE_EXTRUDEFROMTOP=yes
+-
+ 	AC_DEFINE([_HAVE_EXTRUDEFROMTOP_],[1],[with ExtrudeFromTopcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([EXTRUDEFROMTOP], [test x$HAVE_EXTRUDEFROMTOP = xyes])
+-
+ AC_MSG_RESULT($HAVE_EXTRUDEFROMTOP)
+-
+ dnl }}}
+ dnl with-DepthAverage{{{
+-
+ AC_ARG_WITH([DepthAverage],
+-
+ 	AS_HELP_STRING([--with-DepthAverage = YES], [compile with DepthAverage capabilities (default is yes)]),
+-
+ 	[DEPTHAVERAGE=$withval],[DEPTHAVERAGE=yes])
+-
+ AC_MSG_CHECKING(for DepthAverage capability compilation)
+ 
+-
+ HAVE_DEPTHAVERAGE=no 
+-
+ if test "x$DEPTHAVERAGE" = "xyes"; then
+-
+ 	HAVE_DEPTHAVERAGE=yes
+-
+ 	AC_DEFINE([_HAVE_DEPTHAVERAGE_],[1],[with DepthAveragecapability])
+-
+ fi
+-
+ AM_CONDITIONAL([DEPTHAVERAGE], [test x$HAVE_DEPTHAVERAGE = xyes])
+-
+ AC_MSG_RESULT($HAVE_DEPTHAVERAGE)
+-
+ dnl }}}
+ dnl with-SmoothedSurfaceSlopeX{{{
+-
+ AC_ARG_WITH([SmoothedSurfaceSlopeX],
+-
+ 	AS_HELP_STRING([--with-SmoothedSurfaceSlopeX = YES], [compile with SmoothedSurfaceSlopeX capabilities (default is yes)]),
+-
+ 	[SMOOTHEDSURFACESLOPEX=$withval],[SMOOTHEDSURFACESLOPEX=yes])
+-
+ AC_MSG_CHECKING(for SmoothedSurfaceSlopeX capability compilation)
+ 
+-
+ HAVE_SMOOTHEDSURFACESLOPEX=no 
+-
+ if test "x$SMOOTHEDSURFACESLOPEX" = "xyes"; then
+-
+ 	HAVE_SMOOTHEDSURFACESLOPEX=yes
+-
+ 	AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEX_],[1],[with SmoothedSurfaceSlopeXcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([SMOOTHEDSURFACESLOPEX], [test x$HAVE_SMOOTHEDSURFACESLOPEX = xyes])
+-
+ AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEX)
+-
+ dnl }}}
+ dnl with-SmoothedSurfaceSlopeY{{{
+-
+ AC_ARG_WITH([SmoothedSurfaceSlopeY],
+-
+ 	AS_HELP_STRING([--with-SmoothedSurfaceSlopeY = YES], [compile with SmoothedSurfaceSlopeY capabilities (default is yes)]),
+-
+ 	[SMOOTHEDSURFACESLOPEY=$withval],[SMOOTHEDSURFACESLOPEY=yes])
+-
+ AC_MSG_CHECKING(for SmoothedSurfaceSlopeY capability compilation)
+ 
+-
+ HAVE_SMOOTHEDSURFACESLOPEY=no 
+-
+ if test "x$SMOOTHEDSURFACESLOPEY" = "xyes"; then
+-
+ 	HAVE_SMOOTHEDSURFACESLOPEY=yes
+-
+ 	AC_DEFINE([_HAVE_SMOOTHEDSURFACESLOPEY_],[1],[with SmoothedSurfaceSlopeYcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([SMOOTHEDSURFACESLOPEY], [test x$HAVE_SMOOTHEDSURFACESLOPEY = xyes])
+-
+ AC_MSG_RESULT($HAVE_SMOOTHEDSURFACESLOPEY)
+-
+ dnl }}}
+ 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)
+ 
+-
+ HAVE_THERMAL=no 
+-
+ if test "x$THERMAL" = "xyes"; then
+-
+ 	HAVE_THERMAL=yes
+-
+ 	AC_DEFINE([_HAVE_THERMAL_],[1],[with Thermalcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([THERMAL], [test x$HAVE_THERMAL = xyes])
+-
+ AC_MSG_RESULT($HAVE_THERMAL)
+-
+ dnl }}}
+ dnl with-Gia{{{
+-
+ AC_ARG_WITH([Gia],
+-
+ 	AS_HELP_STRING([--with-Gia = YES], [compile with Gia capabilities (default is yes)]),
+-
+ 	[GIA=$withval],[GIA=yes])
+-
+ AC_MSG_CHECKING(for Gia capability compilation)
+ 
+-
+ HAVE_GIA=no 
+-
+ if test "x$GIA" = "xyes"; then
+-
+ 	HAVE_GIA=yes
+-
+ 	AC_DEFINE([_HAVE_GIA_],[1],[with Giacapability])
+-
+ fi
+-
+ AM_CONDITIONAL([GIA], [test x$HAVE_GIA = xyes])
+-
+ AC_MSG_RESULT($HAVE_GIA)
+-
+ dnl }}}
+ dnl with-Meshdeformation{{{
+-
+ AC_ARG_WITH([Meshdeformation],
+-
+ 	AS_HELP_STRING([--with-Meshdeformation = YES], [compile with Meshdeformation capabilities (default is yes)]),
+-
+ 	[MESHDEFORMATION=$withval],[MESHDEFORMATION=yes])
+-
+ AC_MSG_CHECKING(for Meshdeformation capability compilation)
+ 
+-
+ HAVE_MESHDEFORMATION=no 
+-
+ if test "x$MESHDEFORMATION" = "xyes"; then
+-
+ 	HAVE_MESHDEFORMATION=yes
+-
+ 	AC_DEFINE([_HAVE_MESHDEFORMATION_],[1],[with Meshdeformationcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([MESHDEFORMATION], [test x$HAVE_MESHDEFORMATION = xyes])
+-
+ AC_MSG_RESULT($HAVE_MESHDEFORMATION)
+-
+ dnl }}}
+ dnl with-Levelset{{{
+-
+ AC_ARG_WITH([Levelset],
+-
+ 	AS_HELP_STRING([--with-Levelset = YES], [compile with Levelset capabilities (default is yes)]),
+-
+ 	[LEVELSET=$withval],[LEVELSET=yes])
+-
+ AC_MSG_CHECKING(for Levelset capability compilation)
+ 
+-
+ HAVE_LEVELSET=no 
+-
+ if test "x$LEVELSET" = "xyes"; then
+-
+ 	HAVE_LEVELSET=yes
+-
+ 	AC_DEFINE([_HAVE_LEVELSET_],[1],[with Levelsetcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([LEVELSET], [test x$HAVE_LEVELSET = xyes])
+-
+ AC_MSG_RESULT($HAVE_LEVELSET)
+-
+ dnl }}}
+ dnl with-Extrapolation{{{
+-
+ AC_ARG_WITH([Extrapolation],
+-
+ 	AS_HELP_STRING([--with-Extrapolation = YES], [compile with Extrapolation capabilities (default is yes)]),
+-
+ 	[EXTRAPOLATION=$withval],[EXTRAPOLATION=yes])
+-
+ AC_MSG_CHECKING(for Extrapolation capability compilation)
+ 
+-
+ HAVE_EXTRAPOLATION=no 
+-
+ if test "x$EXTRAPOLATION" = "xyes"; then
+-
+ 	HAVE_EXTRAPOLATION=yes
+-
+ 	AC_DEFINE([_HAVE_EXTRAPOLATION_],[1],[with Extrapolationcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([EXTRAPOLATION], [test x$HAVE_EXTRAPOLATION = xyes])
+-
+ AC_MSG_RESULT($HAVE_EXTRAPOLATION)
+-
+ dnl }}}
+ dnl with-LsfReinitialization{{{
+-
+ AC_ARG_WITH([LsfReinitialization],
+-
+ 	AS_HELP_STRING([--with-LsfReinitialization = YES], [compile with LsfReinitialization capabilities (default is yes)]),
+-
+ 	[LSFREINITIALIZATION=$withval],[LSFREINITIALIZATION=yes])
+-
+ AC_MSG_CHECKING(for LsfReinitialization capability compilation)
+ 
+-
+ HAVE_LSFREINITIALIZATION=no 
+-
+ if test "x$LSFREINITIALIZATION" = "xyes"; then
+-
+ 	HAVE_LSFREINITIALIZATION=yes
+-
+ 	AC_DEFINE([_HAVE_LSFREINITIALIZATION_],[1],[with LsfReinitializationcapability])
+-
+ fi
+-
+ AM_CONDITIONAL([LSFREINITIALIZATION], [test x$HAVE_LSFREINITIALIZATION = xyes])
+-
+ AC_MSG_RESULT($HAVE_LSFREINITIALIZATION)
+-
+ dnl }}}
+ 
+ ])
Index: /issm/oecreview/Archive/17802-17983/ISSM-17934-17935.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17934-17935.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17934-17935.diff	(revision 17986)
@@ -0,0 +1,38 @@
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17934)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17935)
+@@ -33,11 +33,12 @@
+ 	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+ 	/*Update elements: */
++	int finiteelement = P1Enum;
+ 	int counter=0;
+ 	for(int i=0;i<iomodel->numberofelements;i++){
+ 		if(iomodel->my_elements[i]){
+ 			Element* element=(Element*)elements->GetObjectByOffset(counter);
+-			element->Update(i,iomodel,analysis_counter,analysis_type,P2Enum);
++			element->Update(i,iomodel,analysis_counter,analysis_type,finiteelement);
+ 			counter++;
+ 		}
+ 	}
+@@ -86,15 +87,17 @@
+ }/*}}}*/
+ void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
++	int finiteelement = P1Enum;
+ 	if(iomodel->domaintype==Domain3DEnum) iomodel->FetchData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+-	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,P2Enum);
++	::CreateNodes(nodes,iomodel,ThermalAnalysisEnum,finiteelement);
+ 	iomodel->DeleteData(2,MeshVertexonbaseEnum,MeshVertexonsurfaceEnum);
+ }/*}}}*/
+ void ThermalAnalysis::CreateConstraints(Constraints* constraints,IoModel* iomodel){/*{{{*/
+ 
+ 	/*Only 3d mesh supported*/
++	int finiteelement = P1Enum;
+ 	if(iomodel->domaintype==Domain3DEnum){
+-		IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,P2Enum);
++		IoModelToConstraintsx(constraints,iomodel,ThermalSpctemperatureEnum,ThermalAnalysisEnum,finiteelement);
+ 	}
+ 
+ }/*}}}*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17935-17936.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17935-17936.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17935-17936.diff	(revision 17986)
@@ -0,0 +1,154 @@
+Index: ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 17935)
++++ ../trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp	(revision 17936)
+@@ -41,12 +41,14 @@
+ 			case VyEnum:
+ 			case ThicknessEnum:
+ 			case FrictionCoefficientEnum:
+-			case MaterialsRheologyBbarEnum:
+-			case DamageDbarEnum:
+ 			case BalancethicknessNuxEnum:
+ 			case BalancethicknessNuyEnum:
+ 				iomodel->FetchData(1,control); 
+ 				break;
++
++			/*Special cases*/
++			case MaterialsRheologyBbarEnum: iomodel->FetchData(1,MaterialsRheologyBEnum); break;
++			case DamageDbarEnum:            iomodel->FetchData(1,DamageDEnum);            break;
+ 			default:
+ 				_error_("Control " << EnumToStringx(control) << " not implemented yet");
+ 		}
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17935)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17936)
+@@ -1025,9 +1025,9 @@
+ 				case VxEnum:
+ 				case VyEnum:
+ 					if(iomodel->Data(control)){
+-						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(control)[tria_vertex_ids[j]-1];
+-						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(control)[tria_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]/yts;
+ 						this->inputs->AddInput(new ControlInput(control,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+@@ -1038,9 +1038,9 @@
+ 				case BalancethicknessNuxEnum:
+ 				case BalancethicknessNuyEnum:
+ 					if(iomodel->Data(control)){
+-						for(j=0;j<3;j++)nodeinputs[j]=iomodel->Data(control)[tria_vertex_ids[j]-1];
+-						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+-						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(control)[tria_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+ 						this->inputs->AddInput(new ControlInput(control,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+@@ -1048,17 +1048,17 @@
+ 				/*Special cases (depth averaged quantities)*/
+ 				case MaterialsRheologyBbarEnum:
+ 					if(iomodel->Data(MaterialsRheologyBEnum)){
+-						for(j=0;j<3;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[tria_vertex_ids[j]-1];
+-						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+-						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[tria_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+ 						this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case DamageDbarEnum:
+ 					if(iomodel->Data(DamageDEnum)){
+-						for(j=0;j<3;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[tria_vertex_ids[j]-1];
+-						for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+-						for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[tria_vertex_ids[j]-1];
++						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
++						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i];
+ 						this->inputs->AddInput(new ControlInput(DamageDbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17935)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17936)
+@@ -1336,45 +1336,38 @@
+ 	/*Control Inputs*/
+ 	if (control_analysis && iomodel->Data(InversionControlParametersEnum)){
+ 		for(i=0;i<num_control_type;i++){
+-			switch(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])){
++			int control = reCast<int>(iomodel->Data(InversionControlParametersEnum)[i]);
++			switch(control){
++				/*yts conversion*/
+ 				case BalancethicknessThickeningRateEnum:
+-					if (iomodel->Data(BalancethicknessThickeningRateEnum)){
+-						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(BalancethicknessThickeningRateEnum)[penta_vertex_ids[j]-1]/yts;
+-						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						this->inputs->AddInput(new ControlInput(BalancethicknessThickeningRateEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-					}
+-					break;
+ 				case VxEnum:
+-					if (iomodel->Data(VxEnum)){
+-						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VxEnum)[penta_vertex_ids[j]-1]/yts;
+-						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						this->inputs->AddInput(new ControlInput(VxEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+-					}
+-					break;
+ 				case VyEnum:
+-					if (iomodel->Data(VyEnum)){
+-						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(VyEnum)[penta_vertex_ids[j]-1]/yts;
++					if(iomodel->Data(control)){
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(control)[penta_vertex_ids[j]-1];
+ 						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+ 						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]/yts;
+-						this->inputs->AddInput(new ControlInput(VyEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(control,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
++
++				/*No yts conversion*/
++				case ThicknessEnum:
+ 				case FrictionCoefficientEnum:
+-					if (iomodel->Data(FrictionCoefficientEnum)){
+-						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(FrictionCoefficientEnum)[penta_vertex_ids[j]-1];
++					if(iomodel->Data(control)){
++						for(j=0;j<NUMVERTICES;j++)nodeinputs[j]=iomodel->Data(control)[penta_vertex_ids[j]-1];
+ 						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						this->inputs->AddInput(new ControlInput(FrictionCoefficientEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(control,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
++
++				/*Special cases (depth averaged quantities)*/
+ 				case MaterialsRheologyBbarEnum:
+ 					if(iomodel->Data(MaterialsRheologyBEnum)){
+ 						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1];
+ 						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case DamageDbarEnum:
+@@ -1382,11 +1375,11 @@
+ 						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1];
+ 						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(DamageDbarEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				default:
+-					_error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet");
++					_error_("Control " << EnumToStringx(control) << " not implemented yet");
+ 			}
+ 		}
+ 	}
Index: /issm/oecreview/Archive/17802-17983/ISSM-17936-17937.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17936-17937.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17936-17937.diff	(revision 17986)
@@ -0,0 +1,22 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17936)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17937)
+@@ -1367,7 +1367,7 @@
+ 						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1];
+ 						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				case DamageDbarEnum:
+@@ -1375,7 +1375,7 @@
+ 						for(j=0;j<NUMVERTICES;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1];
+ 						for(j=0;j<NUMVERTICES;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+ 						for(j=0;j<NUMVERTICES;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i];
+-						this->inputs->AddInput(new ControlInput(DamageDbarEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
++						this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));
+ 					}
+ 					break;
+ 				default:
Index: /issm/oecreview/Archive/17802-17983/ISSM-17937-17938.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17937-17938.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17937-17938.diff	(revision 17986)
@@ -0,0 +1,33 @@
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17937)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17938)
+@@ -93,10 +93,9 @@
+ 			_error_("not supported");
+ 	}
+ 
+-	/*Checks that s-1>0 if v=0*/
+-	if(vmag==0. && (s-1.)<0.) _error_("velocity is 0 and (s-1)=" << (s-1.) << "<0, alpha2 is Inf");
+-
+-	alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
++	/*Check to prevent dividing by zero if vmag==0*/
++	if(vmag==0. && (s-1.)<0.) alpha2=0.;
++	else alpha2=drag_coefficient*drag_coefficient*pow(Neff,r)*pow(vmag,(s-1.));
+ 	_assert_(!xIsNan<IssmDouble>(alpha2));
+ 
+ 	/*Assign output pointers:*/
+@@ -158,11 +157,10 @@
+ 			_error_("not supported");
+ 	}
+ 
+-	/*Checks that s-1>0 if v=0*/
+-	if(vmag==0. && (s-1.)<0.) _error_("velocity is 0 and (s-1)=" << (s-1.) << "<0, alpha2 is Inf");
++	/*Check to prevent dividing by zero if vmag==0*/
++	if(vmag==0. && (s-1.)<0.) alpha_complement=0.;
++	else alpha_complement=pow(Neff,r)*pow(vmag,(s-1));_assert_(!xIsNan<IssmDouble>(alpha_complement));
+ 
+-	alpha_complement=pow(Neff,r)*pow(vmag,(s-1));_assert_(!xIsNan<IssmDouble>(alpha_complement));
+-
+ 	/*Assign output pointers:*/
+ 	*palpha_complement=alpha_complement;
+ }
Index: /issm/oecreview/Archive/17802-17983/ISSM-17938-17939.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17938-17939.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17938-17939.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17938)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17939)
+@@ -25,7 +25,7 @@
+ 	def __repr__(self): # {{{
+ 		string='   grounding line migration parameters:'
+ 
+-		string="%s\n%s"%(string,fielddisplay(self,'migration','type of grounding line migration: ''SoftMigration'',''AgressiveMigration'' or ''None'''))
++		string="%s\n%s"%(string,fielddisplay(self,'migration','type of grounding line migration: ''SoftMigration'',''AgressiveMigration'',''SubelementMigration'',''SubelementMigration2'',''Contact'',''None'''))
+ 		string="%s\n%s"%(string,fielddisplay(self,'melting_rate','melting rate applied when previously grounded parts start floating [m/yr]'))
+ 		return string
+ 		#}}}	
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17938)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17939)
+@@ -44,7 +44,7 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration','SubelementMigration2' 'Contact'});
++			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration' 'SubelementMigration2' 'Contact' 'None'});
+ 
+ 			if ~strcmp(obj.migration,'None'),
+ 				if isnan(md.geometry.bed),
Index: /issm/oecreview/Archive/17802-17983/ISSM-17939-17940.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17939-17940.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17939-17940.diff	(revision 17986)
@@ -0,0 +1,29 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17939)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17940)
+@@ -771,7 +771,8 @@
+ 		md.materials.rheology_n=project2d(md,md.materials.rheology_n,1)
+ 		
+ 		#damage: 
+-		md.damage.D=DepthAverage(md,md.damage.D)
++		if md.damage.isdamage:
++			md.damage.D=DepthAverage(md,md.damage.D)
+ 
+ 		#special for thermal modeling:
+ 		md.basalforcings.melting_rate=project2d(md,md.basalforcings.melting_rate,1) 
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17939)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17940)
+@@ -215,7 +215,9 @@
+ 			md.materials.rheology_n=project2d(md,md.materials.rheology_n,1);
+ 			
+ 			%damage: 
+-			md.damage.D=DepthAverage(md,md.damage.D);
++			if md.damage.isdamage,
++				md.damage.D=DepthAverage(md,md.damage.D);
++			end
+ 
+ 			%special for thermal modeling:
+ 			md.basalforcings.melting_rate=project2d(md,md.basalforcings.melting_rate,1); 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17940-17941.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17940-17941.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17940-17941.diff	(revision 17986)
@@ -0,0 +1,214 @@
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17940)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17941)
+@@ -649,7 +649,7 @@
+ 	/*}}}*/
+ 	/*Grounding Line{{{*/
+ 	NoneEnum,
+-	AgressiveMigrationEnum,
++	AggressiveMigrationEnum,
+ 	SoftMigrationEnum,
+ 	SubelementMigrationEnum,
+ 	SubelementMigration2Enum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17940)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17941)
+@@ -628,7 +628,7 @@
+ 		case AugmentedLagrangianREnum : return "AugmentedLagrangianR";
+ 		case AugmentedLagrangianThetaEnum : return "AugmentedLagrangianTheta";
+ 		case NoneEnum : return "None";
+-		case AgressiveMigrationEnum : return "AgressiveMigration";
++		case AggressiveMigrationEnum : return "AggressiveMigration";
+ 		case SoftMigrationEnum : return "SoftMigration";
+ 		case SubelementMigrationEnum : return "SubelementMigration";
+ 		case SubelementMigration2Enum : return "SubelementMigration2";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17940)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17941)
+@@ -643,7 +643,7 @@
+ 	      else if (strcmp(name,"AugmentedLagrangianR")==0) return AugmentedLagrangianREnum;
+ 	      else if (strcmp(name,"AugmentedLagrangianTheta")==0) return AugmentedLagrangianThetaEnum;
+ 	      else if (strcmp(name,"None")==0) return NoneEnum;
+-	      else if (strcmp(name,"AgressiveMigration")==0) return AgressiveMigrationEnum;
++	      else if (strcmp(name,"AggressiveMigration")==0) return AggressiveMigrationEnum;
+ 	      else if (strcmp(name,"SoftMigration")==0) return SoftMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration")==0) return SubelementMigrationEnum;
+ 	      else if (strcmp(name,"SubelementMigration2")==0) return SubelementMigration2Enum;
+Index: ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17940)
++++ ../trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 17941)
+@@ -35,7 +35,7 @@
+ 		case ContactEnum:
+ 			phi_ungrounding=ContactFSLevelset(elements,vertices);
+ 			break;
+-		case AgressiveMigrationEnum:
++		case AggressiveMigrationEnum:
+ 		case SubelementMigrationEnum:
+ 		case SubelementMigration2Enum:
+ 			/*Nothing additional to do here, MigrateGroundingLine takes care of everything*/
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17940)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17941)
+@@ -4405,12 +4405,12 @@
+ 			}
+ 		}
+ 		/*Ice sheet: if hydrostatic bed above bathymetry, ice sheet starts to unground, elso do nothing */
+-		/*Change only if AgressiveMigration or if the ice sheet is in contact with the ocean*/
++		/*Change only if AggressiveMigration or if the ice sheet is in contact with the ocean*/
+ 		else{ // phi>0
+ 			bed_hydro=-density*h[i];
+ 			if (bed_hydro>r[i]){
+ 				/*Unground only if the element is connected to the ice shelf*/
+-				if(migration_style==AgressiveMigrationEnum || migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
++				if(migration_style==AggressiveMigrationEnum || migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
+ 					s[i]        = (1-density)*h[i];
+ 					b[i]        = -density*h[i];
+ 				}
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17940)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17941)
+@@ -3960,12 +3960,12 @@
+ 			}
+ 		}
+ 		/*Ice sheet: if hydrostatic bed above bathymetry, ice sheet starts to unground, elso do nothing */
+-		/*Change only if AgressiveMigration or if the ice sheet is in contact with the ocean*/
++		/*Change only if AggressiveMigration or if the ice sheet is in contact with the ocean*/
+ 		else{
+ 			bed_hydro=-density*h[i];
+ 			if(bed_hydro>r[i]){
+ 				/*Unground only if the element is connected to the ice shelf*/
+-				if(migration_style==AgressiveMigrationEnum || migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
++				if(migration_style==AggressiveMigrationEnum || migration_style==SubelementMigrationEnum || migration_style==SubelementMigration2Enum){
+ 					s[i]        = (1-density)*h[i];
+ 					b[i]        = -density*h[i];
+ 				}
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17940)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17941)
+@@ -743,7 +743,7 @@
+ 		if(this->inputs->Max(MaskGroundediceLevelsetEnum) <= 0.) shelf=true;
+ 		else shelf=false;
+ 	}
+-	else if(migration_style==NoneEnum || migration_style==AgressiveMigrationEnum || migration_style==SoftMigrationEnum){ //Floating if all nodes are floating
++	else if(migration_style==NoneEnum || migration_style==AggressiveMigrationEnum || migration_style==SoftMigrationEnum){ //Floating if all nodes are floating
+ 		if(this->inputs->Min(MaskGroundediceLevelsetEnum) > 0.) shelf=false;
+ 		else shelf=true;
+ 	}
+Index: ../trunk-jpl/src/m/classes/groundingline.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.py	(revision 17940)
++++ ../trunk-jpl/src/m/classes/groundingline.py	(revision 17941)
+@@ -25,7 +25,7 @@
+ 	def __repr__(self): # {{{
+ 		string='   grounding line migration parameters:'
+ 
+-		string="%s\n%s"%(string,fielddisplay(self,'migration','type of grounding line migration: ''SoftMigration'',''AgressiveMigration'',''SubelementMigration'',''SubelementMigration2'',''Contact'',''None'''))
++		string="%s\n%s"%(string,fielddisplay(self,'migration','type of grounding line migration: ''SoftMigration'',''AggressiveMigration'',''SubelementMigration'',''SubelementMigration2'',''Contact'',''None'''))
+ 		string="%s\n%s"%(string,fielddisplay(self,'melting_rate','melting rate applied when previously grounded parts start floating [m/yr]'))
+ 		return string
+ 		#}}}	
+@@ -41,7 +41,7 @@
+ 	#}}}
+ 	def checkconsistency(self,md,solution,analyses):    # {{{
+ 
+-		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AgressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2','Contact'])
++		md = checkfield(md,'fieldname','groundingline.migration','values',['None','AggressiveMigration','SoftMigration','SubelementMigration','SubelementMigration2','Contact'])
+ 
+ 		if not m.strcmp(self.migration,'None'):
+ 			if numpy.any(numpy.isnan(md.geometry.bed)):
+Index: ../trunk-jpl/src/m/classes/groundingline.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/groundingline.m	(revision 17940)
++++ ../trunk-jpl/src/m/classes/groundingline.m	(revision 17941)
+@@ -17,7 +17,7 @@
+             fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Grounding line migration parameters">','<section name="groundingline" />');  
+ 			
+             % migration (SoftMigration, AggressiveMigration, or None)drop-down
+-            fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="migration" type="alternative" optional="false">','     <section name="groundingline" />','     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>');
++            fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="migration" type="alternative" optional="false">','     <section name="groundingline" />','     <help> type of grounding line migration: "SoftMigration","AggressiveMigration" or "None" </help>');
+             fprintf(fid,'%s\n','       <option value="SoftMigration" type="string" default="true"> </option>');
+             fprintf(fid,'%s\n','       <option value="AggressiveMigration" type="string" default="false"> </option>');
+             fprintf(fid, '%s\n%s\n','       <option value="None" type="string" default="false"></option>','</parameter>');
+@@ -44,7 +44,7 @@
+ 		end % }}}
+ 		function md = checkconsistency(obj,md,solution,analyses) % {{{
+ 
+-			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AgressiveMigration' 'SoftMigration' 'SubelementMigration' 'SubelementMigration2' 'Contact' 'None'});
++			md = checkfield(md,'fieldname','groundingline.migration','values',{'None' 'AggressiveMigration' 'SoftMigration' 'SubelementMigration' 'SubelementMigration2' 'Contact' 'None'});
+ 
+ 			if ~strcmp(obj.migration,'None'),
+ 				if isnan(md.geometry.bed),
+@@ -62,7 +62,7 @@
+ 		end % }}}
+ 		function disp(obj) % {{{
+ 			disp(sprintf('   grounding line migration parameters:'));
+-			fielddisplay(obj,'migration','type of grounding line migration: ''SoftMigration'',''AgressiveMigration'' or ''None''');
++			fielddisplay(obj,'migration','type of grounding line migration: ''SoftMigration'',''AggressiveMigration'' or ''None''');
+ 			fielddisplay(obj,'melting_rate','melting rate applied when previously grounded parts start floating [m/yr]');
+ 
+ 		end % }}}
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17940)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17941)
+@@ -1016,7 +1016,7 @@
+ 			end
+ 			if isfield(structmd,'groundingline_migration') & isnumeric(structmd.groundingline_migration),
+ 				if (structmd.groundingline_migration==272), md.groundingline.migration='None';      end
+-				if (structmd.groundingline_migration==273), md.groundingline.migration='AgressiveMigration';  end
++				if (structmd.groundingline_migration==273), md.groundingline.migration='AggressiveMigration';  end
+ 				if (structmd.groundingline_migration==274), md.groundingline.migration='SoftMigration'; end
+ 			end
+ 			if isfield(structmd,'control_type') & isnumeric(structmd.control_type),
+Index: ../trunk-jpl/src/m/enum/AgressiveMigrationEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/AgressiveMigrationEnum.m	(revision 17940)
++++ ../trunk-jpl/src/m/enum/AgressiveMigrationEnum.m	(revision 17941)
+@@ -1,11 +0,0 @@
+-function macro=AgressiveMigrationEnum()
+-%AGRESSIVEMIGRATIONENUM - Enum of AgressiveMigration
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=AgressiveMigrationEnum()
+-
+-macro=StringToEnum('AgressiveMigration');
+Index: ../trunk-jpl/src/m/enum/AggressiveMigrationEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/AggressiveMigrationEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/AggressiveMigrationEnum.m	(revision 17941)
+@@ -0,0 +1,11 @@
++function macro=AggressiveMigrationEnum()
++%AGGRESSIVEMIGRATIONENUM - Enum of AggressiveMigration
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=AggressiveMigrationEnum()
++
++macro=StringToEnum('AggressiveMigration');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17940)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17941)
+@@ -620,7 +620,7 @@
+ def AugmentedLagrangianREnum(): return StringToEnum("AugmentedLagrangianR")[0]
+ def AugmentedLagrangianThetaEnum(): return StringToEnum("AugmentedLagrangianTheta")[0]
+ def NoneEnum(): return StringToEnum("None")[0]
+-def AgressiveMigrationEnum(): return StringToEnum("AgressiveMigration")[0]
++def AggressiveMigrationEnum(): return StringToEnum("AggressiveMigration")[0]
+ def SoftMigrationEnum(): return StringToEnum("SoftMigration")[0]
+ def SubelementMigrationEnum(): return StringToEnum("SubelementMigration")[0]
+ def SubelementMigration2Enum(): return StringToEnum("SubelementMigration2")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17941-17942.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17941-17942.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17941-17942.diff	(revision 17986)
@@ -0,0 +1,181 @@
+Index: ../trunk-jpl/test/Par/RoundSheetShelf.py
+===================================================================
+--- ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17941)
++++ ../trunk-jpl/test/Par/RoundSheetShelf.py	(revision 17942)
+@@ -101,7 +101,7 @@
+ md.timestepping.final_time=5.
+ 
+ #bathymetry and grounding line migration:
+-md.groundingline.migration='AgressiveMigration'
++md.groundingline.migration='AggressiveMigration'
+ md.geometry.bed=copy.deepcopy(md.geometry.base)
+ pos=numpy.nonzero(md.mask.groundedice_levelset<0.)[0]
+ md.geometry.bed[pos]=md.geometry.base[pos]-900.
+Index: ../trunk-jpl/test/NightlyRun/test426.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.m	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test426.m	(revision 17942)
+@@ -12,7 +12,7 @@
+ md=setflowequation(md,'SSA','all');
+ md.transient.isstressbalance=0;
+ md.transient.isgroundingline=1;
+-md.groundingline.migration='AgressiveMigration';
++md.groundingline.migration='AggressiveMigration';
+ md.transient.requested_outputs={'IceVolume','IceVolumeAboveFloatation'};
+ md.cluster=generic('name',oshostname(),'np',3);
+ 
+Index: ../trunk-jpl/test/NightlyRun/test423.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.py	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test423.py	(revision 17942)
+@@ -34,7 +34,7 @@
+ md.transient.isgroundingline=True
+ 
+ #test different grounding line dynamics.
+-md.groundingline.migration='AgressiveMigration'
++md.groundingline.migration='AggressiveMigration'
+ md=solve(md,TransientSolutionEnum())
+ element_on_iceshelf_agressive=md.results.TransientSolution[0].MaskGroundediceLevelset
+ vel_agressive=md.results.TransientSolution[0].Vel
+@@ -56,6 +56,6 @@
+ vel_subelement2=md.results.TransientSolution[0].Vel
+ 
+ #Fields and tolerances to track changes
+-field_names     =['ElementOnIceShelfAgressive','VelAgressive','ElementOnIceShelfSoft','VelSoft','ElementOnIceShelfSubelement','VelSubelement','ElementOnIceShelfSubelement2','VelSubelement2']
++field_names     =['ElementOnIceShelfAggressive','VelAggressive','ElementOnIceShelfSoft','VelSoft','ElementOnIceShelfSubelement','VelSubelement','ElementOnIceShelfSubelement2','VelSubelement2']
+ field_tolerances=[1e-13,2e-13,1e-13,2e-13,1e-13,2e-13,1e-13,2e-13]
+ field_values=[element_on_iceshelf_agressive,vel_agressive,element_on_iceshelf_soft,vel_soft,element_on_iceshelf_subelement,vel_subelement,element_on_iceshelf_subelement2,vel_subelement2]
+Index: ../trunk-jpl/test/NightlyRun/test424.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.py	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test424.py	(revision 17942)
+@@ -21,7 +21,7 @@
+ md.surfaceforcings.mass_balance[:]=100.
+ md.transient.isstressbalance=False
+ md.transient.isgroundingline=True
+-md.groundingline.migration='AgressiveMigration'
++md.groundingline.migration='AggressiveMigration'
+ md.transient.requested_outputs=['IceVolume','IceVolumeAboveFloatation']
+ 
+ md.cluster=generic('name',oshostname(),'np',3)
+Index: ../trunk-jpl/test/NightlyRun/test433.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test433.py	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test433.py	(revision 17942)
+@@ -35,7 +35,7 @@
+ md.transient.isgroundingline=True
+ 
+ #test different grounding line dynamics.
+-md.groundingline.migration='AgressiveMigration'
++md.groundingline.migration='AggressiveMigration'
+ md=solve(md,TransientSolutionEnum())
+ element_on_iceshelf_agressive=md.results.TransientSolution[0].MaskGroundediceLevelset
+ 
+@@ -48,6 +48,6 @@
+ element_on_iceshelf_subelement=md.results.TransientSolution[0].MaskGroundediceLevelset
+ 
+ #Fields and tolerances to track changes
+-field_names     =['ElementOnIceShelfAgressive','ElementOnIceShelfSoft','ElementOnIceShelfSubelement']
++field_names     =['ElementOnIceShelfAggressive','ElementOnIceShelfSoft','ElementOnIceShelfSubelement']
+ field_tolerances=[1e-13,1e-13,1e-13]
+ field_values=[element_on_iceshelf_agressive,element_on_iceshelf_soft,element_on_iceshelf_subelement]
+Index: ../trunk-jpl/test/NightlyRun/test423.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test423.m	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test423.m	(revision 17942)
+@@ -23,7 +23,7 @@
+ md.transient.isgroundingline=1;
+ 
+ %test different grounding line dynamics.
+-md.groundingline.migration='AgressiveMigration';
++md.groundingline.migration='AggressiveMigration';
+ md=solve(md,TransientSolutionEnum());
+ element_on_iceshelf_agressive=(md.results.TransientSolution.MaskGroundediceLevelset);
+ vel_agressive=(md.results.TransientSolution.Vel);
+@@ -45,6 +45,6 @@
+ vel_subelement2=(md.results.TransientSolution.Vel);
+ 
+ %Fields and tolerances to track changes
+-field_names     ={'ElementOnIceShelfAgressive','VelAgressive','ElementOnIceShelfSoft','VelSoft','ElementOnIceShelfSubelement','VelSubelement','ElementOnIceShelfSubelement2','VelSubelement2'};
++field_names     ={'ElementOnIceShelfAggressive','VelAggressive','ElementOnIceShelfSoft','VelSoft','ElementOnIceShelfSubelement','VelSubelement','ElementOnIceShelfSubelement2','VelSubelement2'};
+ field_tolerances={1e-13,2e-12,1e-13,2e-12,1e-13,3e-12,1e-13,2e-12};
+ field_values={element_on_iceshelf_agressive,vel_agressive,element_on_iceshelf_soft,vel_soft,element_on_iceshelf_subelement,vel_subelement,element_on_iceshelf_subelement2,vel_subelement2};
+Index: ../trunk-jpl/test/NightlyRun/IdToName.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/IdToName.m	(revision 17942)
+@@ -131,9 +131,9 @@
+ 	case 421, name='SquareSheetShelfStressHOFS3dTiling';
+ 	case 422, name='SquareSheetShelfStressSSAFS3dTiling';
+ 	case 423, name='RoundSheetShelfGLMigrationSSA2d';
+-	case 424, name='SquareSheetShelfGroundingLine2dAgressive';
++	case 424, name='SquareSheetShelfGroundingLine2dAggressive';
+ 	case 425, name='SquareSheetShelfGroundingLine2dSoft';
+-	case 426, name='SquareSheetShelfGroundingLine3dAgressive';
++	case 426, name='SquareSheetShelfGroundingLine3dAggressive';
+ 	case 427, name='SquareSheetShelfGroundingLine3dSoft';
+ 	case 428, name='SquareSheetShelfStressSSA2dNewton';
+ 	case 429, name='SquareSheetShelfStressHONewton';
+Index: ../trunk-jpl/test/NightlyRun/test424.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test424.m	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test424.m	(revision 17942)
+@@ -11,7 +11,7 @@
+ md.surfaceforcings.mass_balance(:)=100.;
+ md.transient.isstressbalance=0;
+ md.transient.isgroundingline=1;
+-md.groundingline.migration='AgressiveMigration';
++md.groundingline.migration='AggressiveMigration';
+ md.transient.requested_outputs={'IceVolume','IceVolumeAboveFloatation'};
+ 
+ md.cluster=generic('name',oshostname(),'np',3);
+Index: ../trunk-jpl/test/NightlyRun/test433.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test433.m	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test433.m	(revision 17942)
+@@ -24,7 +24,7 @@
+ md.transient.isgroundingline=1;
+ 
+ %test different grounding line dynamics.
+-md.groundingline.migration='AgressiveMigration';
++md.groundingline.migration='AggressiveMigration';
+ md=solve(md,TransientSolutionEnum());
+ element_on_iceshelf_agressive=(md.results.TransientSolution.MaskGroundediceLevelset);
+ 
+@@ -41,6 +41,6 @@
+ element_on_iceshelf_subelement2=(md.results.TransientSolution.MaskGroundediceLevelset);
+ 
+ %Fields and tolerances to track changes
+-field_names     ={'ElementOnIceShelfAgressive','ElementOnIceShelfSoft','ElementOnIceShelfSubelement','ElementOnIceShelfSubelement'};
++field_names     ={'ElementOnIceShelfAggressive','ElementOnIceShelfSoft','ElementOnIceShelfSubelement','ElementOnIceShelfSubelement'};
+ field_tolerances={1e-13,1e-13,1e-13,1e-13};
+ field_values={element_on_iceshelf_agressive,element_on_iceshelf_soft,element_on_iceshelf_subelement,element_on_iceshelf_subelement2};
+Index: ../trunk-jpl/test/NightlyRun/test426.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test426.py	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/test426.py	(revision 17942)
+@@ -22,7 +22,7 @@
+ md=setflowequation(md,'SSA','all');
+ md.transient.isstressbalance=False
+ md.transient.isgroundingline=True
+-md.groundingline.migration='AgressiveMigration'
++md.groundingline.migration='AggressiveMigration'
+ md.transient.requested_outputs=['IceVolume','IceVolumeAboveFloatation']
+ md.cluster=generic('name',oshostname(),'np',3)
+ 
+Index: ../trunk-jpl/test/NightlyRun/IdToName.py
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17941)
++++ ../trunk-jpl/test/NightlyRun/IdToName.py	(revision 17942)
+@@ -130,9 +130,9 @@
+ 	421  : 'SquareSheetShelfStressHOFS3dTiling',
+ 	422  : 'SquareSheetShelfStressSSAFS3dTiling',
+ 	423  : 'RoundSheetShelfGLMigrationSSA2d',
+-	424  : 'SquareSheetShelfGroundingLine2dAgressive',
++	424  : 'SquareSheetShelfGroundingLine2dAggressive',
+ 	425  : 'SquareSheetShelfGroundingLine2dSoft',
+-	426  : 'SquareSheetShelfGroundingLine3dAgressive',
++	426  : 'SquareSheetShelfGroundingLine3dAggressive',
+ 	427  : 'SquareSheetShelfGroundingLine3dSoft',
+ 	428  : 'SquareSheetShelfStressSSA2dNewton',
+ 	429  : 'SquareSheetShelfStressHONewton',
Index: /issm/oecreview/Archive/17802-17983/ISSM-17942-17943.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17942-17943.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17942-17943.diff	(revision 17986)
@@ -0,0 +1,281 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17942)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17943)
+@@ -1220,10 +1220,7 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&migration_style,GroundinglineMigrationEnum);
+ 	Input* surface_input    = element->GetInput(SurfaceEnum); _assert_(surface_input);
+-	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
+ 	Input* gllevelset_input = NULL;
+-	Input* vy_input         = NULL;
+-	if(dim==2){vy_input     = element->GetInput(VyEnum);      _assert_(vy_input);}
+ 
+ 	/*build friction object, used later on: */
+ 	Friction* friction=new Friction(element,1);
+@@ -1243,7 +1240,7 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		friction->GetAlpha2(&alpha2, gauss,vx_input,vy_input,NULL);
++		friction->GetAlpha2(&alpha2,gauss);
+ 		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+ 		if(migration_style==SubelementMigration2Enum){
+ 			gllevelset_input->GetInputValue(&gllevelset, gauss);
+@@ -2248,11 +2245,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	element->FindParam(&migration_style,GroundinglineMigrationEnum);
+-	Input* vx_input = element->GetInput(VxEnum);   _assert_(vx_input);
+-	Input* vy_input = element->GetInput(VyEnum);   _assert_(vy_input);
+-	Input* vz_input = NULL;
+ 	Input* gllevelset_input = NULL;
+-	if(dim==3){vz_input=element->GetInput(VzEnum); _assert_(vz_input);}
+ 
+ 	/*build friction object, used later on: */
+ 	Friction* friction=new Friction(element,2);
+@@ -2273,7 +2266,7 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2,gauss);
+ 		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+ 		if(migration_style==SubelementMigration2Enum){
+ 			gllevelset_input->GetInputValue(&gllevelset, gauss);
+@@ -3221,10 +3214,6 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	element->FindParam(&migration_style,GroundinglineMigrationEnum);
+-	Input* vx_input         = element->GetInput(VxEnum);      _assert_(vx_input);
+-	Input* vy_input         = element->GetInput(VyEnum);      _assert_(vy_input);
+-	Input* vz_input         = NULL;
+-	if(dim==3){    vz_input = element->GetInput(VzEnum);      _assert_(vz_input);}
+ 	Input* gllevelset_input = NULL;
+ 
+ 	/*build friction object, used later on: */
+@@ -3247,7 +3236,7 @@
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 		gauss->GaussPoint(ig);
+ 
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2,gauss);
+ 		if(migration_style==SubelementMigrationEnum) alpha2=phi*alpha2;
+ 		if(migration_style==SubelementMigration2Enum){
+ 			gllevelset_input->GetInputValue(&gllevelset, gauss);
+@@ -4813,9 +4802,6 @@
+ 
+ 	/*retrieve inputs :*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_tria);
+-	Input* vx_input=element->GetInput(VxEnum);  _assert_(vx_input);
+-	Input* vy_input=element->GetInput(VyEnum);  _assert_(vy_input);
+-	Input* vz_input=element->GetInput(VzEnum);  _assert_(vz_input);
+ 
+ 	/*build friction object, used later on: */
+ 	Friction* friction=new Friction(element,2);
+@@ -4827,7 +4813,7 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		/*Friction: */
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2,gauss);
+ 		element->JacobianDeterminantBase(&Jdet2d, xyz_list_tria,gauss);
+ 		this->GetBHOFriction(L,element,3,xyz_list_tria,gauss);
+ 
+@@ -5038,7 +5024,7 @@
+ 		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+ 
+ 		element->NormalBase(&bed_normal[0],xyz_list_tria);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2_gauss,gauss);
+ 
+ 		DLSSAFS[0][0]=alpha2_gauss*gauss->weight*Jdet2d;
+ 		DLSSAFS[1][1]=alpha2_gauss*gauss->weight*Jdet2d;
+@@ -5318,7 +5304,7 @@
+ 
+ 		element->NormalBase(&bed_normal[0],xyz_list_tria);
+ 		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2_gauss,gauss);
+ 
+ 		for(i=0;i<3;i++){
+ 			pe->values[i*3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
+@@ -5479,7 +5465,7 @@
+ 
+ 		element->NormalBase(&bed_normal[0],xyz_list_tria);
+ 		element->ViscosityFS(&viscosity,dim,xyz_list,gauss,vx_input,vy_input,vz_input);
+-		friction->GetAlpha2(&alpha2_gauss, gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2_gauss,gauss);
+ 
+ 		for(i=0;i<3;i++){
+ 			pe->values[i*3+0]+=Jdet2d*gauss->weight*(alpha2_gauss*w*bed_normal[0]*bed_normal[2]+2*viscosity*dw[2]*bed_normal[0])*basis[i];
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17942)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17943)
+@@ -475,7 +475,7 @@
+ 		element->NodalFunctions(basis,gauss);
+ 
+ 		geothermalflux_input->GetInputValue(&geothermalflux,gauss);
+-		friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++		friction->GetAlpha2(&alpha2,gauss);
+ 		vx_input->GetInputValue(&vx,gauss);
+ 		vy_input->GetInputValue(&vy,gauss);
+ 		vz_input->GetInputValue(&vz,gauss);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17942)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17943)
+@@ -587,7 +587,7 @@
+ 			 NOT [(watercolumn>0.) AND (enthalpy<PIE)] AND (enthalpy<PIE)*/
+ 			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
+ 
+-			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++			friction->GetAlpha2(&alpha2,gauss);
+ 			vx_input->GetInputValue(&vx,gauss);
+ 			vy_input->GetInputValue(&vy,gauss);
+ 			vz_input->GetInputValue(&vz,gauss);
+@@ -989,7 +989,7 @@
+ 			for(i=0;i<3;i++) heatflux+=(vec_heatflux[i])*normal_base[i];
+ 
+ 			/*basal friction*/
+-			friction->GetAlpha2(&alpha2,gauss,vx_input,vy_input,vz_input);
++			friction->GetAlpha2(&alpha2,gauss);
+ 			vx_input->GetInputValue(&vx,gauss);
+ 			vy_input->GetInputValue(&vy,gauss);
+ 			vz_input->GetInputValue(&vz,gauss);
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 17942)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 17943)
+@@ -27,8 +27,8 @@
+ 		~Friction();
+ 
+ 		void  Echo(void);
+-		void  GetAlpha2(IssmDouble* palpha2, Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
+-		void  GetAlphaComplement(IssmDouble* alpha_complement,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input);
++		void  GetAlpha2(IssmDouble* palpha2,Gauss* gauss);
++		void  GetAlphaComplement(IssmDouble* alpha_complement,Gauss* gauss);
+ };
+ 
+ #endif  /* _FRICTION_H_ */
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17942)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17943)
+@@ -41,7 +41,7 @@
+ }
+ /*}}}*/
+ /*FUNCTION Friction::GetAlpha2{{{*/
+-void Friction::GetAlpha2(IssmDouble* palpha2, Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++void Friction::GetAlpha2(IssmDouble* palpha2, Gauss* gauss){
+ 
+ 	/*This routine calculates the basal friction coefficient 
+ 	  alpha2= drag^2 * Neff ^r * | vel | ^(s-1), with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p**/
+@@ -75,18 +75,18 @@
+ 
+ 	switch(dim){
+ 		case 1:
+-			vx_input->GetInputValue(&vx,gauss);
++			element->GetInputValue(&vx,gauss,VxEnum);
+ 			vmag=sqrt(vx*vx);
+ 			break;
+ 		case 2:
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
++			element->GetInputValue(&vx,gauss,VxEnum);
++			element->GetInputValue(&vy,gauss,VyEnum);
+ 			vmag=sqrt(vx*vx+vy*vy);
+ 			break;
+ 		case 3:
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
+-			vz_input->GetInputValue(&vz,gauss);
++			element->GetInputValue(&vx,gauss,VxEnum);
++			element->GetInputValue(&vy,gauss,VyEnum);
++			element->GetInputValue(&vz,gauss,VzEnum);
+ 			vmag=sqrt(vx*vx+vy*vy+vz*vz);
+ 			break;
+ 		default:
+@@ -100,10 +100,9 @@
+ 
+ 	/*Assign output pointers:*/
+ 	*palpha2=alpha2;
+-}
+-/*}}}*/
++}/*}}}*/
+ /*FUNCTION Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss,int vxenum,int vyenum,int vzenum) {{{*/
+-void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss){
+ 
+ 	/* FrictionGetAlpha2 computes alpha2= drag^2 * Neff ^r * vel ^s, with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p. 
+ 	 * FrictionGetAlphaComplement is used in control methods on drag, and it computes: 
+@@ -139,18 +138,18 @@
+ 	//We need the velocity magnitude to evaluate the basal stress:
+ 	switch(dim){
+ 		case 1:
+-			vx_input->GetInputValue(&vx,gauss);
++			element->GetInputValue(&vx,gauss,VxEnum);
+ 			vmag=sqrt(vx*vx);
+ 			break;
+ 		case 2:
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
++			element->GetInputValue(&vx,gauss,VxEnum);
++			element->GetInputValue(&vy,gauss,VyEnum);
+ 			vmag=sqrt(vx*vx+vy*vy);
+ 			break;
+ 		case 3:
+-			vx_input->GetInputValue(&vx,gauss);
+-			vy_input->GetInputValue(&vy,gauss);
+-			vz_input->GetInputValue(&vz,gauss);
++			element->GetInputValue(&vx,gauss,VxEnum);
++			element->GetInputValue(&vy,gauss,VyEnum);
++			element->GetInputValue(&vz,gauss,VzEnum);
+ 			vmag=sqrt(vx*vx+vy*vy+vz*vz);
+ 			break;
+ 		default:
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17942)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17943)
+@@ -3241,7 +3241,7 @@
+ 		GetNodalFunctions(basis, gauss);
+ 
+ 		/*Build alpha_complement_list: */
+-		friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,NULL);
++		friction->GetAlphaComplement(&alpha_complement,gauss);
+ 
+ 		dragcoefficient_input->GetInputValue(&drag, gauss);
+ 		adjointx_input->GetInputValue(&lambda, gauss);
+@@ -3266,7 +3266,7 @@
+ 	//gauss=new GaussTria();
+ 	//for (int iv=0;iv<NUMVERTICES;iv++){
+ 	//	gauss->GaussVertex(iv);
+-	//	friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,vz_input);
++	//	friction->GetAlphaComplement(&alpha_complement,gauss);
+ 	//	dragcoefficient_input->GetInputValue(&drag, gauss);
+ 	//	adjointx_input->GetInputValue(&lambda, gauss);
+ 	//	adjointy_input->GetInputValue(&mu, gauss);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17942)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17943)
+@@ -3233,7 +3233,7 @@
+ 		GetNodalFunctionsP1(basis,gauss);
+ 
+ 		/*Build alpha_complement_list: */
+-		friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,NULL);
++		friction->GetAlphaComplement(&alpha_complement,gauss);
+ 
+ 		dragcoefficient_input->GetInputValue(&drag, gauss);
+ 		adjointx_input->GetInputValue(&lambda, gauss);
+@@ -3305,7 +3305,7 @@
+ 		gauss->GaussPoint(ig);
+ 
+ 		/*Recover alpha_complement and drag: */
+-		friction->GetAlphaComplement(&alpha_complement,gauss,vx_input,vy_input,vz_input);
++		friction->GetAlphaComplement(&alpha_complement,gauss);
+ 		drag_input->GetInputValue(&drag,gauss);
+ 
+ 		/*recover lambda mu and xi: */
Index: /issm/oecreview/Archive/17802-17983/ISSM-17943-17944.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17943-17944.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17943-17944.diff	(revision 17986)
@@ -0,0 +1,35 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17943)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17944)
+@@ -910,7 +910,6 @@
+ 	int         i,is,vertexdown,vertexup,numvertices,numsegments;
+ 	IssmDouble  heatflux;
+ 	IssmDouble  vec_heatflux[dim],normal_base[dim],d1enthalpy[dim];
+-	IssmDouble  temperature, waterfraction;
+ 	IssmDouble  basalfriction,alpha2;
+ 	IssmDouble  dt,yts;
+ 	IssmDouble  melting_overshoot,lambda;
+@@ -925,7 +924,7 @@
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	IssmDouble latentheat = element->GetMaterialParameter(MaterialsLatentheatEnum);
+ 	IssmDouble rho_ice    = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	IssmDouble rho_water  = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_water  = element->GetMaterialParameter(MaterialsRhoFreshwaterEnum);
+ 	Input* enthalpy_input         = element->GetInput(EnthalpyEnum);                    _assert_(enthalpy_input);
+ 	Input* geothermalflux_input   = element->GetInput(BasalforcingsGeothermalfluxEnum); _assert_(geothermalflux_input);
+ 	Input* vx_input               = element->GetInput(VxEnum);                          _assert_(vx_input);
+@@ -995,11 +994,10 @@
+ 			vz_input->GetInputValue(&vz,gauss);
+ 			basalfriction=alpha2*(vx*vx + vy*vy + vz*vz);
+ 
+-			element->EnthalpyToThermal(&temperature,&waterfraction,enthalpy[vertexdown],pressure[vertexdown]);
+ 			geothermalflux_input->GetInputValue(&geothermalflux,gauss);
+-			/* -Mb= Fb-(q-q_geo)/((1-w)*L), cf Aschwanden 2012, eq.66*/
++			/* -Mb= Fb-(q-q_geo)/((1-w)*L*rho), and (1-w)*rho=rho_ice, cf Aschwanden 2012, eqs.1, 2, 66*/
+ 			heating[is]=(heatflux+basalfriction+geothermalflux);
+-			meltingrate_enthalpy[is]=heating[is]/((1-waterfraction)*latentheat*rho_water); // m/s water equivalent
++			meltingrate_enthalpy[is]=heating[is]/(latentheat*rho_ice); // m/s water equivalent
+ 		}
+ 	}
+ 	/******** UPDATE MELTINGRATES AND WATERCOLUMN **************/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17944-17945.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17944-17945.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17944-17945.diff	(revision 17986)
@@ -0,0 +1,35 @@
+Index: ../trunk-jpl/src/m/solve/WriteData.m
+===================================================================
+--- ../trunk-jpl/src/m/solve/WriteData.m	(revision 17944)
++++ ../trunk-jpl/src/m/solve/WriteData.m	(revision 17945)
+@@ -13,8 +13,11 @@
+ 	obj       = getfieldvalue(options,'object');
+ 	fieldname = getfieldvalue(options,'fieldname');
+ 	classname = getfieldvalue(options,'class',class(obj));
+-
+-	enum      = BuildEnum([classname '_' fieldname]);
++	if exist(options,'enum'),
++		enum = getfieldvalue(options,'enum');
++	else
++		enum = BuildEnum([classname '_' fieldname]);
++	end
+ 	data      = obj.(fieldname);
+ else
+ 	%No processing required
+Index: ../trunk-jpl/src/m/solve/WriteData.py
+===================================================================
+--- ../trunk-jpl/src/m/solve/WriteData.py	(revision 17944)
++++ ../trunk-jpl/src/m/solve/WriteData.py	(revision 17945)
+@@ -23,8 +23,10 @@
+ 		obj       = options.getfieldvalue('object')
+ 		fieldname = options.getfieldvalue('fieldname')
+ 		classname = options.getfieldvalue('class',str(type(obj)).rsplit('.')[-1].split("'")[0])
+-
+-		enum      = BuildEnum(classname+'_'+fieldname)
++		if options.exist('enum'):
++			enum = options.getfieldvalue('enum')
++		else:
++			enum = BuildEnum(classname+'_'+fieldname)
+ 		data      = getattr(obj,fieldname)
+ 	else:
+ 		#No processing required
Index: /issm/oecreview/Archive/17802-17983/ISSM-17945-17946.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17945-17946.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17945-17946.diff	(revision 17986)
@@ -0,0 +1,446 @@
+Index: ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp	(revision 17946)
+@@ -710,7 +710,7 @@
+ 	/*Find MasstransportHydrostaticAdjustment to figure out how to update the geometry:*/
+ 	basalelement->FindParam(&hydroadjustment,MasstransportHydrostaticAdjustmentEnum);
+ 	rho_ice   = basalelement->GetMaterialParameter(MaterialsRhoIceEnum);
+-	rho_water = basalelement->GetMaterialParameter(MaterialsRhoWaterEnum);
++	rho_water = basalelement->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 
+ 	for(i=0;i<numnodes;i++) {
+ 		/*If shelf: hydrostatic equilibrium*/
+Index: ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp	(revision 17946)
+@@ -330,7 +330,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	IssmDouble  rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  g         = element->GetMaterialParameter(ConstantsGEnum);
+ 	IssmDouble  mu_water  = element->GetMaterialParameter(MaterialsMuWaterEnum);
+ 	Input* surfaceslopex_input = element->GetInput(SurfaceSlopeXEnum); _assert_(surfaceslopex_input);
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17946)
+@@ -1476,7 +1476,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 	Input* base_input       = element->GetInput(BaseEnum);       _assert_(base_input);
+-	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -1928,7 +1928,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* thickness_input = element->GetInput(ThicknessEnum); _assert_(thickness_input);
+ 	Input* base_input       = element->GetInput(BaseEnum);       _assert_(base_input);
+-	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -2446,7 +2446,7 @@
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	Input* surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
+-	IssmDouble rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble rho_ice   = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity   = element->GetMaterialParameter(ConstantsGEnum);
+ 	element->GetVerticesCoordinates(&xyz_list);
+@@ -3011,7 +3011,7 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	if(dt==0)   dt=1.e+5;
+-	IssmDouble  rho_water     = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water     = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  gravity       = element->GetMaterialParameter(ConstantsGEnum);
+ 	Input*      surface_input = element->GetInput(SurfaceEnum); _assert_(surface_input);
+ 
+@@ -3568,7 +3568,7 @@
+ 	/*Retrieve all inputs and parameters*/
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	Input*      base_input=element->GetInput(BaseEnum); _assert_(base_input);
+-	IssmDouble  rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water=element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  gravity  =element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+@@ -3642,7 +3642,7 @@
+ 	element->ZeroLevelsetCoordinates(&xyz_list_front,xyz_list,MaskIceLevelsetEnum);
+ 	element->NormalSection(&normal[0],xyz_list_front);
+ 	Input* surface_input  = element->GetInput(SurfaceEnum); _assert_(surface_input);
+-	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  gravity   = element->GetMaterialParameter(ConstantsGEnum);
+ 
+ 	/*Initialize gauss points*/
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17946)
+@@ -177,7 +177,7 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	element->FindParam(&stabilization,ThermalStabilizationEnum);
+-	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
+ 	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+@@ -306,7 +306,7 @@
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
+-	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+ 	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
+@@ -519,7 +519,7 @@
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input*      pressure_input=element->GetInput(PressureEnum); _assert_(pressure_input);
+ 	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
+-	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+ 	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17946)
+@@ -244,7 +244,7 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	element->FindParam(&stabilization,ThermalStabilizationEnum);
+-	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
+ 	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+@@ -372,7 +372,7 @@
+ 	element->GetVerticesCoordinatesBase(&xyz_list_base);
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
+-	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+ 	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
+@@ -647,7 +647,7 @@
+ 	element->FindParam(&dt,TimesteppingTimeStepEnum);
+ 	Input*      pressure_input=element->GetInput(PressureEnum); _assert_(pressure_input);
+ 	IssmDouble  gravity             = element->GetMaterialParameter(ConstantsGEnum);
+-	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble  rho_water           = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble  rho_ice             = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble  heatcapacity        = element->GetMaterialParameter(MaterialsHeatcapacityEnum);
+ 	IssmDouble  mixed_layer_capacity= element->GetMaterialParameter(MaterialsMixedLayerCapacityEnum);
+@@ -1102,7 +1102,7 @@
+ 	int        *pairindices   = NULL;
+ 	
+ 	rho_ice=element->GetMaterialParameter(MaterialsRhoIceEnum);
+-	rho_water=element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	rho_water=element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	element->GetInputListOnVertices(enthalpies,EnthalpyEnum);
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17945)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17946)
+@@ -191,7 +191,7 @@
+ 	DamageEvolutionNumRequestedOutputsEnum,
+ 	DamageEvolutionRequestedOutputsEnum,
+ 	MaterialsRhoIceEnum,
+-	MaterialsRhoWaterEnum,
++	MaterialsRhoSeawaterEnum,
+ 	MaterialsRhoFreshwaterEnum,
+ 	MaterialsMuWaterEnum,
+ 	MaterialsThermalExchangeVelocityEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17946)
+@@ -199,7 +199,7 @@
+ 		case DamageEvolutionNumRequestedOutputsEnum : return "DamageEvolutionNumRequestedOutputs";
+ 		case DamageEvolutionRequestedOutputsEnum : return "DamageEvolutionRequestedOutputs";
+ 		case MaterialsRhoIceEnum : return "MaterialsRhoIce";
+-		case MaterialsRhoWaterEnum : return "MaterialsRhoWater";
++		case MaterialsRhoSeawaterEnum : return "MaterialsRhoSeawater";
+ 		case MaterialsRhoFreshwaterEnum : return "MaterialsRhoFreshwater";
+ 		case MaterialsMuWaterEnum : return "MaterialsMuWater";
+ 		case MaterialsThermalExchangeVelocityEnum : return "MaterialsThermalExchangeVelocity";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17946)
+@@ -202,7 +202,7 @@
+ 	      else if (strcmp(name,"DamageEvolutionNumRequestedOutputs")==0) return DamageEvolutionNumRequestedOutputsEnum;
+ 	      else if (strcmp(name,"DamageEvolutionRequestedOutputs")==0) return DamageEvolutionRequestedOutputsEnum;
+ 	      else if (strcmp(name,"MaterialsRhoIce")==0) return MaterialsRhoIceEnum;
+-	      else if (strcmp(name,"MaterialsRhoWater")==0) return MaterialsRhoWaterEnum;
++	      else if (strcmp(name,"MaterialsRhoSeawater")==0) return MaterialsRhoSeawaterEnum;
+ 	      else if (strcmp(name,"MaterialsRhoFreshwater")==0) return MaterialsRhoFreshwaterEnum;
+ 	      else if (strcmp(name,"MaterialsMuWater")==0) return MaterialsMuWaterEnum;
+ 	      else if (strcmp(name,"MaterialsThermalExchangeVelocity")==0) return MaterialsThermalExchangeVelocityEnum;
+Index: ../trunk-jpl/src/c/classes/Materials/Matpar.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/classes/Materials/Matpar.cpp	(revision 17946)
+@@ -27,7 +27,7 @@
+ 
+ 	this->mid = matpar_mid;
+ 	iomodel->Constant(&this->rho_ice,MaterialsRhoIceEnum);
+-	iomodel->Constant(&this->rho_water,MaterialsRhoWaterEnum);
++	iomodel->Constant(&this->rho_water,MaterialsRhoSeawaterEnum);
+ 	iomodel->Constant(&this->rho_freshwater,MaterialsRhoFreshwaterEnum);
+ 	iomodel->Constant(&this->mu_water,MaterialsMuWaterEnum);
+ 	iomodel->Constant(&this->heatcapacity,MaterialsHeatcapacityEnum);
+@@ -163,7 +163,7 @@
+ 		case MaterialsRhoIceEnum:
+ 			this->rho_ice=constant;
+ 			break;
+-		case MaterialsRhoWaterEnum:
++		case MaterialsRhoSeawaterEnum:
+ 			this->rho_water=constant;
+ 			break;
+ 		case MaterialsRhoFreshwaterEnum:
+@@ -238,7 +238,7 @@
+ 
+ 	switch(enum_in){
+ 		case MaterialsRhoIceEnum:                    return this->rho_ice;
+-		case MaterialsRhoWaterEnum:                  return this->rho_water;
++		case MaterialsRhoSeawaterEnum:                  return this->rho_water;
+ 		case MaterialsRhoFreshwaterEnum:             return this->rho_freshwater;
+ 		case MaterialsMuWaterEnum:                   return this->mu_water;
+ 		case MaterialsHeatcapacityEnum:              return this->heatcapacity;
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17945)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17946)
+@@ -61,7 +61,7 @@
+ 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
+ 	element->GetInputValue(&bed, gauss,BaseEnum);
+ 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+-	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 
+@@ -123,7 +123,7 @@
+ 	element->GetInputValue(&thickness, gauss,ThicknessEnum);
+ 	element->GetInputValue(&bed, gauss,BaseEnum);
+ 	element->GetInputValue(&drag_coefficient, gauss,FrictionCoefficientEnum);
+-	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoWaterEnum);
++	IssmDouble rho_water   = element->GetMaterialParameter(MaterialsRhoSeawaterEnum);
+ 	IssmDouble rho_ice     = element->GetMaterialParameter(MaterialsRhoIceEnum);
+ 	IssmDouble gravity     = element->GetMaterialParameter(ConstantsGEnum);
+ 
+Index: ../trunk-jpl/src/m/classes/matdamageice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matdamageice.py	(revision 17945)
++++ ../trunk-jpl/src/m/classes/matdamageice.py	(revision 17946)
+@@ -128,7 +128,7 @@
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'enum',MaterialsEnum(),'data',MatdamageiceEnum(),'format','Integer');
+ 		WriteData(fid,'object',self,'class','materials','fieldname','rho_ice','format','Double')
+-		WriteData(fid,'object',self,'class','materials','fieldname','rho_water','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','rho_water','enum',MaterialsRhoSeawaterEnum(),'format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','rho_freshwater','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','mu_water','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','heatcapacity','format','Double')
+Index: ../trunk-jpl/src/m/classes/matdamageice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matdamageice.m	(revision 17945)
++++ ../trunk-jpl/src/m/classes/matdamageice.m	(revision 17946)
+@@ -173,7 +173,7 @@
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',MaterialsEnum(),'data',MatdamageiceEnum(),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','rho_ice','format','Double');
+-			WriteData(fid,'object',obj,'class','materials','fieldname','rho_water','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','rho_water','enum',MaterialsRhoSeawaterEnum(),'format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','rho_freshwater','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','mu_water','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','heatcapacity','format','Double');
+Index: ../trunk-jpl/src/m/classes/matice.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.m	(revision 17945)
++++ ../trunk-jpl/src/m/classes/matice.m	(revision 17946)
+@@ -29,47 +29,47 @@
+ 
+ 	end
+ 	methods
+-        function createxml(obj,fid) % {{{
+-            fprintf(fid, '\n\n');
+-            fprintf(fid, '<!-- materials -->\n');
+-			 fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(obj.rho_ice),'" default="',convert2str(obj.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(obj.rho_water),'" default="',convert2str(obj.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(obj.rho_freshwater),'" default="',convert2str(obj.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
+-             
+-  
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(obj.mu_water),'" default="',convert2str(obj.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(obj.heatcapacity),'" default="',convert2str(obj.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(obj.latentheat),'" default="',convert2str(obj.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
+-             
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(obj.thermalconductivity),'" default="',convert2str(obj.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(obj.temperateiceconductivity),'" default="',convert2str(obj.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(obj.meltingpoint),'" default="',convert2str(obj.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
+-             
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(obj.beta),'" default="',convert2str(obj.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(obj.mixed_layer_capacity),'" default="',convert2str(obj.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(obj.thermal_exchange_velocity),'" default="',convert2str(obj.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
+-             
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(obj.rheology_B),'" default="',convert2str(obj.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(obj.rheology_n),'" default="',convert2str(obj.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
+-             
+-             % rheology_law drop-down
+-             fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="alternative" optional="false">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>');
+-             fprintf(fid,'%s\n','       <option value="None" type="string" default="true"> </option>');
+-             fprintf(fid,'%s\n','       <option value="Paterson" type="string" default="false"> </option>');
+-             fprintf(fid,'%s\n','       <option value="Arrhenius" type="string" default="false"> </option>');
+-             fprintf(fid,'%s\n%s\n','       <option value="LliboutryDuval" type="string" default="false"> </option>','</parameter>');
+-             
+-             
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(obj.lithosphere_shear_modulus),'" default="',convert2str(obj.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(obj.lithosphere_density),'" default="',convert2str(obj.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(obj.mantle_shear_modulus),'" default="',convert2str(obj.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
+-             fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(obj.mantle_density),'" default="',convert2str(obj.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
+-        
+-         
+-        end % }}}
++		function createxml(obj,fid) % {{{
++			fprintf(fid, '\n\n');
++			fprintf(fid, '<!-- materials -->\n');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_ice" type="',class(obj.rho_ice),'" default="',convert2str(obj.rho_ice),'">','     <section name="materials" />','     <help> ice density [kg/m^3] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_water" type="',class(obj.rho_water),'" default="',convert2str(obj.rho_water),'">','     <section name="materials" />','     <help> ocean water density [kg/m^3] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rho_freshwater" type="',class(obj.rho_freshwater),'" default="',convert2str(obj.rho_freshwater),'">','     <section name="materials" />','     <help> fresh water density [kg/m^3] </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mu_water" type="',class(obj.mu_water),'" default="',convert2str(obj.mu_water),'">','     <section name="materials" />','     <help> water viscosity [N s/m^2] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="heatcapacity" type="',class(obj.heatcapacity),'" default="',convert2str(obj.heatcapacity),'">','     <section name="materials" />','     <help> heat capacity [J/kg/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="latentheat" type="',class(obj.latentheat),'" default="',convert2str(obj.latentheat),'">','     <section name="materials" />','     <help> latent heat of fusion [J/kg] </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermalconductivity" type="',class(obj.thermalconductivity),'" default="',convert2str(obj.thermalconductivity),'">','     <section name="materials" />','     <help> ice thermal conductivity [W/m/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="temperateiceconductivity" type="',class(obj.temperateiceconductivity),'" default="',convert2str(obj.temperateiceconductivity),'">','     <section name="materials" />','     <help> temperate ice thermal conductivity [W/m/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="meltingpoint" type="',class(obj.meltingpoint),'" default="',convert2str(obj.meltingpoint),'">','     <section name="materials" />','     <help> melting point of ice at 1atm in K </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="beta" type="',class(obj.beta),'" default="',convert2str(obj.beta),'">','     <section name="materials" />','     <help> rate of change of melting point with pressure [K/Pa] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mixed_layer_capacity" type="',class(obj.mixed_layer_capacity),'" default="',convert2str(obj.mixed_layer_capacity),'">','     <section name="materials" />','     <help> mixed layer capacity [W/kg/K] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="thermal_exchange_velocity" type="',class(obj.thermal_exchange_velocity),'" default="',convert2str(obj.thermal_exchange_velocity),'">','     <section name="materials" />','     <help> thermal exchange velocity [m/s] </help>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_B" type="',class(obj.rheology_B),'" default="',convert2str(obj.rheology_B),'">','     <section name="materials" />','     <help> flow law parameter [Pa/s^(1/n)] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="rheology_n" type="',class(obj.rheology_n),'" default="',convert2str(obj.rheology_n),'">','     <section name="materials" />','     <help> Glens flow law exponent </help>','</parameter>');
++
++			% rheology_law drop-down
++			fprintf(fid,'%s\n%s\n%s\n%s\n','<parameter key ="rheology_law" type="alternative" optional="false">','     <section name="materials" />','     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>');
++			fprintf(fid,'%s\n','       <option value="None" type="string" default="true"> </option>');
++			fprintf(fid,'%s\n','       <option value="Paterson" type="string" default="false"> </option>');
++			fprintf(fid,'%s\n','       <option value="Arrhenius" type="string" default="false"> </option>');
++			fprintf(fid,'%s\n%s\n','       <option value="LliboutryDuval" type="string" default="false"> </option>','</parameter>');
++
++
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_shear_modulus" type="',class(obj.lithosphere_shear_modulus),'" default="',convert2str(obj.lithosphere_shear_modulus),'">','     <section name="materials" />','     <help> Lithosphere shear modulus [Pa] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="lithosphere_density" type="',class(obj.lithosphere_density),'" default="',convert2str(obj.lithosphere_density),'">','     <section name="materials" />','     <help> Lithosphere density [g/cm^-3] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_shear_modulus" type="',class(obj.mantle_shear_modulus),'" default="',convert2str(obj.mantle_shear_modulus),'">','     <section name="materials" />','     <help> Mantle shear modulus [Pa] </help>','</parameter>');
++			fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n','<parameter key ="mantle_density" type="',class(obj.mantle_density),'" default="',convert2str(obj.mantle_density),'">','     <section name="materials" />','     <help> Mantle density [g/cm^-3] </help>','</parameter>');
++
++
++		end % }}}
+ 		function obj = matice(varargin) % {{{
+ 			switch nargin
+ 				case 0
+@@ -180,7 +180,7 @@
+ 		function marshall(obj,md,fid) % {{{
+ 			WriteData(fid,'enum',MaterialsEnum(),'data',MaticeEnum(),'format','Integer');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','rho_ice','format','Double');
+-			WriteData(fid,'object',obj,'class','materials','fieldname','rho_water','format','Double');
++			WriteData(fid,'object',obj,'class','materials','fieldname','rho_water','enum',MaterialsRhoSeawaterEnum(),'format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','rho_freshwater','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','mu_water','format','Double');
+ 			WriteData(fid,'object',obj,'class','materials','fieldname','heatcapacity','format','Double');
+Index: ../trunk-jpl/src/m/classes/matice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matice.py	(revision 17945)
++++ ../trunk-jpl/src/m/classes/matice.py	(revision 17946)
+@@ -128,7 +128,7 @@
+ 	def marshall(self,md,fid):    # {{{
+ 		WriteData(fid,'enum',MaterialsEnum(),'data',MaticeEnum(),'format','Integer');
+ 		WriteData(fid,'object',self,'class','materials','fieldname','rho_ice','format','Double')
+-		WriteData(fid,'object',self,'class','materials','fieldname','rho_water','format','Double')
++		WriteData(fid,'object',self,'class','materials','fieldname','rho_water','enum',MaterialsRhoSeawaterEnum(),'format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','rho_freshwater','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','mu_water','format','Double')
+ 		WriteData(fid,'object',self,'class','materials','fieldname','heatcapacity','format','Double')
+Index: ../trunk-jpl/src/m/qmu/setupdesign/IsScaled.m
+===================================================================
+--- ../trunk-jpl/src/m/qmu/setupdesign/IsScaled.m	(revision 17945)
++++ ../trunk-jpl/src/m/qmu/setupdesign/IsScaled.m	(revision 17946)
+@@ -2,7 +2,7 @@
+ %ISSCALED decide whether a variable should be scaled or not. 
+ 
+ switch variablename,
+-case {'MaterialsRhoIce','MaterialsRhoWater','MaterialsHeatCapacity','MaterialsThermalConductivity','Gravity','MaxVel'},
++case {'MaterialsRhoIce','MaterialsRhoSeawater','MaterialsHeatCapacity','MaterialsThermalConductivity','Gravity','MaxVel'},
+ 
+ 	status=0;
+ 
+Index: ../trunk-jpl/src/m/enum/MaterialsRhoWaterEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MaterialsRhoWaterEnum.m	(revision 17945)
++++ ../trunk-jpl/src/m/enum/MaterialsRhoWaterEnum.m	(revision 17946)
+@@ -1,11 +0,0 @@
+-function macro=MaterialsRhoWaterEnum()
+-%MATERIALSRHOWATERENUM - Enum of MaterialsRhoWater
+-%
+-%   WARNING: DO NOT MODIFY THIS FILE
+-%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+-%            Please read src/c/shared/Enum/README for more information
+-%
+-%   Usage:
+-%      macro=MaterialsRhoWaterEnum()
+-
+-macro=StringToEnum('MaterialsRhoWater');
+Index: ../trunk-jpl/src/m/enum/MaterialsRhoSeawaterEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/MaterialsRhoSeawaterEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/MaterialsRhoSeawaterEnum.m	(revision 17946)
+@@ -0,0 +1,11 @@
++function macro=MaterialsRhoSeawaterEnum()
++%MATERIALSRHOSEAWATERENUM - Enum of MaterialsRhoSeawater
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=MaterialsRhoSeawaterEnum()
++
++macro=StringToEnum('MaterialsRhoSeawater');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17945)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17946)
+@@ -191,7 +191,7 @@
+ def DamageEvolutionNumRequestedOutputsEnum(): return StringToEnum("DamageEvolutionNumRequestedOutputs")[0]
+ def DamageEvolutionRequestedOutputsEnum(): return StringToEnum("DamageEvolutionRequestedOutputs")[0]
+ def MaterialsRhoIceEnum(): return StringToEnum("MaterialsRhoIce")[0]
+-def MaterialsRhoWaterEnum(): return StringToEnum("MaterialsRhoWater")[0]
++def MaterialsRhoSeawaterEnum(): return StringToEnum("MaterialsRhoSeawater")[0]
+ def MaterialsRhoFreshwaterEnum(): return StringToEnum("MaterialsRhoFreshwater")[0]
+ def MaterialsMuWaterEnum(): return StringToEnum("MaterialsMuWater")[0]
+ def MaterialsThermalExchangeVelocityEnum(): return StringToEnum("MaterialsThermalExchangeVelocity")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17946-17947.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17946-17947.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17946-17947.diff	(revision 17986)
@@ -0,0 +1,4 @@
+Index: ../trunk-jpl/test/Archives/Archive327.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: /issm/oecreview/Archive/17802-17983/ISSM-17947-17948.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17947-17948.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17947-17948.diff	(revision 17986)
@@ -0,0 +1,11 @@
+Index: ../trunk-jpl/src/m/classes/matdamageice.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/matdamageice.py	(revision 17947)
++++ ../trunk-jpl/src/m/classes/matdamageice.py	(revision 17948)
+@@ -1,5 +1,5 @@
+ from fielddisplay import fielddisplay
+-from EnumDefinitions import MaterialsEnum, MatdamageiceEnum, MaterialsRheologyLawEnum
++from EnumDefinitions import MaterialsEnum, MatdamageiceEnum, MaterialsRheologyLawEnum, MaterialsRhoSeawaterEnum
+ from StringToEnum import StringToEnum
+ from checkfield import checkfield
+ from WriteData import WriteData
Index: /issm/oecreview/Archive/17802-17983/ISSM-17948-17949.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17948-17949.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17948-17949.diff	(revision 17986)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17948)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17949)
+@@ -211,6 +211,7 @@
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
++	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum,0.);
+ 	if(dakota_analysis)elements->InputDuplicate(VxEnum,QmuVxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum,0.);
+@@ -3596,6 +3597,27 @@
+ 	/*Transform coordinate system*/
+ 	element->TransformLoadVectorCoord(pe,cs_list);
+ 
++	/* shelf dampening*/
++	int shelf_dampening;
++	element->FindParam(&shelf_dampening,StressbalanceShelfDampeningEnum);
++	if(shelf_dampening) {
++		Input*      mb_input=element->GetInput(BasalforcingsMeltingRateEnum); _assert_(mb_input);
++		IssmDouble dt,mb,normal_b;
++		element->FindParam(&dt,TimesteppingTimeStepEnum);
++		for(int ig=gauss->begin();ig<gauss->end();ig++){
++			gauss->GaussPoint(ig);
++			element->JacobianDeterminantBase(&Jdet,xyz_list_base,gauss);
++			element->NodalFunctionsVelocity(vbasis,gauss);
++			element->NormalBase(&normal[0],xyz_list_base);
++			if (dim==2) normal_b=normal[1];
++			else if (dim==3) normal_b=sqrt(normal[0]*normal[0]+normal[1]*normal[1]);
++			mb_input->GetInputValue(&mb, gauss);
++			for(i=0;i<vnumnodes;i++){
++				pe->values[i*dim+1] += dt*rho_water*gravity*mb*gauss->weight*Jdet*vbasis[i]*normal_b;
++			}
++		}
++	}
++
+ 	/*Clean up and return*/
+ 	delete gauss;
+ 	xDelete<int>(cs_list);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17949-17950.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17949-17950.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17949-17950.diff	(revision 17986)
@@ -0,0 +1,72 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17949)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17950)
+@@ -415,11 +415,13 @@
+ 				transfer=0.0;
+ 			}
+ 			else{
+-				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
++				transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
++				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
+ 			}
+ 		}
+ 		else{
+-			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
++			transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
++			//			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
+ 		}
+ 		break;
+ 	default:
+@@ -466,11 +468,13 @@
+ 				transfer=0.0;
+ 			}
+ 			else{
+-				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
++				transfer=(sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
++				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
+ 			}
+ 		}
+ 		else{
+-			transfer=(sediment_storing*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
++			transfer=(sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
++			//			transfer=(sediment_storing*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
+ 		}
+ 		break;
+ 	default:
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17949)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17950)
+@@ -607,11 +607,13 @@
+ 				transfer=0.0;
+ 			}
+ 			else{
+-				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
++				transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
++				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
+ 			}
+ 		}
+ 		else{
+-			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
++			transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
++			//			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
+ 		}
+ 		break;
+ 	default:
+@@ -662,11 +664,13 @@
+ 				transfer=0.0;
+ 			}
+ 			else{
+-				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
++				transfer=(sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
++				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
+ 			}
+ 		}
+ 		else{
+-			transfer=(sediment_storing*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
++			transfer=(sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
++			//			transfer=(sediment_storing*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
+ 		}
+ 		break;
+ 	default:
Index: /issm/oecreview/Archive/17802-17983/ISSM-17950-17951.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17950-17951.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17950-17951.diff	(revision 17986)
@@ -0,0 +1,26 @@
+Index: ../trunk-jpl/src/m/classes/damage.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.py	(revision 17950)
++++ ../trunk-jpl/src/m/classes/damage.py	(revision 17951)
+@@ -16,7 +16,7 @@
+ 	def __init__(self,*args):    # {{{
+ 			
+ 		#damage: 
+-		self.isdamage           = float('NaN')
++		self.isdamage           = 0.
+ 		self.D						= float('NaN')
+ 		self.law						= ''
+ 		self.spcdamage				= float('NaN')
+Index: ../trunk-jpl/src/m/classes/damage.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/damage.m	(revision 17950)
++++ ../trunk-jpl/src/m/classes/damage.m	(revision 17951)
+@@ -6,7 +6,7 @@
+ classdef damage
+ 	properties (SetAccess=public)  
+ 		%damage 
+-		isdamage            = NaN;
++		isdamage            = 0;
+ 		D                   = NaN;
+ 		law                 = '';
+ 		spcdamage           = NaN; 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17951-17952.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17951-17952.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17951-17952.diff	(revision 17986)
@@ -0,0 +1,688 @@
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17951)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17952)
+@@ -9,9 +9,12 @@
+ 	return 1;
+ }/*}}}*/
+ void MeltingAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
++	parameters->AddObject(iomodel->CopyConstantObject(FrictionLawEnum));
+ }/*}}}*/
+ void MeltingAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
++	int frictionlaw;
++
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+ 	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+@@ -29,9 +32,6 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+-	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+-	iomodel->FetchDataToInput(elements,FrictionPEnum);
+-	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum);
+@@ -42,6 +42,21 @@
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+ 	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,PressureEnum);
++	
++	/*Friction law variables*/
++	switch(frictionlaw){
++		case 1:
++			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
++			iomodel->FetchDataToInput(elements,FrictionPEnum);
++			iomodel->FetchDataToInput(elements,FrictionQEnum);
++			break;
++		case 2:
++			iomodel->FetchDataToInput(elements,FrictionCEnum);
++			iomodel->FetchDataToInput(elements,FrictionMEnum);
++			break;
++		default:
++			_error_("not supported");
++	}
+ }/*}}}*/
+ void MeltingAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17951)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17952)
+@@ -105,6 +105,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceFSreconditioningEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceShelfDampeningEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(StressbalanceViscosityOvershootEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(FrictionLawEnum));
+ 
+ 	/*XTH parameters*/
+ 	iomodel->Constant(&fe_FS,FlowequationFeFSEnum);
+@@ -124,7 +125,7 @@
+ 
+ 	/*Intermediaries*/
+ 	int    materials_type,finiteelement;
+-	int    approximation;
++	int    approximation,frictionlaw;
+ 	int*   finiteelement_list=NULL;
+ 	bool   isSSA,isL1L2,isHO,isFS,iscoupling;
+ 	bool   control_analysis;
+@@ -141,6 +142,7 @@
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
+ 	iomodel->Constant(&materials_type,MaterialsEnum);
+ 	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
++	iomodel->Constant(&frictionlaw,FrictionLawEnum);
+ 
+ 	/*return if no processing required*/
+ 	if(!isSSA & !isL1L2 & !isHO & !isFS) return;
+@@ -204,9 +206,6 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+-	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+-	iomodel->FetchDataToInput(elements,FrictionPEnum);
+-	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+@@ -239,6 +238,21 @@
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 	}
+ 
++	/*Friction law variables*/
++	switch(frictionlaw){
++		case 1:
++			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
++			iomodel->FetchDataToInput(elements,FrictionPEnum);
++			iomodel->FetchDataToInput(elements,FrictionQEnum);
++			break;
++		case 2:
++			iomodel->FetchDataToInput(elements,FrictionCEnum);
++			iomodel->FetchDataToInput(elements,FrictionMEnum);
++			break;
++		default:
++			_error_("not supported");
++	}
++
+ #ifdef _HAVE_ANDROID_
+ 	elements->InputDuplicate(FrictionCoefficientEnum,AndroidFrictionCoefficientEnum);
+ #endif
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17951)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17952)
+@@ -20,6 +20,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalPenaltyLockEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsdynamicbasalspcEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(FrictionLawEnum));
+ 
+ 	iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum);
+ 	parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs));
+@@ -29,6 +30,8 @@
+ }/*}}}*/
+ void ThermalAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
++	int frictionlaw;
++
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+ 	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
+ 
+@@ -50,9 +53,6 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+-	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+-	iomodel->FetchDataToInput(elements,FrictionPEnum);
+-	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+ 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+@@ -84,6 +84,20 @@
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
++	/*Friction law variables*/
++	switch(frictionlaw){
++		case 1:
++			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
++			iomodel->FetchDataToInput(elements,FrictionPEnum);
++			iomodel->FetchDataToInput(elements,FrictionQEnum);
++			break;
++		case 2:
++			iomodel->FetchDataToInput(elements,FrictionCEnum);
++			iomodel->FetchDataToInput(elements,FrictionMEnum);
++			break;
++		default:
++			_error_("not supported");
++	}
+ }/*}}}*/
+ void ThermalAnalysis::CreateNodes(Nodes* nodes,IoModel* iomodel){/*{{{*/
+ 
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17951)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17952)
+@@ -16,6 +16,7 @@
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalStabilizationEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsenthalpyEnum));
+ 	parameters->AddObject(iomodel->CopyConstantObject(ThermalIsdynamicbasalspcEnum));
++	parameters->AddObject(iomodel->CopyConstantObject(FrictionLawEnum));
+ 
+ 	iomodel->FetchData(&requestedoutputs,&numoutputs,ThermalRequestedOutputsEnum);
+ 	parameters->AddObject(new IntParam(ThermalNumRequestedOutputsEnum,numoutputs));
+@@ -24,8 +25,8 @@
+ }/*}}}*/
+ void EnthalpyAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+ 
+-	bool dakota_analysis, islevelset;
+-	bool isenthalpy;
++	bool dakota_analysis,islevelset,isenthalpy;
++	int frictionlaw;
+ 
+ 	/*Now, is the model 3d? otherwise, do nothing: */
+ 	if(iomodel->domaintype==Domain2DhorizontalEnum)return;
+@@ -53,9 +54,6 @@
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+ 	iomodel->FetchDataToInput(elements,BaseEnum);
+-	iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
+-	iomodel->FetchDataToInput(elements,FrictionPEnum);
+-	iomodel->FetchDataToInput(elements,FrictionQEnum);
+ 	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+ 	if(iomodel->domaintype!=Domain2DhorizontalEnum){
+@@ -89,7 +87,21 @@
+ 		iomodel->FetchDataToInput(elements,IceMaskNodeActivationEnum);
+ 		iomodel->FetchDataToInput(elements,MeshVertexonbaseEnum); // required for updating active nodes
+ 	}
+-
++	
++	/*Friction law variables*/
++	switch(frictionlaw){
++		case 1:
++			iomodel->FetchDataToInput(elements,FrictionCoefficientEnum);
++			iomodel->FetchDataToInput(elements,FrictionPEnum);
++			iomodel->FetchDataToInput(elements,FrictionQEnum);
++			break;
++		case 2:
++			iomodel->FetchDataToInput(elements,FrictionCEnum);
++			iomodel->FetchDataToInput(elements,FrictionMEnum);
++			break;
++		default:
++			_error_("not supported");
++	}
+ 	/*Free data: */
+ 	iomodel->DeleteData(3,TemperatureEnum,WaterfractionEnum,PressureEnum);
+ }/*}}}*/
+Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17951)
++++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 17952)
+@@ -83,6 +83,9 @@
+ 	FrictionCoefficientEnum,
+ 	FrictionPEnum,
+ 	FrictionQEnum,
++	FrictionMEnum,
++	FrictionCEnum,
++	FrictionLawEnum,
+ 	GeometryHydrostaticRatioEnum,
+ 	HydrologyModelEnum,
+ 	HydrologyshreveEnum,
+Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17951)
++++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 17952)
+@@ -91,6 +91,9 @@
+ 		case FrictionCoefficientEnum : return "FrictionCoefficient";
+ 		case FrictionPEnum : return "FrictionP";
+ 		case FrictionQEnum : return "FrictionQ";
++		case FrictionMEnum : return "FrictionM";
++		case FrictionCEnum : return "FrictionC";
++		case FrictionLawEnum : return "FrictionLaw";
+ 		case GeometryHydrostaticRatioEnum : return "GeometryHydrostaticRatio";
+ 		case HydrologyModelEnum : return "HydrologyModel";
+ 		case HydrologyshreveEnum : return "Hydrologyshreve";
+Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17951)
++++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 17952)
+@@ -91,6 +91,9 @@
+ 	      else if (strcmp(name,"FrictionCoefficient")==0) return FrictionCoefficientEnum;
+ 	      else if (strcmp(name,"FrictionP")==0) return FrictionPEnum;
+ 	      else if (strcmp(name,"FrictionQ")==0) return FrictionQEnum;
++	      else if (strcmp(name,"FrictionM")==0) return FrictionMEnum;
++	      else if (strcmp(name,"FrictionC")==0) return FrictionCEnum;
++	      else if (strcmp(name,"FrictionLaw")==0) return FrictionLawEnum;
+ 	      else if (strcmp(name,"GeometryHydrostaticRatio")==0) return GeometryHydrostaticRatioEnum;
+ 	      else if (strcmp(name,"HydrologyModel")==0) return HydrologyModelEnum;
+ 	      else if (strcmp(name,"Hydrologyshreve")==0) return HydrologyshreveEnum;
+@@ -133,13 +136,13 @@
+ 	      else if (strcmp(name,"HydrologydcBasalMoulinInput")==0) return HydrologydcBasalMoulinInputEnum;
+ 	      else if (strcmp(name,"HydrologyLayer")==0) return HydrologyLayerEnum;
+ 	      else if (strcmp(name,"HydrologySediment")==0) return HydrologySedimentEnum;
+-	      else if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
+-	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
+-	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
+          else stage=2;
+    }
+    if(stage==2){
+-	      if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
++	      if (strcmp(name,"HydrologyEfficient")==0) return HydrologyEfficientEnum;
++	      else if (strcmp(name,"HydrologySedimentKmax")==0) return HydrologySedimentKmaxEnum;
++	      else if (strcmp(name,"IndependentObject")==0) return IndependentObjectEnum;
++	      else if (strcmp(name,"InversionControlParameters")==0) return InversionControlParametersEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionThreshold")==0) return InversionCostFunctionThresholdEnum;
+ 	      else if (strcmp(name,"InversionCostFunctionsCoefficients")==0) return InversionCostFunctionsCoefficientsEnum;
+ 	      else if (strcmp(name,"InversionCostFunctions")==0) return InversionCostFunctionsEnum;
+@@ -256,13 +259,13 @@
+ 	      else if (strcmp(name,"QmuVariabledescriptors")==0) return QmuVariabledescriptorsEnum;
+ 	      else if (strcmp(name,"QmuMaterialsRheologyB")==0) return QmuMaterialsRheologyBEnum;
+ 	      else if (strcmp(name,"RiftsNumrifts")==0) return RiftsNumriftsEnum;
+-	      else if (strcmp(name,"RiftsRiftstruct")==0) return RiftsRiftstructEnum;
+-	      else if (strcmp(name,"SettingsResultsOnNodes")==0) return SettingsResultsOnNodesEnum;
+-	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
+          else stage=3;
+    }
+    if(stage==3){
+-	      if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
++	      if (strcmp(name,"RiftsRiftstruct")==0) return RiftsRiftstructEnum;
++	      else if (strcmp(name,"SettingsResultsOnNodes")==0) return SettingsResultsOnNodesEnum;
++	      else if (strcmp(name,"SettingsIoGather")==0) return SettingsIoGatherEnum;
++	      else if (strcmp(name,"SettingsLowmem")==0) return SettingsLowmemEnum;
+ 	      else if (strcmp(name,"SettingsOutputFrequency")==0) return SettingsOutputFrequencyEnum;
+ 	      else if (strcmp(name,"SettingsWaitonlock")==0) return SettingsWaitonlockEnum;
+ 	      else if (strcmp(name,"DebugProfiling")==0) return DebugProfilingEnum;
+@@ -379,13 +382,13 @@
+ 	      else if (strcmp(name,"SmoothedSurfaceSlopeXAnalysis")==0) return SmoothedSurfaceSlopeXAnalysisEnum;
+ 	      else if (strcmp(name,"SmoothedSurfaceSlopeYAnalysis")==0) return SmoothedSurfaceSlopeYAnalysisEnum;
+ 	      else if (strcmp(name,"ThermalAnalysis")==0) return ThermalAnalysisEnum;
+-	      else if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
+-	      else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
+-	      else if (strcmp(name,"GiaSolution")==0) return GiaSolutionEnum;
+          else stage=4;
+    }
+    if(stage==4){
+-	      if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
++	      if (strcmp(name,"ThermalSolution")==0) return ThermalSolutionEnum;
++	      else if (strcmp(name,"TransientSolution")==0) return TransientSolutionEnum;
++	      else if (strcmp(name,"GiaSolution")==0) return GiaSolutionEnum;
++	      else if (strcmp(name,"GiaAnalysis")==0) return GiaAnalysisEnum;
+ 	      else if (strcmp(name,"MeshdeformationSolution")==0) return MeshdeformationSolutionEnum;
+ 	      else if (strcmp(name,"MeshdeformationAnalysis")==0) return MeshdeformationAnalysisEnum;
+ 	      else if (strcmp(name,"LevelsetAnalysis")==0) return LevelsetAnalysisEnum;
+@@ -502,13 +505,13 @@
+ 	      else if (strcmp(name,"QmuBase")==0) return QmuBaseEnum;
+ 	      else if (strcmp(name,"QmuSurface")==0) return QmuSurfaceEnum;
+ 	      else if (strcmp(name,"QmuMelting")==0) return QmuMeltingEnum;
+-	      else if (strcmp(name,"QmuVxMesh")==0) return QmuVxMeshEnum;
+-	      else if (strcmp(name,"QmuVyMesh")==0) return QmuVyMeshEnum;
+-	      else if (strcmp(name,"QmuVzMesh")==0) return QmuVzMeshEnum;
+          else stage=5;
+    }
+    if(stage==5){
+-	      if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
++	      if (strcmp(name,"QmuVxMesh")==0) return QmuVxMeshEnum;
++	      else if (strcmp(name,"QmuVyMesh")==0) return QmuVyMeshEnum;
++	      else if (strcmp(name,"QmuVzMesh")==0) return QmuVzMeshEnum;
++	      else if (strcmp(name,"AndroidFrictionCoefficient")==0) return AndroidFrictionCoefficientEnum;
+ 	      else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
+ 	      else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
+ 	      else if (strcmp(name,"SurfaceAbsVelMisfit")==0) return SurfaceAbsVelMisfitEnum;
+@@ -625,13 +628,13 @@
+ 	      else if (strcmp(name,"MaxVel")==0) return MaxVelEnum;
+ 	      else if (strcmp(name,"MinVx")==0) return MinVxEnum;
+ 	      else if (strcmp(name,"MaxVx")==0) return MaxVxEnum;
+-	      else if (strcmp(name,"MaxAbsVx")==0) return MaxAbsVxEnum;
+-	      else if (strcmp(name,"MinVy")==0) return MinVyEnum;
+-	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
+          else stage=6;
+    }
+    if(stage==6){
+-	      if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
++	      if (strcmp(name,"MaxAbsVx")==0) return MaxAbsVxEnum;
++	      else if (strcmp(name,"MinVy")==0) return MinVyEnum;
++	      else if (strcmp(name,"MaxVy")==0) return MaxVyEnum;
++	      else if (strcmp(name,"MaxAbsVy")==0) return MaxAbsVyEnum;
+ 	      else if (strcmp(name,"MinVz")==0) return MinVzEnum;
+ 	      else if (strcmp(name,"MaxVz")==0) return MaxVzEnum;
+ 	      else if (strcmp(name,"MaxAbsVz")==0) return MaxAbsVzEnum;
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 17951)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.h	(revision 17952)
+@@ -20,6 +20,7 @@
+ 
+ 		Element* element;
+ 		int      dim;
++		int      law;
+ 
+ 		/*methods: */
+ 		Friction();
+@@ -28,6 +29,8 @@
+ 
+ 		void  Echo(void);
+ 		void  GetAlpha2(IssmDouble* palpha2,Gauss* gauss);
++		void  GetAlpha2Viscous(IssmDouble* palpha2,Gauss* gauss);
++		void  GetAlpha2Weertman(IssmDouble* palpha2,Gauss* gauss);
+ 		void  GetAlphaComplement(IssmDouble* alpha_complement,Gauss* gauss);
+ };
+ 
+Index: ../trunk-jpl/src/c/classes/Loads/Friction.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17951)
++++ ../trunk-jpl/src/c/classes/Loads/Friction.cpp	(revision 17952)
+@@ -19,6 +19,8 @@
+ Friction::Friction(){
+ 	this->element=NULL;
+ 	this->dim=0;
++	this->law=0;
++
+ }
+ /*}}}*/
+ /*FUNCTION Friction::Friction(Element* element,int dim){{{*/
+@@ -26,6 +28,7 @@
+ 
+ 	this->element=element_in;
+ 	this->dim=dim_in;
++	element_in->FindParam(&this->law,FrictionLawEnum);
+ }
+ /*}}}*/
+ /*FUNCTION Friction::~Friction() {{{*/
+@@ -43,6 +46,21 @@
+ /*FUNCTION Friction::GetAlpha2{{{*/
+ void Friction::GetAlpha2(IssmDouble* palpha2, Gauss* gauss){
+ 
++	switch(this->law){
++		case 1:
++			GetAlpha2Viscous(palpha2,gauss);
++			break;
++		case 2:
++			GetAlpha2Weertman(palpha2,gauss);
++			break;
++		default:
++			_error_("not supported");
++	}
++
++}/*}}}*/
++/*FUNCTION Friction::GetAlpha2{{{*/
++void Friction::GetAlpha2Viscous(IssmDouble* palpha2, Gauss* gauss){
++
+ 	/*This routine calculates the basal friction coefficient 
+ 	  alpha2= drag^2 * Neff ^r * | vel | ^(s-1), with Neff=rho_ice*g*thickness+rho_ice*g*bed, r=q/p and s=1/p**/
+ 
+@@ -101,6 +119,48 @@
+ 	/*Assign output pointers:*/
+ 	*palpha2=alpha2;
+ }/*}}}*/
++/*FUNCTION Friction::GetAlpha2Weertman{{{*/
++void Friction::GetAlpha2Weertman(IssmDouble* palpha2, Gauss* gauss){
++
++	/*This routine calculates the basal friction coefficient alpha2= C^-1/m |v|^(1/m-1) */
++
++	/*diverse: */
++	IssmDouble  C,m;
++	IssmDouble  vx,vy,vz,vmag;
++	IssmDouble  alpha2;
++
++	/*Recover parameters: */
++	element->GetInputValue(&C,gauss,FrictionCEnum);
++	element->GetInputValue(&m,FrictionMEnum);
++
++	switch(dim){
++		case 1:
++			element->GetInputValue(&vx,gauss,VxEnum);
++			vmag=sqrt(vx*vx);
++			break;
++		case 2:
++			element->GetInputValue(&vx,gauss,VxEnum);
++			element->GetInputValue(&vy,gauss,VyEnum);
++			vmag=sqrt(vx*vx+vy*vy);
++			break;
++		case 3:
++			element->GetInputValue(&vx,gauss,VxEnum);
++			element->GetInputValue(&vy,gauss,VyEnum);
++			element->GetInputValue(&vz,gauss,VzEnum);
++			vmag=sqrt(vx*vx+vy*vy+vz*vz);
++			break;
++		default:
++			_error_("not supported");
++	}
++
++	/*Check to prevent dividing by zero if vmag==0*/
++	if(vmag==0. && (1./m-1.)<0.) alpha2=0.;
++	else alpha2=pow(C,-1./m)*pow(vmag,(1./m-1.));
++	_assert_(!xIsNan<IssmDouble>(alpha2));
++
++	/*Assign output pointers:*/
++	*palpha2=alpha2;
++}/*}}}*/
+ /*FUNCTION Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss,int vxenum,int vyenum,int vzenum) {{{*/
+ void Friction::GetAlphaComplement(IssmDouble* palpha_complement, Gauss* gauss){
+ 
+@@ -108,6 +168,8 @@
+ 	 * FrictionGetAlphaComplement is used in control methods on drag, and it computes: 
+ 	 * alpha_complement= Neff ^r * vel ^s*/
+ 
++	if(this->law!=1)_error_("not supported");
++
+ 	/*diverse: */
+ 	IssmDouble  r,s;
+ 	IssmDouble  vx,vy,vz,vmag;
+Index: ../trunk-jpl/src/m/plot/plot_overlay.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17951)
++++ ../trunk-jpl/src/m/plot/plot_overlay.py	(revision 17952)
+@@ -1,10 +1,13 @@
+ import numpy as npy
+ from processmesh import processmesh
+ from processdata import processdata
+-from osgeo import gdal
+ import matplotlib.pyplot as plt
+ import matplotlib as mpl
+ import os
++try:
++	from osgeo import gdal
++except ImportError:
++	print 'osgeo/gdal for python not installed, plot_overlay is disabled'
+ 
+ def plot_overlay(md,data,options,ax):
+ 	'''
+Index: ../trunk-jpl/src/m/classes/frictionweertman.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/frictionweertman.py	(revision 0)
++++ ../trunk-jpl/src/m/classes/frictionweertman.py	(revision 17952)
+@@ -0,0 +1,47 @@
++from fielddisplay import fielddisplay
++from EnumDefinitions import *
++from checkfield import checkfield
++from WriteData import WriteData
++
++class frictionweertman(object):
++	"""
++	FRICTIONWEERTMAN class definition
++
++	   Usage:
++	      frictionweertman=frictionweertman();
++	"""
++
++	def __init__(self): # {{{
++		self.C = float('NaN')
++		self.m = float('NaN')
++
++		#set defaults
++		self.setdefaultparameters()
++
++		#}}}
++	def __repr__(self): # {{{
++		string="Weertman sliding law parameters: Sigma_b = C^2 * |u_b|^(1/m-1) * u_b"
++
++		string="%s\n%s"%(string,fielddisplay(self,"C","friction coefficient [SI]"))
++		string="%s\n%s"%(string,fielddisplay(self,"m","m exponent"))
++		return string
++		#}}}
++	def setdefaultparameters(self): # {{{
++		return self
++	#}}}
++	def checkconsistency(self,md,solution,analyses):    # {{{
++
++		#Early return
++		if StressbalanceAnalysisEnum() not in analyses and ThermalAnalysisEnum() not in analyses:
++			return md
++
++		md = checkfield(md,'fieldname','friction.C','forcing',1,'NaN',1)
++		md = checkfield(md,'fieldname','friction.m','NaN',1,'size',[md.mesh.numberofelements])
++
++		return md
++	# }}}
++	def marshall(self,md,fid):    # {{{
++		WriteData(fid,'enum',FrictionLawEnum(),'data',2,'format','Integer')
++		WriteData(fid,'class','friction','object',self,'fieldname','C','format','DoubleMat','mattype',1)
++		WriteData(fid,'class','friction','object',self,'fieldname','m','format','DoubleMat','mattype',2)
++	# }}}
+Index: ../trunk-jpl/src/m/classes/friction.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.py	(revision 17951)
++++ ../trunk-jpl/src/m/classes/friction.py	(revision 17952)
+@@ -44,6 +44,7 @@
+ 		return md
+ 	# }}}
+ 	def marshall(self,md,fid):    # {{{
++		WriteData(fid,'enum',FrictionLawEnum(),'data',1,'format','Integer')
+ 		WriteData(fid,'object',self,'fieldname','coefficient','format','DoubleMat','mattype',1)
+ 		WriteData(fid,'object',self,'fieldname','p','format','DoubleMat','mattype',2)
+ 		WriteData(fid,'object',self,'fieldname','q','format','DoubleMat','mattype',2)
+Index: ../trunk-jpl/src/m/classes/friction.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/friction.m	(revision 17951)
++++ ../trunk-jpl/src/m/classes/friction.m	(revision 17952)
+@@ -47,6 +47,7 @@
+ 		function marshall(obj,md,fid) % {{{
+ 			yts=365.0*24.0*3600.0;
+ 
++			WriteData(fid,'enum',FrictionLawEnum,'data',1,'format','Integer');
+ 			WriteData(fid,'object',obj,'fieldname','coefficient','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
+ 			%WriteData(fid,'object',obj,'fieldname','coefficient','format','DoubleMat','mattype',1);
+ 			WriteData(fid,'object',obj,'fieldname','p','format','DoubleMat','mattype',2);
+Index: ../trunk-jpl/src/m/classes/frictionweertman.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/frictionweertman.m	(revision 0)
++++ ../trunk-jpl/src/m/classes/frictionweertman.m	(revision 17952)
+@@ -0,0 +1,54 @@
++%FRICTIONWEERTMAN class definition
++%
++%   Usage:
++%      frictionweertman=frictionweertman();
++
++classdef frictionweertman
++	properties (SetAccess=public) 
++		C = NaN;
++		m = NaN;
++	end
++	methods
++        function createxml(obj,fid) % {{{
++            fprintf(fid, '\n\n');
++            fprintf(fid, '%s\n', '<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->');
++            fprintf(fid,'%s\n%s\n%s\n','<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">','<section name="frictionweertman" />');   
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="coefficient" type="',   	class(obj.coefficient),'" default="',     	convert2str(obj.coefficient),'">',              '     <section name="frictionweertman" />','     <help> frictionweertman coefficient [SI] </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n%s\n',    '<parameter key ="p" type="',               class(obj.p),'" default="',                 convert2str(obj.p),'">',   '     <section name="frictionweertman" />','     <help> p exponent </help>','</parameter>');
++            fprintf(fid,'%s%s%s%s%s\n%s\n%s\n',        '<parameter key ="q" type="',               class(obj.q),'" default="',                 convert2str(obj.q),'">',            '     <section name="frictionweertman" />','     <help> q exponent </help>','</parameter>');
++            fprintf(fid,'%s\n%s\n','</frame>');
++        end % }}}
++		function obj = frictionweertman(varargin) % {{{
++			switch nargin
++				case 0
++					obj=setdefaultparameters(obj);
++				otherwise
++					error('constructor not supported');
++			end
++		end % }}}
++		function obj = setdefaultparameters(obj) % {{{
++
++		end % }}}
++		function md = checkconsistency(obj,md,solution,analyses) % {{{
++
++			%Early return
++			if ~ismember(StressbalanceAnalysisEnum(),analyses) & ~ismember(ThermalAnalysisEnum(),analyses), return; end
++			md = checkfield(md,'fieldname','frictionweertman.C','forcing',1,'NaN',1);
++			md = checkfield(md,'fieldname','frictionweertman.m','NaN',1,'size',[md.mesh.numberofelements 1]);
++		end % }}}
++		function disp(obj) % {{{
++			disp(sprintf('Weertman sliding law parameters: Sigma_b = C^2 * |u_b|^(1/m-1) * u_b'));
++			fielddisplay(obj,'coefficient','friction coefficient [SI]');
++			fielddisplay(obj,'m','m exponent');
++		end % }}}
++		function marshall(obj,md,fid) % {{{
++			yts=365.0*24.0*3600.0;
++
++			WriteData(fid,'enum',FrictionLawEnum,'data',1,'format','Integer');
++			WriteData(fid,'class','friction','object',obj,'fieldname','C','format','DoubleMat','mattype',1,'forcinglength',md.mesh.numberofvertices+1);
++			WriteData(fid,'class','friction','object',obj,'fieldname','m','format','DoubleMat','mattype',2);
++			
++
++		end % }}}
++	end
++end
+Index: ../trunk-jpl/src/m/enum/FrictionMEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/FrictionMEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/FrictionMEnum.m	(revision 17952)
+@@ -0,0 +1,11 @@
++function macro=FrictionMEnum()
++%FRICTIONMENUM - Enum of FrictionM
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=FrictionMEnum()
++
++macro=StringToEnum('FrictionM');
+Index: ../trunk-jpl/src/m/enum/FrictionCEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/FrictionCEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/FrictionCEnum.m	(revision 17952)
+@@ -0,0 +1,11 @@
++function macro=FrictionCEnum()
++%FRICTIONCENUM - Enum of FrictionC
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=FrictionCEnum()
++
++macro=StringToEnum('FrictionC');
+Index: ../trunk-jpl/src/m/enum/FrictionLawEnum.m
+===================================================================
+--- ../trunk-jpl/src/m/enum/FrictionLawEnum.m	(revision 0)
++++ ../trunk-jpl/src/m/enum/FrictionLawEnum.m	(revision 17952)
+@@ -0,0 +1,11 @@
++function macro=FrictionLawEnum()
++%FRICTIONLAWENUM - Enum of FrictionLaw
++%
++%   WARNING: DO NOT MODIFY THIS FILE
++%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
++%            Please read src/c/shared/Enum/README for more information
++%
++%   Usage:
++%      macro=FrictionLawEnum()
++
++macro=StringToEnum('FrictionLaw');
+Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
+===================================================================
+--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17951)
++++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 17952)
+@@ -83,6 +83,9 @@
+ def FrictionCoefficientEnum(): return StringToEnum("FrictionCoefficient")[0]
+ def FrictionPEnum(): return StringToEnum("FrictionP")[0]
+ def FrictionQEnum(): return StringToEnum("FrictionQ")[0]
++def FrictionMEnum(): return StringToEnum("FrictionM")[0]
++def FrictionCEnum(): return StringToEnum("FrictionC")[0]
++def FrictionLawEnum(): return StringToEnum("FrictionLaw")[0]
+ def GeometryHydrostaticRatioEnum(): return StringToEnum("GeometryHydrostaticRatio")[0]
+ def HydrologyModelEnum(): return StringToEnum("HydrologyModel")[0]
+ def HydrologyshreveEnum(): return StringToEnum("Hydrologyshreve")[0]
Index: /issm/oecreview/Archive/17802-17983/ISSM-17952-17953.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17952-17953.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17952-17953.diff	(revision 17986)
@@ -0,0 +1,39 @@
+Index: ../trunk-jpl/src/m/plot/processdata.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/processdata.py	(revision 17952)
++++ ../trunk-jpl/src/m/plot/processdata.py	(revision 17953)
+@@ -44,10 +44,16 @@
+ 	#process NaN's if any
+ 	nanfill=options.getfieldvalue('nan',-9999)
+ 	if npy.any(npy.isnan(procdata)):
++		lb=npy.min(data[~npy.isnan(data)])
++		ub=npy.max(data[~npy.isnan(data)])
++		if lb==ub:
++			lb=lb-0.5
++			ub=ub+0.5
++			nanfill=lb-1
+ 		procdata[npy.isnan(procdata)]=nanfill
++		options.addfielddefault('clim',[lb,ub])
+ 		options.addfielddefault('cmap_set_under','1')
+-		options.addfielddefault('clim',[npy.min(data[~npy.isnan(data)]),npy.max(data[~npy.isnan(data)])])
+-		print "WARNING: nan's treated as -9999 by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
++		print "WARNING: nan's treated as", nanfill, "by default.  Change using pairoption 'nan',nan_fill_value in plotmodel call"
+ 
+ 	#non-patch processing 
+ 
+Index: ../trunk-jpl/src/m/plot/plot_unit.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17952)
++++ ../trunk-jpl/src/m/plot/plot_unit.py	(revision 17953)
+@@ -41,7 +41,10 @@
+ 	elif options.exist('caxis'):
+ 	   lims=options.getfieldvalue('caxis',[min(data),max(data)])
+ 	else:
+-	   lims=[min(data),max(data)]
++		if min(data)==max(data):
++			lims=[min(data)-0.5,max(data)+0.5]
++		else:
++			lims=[min(data),max(data)]
+ 	norm = mpl.colors.Normalize(vmin=lims[0], vmax=lims[1])
+ 	if datatype==1:
+ 	   #element plot
Index: /issm/oecreview/Archive/17802-17983/ISSM-17953-17954.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17953-17954.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17953-17954.diff	(revision 17986)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/src/m/plot/plot_manager.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17953)
++++ ../trunk-jpl/src/m/plot/plot_manager.py	(revision 17954)
+@@ -10,8 +10,17 @@
+ from processdata import processdata
+ from plot_unit import plot_unit
+ from applyoptions import applyoptions
+-from plot_overlay import plot_overlay
+ 
++try:
++	from osgeo import gdal
++	overlaysupport=True
++except ImportError:
++	print 'osgeo/gdal for python not installed, overlay plots are not enabled'
++	overlaysupport=False
++
++if overlaysupport:
++	from plot_overlay import plot_overlay
++
+ def plot_manager(md,options,fig,ax):
+ 	'''
+ 	PLOT_MANAGER - distribute the plots called by plotmodel
+@@ -44,7 +53,7 @@
+ 	#	plot_basemap(md,data,options,nrows,ncols,i)
+ 
+ 	#overlay plot
+-	if options.exist('overlay'):
++	if options.exist('overlay') and overlaysupport:
+ 		plot_overlay(md,data,options,ax)
+ 		options.addfielddefault('alpha',0.5)
+ 		options.addfielddefault('xlim',[min(md.mesh.x),max(md.mesh.x)])
Index: /issm/oecreview/Archive/17802-17983/ISSM-17954-17955.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17954-17955.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17954-17955.diff	(revision 17986)
@@ -0,0 +1,9 @@
+Index: ../trunk-jpl/src/m/plot/plot_mesh.py
+===================================================================
+--- ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 17954)
++++ ../trunk-jpl/src/m/plot/plot_mesh.py	(revision 17955)
+@@ -26,3 +26,4 @@
+ 	#apply options
+ 	options.addfielddefault('title','Mesh')
+ 	options.addfielddefault('colorbar','off')
++	options.addfielddefault('ticklabels','on')
Index: /issm/oecreview/Archive/17802-17983/ISSM-17955-17956.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17955-17956.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17955-17956.diff	(revision 17986)
@@ -0,0 +1,37 @@
+Index: ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17955)
++++ ../trunk-jpl/src/c/analyses/MeltingAnalysis.cpp	(revision 17956)
+@@ -28,6 +28,8 @@
+ 		}
+ 	}
+ 
++	iomodel->Constant(&frictionlaw,FrictionLawEnum);
++
+ 	/*Create inputs: */
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+Index: ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17955)
++++ ../trunk-jpl/src/c/analyses/ThermalAnalysis.cpp	(revision 17956)
+@@ -49,6 +49,7 @@
+ 	bool dakota_analysis, islevelset;
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
+ 	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
++	iomodel->Constant(&frictionlaw,FrictionLawEnum);
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17955)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17956)
+@@ -50,6 +50,7 @@
+ 
+ 	iomodel->Constant(&dakota_analysis,QmuIsdakotaEnum);
+ 	iomodel->Constant(&islevelset,TransientIslevelsetEnum);
++	iomodel->Constant(&frictionlaw,FrictionLawEnum);
+ 
+ 	iomodel->FetchDataToInput(elements,ThicknessEnum);
+ 	iomodel->FetchDataToInput(elements,SurfaceEnum);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17956-17957.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17956-17957.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17956-17957.diff	(revision 17986)
@@ -0,0 +1,32 @@
+Index: ../trunk-jpl/test/Archives/Archive703.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17956)
++++ ../trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp	(revision 17957)
+@@ -210,7 +210,6 @@
+ 	iomodel->FetchDataToInput(elements,MaskGroundediceLevelsetEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum);
+ 	iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum);
+-	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 	iomodel->FetchDataToInput(elements,VxEnum,0.);
+ 	if(dakota_analysis)elements->InputDuplicate(VxEnum,QmuVxEnum);
+ 	iomodel->FetchDataToInput(elements,VyEnum,0.);
+@@ -224,7 +223,6 @@
+ 		iomodel->FetchDataToInput(elements,MeshVertexonsurfaceEnum);
+ 	}
+ 	if(iomodel->domaintype==Domain3DEnum){
+-		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+ 		iomodel->FetchDataToInput(elements,FlowequationBorderFSEnum);
+ 		iomodel->FetchDataToInput(elements,LoadingforceZEnum);
+ 		iomodel->FetchDataToInput(elements,VzEnum,0.);
+@@ -232,6 +230,7 @@
+ 	}
+ 	if(isFS){
+ 		iomodel->FetchDataToInput(elements,PressureEnum,0.);
++		iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum,0.);
+ 		if(dakota_analysis)elements->InputDuplicate(PressureEnum,QmuPressureEnum);
+ 	}
+ 	if(islevelset){
Index: /issm/oecreview/Archive/17802-17983/ISSM-17957-17958.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17957-17958.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17957-17958.diff	(revision 17986)
@@ -0,0 +1,19 @@
+Index: ../trunk-jpl/src/m/interp/SectionValues.py
+===================================================================
+--- ../trunk-jpl/src/m/interp/SectionValues.py	(revision 17957)
++++ ../trunk-jpl/src/m/interp/SectionValues.py	(revision 17958)
+@@ -79,7 +79,7 @@
+ 	Z=npy.zeros(numberofnodes)
+ 	
+ 	#New mesh and Data interpolation
+-	if md.mesh.domaintype().lower() == '2d':
++	if '2d' in md.mesh.domaintype().lower():
+ 	
+ 		#Interpolation of data on specified points
+ 		#data_interp=InterpFromMesh2d(md.mesh.elements,md.mesh.x,md.mesh.y,data,X,Y)[0]
+@@ -136,4 +136,4 @@
+ 
+ 		index=index3
+ 
+-		return index,X,Y,Z,S,data_interp
++	return index,X,Y,Z,S,data_interp
Index: /issm/oecreview/Archive/17802-17983/ISSM-17958-17959.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17958-17959.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17958-17959.diff	(revision 17986)
@@ -0,0 +1,44 @@
+Index: ../trunk-jpl/src/m/classes/model.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.py	(revision 17958)
++++ ../trunk-jpl/src/m/classes/model.py	(revision 17959)
+@@ -790,8 +790,6 @@
+ 		md.geometry.thickness=project2d(md,md.geometry.thickness,1)
+ 		md.geometry.base=project2d(md,md.geometry.base,1)
+ 		md.geometry.bed=project2d(md,md.geometry.bed,1)
+-		md.mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1)
+-		md.mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1)
+ 		md.mask.groundedice_levelset=project2d(md,md.mask.groundedice_levelset,1)
+ 		md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1)
+ 
+@@ -806,6 +804,8 @@
+ 		mesh.numberofvertices=md.mesh.numberofvertices2d
+ 		mesh.numberofelements=md.mesh.numberofelements2d
+ 		mesh.elements=md.mesh.elements2d
++		mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1)
++		mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1)
+ 		md.mesh=mesh
+ 
+ 		return md
+Index: ../trunk-jpl/src/m/classes/model.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/model.m	(revision 17958)
++++ ../trunk-jpl/src/m/classes/model.m	(revision 17959)
+@@ -235,8 +235,6 @@
+ 			md.geometry.thickness=project2d(md,md.geometry.thickness,1);
+ 			md.geometry.base=project2d(md,md.geometry.base,1);
+ 			md.geometry.bed=project2d(md,md.geometry.bed,1);
+-			md.mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1);
+-			md.mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1);
+ 			md.mask.groundedice_levelset=project2d(md,md.mask.groundedice_levelset,1);
+ 			md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1);
+ 
+@@ -251,6 +249,8 @@
+ 			mesh.numberofvertices=md.mesh.numberofvertices2d;
+ 			mesh.numberofelements=md.mesh.numberofelements2d;
+ 			mesh.elements=md.mesh.elements2d;
++			mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1);
++			mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1);
+ 			md.mesh=mesh;
+ 
+ 		end % }}}
Index: /issm/oecreview/Archive/17802-17983/ISSM-17959-17960.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17959-17960.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17959-17960.diff	(revision 17986)
@@ -0,0 +1,51 @@
+Index: ../trunk-jpl/externalpackages/petsc/install-3.4-hpc.sh
+===================================================================
+--- ../trunk-jpl/externalpackages/petsc/install-3.4-hpc.sh	(revision 0)
++++ ../trunk-jpl/externalpackages/petsc/install-3.4-hpc.sh	(revision 17960)
+@@ -0,0 +1,39 @@
++#!/bin/bash
++set -eu
++
++#Some cleanup
++rm -rf install petsc-3.4.3 src
++mkdir install src
++
++#Download from ISSM server
++$ISSM_DIR/scripts/DownloadExternalPackage.py 'http://issm.jpl.nasa.gov/files/externalpackages/petsc-lite-3.4.3.tar.gz' 'petsc-3.4.3.tar.gz'
++
++#Untar and move petsc to install directory
++tar -zxvf  petsc-3.4.3.tar.gz
++mv petsc-3.4.3/* src/
++rm -rf petsc-3.4.3
++
++#configure
++cd src
++./config/configure.py \
++ --prefix="$ISSM_DIR/externalpackages/petsc/install" \
++ --PETSC_DIR="$ISSM_DIR/externalpackages/petsc/src" \
++ --with-debugging=0 \
++ --with-shared-libraries=1 \
++ --known-mpi-shared-libraries=1 \
++ --with-mpi=1 \
++ --with-mpi-dir=/data/apps/mpi/openmpi-1.6.0/gcc-4.7.2// \
++ --download-scalapack=yes \
++ --download-blacs=yes \
++ --download-blas=yes \
++ --download-f-blas-lapack=yes \
++ --download-mumps=yes \
++ --download-metis=yes \
++ --download-parmetis=yes \
++ --COPTFLAGS="-O3" \
++ --FOPTFLAGS="-O3" \
++ --CXXOPTFLAGS="-O3"
++
++#Compile petsc and install it
++make
++make install
+
+Property changes on: ../trunk-jpl/externalpackages/petsc/install-3.4-hpc.sh
+___________________________________________________________________
+Added: svn:executable
+## -0,0 +1 ##
++*
+\ No newline at end of property
Index: /issm/oecreview/Archive/17802-17983/ISSM-17960-17961.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17960-17961.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17960-17961.diff	(revision 17986)
@@ -0,0 +1,63 @@
+Index: ../trunk-jpl/src/m/materials/DepthAvgTempCond.py
+===================================================================
+--- ../trunk-jpl/src/m/materials/DepthAvgTempCond.py	(revision 0)
++++ ../trunk-jpl/src/m/materials/DepthAvgTempCond.py	(revision 17961)
+@@ -0,0 +1,28 @@
++def Tbar=DepthAvgTempCond(md)
++   ''' compute conduction dependent temperature profile for an ice sheet. 
++
++   Usage:
++   Tbar=DepthAvgTempCond(md)
++   '''
++
++	Tpmp=TMeltingPoint(md.materials.meltingpoint,0); #pressure melting point at 0 pressure.
++	k=md.materials.thermalconductivity
++	G=md.basalforcings.geothermalflux 
++	H=md.geometry.thickness
++	Ts=md.initialization.temperature
++	alpha=G*H/k
++
++	Tbar=npy.zeros(md.mesh.numberofvertices,)
++
++	#find temperature average when we are below melting point: 
++	pos=numpy.nonzero( (Ts+alpha) < Tpmp)
++	Tbar[pos]=Ts[pos]+alpha[pos]/2
++
++	pos=numpy.nonzero( (Ts+alpha) >=Tpmp)
++	Tbar[pos]=Tpmp+(Tpmp**2-Ts[pos]**2)/2./alpha[pos]+ Tpmp*(Ts[pos]-Tpmp)./alpha[pos]
++
++	#on ice shelf, easier: 
++	pos=numpy.nonzero(md.mask.groundedice_levelset<=0)
++	Tbar[pos]=(Ts[pos]+Tpmp)/2;
++
++	return Tbar
+Index: ../trunk-jpl/src/m/materials/DepthAvgTempCond.m
+===================================================================
+--- ../trunk-jpl/src/m/materials/DepthAvgTempCond.m	(revision 0)
++++ ../trunk-jpl/src/m/materials/DepthAvgTempCond.m	(revision 17961)
+@@ -0,0 +1,25 @@
++function Tbar=DepthAvgTempCond(md)
++%DEPTHAVGTEMPCOND- compute conduction dependent temperature profile for an ice sheet. 
++%
++%   Usage:
++%   Tbar=DepthAvgTempCond(md)
++
++Tpmp=TMeltingPoint(md.materials.meltingpoint,0); %pressure melting point at 0 pressure.
++k=md.materials.thermalconductivity;
++G=md.basalforcings.geothermalflux; 
++H=md.geometry.thickness;
++Ts=md.initialization.temperature;
++alpha=G.*H/k;
++
++Tbar=zeros(md.mesh.numberofvertices,1);
++
++%find temperature average when we are below melting point: 
++pos=find( (Ts+alpha) <Tpmp);
++Tbar(pos)=Ts(pos)+alpha(pos)/2;
++
++pos=find( (Ts+alpha) >=Tpmp);
++Tbar(pos)=Tpmp+(Tpmp^2-Ts(pos).^2)/2./alpha(pos)+ Tpmp*(Ts(pos)-Tpmp)./alpha(pos);
++
++%on ice shelf, easier: 
++pos=find(md.mask.groundedice_levelset<=0);
++Tbar(pos)=(Ts(pos)+Tpmp)/2;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17961-17962.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17961-17962.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17961-17962.diff	(revision 17986)
@@ -0,0 +1,3727 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17962)
+@@ -23,8 +23,7 @@
+ #define NUMVERTICES1D 2
+ 
+ /*Constructors/destructor/copy*/
+-/*FUNCTION Tria::Tria(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+-Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels)
++Tria::Tria(int tria_id, int tria_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/
+ 	:TriaRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+ 		/*id: */
+@@ -44,13 +43,11 @@
+ 		this->matpar   = NULL;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::~Tria(){{{*/
+-Tria::~Tria(){
++Tria::~Tria(){/*{{{*/
+ 	this->parameters=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::copy {{{*/
+-Object* Tria::copy() {
++Object* Tria::copy() {/*{{{*/
+ 
+ 	int i;
+ 	Tria* tria=NULL;
+@@ -94,8 +91,7 @@
+ /*}}}*/
+ 
+ /*Other*/
+-/*FUNCTION Tria::AddBasalInput{{{*/
+-void  Tria::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
++void       Tria::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
+ 
+ 	/*Call inputs method*/
+ 	_assert_(this->inputs);
+@@ -127,27 +123,23 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::AddInput{{{*/
+-void  Tria::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
++void       Tria::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
+ 
+ 	/*Call inputs method*/
+ 	_assert_(this->inputs);
+ 	this->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::CharacteristicLength{{{*/
+-IssmDouble Tria::CharacteristicLength(void){
++IssmDouble Tria::CharacteristicLength(void){/*{{{*/
+ 
+ 	return sqrt(2*this->GetArea());
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ComputeBasalStress {{{*/
+-void  Tria::ComputeBasalStress(Vector<IssmDouble>* eps){
++void       Tria::ComputeBasalStress(Vector<IssmDouble>* eps){/*{{{*/
+ 	_error_("Not Implemented yet");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ComputeSigmaNN {{{*/
+-void  Tria::ComputeSigmaNN(){
++void       Tria::ComputeSigmaNN(){/*{{{*/
+ 
+ 	if(!IsOnBase()){
+ 		IssmDouble sigma_nn=0;
+@@ -204,8 +196,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ComputeStrainRate {{{*/
+-void  Tria::ComputeStrainRate(){
++void       Tria::ComputeStrainRate(){/*{{{*/
+ 
+ 	IssmDouble      xyz_list[NUMVERTICES][3];
+ 	IssmDouble      epsilon[6]; /* epsilon=[exx,eyy,exy];*/
+@@ -250,8 +241,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ComputeStressTensor {{{*/
+-void  Tria::ComputeStressTensor(){
++void       Tria::ComputeStressTensor(){/*{{{*/
+ 
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  pressure,viscosity;
+@@ -303,8 +293,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ComputeDeviatoricStressTensor {{{*/
+-void  Tria::ComputeDeviatoricStressTensor(){
++void       Tria::ComputeDeviatoricStressTensor(){/*{{{*/
+ 
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+ 	IssmDouble  viscosity;
+@@ -354,8 +343,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::Configure {{{*/
+-void  Tria::Configure(Elements* elementsin, Loads* loadsin,Nodes* nodesin,Vertices *verticesin,Materials* materialsin, Parameters* parametersin){
++void       Tria::Configure(Elements* elementsin, Loads* loadsin,Nodes* nodesin,Vertices *verticesin,Materials* materialsin, Parameters* parametersin){/*{{{*/
+ 
+ 	/*go into parameters and get the analysis_counter: */
+ 	int analysis_counter;
+@@ -386,8 +374,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::Delta18oParameterization{{{*/
+-void  Tria::Delta18oParameterization(void){
++void       Tria::Delta18oParameterization(void){/*{{{*/
+ 
+ 	int        i;
+ 	IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
+@@ -457,8 +444,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ElementSizes{{{*/
+-void Tria::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
++void       Tria::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){/*{{{*/
+ 
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble xmin,ymin;
+@@ -481,20 +467,17 @@
+ 	*hz=0.;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::FiniteElement{{{*/
+-int Tria::FiniteElement(void){
++int        Tria::FiniteElement(void){/*{{{*/
+ 	return this->element_type;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ObjectEnum{{{*/
+-int Tria::ObjectEnum(void){
++int        Tria::ObjectEnum(void){/*{{{*/
+ 
+ 	return TriaEnum;
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetArea {{{*/
+-IssmDouble Tria::GetArea(void){
++IssmDouble Tria::GetArea(void){/*{{{*/
+ 
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble x1,y1,x2,y2,x3,y3;
+@@ -509,8 +492,7 @@
+ 	return (x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetAreaCoordinates{{{*/
+-void Tria::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){
++void       Tria::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){/*{{{*/
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	int         i,j,k;
+@@ -545,16 +527,14 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetElementType {{{*/
+-int Tria::GetElementType(){
++int        Tria::GetElementType(){/*{{{*/
+ 
+ 	/*return TriaRef field*/
+ 	return this->element_type;
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetGroundedPart{{{*/
+-void Tria::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){
++void       Tria::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){/*{{{*/
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	bool               floating=true;
+@@ -607,8 +587,7 @@
+ 	*mainlyfloating=floating;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetGroundedPortion{{{*/
+-IssmDouble Tria::GetGroundedPortion(IssmDouble* xyz_list){
++IssmDouble Tria::GetGroundedPortion(IssmDouble* xyz_list){/*{{{*/
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	bool              mainlyfloating = true;
+@@ -726,8 +705,7 @@
+ 	return phi;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
+-void Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
++void       Tria::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	int        indices[2];
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+@@ -744,8 +722,7 @@
+ 	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){{{*/
+-void Tria::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){
++void       Tria::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	int        indices[2];
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+@@ -762,8 +739,7 @@
+ 	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::NormalSection{{{*/
+-void Tria::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
++void       Tria::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble vector[2];
+@@ -778,8 +754,7 @@
+ 	normal[1]= - vector[0]/norm;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ZeroLevelsetCoordinates{{{*/
+-void Tria::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
++void       Tria::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
+ 
+ 	int         normal_orientation=0;
+ 	IssmDouble  s1,s2;
+@@ -873,7 +848,7 @@
+ 	*pxyz_zero= xyz_zero;
+ }
+ /*}}}*/
+-void  Tria::GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
++void       Tria::GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
+ 	
+ 	/* Intermediaries */
+ 	int i, dir,nrfrontnodes;
+@@ -913,8 +888,7 @@
+ 
+ 	xDelete<int>(indicesfront);
+ }/*}}}*/
+-/*FUNCTION Tria::GetNodeIndex {{{*/
+-int Tria::GetNodeIndex(Node* node){
++int        Tria::GetNodeIndex(Node* node){/*{{{*/
+ 
+ 	_assert_(nodes);
+ 	for(int i=0;i<NUMVERTICES;i++){
+@@ -924,18 +898,15 @@
+ 	_error_("Node provided not found among element nodes");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetNumberOfNodes;{{{*/
+-int Tria::GetNumberOfNodes(void){
++int        Tria::GetNumberOfNodes(void){/*{{{*/
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetNumberOfVertices;{{{*/
+-int Tria::GetNumberOfVertices(void){
++int        Tria::GetNumberOfVertices(void){/*{{{*/
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+-void Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
++void       Tria::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(enumtype);
+ 	if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
+@@ -947,14 +918,13 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-Node* Tria::GetNode(int node_number){/*{{{*/
++Node*      Tria::GetNode(int node_number){/*{{{*/
+ 	_assert_(node_number>=0); 
+ 	_assert_(node_number<this->NumberofNodes()); 
+ 	return this->nodes[node_number];
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::InputDepthAverageAtBase {{{*/
+-void  Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type){
++void       Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type){/*{{{*/
+ 
+ 	/*New input*/
+ 	Input* oldinput=NULL;
+@@ -972,8 +942,7 @@
+ 	this->inputs->AddInput((Input*)newinput);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputScale{{{*/
+-void  Tria::InputScale(int enum_type,IssmDouble scale_factor){
++void       Tria::InputScale(int enum_type,IssmDouble scale_factor){/*{{{*/
+ 
+ 	Input* input=NULL;
+ 
+@@ -985,8 +954,7 @@
+ 	input->Scale(scale_factor);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromIoModel{{{*/
+-void Tria::InputUpdateFromIoModel(int index, IoModel* iomodel){ //i is the element index
++void       Tria::InputUpdateFromIoModel(int index, IoModel* iomodel){ //i is the element index/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i,j;
+@@ -1083,8 +1051,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromSolutionOneDof{{{*/
+-void  Tria::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
++void       Tria::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){/*{{{*/
+ 
+ 	/*Intermediary*/
+ 	int* doflist = NULL;
+@@ -1110,8 +1077,7 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type);{{{*/
+-void  Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type){
++void       Tria::InputUpdateFromVector(IssmDouble* vector, int name, int type){/*{{{*/
+ 
+ 	/*Check that name is an element input*/
+ 	if (!IsInput(name)) return;
+@@ -1176,8 +1142,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsOnBase {{{*/
+-bool Tria::IsOnBase(){
++bool       Tria::IsOnBase(){/*{{{*/
+ 
+ 	int domaintype;
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+@@ -1190,8 +1155,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsOnSurface {{{*/
+-bool Tria::IsOnSurface(){
++bool       Tria::IsOnSurface(){/*{{{*/
+ 
+ 	int domaintype;
+ 	this->parameters->FindParam(&domaintype,DomainTypeEnum);
+@@ -1204,40 +1168,35 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::JacobianDeterminant{{{*/
+-void Tria::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++void       Tria::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::JacobianDeterminantBase{{{*/
+-void Tria::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++void       Tria::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetSegmentJacobianDeterminant(pJdet,xyz_list_base,(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::JacobianDeterminantSurface{{{*/
+-void Tria::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++void       Tria::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetSegmentJacobianDeterminant(pJdet,xyz_list,(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::JacobianDeterminantTop{{{*/
+-void Tria::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_top,Gauss* gauss){
++void       Tria::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_top,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetSegmentJacobianDeterminant(pJdet,xyz_list_top,(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::HasEdgeOnBase {{{*/
+-bool Tria::HasEdgeOnBase(){
++bool       Tria::HasEdgeOnBase(){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -1258,8 +1217,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::HasEdgeOnSurface {{{*/
+-bool Tria::HasEdgeOnSurface(){
++bool       Tria::HasEdgeOnSurface(){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -1280,8 +1238,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::EdgeOnBaseIndices{{{*/
+-void Tria::EdgeOnBaseIndices(int* pindex1,int* pindex2){
++void       Tria::EdgeOnBaseIndices(int* pindex1,int* pindex2){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+@@ -1301,8 +1258,7 @@
+ 	_error_("Could not find 2 vertices on bed");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::EdgeOnSurfaceIndices{{{*/
+-void Tria::EdgeOnSurfaceIndices(int* pindex1,int* pindex2){
++void       Tria::EdgeOnSurfaceIndices(int* pindex1,int* pindex2){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+@@ -1322,8 +1278,7 @@
+ 	_error_("Could not find 2 vertices on surface");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::EdgeOnBaseIndex{{{*/
+-int Tria::EdgeOnBaseIndex(void){
++int        Tria::EdgeOnBaseIndex(void){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+@@ -1341,8 +1296,7 @@
+ 	_error_("Could not find 2 vertices on bed");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::EdgeOnSurfaceIndex{{{*/
+-int Tria::EdgeOnSurfaceIndex(void){
++int        Tria::EdgeOnSurfaceIndex(void){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[3][2] = {{1,2},{2,0},{0,1}};
+@@ -1360,8 +1314,7 @@
+ 	_error_("Could not find 2 vertices on surface");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::FSContactMigration{{{*/
+-void Tria::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){
++void       Tria::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){/*{{{*/
+ 
+ 	if(!IsOnBase()) return;
+ 
+@@ -1440,8 +1393,7 @@
+ 	xDelete<IssmDouble>(xyz_list_base);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsNodeOnShelfFromFlags {{{*/
+-bool   Tria::IsNodeOnShelfFromFlags(IssmDouble* flags){
++bool       Tria::IsNodeOnShelfFromFlags(IssmDouble* flags){/*{{{*/
+ 
+ 	int  i;
+ 	bool shelf=false;
+@@ -1455,104 +1407,90 @@
+ 	return shelf;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGauss(){{{*/
+-Gauss* Tria::NewGauss(void){
++Gauss*     Tria::NewGauss(void){/*{{{*/
+ 	return new GaussTria();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGauss(int order){{{*/
+-Gauss* Tria::NewGauss(int order){
++Gauss*     Tria::NewGauss(int order){/*{{{*/
+ 	return new GaussTria(order);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){{{*/
+-Gauss* Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){
++Gauss*     Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){/*{{{*/
+ 
+ 	IssmDouble  area_coordinates[2][3];
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+ 	return new GaussTria(area_coordinates,order);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating){{{*/
+-Gauss* Tria::NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){
++Gauss*     Tria::NewGauss(int point1,IssmDouble fraction1,IssmDouble fraction2,bool mainlyfloating,int order){/*{{{*/
+ 
+ 	return new GaussTria(point1,fraction1,fraction2,mainlyfloating,order);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
+-Gauss* Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
++Gauss*     Tria::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){/*{{{*/
+ 
+ 	IssmDouble  area_coordinates[2][3];
+ 	GetAreaCoordinates(&area_coordinates[0][0],xyz_list_front,xyz_list,2);
+ 	return new GaussTria(area_coordinates,order_vert);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGaussBase(int order){{{*/
+-Gauss* Tria::NewGaussBase(int order){
++Gauss*     Tria::NewGaussBase(int order){/*{{{*/
+ 
+ 	int indices[2];
+ 	this->EdgeOnBaseIndices(&indices[0],&indices[1]);
+ 	return new GaussTria(indices[0],indices[1],order);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NewGaussTop(int order){{{*/
+-Gauss* Tria::NewGaussTop(int order){
++Gauss*     Tria::NewGaussTop(int order){/*{{{*/
+ 
+ 	int indices[2];
+ 	this->EdgeOnSurfaceIndices(&indices[0],&indices[1]);
+ 	return new GaussTria(indices[0],indices[1],order);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NodalFunctions{{{*/
+-void Tria::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++void       Tria::NodalFunctions(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetNodalFunctions(basis,(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NodalFunctionsDerivatives{{{*/
+-void Tria::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void       Tria::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NodalFunctionsDerivativesVelocity{{{*/
+-void Tria::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void       Tria::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTria*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NodalFunctionsVelocity{{{*/
+-void Tria::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
++void       Tria::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetNodalFunctions(basis,(GaussTria*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NodalFunctionsPressure{{{*/
+-void Tria::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
++void       Tria::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetNodalFunctions(basis,(GaussTria*)gauss,this->PressureInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NodalFunctionsTensor{{{*/
+-void Tria::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
++void       Tria::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTriaEnum);
+ 	this->GetNodalFunctions(basis,(GaussTria*)gauss,this->TensorInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NodalValue {{{*/
+-int    Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){
++int        Tria::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){/*{{{*/
+ 
+ 	int         found = 0;
+ 	IssmDouble  value;
+@@ -1584,8 +1522,7 @@
+ 	return found;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NormalBase {{{*/
+-void Tria::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
++void       Tria::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble vector[2];
+@@ -1601,8 +1538,7 @@
+ 	_assert_(bed_normal[1]<0); 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NormalTop {{{*/
+-void Tria::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){
++void       Tria::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	/*Build unit outward pointing vector*/
+ 	int index1,index2;
+@@ -1620,33 +1556,27 @@
+ 	_assert_(top_normal[1]>0); 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::VelocityInterpolation{{{*/
+-int Tria::VelocityInterpolation(void){
++int        Tria::VelocityInterpolation(void){/*{{{*/
+ 	return TriaRef::VelocityInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::PressureInterpolation{{{*/
+-int Tria::PressureInterpolation(void){
++int        Tria::PressureInterpolation(void){/*{{{*/
+ 	return TriaRef::PressureInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TensorInterpolation{{{*/
+-int Tria::TensorInterpolation(void){
++int        Tria::TensorInterpolation(void){/*{{{*/
+ 	return TriaRef::TensorInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NumberofNodesPressure{{{*/
+-int Tria::NumberofNodesPressure(void){
++int        Tria::NumberofNodesPressure(void){/*{{{*/
+ 	return TriaRef::NumberofNodes(this->PressureInterpolation());
+ }
+ /*}}}*/
+-/*FUNCTION Tria::NumberofNodesVelocity{{{*/
+-int Tria::NumberofNodesVelocity(void){
++int        Tria::NumberofNodesVelocity(void){/*{{{*/
+ 	return TriaRef::NumberofNodes(this->VelocityInterpolation());
+ }
+ /*}}}*/
+-/*FUNCTION Tria::PositiveDegreeDay{{{*/
+-void  Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){
++void       Tria::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){/*{{{*/
+ 
+    IssmDouble agd[NUMVERTICES];             // surface mass balance
+    IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
+@@ -1695,8 +1625,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ReduceMatrices {{{*/
+-void Tria::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
++void       Tria::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){/*{{{*/
+ 
+ 	/*Static condensation if requested*/
+ 	if(pe){
+@@ -1734,8 +1663,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ResetFSBasalBoundaryCondition{{{*/
+-void  Tria::ResetFSBasalBoundaryCondition(void){
++void       Tria::ResetFSBasalBoundaryCondition(void){/*{{{*/
+ 
+ 	int numnodes = this->NumberofNodesVelocity();
+ 
+@@ -1785,14 +1713,12 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SetClone {{{*/
+-void  Tria::SetClone(int* minranks){
++void       Tria::SetClone(int* minranks){/*{{{*/
+ 
+ 	_error_("not implemented yet");
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SmbGradients{{{*/
+-void Tria::SmbGradients(void){
++void       Tria::SmbGradients(void){/*{{{*/
+ 
+ 	int i;
+ 
+@@ -1837,8 +1763,7 @@
+ 	  this->inputs->AddInput(new TriaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SpawnSeg {{{*/
+-Seg*  Tria::SpawnSeg(int index1,int index2){
++Seg*       Tria::SpawnSeg(int index1,int index2){/*{{{*/
+ 
+ 	int analysis_counter;
+ 
+@@ -1865,8 +1790,7 @@
+ 	return seg;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SpawnBasalElement{{{*/
+-Element*  Tria::SpawnBasalElement(void){
++Element*   Tria::SpawnBasalElement(void){/*{{{*/
+ 
+ 	int index1,index2;
+ 	int domaintype;
+@@ -1884,8 +1808,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SpawnTopElement{{{*/
+-Element*  Tria::SpawnTopElement(void){
++Element*   Tria::SpawnTopElement(void){/*{{{*/
+ 
+ 	int index1,index2;
+ 	int domaintype;
+@@ -1903,8 +1826,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SetCurrentConfiguration {{{*/
+-void  Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
++void       Tria::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){/*{{{*/
+ 
+ 	/*go into parameters and get the analysis_counter: */
+ 	int analysis_counter;
+@@ -1919,8 +1841,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SurfaceArea {{{*/
+-IssmDouble Tria::SurfaceArea(void){
++IssmDouble Tria::SurfaceArea(void){/*{{{*/
+ 
+ 	IssmDouble S;
+ 	IssmDouble normal[3];
+@@ -1947,8 +1868,7 @@
+ 	return S;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TimeAdapt{{{*/
+-IssmDouble  Tria::TimeAdapt(void){
++IssmDouble Tria::TimeAdapt(void){/*{{{*/
+ 
+ 	/*intermediary: */
+ 	int    i;
+@@ -1989,8 +1909,7 @@
+ 	return dt;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::Update{{{*/
+-void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){
++void       Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int  numnodes;
+@@ -2086,8 +2005,7 @@
+ 	this->InputUpdateFromIoModel(index,iomodel);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::UpdateConstraintsExtrudeFromBase{{{*/
+-void  Tria::UpdateConstraintsExtrudeFromBase(void){
++void       Tria::UpdateConstraintsExtrudeFromBase(void){/*{{{*/
+ 
+ 	if(!HasEdgeOnBase()) return;
+ 
+@@ -2111,8 +2029,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::UpdateConstraintsExtrudeFromTop{{{*/
+-void  Tria::UpdateConstraintsExtrudeFromTop(void){
++void       Tria::UpdateConstraintsExtrudeFromTop(void){/*{{{*/
+ 
+ 	if(!HasEdgeOnSurface()) return;
+ 
+@@ -2134,24 +2051,20 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ValueP1OnGauss{{{*/
+-void Tria::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){
++void       Tria::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){/*{{{*/
+ 	TriaRef::GetInputValue(pvalue,values,gauss,P1Enum);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ValueP1DerivativesOnGauss{{{*/
+-void Tria::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){
++void       Tria::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	TriaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::VertexConnectivity{{{*/
+-int Tria::VertexConnectivity(int vertexindex){
++int        Tria::VertexConnectivity(int vertexindex){/*{{{*/
+ 	_assert_(this->vertices);
+ 	return this->vertices[vertexindex]->Connectivity();
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IsZeroLevelset{{{*/
+-bool Tria::IsZeroLevelset(int levelset_enum){
++bool       Tria::IsZeroLevelset(int levelset_enum){/*{{{*/
+ 
+ 	bool iszerols;
+ 	IssmDouble ls[NUMVERTICES];
+@@ -2170,7 +2083,7 @@
+ 	return iszerols;
+ }
+ /*}}}*/
+-bool Tria::IsIcefront(void){/*{{{*/
++bool       Tria::IsIcefront(void){/*{{{*/
+ 
+ 	bool isicefront;
+ 	int i,nrice;
+@@ -2189,7 +2102,7 @@
+ 	}
+ 	return isicefront;
+ }/*}}}*/
+-bool Tria::IsFaceOnBoundary(void){/*{{{*/
++bool       Tria::IsFaceOnBoundary(void){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -2209,8 +2122,7 @@
+ 		return false;
+ 	}
+ }/*}}}*/
+-/*FUNCTION Tria::AverageOntoPartition {{{*/
+-void  Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
++void       Tria::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){/*{{{*/
+ 
+ 	bool       already = false;
+ 	int        i,j;
+@@ -2248,8 +2160,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IceVolume {{{*/
+-IssmDouble Tria::IceVolume(void){
++IssmDouble Tria::IceVolume(void){/*{{{*/
+ 
+ 	/*The volume of a troncated prism is base * 1/3 sum(length of edges)*/
+ 	IssmDouble base,surface,bed;
+@@ -2277,8 +2188,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::IceVolumeAboveFloatation {{{*/
+-IssmDouble Tria::IceVolumeAboveFloatation(void){
++IssmDouble Tria::IceVolumeAboveFloatation(void){/*{{{*/
+ 
+ 	/*The volume above floatation: H + rho_water/rho_ice * bathymetry */
+ 	IssmDouble rho_ice,rho_water;
+@@ -2308,8 +2218,7 @@
+ 	return base*(surface-bed+min(rho_water/rho_ice*bathymetry,0.));
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MassFlux {{{*/
+-IssmDouble Tria::MassFlux( IssmDouble x1, IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id){
++IssmDouble Tria::MassFlux( IssmDouble x1, IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id){/*{{{*/
+ 
+ 	int        domaintype;
+ 	IssmDouble mass_flux=0.;
+@@ -2372,8 +2281,7 @@
+ 	return mass_flux;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MassFlux {{{*/
+-IssmDouble Tria::MassFlux( IssmDouble* segment){
++IssmDouble Tria::MassFlux( IssmDouble* segment){/*{{{*/
+ 
+ 	int        domaintype;
+ 	IssmDouble mass_flux=0.;
+@@ -2439,8 +2347,7 @@
+ 	return mass_flux;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MaxAbsVx{{{*/
+-void  Tria::MaxAbsVx(IssmDouble* pmaxabsvx){
++void       Tria::MaxAbsVx(IssmDouble* pmaxabsvx){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxabsvx=this->inputs->MaxAbs(VxEnum);
+@@ -2449,8 +2356,7 @@
+ 	*pmaxabsvx=maxabsvx;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MaxAbsVy{{{*/
+-void  Tria::MaxAbsVy(IssmDouble* pmaxabsvy){
++void       Tria::MaxAbsVy(IssmDouble* pmaxabsvy){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxabsvy=this->inputs->MaxAbs(VyEnum);
+@@ -2459,8 +2365,7 @@
+ 	*pmaxabsvy=maxabsvy;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MaxAbsVz{{{*/
+-void  Tria::MaxAbsVz(IssmDouble* pmaxabsvz){
++void       Tria::MaxAbsVz(IssmDouble* pmaxabsvz){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxabsvz=this->inputs->MaxAbs(VzEnum);
+@@ -2469,8 +2374,7 @@
+ 	*pmaxabsvz=maxabsvz;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MaxVel{{{*/
+-void  Tria::MaxVel(IssmDouble* pmaxvel){
++void       Tria::MaxVel(IssmDouble* pmaxvel){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvel=this->inputs->Max(VelEnum);
+@@ -2479,8 +2383,7 @@
+ 	*pmaxvel=maxvel;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MaxVx{{{*/
+-void  Tria::MaxVx(IssmDouble* pmaxvx){
++void       Tria::MaxVx(IssmDouble* pmaxvx){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvx=this->inputs->Max(VxEnum);
+@@ -2489,8 +2392,7 @@
+ 	*pmaxvx=maxvx;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MaxVy{{{*/
+-void  Tria::MaxVy(IssmDouble* pmaxvy){
++void       Tria::MaxVy(IssmDouble* pmaxvy){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvy=this->inputs->Max(VyEnum);
+@@ -2500,8 +2402,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MaxVz{{{*/
+-void  Tria::MaxVz(IssmDouble* pmaxvz){
++void       Tria::MaxVz(IssmDouble* pmaxvz){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvz=this->inputs->Max(VzEnum);
+@@ -2510,8 +2411,7 @@
+ 	*pmaxvz=maxvz;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MinVel{{{*/
+-void  Tria::MinVel(IssmDouble* pminvel){
++void       Tria::MinVel(IssmDouble* pminvel){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvel=this->inputs->Min(VelEnum);
+@@ -2520,8 +2420,7 @@
+ 	*pminvel=minvel;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MinVx{{{*/
+-void  Tria::MinVx(IssmDouble* pminvx){
++void       Tria::MinVx(IssmDouble* pminvx){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvx=this->inputs->Min(VxEnum);
+@@ -2530,8 +2429,7 @@
+ 	*pminvx=minvx;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MinVy{{{*/
+-void  Tria::MinVy(IssmDouble* pminvy){
++void       Tria::MinVy(IssmDouble* pminvy){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvy=this->inputs->Min(VyEnum);
+@@ -2540,8 +2438,7 @@
+ 	*pminvy=minvy;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MinVz{{{*/
+-void  Tria::MinVz(IssmDouble* pminvz){
++void       Tria::MinVz(IssmDouble* pminvz){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvz=this->inputs->Min(VzEnum);
+@@ -2550,8 +2447,7 @@
+ 	*pminvz=minvz;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ElementResponse{{{*/
+-void Tria::ElementResponse(IssmDouble* presponse,int response_enum){
++void       Tria::ElementResponse(IssmDouble* presponse,int response_enum){/*{{{*/
+ 
+ 	switch(response_enum){
+ 		case MaterialsRheologyBbarEnum:
+@@ -2576,8 +2472,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::TotalSmb {{{*/
+-IssmDouble Tria::TotalSmb(void){
++IssmDouble Tria::TotalSmb(void){/*{{{*/
+ 
+ 	/*The smb[kg yr-1] of one element is area[m2] * smb [kg m^-2 yr^-1]*/
+ 	IssmDouble base,smb,rho_ice;
+@@ -2605,8 +2500,7 @@
+ 	return Total_Smb;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::MisfitArea{{{*/
+-IssmDouble Tria::MisfitArea(int weightsenum){
++IssmDouble Tria::MisfitArea(int weightsenum){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble weight;
+@@ -2643,8 +2537,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::Misfit{{{*/
+-IssmDouble Tria::Misfit(int modelenum,int observationenum,int weightsenum){
++IssmDouble Tria::Misfit(int modelenum,int observationenum,int weightsenum){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble model,observation,weight;
+@@ -2687,8 +2580,7 @@
+ /*}}}*/
+ 
+ #ifdef _HAVE_GIA_
+-/*FUNCTION Tria::GiaDeflection {{{*/
+-void Tria::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x, IssmDouble* y){
++void       Tria::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x, IssmDouble* y){/*{{{*/
+ 
+ 	int i;
+ 	int gsize;
+@@ -2815,8 +2707,7 @@
+ /*}}}*/
+ #endif
+ 
+-/*FUNCTION Tria::BalancethicknessMisfit{{{*/
+-IssmDouble Tria::BalancethicknessMisfit(void){
++IssmDouble Tria::BalancethicknessMisfit(void){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	IssmDouble Jelem = 0;
+@@ -2873,8 +2764,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputControlUpdate{{{*/
+-void  Tria::InputControlUpdate(IssmDouble scalar,bool save_parameter){
++void       Tria::InputControlUpdate(IssmDouble scalar,bool save_parameter){/*{{{*/
+ 
+ 	/*Intermediary*/
+ 	int    num_controls;
+@@ -2901,8 +2791,7 @@
+ 	xDelete<int>(control_type);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ControlInputGetGradient{{{*/
+-void Tria::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){
++void       Tria::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){/*{{{*/
+ 
+ 	int vertexpidlist[NUMVERTICES];
+ 
+@@ -2914,8 +2803,7 @@
+ 	((ControlInput*)input)->GetGradient(gradient,&vertexpidlist[0]);
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::ControlInputScaleGradient{{{*/
+-void Tria::ControlInputScaleGradient(int enum_type,IssmDouble scale){
++void       Tria::ControlInputScaleGradient(int enum_type,IssmDouble scale){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(enum_type);
+ 	if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found");
+@@ -2923,8 +2811,7 @@
+ 
+ 	((ControlInput*)input)->ScaleGradient(scale);
+ }/*}}}*/
+-/*FUNCTION Tria::ControlInputSetGradient{{{*/
+-void Tria::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){
++void       Tria::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){/*{{{*/
+ 
+ 	int    vertexpidlist[NUMVERTICES];
+ 	IssmDouble grad_list[NUMVERTICES];
+@@ -2941,8 +2828,7 @@
+ 	((ControlInput*)input)->SetGradient(grad_input);
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::ControlToVectors{{{*/
+-void Tria::ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){
++void       Tria::ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(control_enum);
+ 	if (!input) _error_("Input " << EnumToStringx(control_enum) << " not found");
+@@ -2973,8 +2859,7 @@
+ 	vector_gradient->SetValues(NUMVERTICES,&sidlist[0],&gradients[0],ADD_VAL);
+ 
+ }/*}}}*/
+-/*FUNCTION Tria::Gradj {{{*/
+-void  Tria::Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){
++void       Tria::Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){/*{{{*/
+ 	/*dJ/dalpha = ∂L/∂alpha = ∂J/∂alpha + ∂/∂alpha(KU-F)*/
+ 
+ 	/*If on water, grad = 0: */
+@@ -3041,8 +2926,7 @@
+ 	xDelete<int>(responses);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjBGradient{{{*/
+-void  Tria::GradjBGradient(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjBGradient(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	int        i;
+ 	int        vertexpidlist[NUMVERTICES];
+@@ -3081,8 +2965,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjBSSA{{{*/
+-void  Tria::GradjBSSA(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjBSSA(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i;
+@@ -3138,8 +3021,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjDSSA{{{*/
+-void  Tria::GradjDSSA(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjDSSA(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i;
+@@ -3196,8 +3078,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjDragSSA {{{*/
+-void  Tria::GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	int        i;
+ 	int        analysis_type;
+@@ -3283,8 +3164,7 @@
+ 	delete friction;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjDragGradient{{{*/
+-void  Tria::GradjDragGradient(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjDragGradient(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	int        i;
+ 	int        vertexpidlist[NUMVERTICES];
+@@ -3327,8 +3207,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjDhDtBalancedthickness{{{*/
+-void  Tria::GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int    vertexpidlist[NUMVERTICES];
+@@ -3343,8 +3222,7 @@
+ 	gradient->SetValues(NUMVERTICES,vertexpidlist,gradient_g,INS_VAL);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjVxBalancedthickness{{{*/
+-void  Tria::GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i;
+@@ -3386,8 +3264,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjVyBalancedthickness{{{*/
+-void  Tria::GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i;
+@@ -3428,8 +3305,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradjThicknessBalancethicknessSoft{{{*/
+-void  Tria::GradjThicknessBalancethicknessSoft(Vector<IssmDouble>* gradient,int control_index){
++void       Tria::GradjThicknessBalancethicknessSoft(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Intermediaries */
+ 	int         i,resp;
+@@ -3537,8 +3413,7 @@
+ 	xDelete<int>(responses);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GradientIndexing{{{*/
+-void  Tria::GradientIndexing(int* indexing,int control_index){
++void       Tria::GradientIndexing(int* indexing,int control_index){/*{{{*/
+ 
+ 	/*Get some parameters*/
+ 	int num_controls;
+@@ -3551,8 +3426,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::RheologyBbarAbsGradient{{{*/
+-IssmDouble Tria::RheologyBbarAbsGradient(void){
++IssmDouble Tria::RheologyBbarAbsGradient(void){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	IssmDouble Jelem = 0;
+@@ -3594,8 +3468,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SurfaceAverageVelMisfit {{{*/
+-IssmDouble Tria::SurfaceAverageVelMisfit(void){
++IssmDouble Tria::SurfaceAverageVelMisfit(void){/*{{{*/
+ 
+ 	IssmDouble Jelem=0,S,Jdet;
+ 	IssmDouble misfit;
+@@ -3650,8 +3523,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SurfaceLogVelMisfit {{{*/
+-IssmDouble Tria::SurfaceLogVelMisfit(void){
++IssmDouble Tria::SurfaceLogVelMisfit(void){/*{{{*/
+ 
+ 	IssmDouble Jelem=0.;
+ 	IssmDouble misfit,Jdet;
+@@ -3710,8 +3582,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SurfaceLogVxVyMisfit {{{*/
+-IssmDouble Tria::SurfaceLogVxVyMisfit(void){
++IssmDouble Tria::SurfaceLogVxVyMisfit(void){/*{{{*/
+ 
+ 	IssmDouble Jelem=0, S=0;
+ 	IssmDouble epsvel=2.220446049250313e-16;
+@@ -3770,8 +3641,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SurfaceAbsVelMisfit {{{*/
+-IssmDouble Tria::SurfaceAbsVelMisfit(void){
++IssmDouble Tria::SurfaceAbsVelMisfit(void){/*{{{*/
+ 
+ 	IssmDouble Jelem=0;
+ 	IssmDouble misfit,Jdet;
+@@ -3826,8 +3696,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SurfaceRelVelMisfit {{{*/
+-IssmDouble Tria::SurfaceRelVelMisfit(void){
++IssmDouble Tria::SurfaceRelVelMisfit(void){/*{{{*/
+ 
+ 	IssmDouble  Jelem=0;
+ 	IssmDouble  scalex=1,scaley=1;
+@@ -3887,8 +3756,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ThicknessAbsGradient{{{*/
+-IssmDouble Tria::ThicknessAbsGradient(void){
++IssmDouble Tria::ThicknessAbsGradient(void){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	IssmDouble Jelem = 0;
+@@ -3930,8 +3798,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ThicknessAlongGradient{{{*/
+-IssmDouble Tria::ThicknessAlongGradient(void){
++IssmDouble Tria::ThicknessAlongGradient(void){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	IssmDouble  Jelem = 0;
+@@ -3981,8 +3848,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ThicknessAcrossGradient{{{*/
+-IssmDouble Tria::ThicknessAcrossGradient(void){
++IssmDouble Tria::ThicknessAcrossGradient(void){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	IssmDouble  Jelem = 0;
+@@ -4032,8 +3898,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::ThicknessAbsMisfit {{{*/
+-IssmDouble Tria::ThicknessAbsMisfit(void){
++IssmDouble Tria::ThicknessAbsMisfit(void){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble thickness,thicknessobs,weight;
+@@ -4076,8 +3941,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::DragCoefficientAbsGradient{{{*/
+-IssmDouble Tria::DragCoefficientAbsGradient(void){
++IssmDouble Tria::DragCoefficientAbsGradient(void){/*{{{*/
+ 
+ 	/* Intermediaries */
+ 	IssmDouble Jelem = 0;
+@@ -4119,8 +3983,7 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetVectorFromControlInputs{{{*/
+-void  Tria::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){
++void       Tria::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){/*{{{*/
+ 
+ 	int vertexpidlist[NUMVERTICES];
+ 	Input *input=NULL;
+@@ -4142,8 +4005,7 @@
+ 	((ControlInput*)input)->GetVectorFromInputs(vector,&vertexpidlist[0],data);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::SetControlInputsFromVector{{{*/
+-void  Tria::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){
++void       Tria::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){/*{{{*/
+ 
+ 	IssmDouble  values[NUMVERTICES];
+ 	int     vertexpidlist[NUMVERTICES];
+@@ -4170,8 +4032,7 @@
+ 	((ControlInput*)input)->SetInput(new_input);
+ }
+ /*}}}*/
+-/*FUNCTION Tria::GetSolutionFromInputsOneDof{{{*/
+-void  Tria::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
++void       Tria::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){/*{{{*/
+ 
+ 	int        *doflist = NULL;
+ 	IssmDouble  value;
+@@ -4205,8 +4066,7 @@
+ /*}}}*/
+ 
+ #ifdef _HAVE_DAKOTA_
+-/*FUNCTION Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
+-void  Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
++void       Tria::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){/*{{{*/
+ 
+ 	int i,j;
+ 
+@@ -4297,8 +4157,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type);{{{*/
+-void  Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){
++void       Tria::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*{{{*/
+ 
+ 	int             i,t,row;
+ 	IssmDouble      time;
+@@ -4338,8 +4197,7 @@
+ /*}}}*/
+ #endif
+ 
+-/*FUNCTION Tria::MigrateGroundingLine{{{*/
+-void  Tria::MigrateGroundingLine(IssmDouble* phi_ungrounding){
++void       Tria::MigrateGroundingLine(IssmDouble* phi_ungrounding){/*{{{*/
+ 
+ 	int        i,migration_style;
+ 	bool       oldfloating;
+@@ -4469,8 +4327,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tria::PotentialUngrounding{{{*/
+-void  Tria::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){
++void       Tria::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){/*{{{*/
+ 
+ 	IssmDouble  h[NUMVERTICES],r[NUMVERTICES],gl[NUMVERTICES];
+ 	IssmDouble  bed_hydro;
+@@ -4497,8 +4354,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tria::UpdatePotentialUngrounding{{{*/
+-int Tria::UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
++int        Tria::UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){/*{{{*/
+ 
+ 	int i;
+ 	int nflipped=0;
+Index: ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/PentaRef.cpp	(revision 17962)
+@@ -26,28 +26,24 @@
+ #define NUMNODESP2xP4 30
+ 
+ /*Object constructors and destructor*/
+-/*FUNCTION PentaRef::PentaRef(){{{*/
+-PentaRef::PentaRef(){
++PentaRef::PentaRef(){/*{{{*/
+ 	this->element_type_list=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::PentaRef(int* types,int nummodels){{{*/
+-PentaRef::PentaRef(const int nummodels){
++PentaRef::PentaRef(const int nummodels){/*{{{*/
+ 
+ 	/*Only allocate pointer*/
+ 	element_type_list=xNew<int>(nummodels);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::~PentaRef(){{{*/
+-PentaRef::~PentaRef(){
++PentaRef::~PentaRef(){/*{{{*/
+ 	xDelete<int>(element_type_list);
+ }
+ /*}}}*/
+ 
+ /*Management*/
+-/*FUNCTION PentaRef::SetElementType{{{*/
+-void PentaRef::SetElementType(int type,int type_counter){
++void PentaRef::SetElementType(int type,int type_counter){/*{{{*/
+ 
+ 	/*initialize element type*/
+ 	this->element_type_list[type_counter]=type;
+@@ -55,8 +51,7 @@
+ /*}}}*/
+ 
+ /*Reference Element numerics*/
+-/*FUNCTION PentaRef::GetJacobian {{{*/
+-void PentaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss_in){
++void PentaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss_in){/*{{{*/
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -112,8 +107,7 @@
+ 	J[NDOF3*2+2] = SQRT3/12.0*(z1+z2-2*z3-z4-z5+2*z6)*eta+0.25*(z1-z2-z4+z5)*xi+0.25*(-z1+z5-z2+z4);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetJacobianDeterminant {{{*/
+-void PentaRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){
++void PentaRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*On a penta, Jacobian varies according to coordinates. We need to get the Jacobian, and take 
+ 	 * the determinant of it: */
+ 	IssmDouble J[3][3];
+@@ -127,8 +121,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetTriaJacobianDeterminant{{{*/
+-void PentaRef::GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){
++void PentaRef::GetTriaJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -147,8 +140,7 @@
+ 	if(*Jdet<0) _error_("negative jacobian determinant!");
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetSegmentJacobianDeterminant{{{*/
+-void PentaRef::GetSegmentJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){
++void PentaRef::GetSegmentJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -164,8 +156,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetJacobianInvert {{{*/
+-void PentaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,Gauss* gauss){
++void PentaRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	/*Jacobian*/
+ 	IssmDouble J[3][3];
+@@ -177,8 +168,7 @@
+ 	Matrix3x3Invert(Jinv,&J[0][0]);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){{{*/
+-void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){
++void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -186,8 +176,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){{{*/
+-void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){
++void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -331,13 +320,11 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
++void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){{{*/
+-void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){
++void PentaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -370,13 +357,11 @@
+ 	xDelete<IssmDouble>(dbasis_ref);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){{{*/
+-void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){
++void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){/*{{{*/
+ 	GetNodalFunctionsDerivativesReference(dbasis,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){{{*/
+-void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){
++void PentaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+@@ -798,8 +783,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsMINIDerivatives{{{*/
+-void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dbasismini,IssmDouble* xyz_list, Gauss* gauss){
++void PentaRef::GetNodalFunctionsMINIDerivatives(IssmDouble* dbasismini,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -828,8 +812,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsMINIDerivativesReference{{{*/
+-void PentaRef::GetNodalFunctionsMINIDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){
++void PentaRef::GetNodalFunctionsMINIDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){/*{{{*/
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -870,8 +853,7 @@
+ 	dbasis[NUMNODESP1b*2+6]=27*gauss->coord1*gauss->coord2*gauss->coord3*(-2.0*zeta);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsP1 {{{*/
+-void PentaRef::GetNodalFunctionsP1(IssmDouble* basis, Gauss* gauss_in){
++void PentaRef::GetNodalFunctionsP1(IssmDouble* basis, Gauss* gauss_in){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	/*Cast gauss to GaussPenta*/
+@@ -887,8 +869,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsP1Derivatives {{{*/
+-void PentaRef::GetNodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
++void PentaRef::GetNodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -916,8 +897,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetNodalFunctionsP1DerivativesReference {{{*/
+-void PentaRef::GetNodalFunctionsP1DerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){
++void PentaRef::GetNodalFunctionsP1DerivativesReference(IssmDouble* dbasis,Gauss* gauss_in){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. Those values vary along xi,eta,z */
+@@ -954,8 +934,7 @@
+ 	dbasis[NUMNODESP1*2+5]=0.5*gauss->coord3;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetQuadJacobianDeterminant{{{*/
+-void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble* xyz_list,Gauss* gauss){
++void PentaRef::GetQuadJacobianDeterminant(IssmDouble* Jdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	IssmDouble x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4;
+@@ -980,15 +959,13 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){{{*/
+-void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){
++void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){/*{{{*/
+ 
+ 	GetInputValue(pvalue,plist,gauss,this->element_type);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){{{*/
+-void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){
++void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*Output*/
+ 	IssmDouble value =0.;
+@@ -1009,8 +986,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::GetInputDerivativeValue{{{*/
+-void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss){
++void PentaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
+ 	/*From node values of parameter p (p_list[0], p_list[1], p_list[2],
+ 	 * p_list[3], p_list[4] and p_list[4]), return parameter derivative value at
+ 	 * gaussian point specified by gauss_coord:
+@@ -1046,14 +1022,12 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::NumberofNodes(){{{*/
+-int PentaRef::NumberofNodes(void){
++int  PentaRef::NumberofNodes(void){/*{{{*/
+ 
+ 	return this->NumberofNodes(this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::NumberofNodes(int finiteelement){{{*/
+-int PentaRef::NumberofNodes(int finiteelement){
++int  PentaRef::NumberofNodes(int finiteelement){/*{{{*/
+ 
+ 	switch(finiteelement){
+ 		case P0Enum:                return NUMNODESP0;
+@@ -1077,8 +1051,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::VelocityInterpolation{{{*/
+-int PentaRef::VelocityInterpolation(void){
++int  PentaRef::VelocityInterpolation(void){/*{{{*/
+ 
+ 	switch(this->element_type){
+ 		case P1P1Enum:          return P1Enum;
+@@ -1093,8 +1066,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::PressureInterpolation{{{*/
+-int PentaRef::PressureInterpolation(void){
++int  PentaRef::PressureInterpolation(void){/*{{{*/
+ 
+ 	switch(this->element_type){
+ 		case P1P1Enum:          return P1Enum;
+@@ -1109,8 +1081,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::TensorInterpolation{{{*/
+-int PentaRef::TensorInterpolation(void){
++int  PentaRef::TensorInterpolation(void){/*{{{*/
+ 
+ 	switch(this->element_type){
+ 		case XTaylorHoodEnum:    return P1DGEnum;
+@@ -1120,8 +1091,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::BasalNodeIndices{{{*/
+-void PentaRef::BasalNodeIndices(int* pnumindices,int** pindices,int finiteelement){
++void PentaRef::BasalNodeIndices(int* pnumindices,int** pindices,int finiteelement){/*{{{*/
+ 
+ 	/*Output*/
+ 	int  numindices;
+@@ -1195,8 +1165,7 @@
+ 	*pindices    = indices;
+ }
+ /*}}}*/
+-/*FUNCTION PentaRef::SurfaceNodeIndices{{{*/
+-void PentaRef::SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement){
++void PentaRef::SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement){/*{{{*/
+ 
+ 	/*Output*/
+ 	int  numindices;
+Index: ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/ElementHook.cpp	(revision 17962)
+@@ -15,8 +15,7 @@
+ /*}}}*/
+ 
+ /*Object constructors and destructor*/
+-/*FUNCTION ElementHook::ElementHook(){{{*/
+-ElementHook::ElementHook(){
++ElementHook::ElementHook(){/*{{{*/
+ 	numanalyses=UNDEF;
+ 	this->hnodes     = NULL;
+ 	this->hvertices  = NULL;
+@@ -25,8 +24,7 @@
+ 	this->hneighbors = NULL;
+ }
+ /*}}}*/
+-/*FUNCTION ElementHook::~ElementHook(){{{*/
+-ElementHook::~ElementHook(){
++ElementHook::~ElementHook(){/*{{{*/
+ 
+ 	int i;
+ 
+@@ -40,8 +38,7 @@
+ 	delete hneighbors;
+ }
+ /*}}}*/
+-/*FUNCTION ElementHook::ElementHook(int in_numanalyses,int element_id, int numvertices,IoModel* iomodel){{{*/
+-ElementHook::ElementHook(int in_numanalyses,int element_id,int numvertices,IoModel* iomodel){
++ElementHook::ElementHook(int in_numanalyses,int element_id,int numvertices,IoModel* iomodel){/*{{{*/
+ 
+ 	/*intermediary: */
+ 	int matpar_id;
+@@ -77,18 +74,15 @@
+ }
+ /*}}}*/
+ 
+-/*FUNCTION ElementHook::SetHookNodes{{{*/
+-void ElementHook::SetHookNodes(int* node_ids,int numnodes,int analysis_counter){
++void ElementHook::SetHookNodes(int* node_ids,int numnodes,int analysis_counter){/*{{{*/
+ 	this->hnodes[analysis_counter]= new Hook(node_ids,numnodes);
+ }
+ /*}}}*/
+-/*FUNCTION ElementHook::InitHookNeighbors{{{*/
+-void ElementHook::InitHookNeighbors(int* element_ids){
++void ElementHook::InitHookNeighbors(int* element_ids){/*{{{*/
+ 	this->hneighbors=new Hook(element_ids,2);
+ }
+ /*}}}*/
+-/*FUNCTION ElementHook::SpawnTriaHook{{{*/
+-void ElementHook::SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3){
++void ElementHook::SpawnTriaHook(ElementHook* triahook,int index1,int index2,int index3){/*{{{*/
+ 
+ 	/*Create arrow of indices depending on location (0=base 1=surface)*/
+ 	int indices[3];
+@@ -116,8 +110,7 @@
+ 	triahook->hmatpar=(Hook*)this->hmatpar->copy();
+ }
+ /*}}}*/
+-/*FUNCTION ElementHook::SpawnSegHook{{{*/
+-void ElementHook::SpawnSegHook(ElementHook* triahook,int index1,int index2){
++void ElementHook::SpawnSegHook(ElementHook* triahook,int index1,int index2){/*{{{*/
+ 
+ 	triahook->numanalyses=this->numanalyses;
+ 
+Index: ../trunk-jpl/src/c/classes/Elements/SegRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/SegRef.cpp	(revision 17962)
+@@ -19,28 +19,24 @@
+ #define NUMNODESP1  2
+ 
+ /*Object constructors and destructor*/
+-/*FUNCTION SegRef::SegRef(){{{*/
+-SegRef::SegRef(){
++SegRef::SegRef(){/*{{{*/
+ 	this->element_type_list=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::SegRef(int* types,int nummodels){{{*/
+-SegRef::SegRef(const int nummodels){
++SegRef::SegRef(const int nummodels){/*{{{*/
+ 
+ 	/*Only allocate pointer*/
+ 	element_type_list=xNew<int>(nummodels);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::~SegRef(){{{*/
+-SegRef::~SegRef(){
++SegRef::~SegRef(){/*{{{*/
+ 	xDelete<int>(element_type_list);
+ }
+ /*}}}*/
+ 
+ /*Management*/
+-/*FUNCTION SegRef::SetElementType{{{*/
+-void SegRef::SetElementType(int type,int type_counter){
++void SegRef::SetElementType(int type,int type_counter){/*{{{*/
+ 
+ 	/*initialize element type*/
+ 	this->element_type_list[type_counter]=type;
+@@ -48,8 +44,7 @@
+ /*}}}*/
+ 
+ /*Reference Element numerics*/
+-/*FUNCTION SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){{{*/
+-void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){
++void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -57,8 +52,7 @@
+ 	GetNodalFunctions(basis,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement){{{*/
+-void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement){
++void SegRef::GetNodalFunctions(IssmDouble* basis,GaussSeg* gauss,int finiteelement){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -81,15 +75,13 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss){{{*/
+-void SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss){
++void SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss){/*{{{*/
+ 
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement){{{*/
+-void SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement){
++void SegRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussSeg* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -117,8 +109,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss){{{*/
+-void SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss){
++void SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -126,8 +117,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement){{{*/
+-void SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement){
++void SegRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussSeg* gauss,int finiteelement){/*{{{*/
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -156,8 +146,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetInputDerivativeValue{{{*/
+-void SegRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussSeg* gauss){
++void SegRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussSeg* gauss){/*{{{*/
+ 
+ 	/*From node values of parameter p (plist[0],plist[1]), return parameter derivative value at gaussian 
+ 	 * point specified by gauss_basis:
+@@ -185,14 +174,12 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss){{{*/
+-void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss){
++void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss){/*{{{*/
+ 
+ 	GetInputValue(p,plist,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement){{{*/
+-void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement){
++void SegRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussSeg* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*Output*/
+ 	IssmDouble value =0.;
+@@ -212,8 +199,7 @@
+ 	*p = value;
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetJacobian{{{*/
+-void SegRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussSeg* gauss){
++void SegRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussSeg* gauss){/*{{{*/
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size 1*/
+ 
+@@ -223,8 +209,7 @@
+ 	*J=.5*fabs(x2-x1);
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetJacobianDeterminant{{{*/
+-void SegRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussSeg* gauss){
++void SegRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussSeg* gauss){/*{{{*/
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -234,8 +219,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::GetJacobianInvert {{{*/
+-void SegRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussSeg* gauss){
++void SegRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussSeg* gauss){/*{{{*/
+ 
+ 	/*Jacobian*/
+ 	IssmDouble J;
+@@ -247,14 +231,12 @@
+ 	*Jinv = 1./J;
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::NumberofNodes(){{{*/
+-int SegRef::NumberofNodes(void){
++int  SegRef::NumberofNodes(void){/*{{{*/
+ 
+ 	return this->NumberofNodes(this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION SegRef::NumberofNodes(int finiteelement){{{*/
+-int SegRef::NumberofNodes(int finiteelement){
++int  SegRef::NumberofNodes(int finiteelement){/*{{{*/
+ 
+ 	switch(finiteelement){
+ 		case P0Enum:                return NUMNODESP0;
+Index: ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/TetraRef.cpp	(revision 17962)
+@@ -3,7 +3,7 @@
+  */
+ 
+ /*Headers:*/
+-/*{{{*/
++/*{{{*//*{{{*/
+ #ifdef HAVE_CONFIG_H
+ #include <config.h>
+ #else
+@@ -21,28 +21,24 @@
+ #define NUMNODESP2  10
+ 
+ /*Object constructors and destructor*/
+-/*FUNCTION TetraRef::TetraRef(){{{*/
+-TetraRef::TetraRef(){
++TetraRef::TetraRef(){/*{{{*/
+ 	this->element_type_list=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::TetraRef(int* types,int nummodels){{{*/
+-TetraRef::TetraRef(const int nummodels){
++TetraRef::TetraRef(const int nummodels){/*{{{*/
+ 
+ 	/*Only allocate pointer*/
+ 	element_type_list=xNew<int>(nummodels);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::~TetraRef(){{{*/
+-TetraRef::~TetraRef(){
++TetraRef::~TetraRef(){/*{{{*/
+ 	xDelete<int>(element_type_list);
+ }
+ /*}}}*/
+ 
+ /*Management*/
+-/*FUNCTION TetraRef::SetElementType{{{*/
+-void TetraRef::SetElementType(int type,int type_counter){
++void TetraRef::SetElementType(int type,int type_counter){/*{{{*/
+ 
+ 	/*initialize element type*/
+ 	this->element_type_list[type_counter]=type;
+@@ -50,15 +46,13 @@
+ /*}}}*/
+ 
+ /*Reference Element numerics*/
+-/*FUNCTION TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss){{{*/
+-void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss){
++void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 	_assert_(basis);
+ 	GetNodalFunctions(basis,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement){{{*/
+-void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement){
++void TetraRef::GetNodalFunctions(IssmDouble* basis,GaussTetra* gauss,int finiteelement){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -101,13 +95,11 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){{{*/
+-void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){
++void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss){/*{{{*/
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement){{{*/
+-void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement){
++void TetraRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, GaussTetra* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -140,8 +132,7 @@
+ 	xDelete<IssmDouble>(dbasis_ref);
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){{{*/
+-void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){
++void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -149,8 +140,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement){{{*/
+-void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement){
++void TetraRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,GaussTetra* gauss,int finiteelement){/*{{{*/
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -248,8 +238,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetInputDerivativeValue{{{*/
+-void TetraRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss){
++void TetraRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, GaussTetra* gauss){/*{{{*/
+ 	/*From node values of parameter p (p_list[0], p_list[1], p_list[2],
+ 	 * p_list[3], p_list[4] and p_list[4]), return parameter derivative value at
+ 	 * gaussian point specified by gauss_coord:
+@@ -284,14 +273,12 @@
+ 	p[2]=dpz;
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss){{{*/
+-void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss){
++void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss){/*{{{*/
+ 
+ 	GetInputValue(p,plist,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss,int finiteelement){{{*/
+-void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss,int finiteelement){
++void TetraRef::GetInputValue(IssmDouble* p, IssmDouble* plist, GaussTetra* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*Output*/
+ 	IssmDouble value =0.;
+@@ -311,8 +298,7 @@
+ 	*p = value;
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetJacobian{{{*/
+-void TetraRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss){
++void TetraRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,GaussTetra* gauss){/*{{{*/
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size 1*/
+ 
+@@ -344,8 +330,7 @@
+ 	J[NDOF3*2+2] = z4-z1;
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetJacobianDeterminant{{{*/
+-void TetraRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss){
++void TetraRef::GetJacobianDeterminant(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss){/*{{{*/
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 	IssmDouble J[3][3];
+@@ -359,8 +344,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetJacobianDeterminantFace{{{*/
+-void TetraRef::GetJacobianDeterminantFace(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss){
++void TetraRef::GetJacobianDeterminantFace(IssmDouble*  Jdet, IssmDouble* xyz_list,GaussTetra* gauss){/*{{{*/
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -379,8 +363,7 @@
+ 	if(*Jdet<0) _error_("negative jacobian determinant!");
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::GetJacobianInvert {{{*/
+-void TetraRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss){
++void TetraRef::GetJacobianInvert(IssmDouble* Jinv, IssmDouble* xyz_list,GaussTetra* gauss){/*{{{*/
+ 
+ 	/*Jacobian*/
+ 	IssmDouble J[3][3];
+@@ -392,14 +375,12 @@
+ 	Matrix3x3Invert(Jinv,&J[0][0]);
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::NumberofNodes(){{{*/
+-int TetraRef::NumberofNodes(void){
++int  TetraRef::NumberofNodes(void){/*{{{*/
+ 
+ 	return this->NumberofNodes(this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::NumberofNodes(int finiteelement){{{*/
+-int TetraRef::NumberofNodes(int finiteelement){
++int  TetraRef::NumberofNodes(int finiteelement){/*{{{*/
+ 
+ 	switch(finiteelement){
+ 		case P0Enum:                return NUMNODESP0;
+@@ -419,8 +400,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::VelocityInterpolation{{{*/
+-int TetraRef::VelocityInterpolation(void){
++int  TetraRef::VelocityInterpolation(void){/*{{{*/
+ 
+ 	switch(this->element_type){
+ 		case P1P1Enum:          return P1Enum;
+@@ -434,8 +414,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION TetraRef::PressureInterpolation{{{*/
+-int TetraRef::PressureInterpolation(void){
++int TetraRef::PressureInterpolation(void){/*{{{*/
+ 
+ 	switch(this->element_type){
+ 		case P1P1Enum:          return P1Enum;
+@@ -448,8 +427,7 @@
+ 
+ 	return -1;
+ }/*}}}*/
+-/*FUNCTION TetraRef::TensorInterpolation{{{*/
+-int TetraRef::TensorInterpolation(void){
++int  TetraRef::TensorInterpolation(void){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	switch(this->element_type){
+Index: ../trunk-jpl/src/c/classes/Elements/Elements.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Elements.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/Elements.cpp	(revision 17962)
+@@ -22,21 +22,18 @@
+ /*}}}*/
+ 
+ /*Object constructors and destructor*/
+-/*FUNCTION Elements::Elements(){{{*/
+-Elements::Elements(){
++Elements::Elements(){/*{{{*/
+ 	enum_type=MeshElementsEnum;
+ 	return;
+ }
+ /*}}}*/
+-/*FUNCTION Elements::~Elements(){{{*/
+-Elements::~Elements(){
++Elements::~Elements(){/*{{{*/
+ 	return;
+ }
+ /*}}}*/
+ 
+ /*Object management*/
+-/*FUNCTION Elements::Configure{{{*/
+-void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
++void Elements::Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){/*{{{*/
+ 
+ 	vector<Object*>::iterator object;
+ 	Element* element=NULL;
+@@ -50,8 +47,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Elements::SetCurrentConfiguration{{{*/
+-void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){
++void Elements::SetCurrentConfiguration(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters){/*{{{*/
+ 
+ 	vector<Object*>::iterator object;
+ 	Element* element=NULL;
+@@ -65,8 +61,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Elements::MaxNumNodes{{{*/
+-int Elements::MaxNumNodes(void){
++int  Elements::MaxNumNodes(void){/*{{{*/
+ 
+ 	int max=0;
+ 	int allmax;
+@@ -87,8 +82,7 @@
+ 	return max;
+ }
+ /*}}}*/
+-/*FUNCTION Elements::NumberOfElements{{{*/
+-int Elements::NumberOfElements(void){
++int  Elements::NumberOfElements(void){/*{{{*/
+ 
+ 	int local_nelem;
+ 	int numberofelements;
+@@ -99,8 +93,7 @@
+ 	return numberofelements;
+ }
+ /*}}}*/
+-/*FUNCTION Elements::InputDuplicate{{{*/
+-void Elements::InputDuplicate(int input_enum,int output_enum){
++void Elements::InputDuplicate(int input_enum,int output_enum){/*{{{*/
+ 
+ 	for(int i=0;i<this->Size();i++){
+ 		Element* element=dynamic_cast<Element*>(this->GetObjectByOffset(i));
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17962)
+@@ -18,8 +18,7 @@
+ /*Element macros*/
+ #define NUMVERTICES 2
+ /*Constructors/destructor/copy*/
+-/*FUNCTION Seg::Seg(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+-Seg::Seg(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
++Seg::Seg(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/
+ 		:SegRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+ 			/*id: */
+@@ -39,19 +38,16 @@
+ 			this->matpar   = NULL;
+ 		}
+ /*}}}*/
+-/*FUNCTION Seg::~Seg(){{{*/
+-Seg::~Seg(){
++Seg::~Seg(){/*{{{*/
+ 	this->parameters=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::copy {{{*/
+-Object* Seg::copy() {
++Object* Seg::copy(){/*{{{*/
+ 	_error_("not implemented yet");
+ }
+ /*}}}*/
+ 
+-/*FUNCTION Seg::CharacteristicLength{{{*/
+-IssmDouble Seg::CharacteristicLength(void){
++IssmDouble Seg::CharacteristicLength(void){/*{{{*/
+ 
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble x1,y1,x2,y2;
+@@ -64,20 +60,17 @@
+ 	return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
+ }
+ /*}}}*/
+-/*FUNCTION Seg::FiniteElement{{{*/
+-int Seg::FiniteElement(void){
++int        Seg::FiniteElement(void){/*{{{*/
+ 	return this->element_type;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::ObjectEnum{{{*/
+-int Seg::ObjectEnum(void){
++int        Seg::ObjectEnum(void){/*{{{*/
+ 
+ 	return SegEnum;
+ 
+ }
+ /*}}}*/
+-
+-void  Seg::GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
++void       Seg::GetIcefrontCoordinates(IssmDouble** pxyz_front,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
+ 	
+ 	/* Intermediaries */
+ 	int nrfrontnodes,index;
+@@ -105,18 +98,15 @@
+ 
+ 	*pxyz_front=xyz_front;
+ }/*}}}*/
+-/*FUNCTION Seg::GetNumberOfNodes;{{{*/
+-int Seg::GetNumberOfNodes(void){
++int        Seg::GetNumberOfNodes(void){/*{{{*/
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
+-/*FUNCTION Seg::GetNumberOfVertices;{{{*/
+-int Seg::GetNumberOfVertices(void){
++int        Seg::GetNumberOfVertices(void){/*{{{*/
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::GetVerticesCoordinates(IssmDouble** pxyz_list){{{*/
+-void Seg::GetVerticesCoordinates(IssmDouble** pxyz_list){
++void       Seg::GetVerticesCoordinates(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
+ 	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
+@@ -125,7 +115,7 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-bool Seg::IsIcefront(void){/*{{{*/
++bool       Seg::IsIcefront(void){/*{{{*/
+ 
+ 	bool isicefront;
+ 	int i,nrice;
+@@ -144,33 +134,28 @@
+ 	}
+ 	return isicefront;
+ }/*}}}*/
+-/*FUNCTION Seg::JacobianDeterminant{{{*/
+-void Seg::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++void       Seg::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussSegEnum);
+ 	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussSeg*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Seg::JacobianDeterminantSurface{{{*/
+-void Seg::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++void       Seg::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	*pJdet = 1.;
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Seg::NewGauss(){{{*/
+-Gauss* Seg::NewGauss(void){
++Gauss*     Seg::NewGauss(void){/*{{{*/
+ 	return new GaussSeg();
+ }
+ /*}}}*/
+-/*FUNCTION Seg::NewGauss(int order){{{*/
+-Gauss* Seg::NewGauss(int order){
++Gauss*     Seg::NewGauss(int order){/*{{{*/
+ 	return new GaussSeg(order);
+ }
+ /*}}}*/
+-/*FUNCTION Seg::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){{{*/
+-Gauss* Seg::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){
++Gauss*     Seg::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order){/*{{{*/
+ 
+ 	/*Output*/
+ 	Gauss* gauss = NULL;
+@@ -188,24 +173,21 @@
+ 	return gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Seg::NodalFunctions{{{*/
+-void Seg::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++void       Seg::NodalFunctions(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussSegEnum);
+ 	this->GetNodalFunctions(basis,(GaussSeg*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Seg::NodalFunctionsDerivatives{{{*/
+-void Seg::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void       Seg::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussSegEnum);
+ 	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussSeg*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Seg::NormalSection{{{*/
+-void Seg::NormalSection(IssmDouble* normal,IssmDouble* xyz_list_front){
++void       Seg::NormalSection(IssmDouble* normal,IssmDouble* xyz_list_front){/*{{{*/
+ 
+ 	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES*3);
+ 	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES);
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.cpp	(revision 17962)
+@@ -19,8 +19,7 @@
+ #define NUMVERTICES 4
+ 
+ /*Constructors/destructor/copy*/
+-/*FUNCTION Tetra::Tetra(int id, int sid,int index, IoModel* iomodel,int nummodels){{{*/
+-Tetra::Tetra(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)
++Tetra::Tetra(int seg_id, int seg_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/
+ 		:TetraRef(nummodels),ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+ 			/*id: */
+@@ -40,38 +39,31 @@
+ 			this->matpar   = NULL;
+ 		}
+ /*}}}*/
+-/*FUNCTION Tetra::~Tetra(){{{*/
+-Tetra::~Tetra(){
++Tetra::~Tetra(){/*{{{*/
+ 	this->parameters=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::copy {{{*/
+-Object* Tetra::copy() {
++Object* Tetra::copy() {/*{{{*/
+ 	_error_("not implemented yet");
+ }
+ /*}}}*/
+ 
+-/*FUNCTION Tetra::FiniteElement{{{*/
+-int Tetra::FiniteElement(void){
++int      Tetra::FiniteElement(void){/*{{{*/
+ 	return this->element_type;
+ } /*}}}*/
+-/*FUNCTION Tetra::ObjectEnum{{{*/
+-int Tetra::ObjectEnum(void){
++int      Tetra::ObjectEnum(void){/*{{{*/
+ 
+ 	return TetraEnum;
+ 
+ }/*}}}*/
++void     Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
+ 
+-/*FUNCTION Tetra::AddInput{{{*/
+-void  Tetra::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
+-
+ 	/*Call inputs method*/
+ 	_assert_(this->inputs);
+ 	this->inputs->AddInput(new TetraInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::Configure {{{*/
+-void  Tetra::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){
++void     Tetra::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){/*{{{*/
+ 
+ 	int analysis_counter;
+ 
+@@ -102,8 +94,7 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::ElementSizes (THIS ONE){{{*/
+-void Tetra::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
++void     Tetra::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){/*{{{*/
+ 
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble xmin,ymin,zmin;
+@@ -129,8 +120,7 @@
+ 	*hz=zmax-zmin;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::FaceOnBaseIndices{{{*/
+-void Tetra::FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3){
++void     Tetra::FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
+@@ -150,8 +140,7 @@
+ 	_error_("Could not find 3 vertices on bed");
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::FaceOnSurfaceIndices{{{*/
+-void Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){
++void     Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
+@@ -171,8 +160,7 @@
+ 	_error_("Could not find 3 vertices on bed");
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::FaceOnFrontIndices{{{*/
+-void Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){
++void     Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	int        indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
+@@ -192,15 +180,13 @@
+ 	_error_("Could not find 3 vertices on bed");
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetElementType {{{*/
+-int Tetra::GetElementType(){
++int      Tetra::GetElementType(){/*{{{*/
+ 
+ 	/*return TetraRef field*/
+ 	return this->element_type;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) (THIS ONE??){{{*/
+-void Tetra::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
++void     Tetra::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(enumtype);
+ 	if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
+@@ -212,8 +198,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetNodeIndex (THIS ONE){{{*/
+-int Tetra::GetNodeIndex(Node* node){
++int      Tetra::GetNodeIndex(Node* node){/*{{{*/
+ 
+ 	_assert_(nodes);
+ 	int numnodes = this->NumberofNodes();
+@@ -225,18 +210,15 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetNumberOfNodes;{{{*/
+-int Tetra::GetNumberOfNodes(void){
++int      Tetra::GetNumberOfNodes(void){/*{{{*/
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetNumberOfVertices;{{{*/
+-int Tetra::GetNumberOfVertices(void){
++int      Tetra::GetNumberOfVertices(void){/*{{{*/
+ 	return NUMVERTICES;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
+-void Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
++void     Tetra::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	int        indices[3];
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+@@ -253,8 +235,7 @@
+ 	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
+-/*FUNCTION Tetra::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){{{*/
+-void Tetra::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){
++void     Tetra::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	int        indices[3];
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+@@ -271,8 +252,7 @@
+ 	*pxyz_list = xyz_list_edge;
+ 
+ }/*}}}*/
+-/*FUNCTION Tetra::HasFaceOnBase{{{*/
+-bool Tetra::HasFaceOnBase(){
++bool     Tetra::HasFaceOnBase(){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -291,8 +271,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::HasFaceOnSurface{{{*/
+-bool Tetra::HasFaceOnSurface(){
++bool     Tetra::HasFaceOnSurface(){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -311,8 +290,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::InputUpdateFromIoModel {{{*/
+-void Tetra::InputUpdateFromIoModel(int index,IoModel* iomodel){ 
++void     Tetra::InputUpdateFromIoModel(int index,IoModel* iomodel){ /*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int         i,j;
+@@ -415,8 +393,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::InputUpdateFromSolutionOneDof{{{*/
+-void  Tetra::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
++void     Tetra::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){/*{{{*/
+ 
+ 	/*Intermediary*/
+ 	int* doflist = NULL;
+@@ -442,17 +419,15 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::IsOnBase {{{*/
+-bool Tetra::IsOnBase(){
++bool     Tetra::IsOnBase(){/*{{{*/
+ 	return HasFaceOnBase();
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::IsOnSurface {{{*/
+-bool Tetra::IsOnSurface(){
++bool     Tetra::IsOnSurface(){/*{{{*/
+ 	return HasFaceOnSurface();
+ }
+ /*}}}*/
+-bool Tetra::IsIcefront(void){/*{{{*/
++bool     Tetra::IsIcefront(void){/*{{{*/
+ 
+ 	/*Retrieve all inputs and parameters*/
+ 	IssmDouble ls[NUMVERTICES];
+@@ -466,122 +441,106 @@
+ 	}
+ 	return false;
+ }/*}}}*/
+-/*FUNCTION Tetra::JacobianDeterminant{{{*/
+-void Tetra::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++void     Tetra::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussTetra*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::JacobianDeterminantSurface{{{*/
+-void Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++void     Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetJacobianDeterminantFace(pJdet,xyz_list,(GaussTetra*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::JacobianDeterminantBase{{{*/
+-void Tetra::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++void     Tetra::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::JacobianDeterminantTop{{{*/
+-void Tetra::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++void     Tetra::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NewGauss(){{{*/
+-Gauss* Tetra::NewGauss(void){
++Gauss*   Tetra::NewGauss(void){/*{{{*/
+ 	return new GaussTetra();
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NewGauss(int order){{{*/
+-Gauss* Tetra::NewGauss(int order){
++Gauss*   Tetra::NewGauss(int order){/*{{{*/
+ 	return new GaussTetra(order);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
+-Gauss* Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
++Gauss*   Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){/*{{{*/
+ 	/*FIXME: this is messed up, should provide indices and not xyz_list!*/
+ 	int indices[3];
+ 	this->FaceOnFrontIndices(&indices[0],&indices[1],&indices[2]);
+ 	return new GaussTetra(indices[0],indices[1],indices[2],max(order_horiz,order_vert));
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NewGaussBase(int order){{{*/
+-Gauss* Tetra::NewGaussBase(int order){
++Gauss*   Tetra::NewGaussBase(int order){/*{{{*/
+ 
+ 	int indices[3];
+ 	this->FaceOnBaseIndices(&indices[0],&indices[1],&indices[2]);
+ 	return new GaussTetra(indices[0],indices[1],indices[2],order);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NewGaussTop(int order){{{*/
+-Gauss* Tetra::NewGaussTop(int order){
++Gauss*   Tetra::NewGaussTop(int order){/*{{{*/
+ 
+ 	int indices[3];
+ 	this->FaceOnSurfaceIndices(&indices[0],&indices[1],&indices[2]);
+ 	return new GaussTetra(indices[0],indices[1],indices[2],order);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NodalFunctions{{{*/
+-void Tetra::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++void     Tetra::NodalFunctions(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetNodalFunctions(basis,(GaussTetra*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NodalFunctionsVelocity{{{*/
+-void Tetra::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
++void     Tetra::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NodalFunctionsPressure{{{*/
+-void Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
++void     Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->PressureInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NodalFunctionsTensor{{{*/
+-void Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
++void     Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->TensorInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NodalFunctionsDerivatives{{{*/
+-void Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void     Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NodalFunctionsDerivativesVelocity{{{*/
+-void Tetra::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void     Tetra::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussTetraEnum);
+ 	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NormalSection{{{*/
+-void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
++void     Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble AB[3];
+@@ -601,8 +560,7 @@
+ 	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NormalBase (THIS ONE){{{*/
+-void Tetra::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
++void     Tetra::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	IssmDouble v13[3],v23[3];
+ 	IssmDouble normal[3];
+@@ -626,8 +584,7 @@
+ 	_assert_(bed_normal[2]<0.);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NormalTop (THIS ONE){{{*/
+-void Tetra::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){
++void     Tetra::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	IssmDouble v13[3],v23[3];
+ 	IssmDouble normal[3];
+@@ -649,18 +606,15 @@
+ 	_assert_(top_normal[2]>0.);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NumberofNodesPressure{{{*/
+-int Tetra::NumberofNodesPressure(void){
++int      Tetra::NumberofNodesPressure(void){/*{{{*/
+ 	return TetraRef::NumberofNodes(this->PressureInterpolation());
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::NumberofNodesVelocity{{{*/
+-int Tetra::NumberofNodesVelocity(void){
++int      Tetra::NumberofNodesVelocity(void){/*{{{*/
+ 	return TetraRef::NumberofNodes(this->VelocityInterpolation());
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::ReduceMatrices{{{*/
+-void Tetra::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
++void     Tetra::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){/*{{{*/
+ 
+ 	if(pe){
+ 		if(this->element_type==MINIcondensedEnum){
+@@ -695,8 +649,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::ResetFSBasalBoundaryCondition {{{*/
+-void  Tetra::ResetFSBasalBoundaryCondition(void){
++void     Tetra::ResetFSBasalBoundaryCondition(void){/*{{{*/
+ 
+ 	int numnodes = this->GetNumberOfNodes();
+ 
+@@ -755,8 +708,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::SetCurrentConfiguration {{{*/
+-void  Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
++void     Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){/*{{{*/
+ 
+ 	/*go into parameters and get the analysis_counter: */
+ 	int analysis_counter;
+@@ -771,8 +723,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::SpawnBasalElement{{{*/
+-Element*  Tetra::SpawnBasalElement(void){
++Element* Tetra::SpawnBasalElement(void){/*{{{*/
+ 
+ 	_assert_(HasFaceOnBase());
+ 
+@@ -780,8 +731,7 @@
+ 	this->FaceOnBaseIndices(&index1,&index2,&index3);
+ 	return SpawnTria(index1,index2,index3);
+ }/*}}}*/
+-/*FUNCTION Tetra::SpawnTopElement{{{*/
+-Element*  Tetra::SpawnTopElement(void){
++Element* Tetra::SpawnTopElement(void){/*{{{*/
+ 
+ 	_assert_(HasFaceOnSurface());
+ 
+@@ -789,8 +739,7 @@
+ 	this->FaceOnSurfaceIndices(&index1,&index2,&index3);
+ 	return SpawnTria(index1,index2,index3);
+ }/*}}}*/
+-/*FUNCTION Tetra::SpawnTria{{{*/
+-Tria*  Tetra::SpawnTria(int index1,int index2,int index3){
++Tria*    Tetra::SpawnTria(int index1,int index2,int index3){/*{{{*/
+ 
+ 	int analysis_counter;
+ 
+@@ -817,8 +766,7 @@
+ 	return tria;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::Update {{{*/
+-void Tetra::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
++void     Tetra::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ /*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i;
+@@ -922,13 +870,11 @@
+ 	this->InputUpdateFromIoModel(index,iomodel);
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::VelocityInterpolation{{{*/
+-int Tetra::VelocityInterpolation(void){
++int      Tetra::VelocityInterpolation(void){/*{{{*/
+ 	return TetraRef::VelocityInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::ViscousHeating (THIS ONE){{{*/
+-void Tetra::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++void     Tetra::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble phi;
+@@ -944,18 +890,15 @@
+ 	*pphi = phi;
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::PressureInterpolation{{{*/
+-int Tetra::PressureInterpolation(void){
++int      Tetra::PressureInterpolation(void){/*{{{*/
+ 	return TetraRef::PressureInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::TensorInterpolation{{{*/
+-int Tetra::TensorInterpolation(void){
++int      Tetra::TensorInterpolation(void){/*{{{*/
+ 	return TetraRef::TensorInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Tetra::ZeroLevelsetCoordinates{{{*/
+-void Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
++void     Tetra::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
+ 	/*Compute portion of the element that is grounded*/ 
+ 
+ 	IssmDouble  levelset[NUMVERTICES];
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17962)
+@@ -32,30 +32,14 @@
+ /*}}}*/
+ 
+ /*Other*/
+-void Element::AddInput(Input* input_in){/*{{{*/
++void       Element::AddInput(Input* input_in){/*{{{*/
+ 
+ 	/*Call inputs method*/
+ 	_assert_(this->inputs);
+ 	this->inputs->AddInput(input_in);
+ }/*}}}*/
+-/* bool Element::AllActive(void){/\*{{{*\/ */
++void       Element::CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+ 
+-/* 	int numnodes = this->GetNumberOfNodes(); */
+-/* 	for(int i=0;i<numnodes;i++){ */
+-/* 		if(!this->nodes[i]->IsActive()) return false; */
+-/* 	} */
+-/* 	return true; */
+-/* }/\*}}}*\/ */
+-/* bool Element::AnyActive(void){/\*{{{*\/ */
+-
+-/* 	int numnodes = this->GetNumberOfNodes(); */
+-/* 	for(int i=0;i<numnodes;i++){ */
+-/* 		if(this->nodes[i]->IsActive()) return true; */
+-/* 	} */
+-/* 	return false; */
+-/* }/\*}}}*\/ */
+-void Element::CoordinateSystemTransform(IssmDouble** ptransform,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+-
+ 	int         i,counter;
+ 	int         numdofs   = 0;
+ 	IssmDouble  norm;
+@@ -128,10 +112,10 @@
+ 	*ptransform=transform;
+ }
+ /*}}}*/
+-void Element::DeleteMaterials(void){/*{{{*/
++void       Element::DeleteMaterials(void){/*{{{*/
+ 	delete this->material;
+ }/*}}}*/
+-void Element::DeepEcho(void){/*{{{*/
++void       Element::DeepEcho(void){/*{{{*/
+ 
+ 	_printf_(EnumToStringx(this->ObjectEnum())<<" element:\n");
+ 	_printf_("   id : "<<this->id <<"\n");
+@@ -165,7 +149,7 @@
+ 	return;
+ }
+ /*}}}*/
+-void Element::Echo(void){/*{{{*/
++void       Element::Echo(void){/*{{{*/
+ 	_printf_(EnumToStringx(this->ObjectEnum())<<" element:\n");
+ 	_printf_("   id : "<<this->id <<"\n");
+ 	_printf_("   sid: "<<this->sid<<"\n");
+@@ -228,10 +212,10 @@
+ 	delete gauss;
+ 	return divergence;
+ }/*}}}*/
+-void Element::ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){/*{{{*/
++void       Element::ThermalToEnthalpy(IssmDouble* penthalpy,IssmDouble temperature,IssmDouble waterfraction,IssmDouble pressure){/*{{{*/
+ 	matpar->ThermalToEnthalpy(penthalpy,temperature,waterfraction,pressure);
+ }/*}}}*/
+-void Element::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
++void       Element::EnthalpyToThermal(IssmDouble* ptemperature,IssmDouble* pwaterfraction,IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
+ 	matpar->EnthalpyToThermal(ptemperature,pwaterfraction,enthalpy,pressure);
+ }/*}}}*/
+ IssmDouble Element::EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){/*{{{*/
+@@ -240,19 +224,19 @@
+ IssmDouble Element::EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){/*{{{*/
+ 	return matpar->GetEnthalpyDiffusionParameterVolume(numvertices,enthalpy,pressure);
+ }/*}}}*/
+-void Element::FindParam(bool* pvalue,int paramenum){/*{{{*/
++void       Element::FindParam(bool* pvalue,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }/*}}}*/
+-void Element::FindParam(int* pvalue,int paramenum){/*{{{*/
++void       Element::FindParam(int* pvalue,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }/*}}}*/
+-void Element::FindParam(IssmDouble* pvalue,int paramenum){/*{{{*/
++void       Element::FindParam(IssmDouble* pvalue,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalue,paramenum);
+ }/*}}}*/
+-void Element::FindParam(int** pvalues,int* psize,int paramenum){/*{{{*/
++void       Element::FindParam(int** pvalues,int* psize,int paramenum){/*{{{*/
+ 	this->parameters->FindParam(pvalues,psize,paramenum);
+ }/*}}}*/
+-void Element::GetDofList(int** pdoflist,int approximation_enum,int setenum){/*{{{*/
++void       Element::GetDofList(int** pdoflist,int approximation_enum,int setenum){/*{{{*/
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = this->GetNumberOfNodes();
+@@ -275,7 +259,7 @@
+ 	*pdoflist=doflist;
+ }
+ /*}}}*/
+-void Element::GetDofListVelocity(int** pdoflist,int setenum){/*{{{*/
++void       Element::GetDofListVelocity(int** pdoflist,int setenum){/*{{{*/
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int numnodes = this->NumberofNodesVelocity();
+@@ -298,7 +282,7 @@
+ 	*pdoflist=doflist;
+ }
+ /*}}}*/
+-void Element::GetDofListPressure(int** pdoflist,int setenum){/*{{{*/
++void       Element::GetDofListPressure(int** pdoflist,int setenum){/*{{{*/
+ 
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = this->NumberofNodesVelocity();
+@@ -336,7 +320,7 @@
+ 			return this->matpar->GetMaterialParameter(enum_in);
+ 	}
+ }/*}}}*/
+-void Element::GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity){/*{{{*/
++void       Element::GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity){/*{{{*/
+ 	/*Compute deformational heating from epsilon and viscosity */
+ 
+ 	IssmDouble epsilon_matrix[3][3];
+@@ -373,10 +357,10 @@
+ 	*phi=4.*epsilon_eff*epsilon_eff*viscosity;
+ }
+ /*}}}*/
+-Input* Element::GetInput(int inputenum){/*{{{*/
++Input*     Element::GetInput(int inputenum){/*{{{*/
+ 	return inputs->GetInput(inputenum);
+ }/*}}}*/
+-void Element::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){/*{{{*/
++void       Element::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){/*{{{*/
+ 
+ 	/*Recover input*/
+ 	Input* input=this->GetInput(enumtype);
+@@ -399,7 +383,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-void Element::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){/*{{{*/
++void       Element::GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){/*{{{*/
+ 
+ 	/*Recover input*/
+ 	Input* input=this->GetInput(enumtype);
+@@ -424,7 +408,7 @@
+ 	}
+ }
+ /*}}}*/
+-void Element::GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){/*{{{*/
++void       Element::GetInputListOnNodes(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){/*{{{*/
+ 
+ 	_assert_(pvalue);
+ 
+@@ -445,7 +429,7 @@
+ 	}
+ }
+ /*}}}*/
+-void Element::GetInputListOnNodes(IssmDouble* pvalue,int enumtype){/*{{{*/
++void       Element::GetInputListOnNodes(IssmDouble* pvalue,int enumtype){/*{{{*/
+ 
+ 	_assert_(pvalue);
+ 
+@@ -462,7 +446,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-void Element::GetInputListOnNodesVelocity(IssmDouble* pvalue,int enumtype){/*{{{*/
++void       Element::GetInputListOnNodesVelocity(IssmDouble* pvalue,int enumtype){/*{{{*/
+ 
+ 	_assert_(pvalue);
+ 
+@@ -479,35 +463,35 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-void Element::GetInputValue(bool* pvalue,int inputenum){/*{{{*/
++void       Element::GetInputValue(bool* pvalue,int inputenum){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(inputenum);
+ 	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+ 	input->GetInputValue(pvalue);
+ 
+ }/*}}}*/
+-void Element::GetInputValue(int* pvalue,int inputenum){/*{{{*/
++void       Element::GetInputValue(int* pvalue,int inputenum){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(inputenum);
+ 	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+ 	input->GetInputValue(pvalue);
+ 
+ }/*}}}*/
+-void Element::GetInputValue(IssmDouble* pvalue,int inputenum){/*{{{*/
++void       Element::GetInputValue(IssmDouble* pvalue,int inputenum){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(inputenum);
+ 	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+ 	input->GetInputValue(pvalue);
+ 
+ }/*}}}*/
+-void Element::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum){/*{{{*/
++void       Element::GetInputValue(IssmDouble* pvalue,Gauss* gauss,int inputenum){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(inputenum);
+ 	if(!input) _error_("Input " << EnumToStringx(inputenum) << " not found in element");
+ 	input->GetInputValue(pvalue,gauss);
+ 
+ }/*}}}*/
+-void Element::GetNodesSidList(int* sidlist){/*{{{*/
++void       Element::GetNodesSidList(int* sidlist){/*{{{*/
+ 
+ 	_assert_(sidlist);
+ 	_assert_(nodes);
+@@ -517,7 +501,7 @@
+ 	}
+ }
+ /*}}}*/
+-void Element::GetNodesLidList(int* lidlist){/*{{{*/
++void       Element::GetNodesLidList(int* lidlist){/*{{{*/
+ 
+ 	_assert_(lidlist);
+ 	_assert_(nodes);
+@@ -527,7 +511,7 @@
+ 	}
+ }
+ /*}}}*/
+-void  Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){/*{{{*/
++void       Element::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){/*{{{*/
+ 
+ 	/*Fetch number vertices for this element and allocate arrays*/
+ 	int numvertices = this->GetNumberOfVertices();
+@@ -545,14 +529,14 @@
+ 
+ }
+ /*}}}*/
+-void  Element::GetVertexPidList(int* pidlist){/*{{{*/
++void       Element::GetVertexPidList(int* pidlist){/*{{{*/
+ 
+ 	int numvertices = this->GetNumberOfVertices();
+ 	for(int i=0;i<numvertices;i++) pidlist[i]=vertices[i]->Pid();
+ 
+ }
+ /*}}}*/
+-void Element::GetVerticesCoordinates(IssmDouble** pxyz_list){/*{{{*/
++void       Element::GetVerticesCoordinates(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	int         numvertices = this->GetNumberOfVertices();
+ 	IssmDouble* xyz_list    = xNew<IssmDouble>(numvertices*3);
+@@ -561,13 +545,13 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-void Element::GetVerticesSidList(int* sidlist){/*{{{*/
++void       Element::GetVerticesSidList(int* sidlist){/*{{{*/
+ 
+ 	int numvertices = this->GetNumberOfVertices();
+ 	for(int i=0;i<numvertices;i++) sidlist[i]=this->vertices[i]->Sid();
+ }
+ /*}}}*/
+-void Element::GetVerticesConnectivityList(int* connectivity){/*{{{*/
++void       Element::GetVerticesConnectivityList(int* connectivity){/*{{{*/
+ 
+ 	int numvertices = this->GetNumberOfVertices();
+ 	for(int i=0;i<numvertices;i++) connectivity[i]=this->vertices[i]->Connectivity();
+@@ -615,23 +599,23 @@
+ 
+ 	return z;
+ }/*}}}*/
+-bool Element::HasNodeOnBase(){/*{{{*/
++bool       Element::HasNodeOnBase(){/*{{{*/
+ 	return (this->inputs->Max(MeshVertexonbaseEnum)>0.);
+ }/*}}}*/
+-bool Element::HasNodeOnSurface(){/*{{{*/
++bool       Element::HasNodeOnSurface(){/*{{{*/
+ 	return (this->inputs->Max(MeshVertexonsurfaceEnum)>0.);
+ }/*}}}*/
+-int  Element::Id(){/*{{{*/
++int        Element::Id(){/*{{{*/
+ 
+ 	return this->id;
+ 
+ }
+ /*}}}*/
+-void Element::InputChangeName(int original_enum,int new_enum){/*{{{*/
++void       Element::InputChangeName(int original_enum,int new_enum){/*{{{*/
+ 	this->inputs->ChangeEnum(original_enum,new_enum);
+ }
+ /*}}}*/
+-void Element::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){/*{{{*/
++void       Element::InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i,t;
+@@ -699,14 +683,14 @@
+ 		_error_("Cannot add input for vector type " << vector_type << " (not supported)");
+ 	}
+ }/*}}}*/
+-void  Element::InputDuplicate(int original_enum,int new_enum){/*{{{*/
++void       Element::InputDuplicate(int original_enum,int new_enum){/*{{{*/
+ 
+ 	/*Call inputs method*/
+ 	if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);
+ 
+ }
+ /*}}}*/
+-void Element::InputUpdateFromConstant(int constant, int name){/*{{{*/
++void       Element::InputUpdateFromConstant(int constant, int name){/*{{{*/
+ 
+ 	/*Check that name is an element input*/
+ 	if(!IsInput(name)) return;
+@@ -715,7 +699,7 @@
+ 	this->inputs->AddInput(new IntInput(name,constant));
+ }
+ /*}}}*/
+-void Element::InputUpdateFromConstant(IssmDouble constant, int name){/*{{{*/
++void       Element::InputUpdateFromConstant(IssmDouble constant, int name){/*{{{*/
+ 
+ 	/*Check that name is an element input*/
+ 	if(!IsInput(name)) return;
+@@ -724,7 +708,7 @@
+ 	this->inputs->AddInput(new DoubleInput(name,constant));
+ }
+ /*}}}*/
+-void Element::InputUpdateFromConstant(bool constant, int name){/*{{{*/
++void       Element::InputUpdateFromConstant(bool constant, int name){/*{{{*/
+ 
+ 	/*Check that name is an element input*/
+ 	if(!IsInput(name)) return;
+@@ -733,7 +717,7 @@
+ 	this->inputs->AddInput(new BoolInput(name,constant));
+ }
+ /*}}}*/
+-bool Element::IsFloating(){/*{{{*/
++bool       Element::IsFloating(){/*{{{*/
+ 
+ 	bool shelf;
+ 	int  migration_style;
+@@ -751,11 +735,11 @@
+ 
+ 	return shelf;
+ }/*}}}*/
+-bool Element::IsIceInElement(){/*{{{*/
++bool       Element::IsIceInElement(){/*{{{*/
+ 	return (this->inputs->Min(MaskIceLevelsetEnum)<0.);
+ }
+ /*}}}*/
+-bool Element::IsInput(int name){/*{{{*/
++bool       Element::IsInput(int name){/*{{{*/
+ 	if (
+ 				name==ThicknessEnum ||
+ 				name==SurfaceEnum ||
+@@ -846,7 +830,7 @@
+ IssmDouble Element::PureIceEnthalpy(IssmDouble pressure){/*{{{*/
+ 	return this->matpar->PureIceEnthalpy(pressure);
+ }/*}}}*/
+-void Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
++void       Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+ 
+@@ -897,7 +881,7 @@
+ 	*pinterpolation   = input->GetResultInterpolation();
+ 	*pnodesperelement = input->GetResultNumberOfNodes();
+ }/*}}}*/
+-void Element::ResultToVector(Vector<IssmDouble>* vector,int output_enum){/*{{{*/
++void       Element::ResultToVector(Vector<IssmDouble>* vector,int output_enum){/*{{{*/
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+ 	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+@@ -943,7 +927,7 @@
+ 					 _error_("interpolation "<<EnumToStringx(input->GetResultInterpolation())<<" not supported yet");
+ 	}
+ } /*}}}*/
+-void Element::ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum){/*{{{*/
++void       Element::ResultToPatch(IssmDouble* values,int nodesperelement,int output_enum){/*{{{*/
+ 
+ 	Input* input=this->inputs->GetInput(output_enum);
+ 	if(!input) _error_("input "<<EnumToStringx(output_enum)<<" not found in element");
+@@ -951,7 +935,7 @@
+ 	input->ResultToPatch(values,nodesperelement,this->Sid());
+ 
+ } /*}}}*/
+-void Element::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){/*{{{*/
++void       Element::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int* flagsindices,int set1_enum,int set2_enum){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	const int numnodes = this->GetNumberOfNodes();
+@@ -1021,7 +1005,7 @@
+ 	*po_nz=o_nz;
+ }
+ /*}}}*/
+-int  Element::Sid(){/*{{{*/
++int        Element::Sid(){/*{{{*/
+ 
+ 	return this->sid;
+ 
+@@ -1031,7 +1015,7 @@
+ 	_assert_(matpar);
+ 	return this->matpar->TMeltingPoint(pressure);
+ }/*}}}*/
+-void Element::ViscousHeatingCreateInput(void){/*{{{*/
++void       Element::ViscousHeatingCreateInput(void){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble phi;
+@@ -1073,7 +1057,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-void Element::ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
++void       Element::ViscosityFS(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
+ 	/*The effective strain rate is defined in Paterson 3d Ed p 91 eq 9,
+ 	 * and Cuffey p 303 eq 8.18:
+ 	 *
+@@ -1112,7 +1096,7 @@
+ 	*pviscosity=viscosity;
+ }
+ /*}}}*/
+-void Element::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){/*{{{*/
++void       Element::ViscosityL1L2(IssmDouble* pviscosity,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* surface_input){/*{{{*/
+ 	/*Compute the L1L2 viscosity
+ 	 *
+ 	 *      1
+@@ -1171,7 +1155,7 @@
+ 	/*Assign output pointer*/
+ 	*pviscosity = viscosity;
+ }/*}}}*/
+-void Element::ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void       Element::ViscosityHO(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+@@ -1196,7 +1180,7 @@
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }/*}}}*/
+-void Element::ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void       Element::ViscositySSA(IssmDouble* pviscosity,int dim,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble viscosity;
+@@ -1221,16 +1205,16 @@
+ 	/*Assign output pointer*/
+ 	*pviscosity=viscosity;
+ }/*}}}*/
+-void Element::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++void       Element::ViscositySSADerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
+ 	this->material->GetViscosity2dDerivativeEpsSquare(pmu_prime,epsilon);
+ }/*}}}*/
+-void Element::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++void       Element::ViscosityHODerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
+ 	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
+ }/*}}}*/
+-void Element::ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
++void       Element::ViscosityFSDerivativeEpsSquare(IssmDouble* pmu_prime,IssmDouble* epsilon){/*{{{*/
+ 	this->material->GetViscosityDerivativeEpsSquare(pmu_prime,epsilon);
+ }/*}}}*/
+-void Element::StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
++void       Element::StrainRateFS(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
+ 	/*Compute the 3d Strain Rate (6 components):
+ 	 *
+ 	 * epsilon=[exx eyy ezz exy exz eyz]
+@@ -1258,7 +1242,7 @@
+ 	epsilon[5] = 0.5*(dvy[2] + dvz[1]);
+ 
+ }/*}}}*/
+-void Element::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void       Element::StrainRateHO(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 	/*Compute the 3d Blatter/HOStrain Rate (5 components):
+ 	 *
+ 	 * epsilon=[exx eyy exy exz eyz]
+@@ -1288,7 +1272,7 @@
+ 	epsilon[4] = 0.5*dvy[2];
+ 
+ }/*}}}*/
+-void Element::StrainRateHO2dvertical(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void       Element::StrainRateHO2dvertical(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 	/*Compute the 2d Blatter/HOStrain Rate (2 components):
+ 	 *
+ 	 * epsilon=[exx exz]
+@@ -1312,7 +1296,7 @@
+ 	epsilon[1] = 0.5*dvx[1];
+ 
+ }/*}}}*/
+-void Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
++void       Element::StrainRateSSA(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble dvx[3];
+@@ -1331,7 +1315,7 @@
+ 	epsilon[2] = 0.5*(dvx[1] + dvy[0]);
+ 
+ }/*}}}*/
+-void Element::StrainRateSSA1d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input){/*{{{*/
++void       Element::StrainRateSSA1d(IssmDouble* epsilon,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble dvx[3];
+@@ -1346,7 +1330,7 @@
+ 	*epsilon = dvx[0];
+ 
+ }/*}}}*/
+-void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
++void       Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
+ 
+ 	/*All nodes have the same Coordinate System*/
+ 	int numnodes  = this->GetNumberOfNodes();
+@@ -1359,7 +1343,7 @@
+ 	/*Clean-up*/
+ 	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++void       Element::TransformInvStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+ 
+ 	int         i,j;
+ 	int         numdofs   = 0;
+@@ -1393,7 +1377,7 @@
+ 	xDelete<IssmDouble>(transform);
+ 	xDelete<IssmDouble>(values);
+ }/*}}}*/
+-void Element::TransformLoadVectorCoord(ElementVector* pe,int transformenum){/*{{{*/
++void       Element::TransformLoadVectorCoord(ElementVector* pe,int transformenum){/*{{{*/
+ 
+ 	/*All nodes have the same Coordinate System*/
+ 	int  numnodes = this->GetNumberOfNodes();
+@@ -1406,12 +1390,12 @@
+ 	/*Clean-up*/
+ 	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformLoadVectorCoord(ElementVector* pe,int* cs_array){/*{{{*/
++void       Element::TransformLoadVectorCoord(ElementVector* pe,int* cs_array){/*{{{*/
+ 
+ 	this->TransformLoadVectorCoord(pe,this->nodes,this->GetNumberOfNodes(),cs_array);
+ 
+ }/*}}}*/
+-void Element::TransformLoadVectorCoord(ElementVector* pe,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++void       Element::TransformLoadVectorCoord(ElementVector* pe,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+ 
+ 	int         i;
+ 	int         numdofs   = 0;
+@@ -1444,7 +1428,7 @@
+ 	xDelete<IssmDouble>(transform);
+ 	xDelete<IssmDouble>(values);
+ }/*}}}*/
+-void Element::TransformSolutionCoord(IssmDouble* values,int transformenum){/*{{{*/
++void       Element::TransformSolutionCoord(IssmDouble* values,int transformenum){/*{{{*/
+ 
+ 	/*All nodes have the same Coordinate System*/
+ 	int  numnodes = this->GetNumberOfNodes();
+@@ -1457,10 +1441,10 @@
+ 	/*Clean-up*/
+ 	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){/*{{{*/
++void       Element::TransformSolutionCoord(IssmDouble* values,int* transformenum_list){/*{{{*/
+ 	this->TransformSolutionCoord(values,this->nodes,this->GetNumberOfNodes(),transformenum_list);
+ }/*}}}*/
+-void Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){/*{{{*/
++void       Element::TransformSolutionCoord(IssmDouble* values,int numnodes,int transformenum){/*{{{*/
+ 
+ 	/*All nodes have the same Coordinate System*/
+ 	int* cs_array = xNew<int>(numnodes);
+@@ -1472,10 +1456,10 @@
+ 	/*Clean-up*/
+ 	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformSolutionCoord(IssmDouble* solution,int numnodes,int* cs_array){/*{{{*/
++void       Element::TransformSolutionCoord(IssmDouble* solution,int numnodes,int* cs_array){/*{{{*/
+ 	this->TransformSolutionCoord(solution,this->nodes,numnodes,cs_array);
+ }/*}}}*/
+-void Element::TransformSolutionCoord(IssmDouble* values,Node** nodes_list,int numnodes,int transformenum){/*{{{*/
++void       Element::TransformSolutionCoord(IssmDouble* values,Node** nodes_list,int numnodes,int transformenum){/*{{{*/
+ 	/*NOT NEEDED*/
+ 	/*All nodes have the same Coordinate System*/
+ 	int* cs_array = xNew<int>(numnodes);
+@@ -1487,7 +1471,7 @@
+ 	/*Clean-up*/
+ 	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformSolutionCoord(IssmDouble* solution,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++void       Element::TransformSolutionCoord(IssmDouble* solution,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+ 
+ 	int         i;
+ 	int         numdofs   = 0;
+@@ -1520,7 +1504,7 @@
+ 	xDelete<IssmDouble>(transform);
+ 	xDelete<IssmDouble>(values);
+ }/*}}}*/
+-void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
++void       Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int transformenum){/*{{{*/
+ 
+ 	/*All nodes have the same Coordinate System*/
+ 	int  numnodes = this->GetNumberOfNodes();
+@@ -1533,10 +1517,10 @@
+ 	/*Clean-up*/
+ 	xDelete<int>(cs_array);
+ }/*}}}*/
+-void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){/*{{{*/
++void       Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,int* transformenum_list){/*{{{*/
+ 	this->TransformStiffnessMatrixCoord(Ke,this->nodes,this->GetNumberOfNodes(),transformenum_list);
+ }/*}}}*/
+-void Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
++void       Element::TransformStiffnessMatrixCoord(ElementMatrix* Ke,Node** nodes_list,int numnodes,int* cs_array){/*{{{*/
+ 
+ 	int         numdofs = 0;
+ 	IssmDouble *transform = NULL;
+Index: ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17961)
++++ ../trunk-jpl/src/c/classes/Elements/TriaRef.cpp	(revision 17962)
+@@ -3,7 +3,7 @@
+  */
+ 
+ /*Headers:*/
+-/*{{{*/
++/*{{{*//*{{{*/
+ #ifdef HAVE_CONFIG_H
+ 	#include <config.h>
+ #else
+@@ -21,28 +21,24 @@
+ #define NUMNODESP2  6
+ 
+ /*Object constructors and destructor*/
+-/*FUNCTION TriaRef::TriaRef(){{{*/
+-TriaRef::TriaRef(){
++TriaRef::TriaRef(){/*{{{*/
+ 	this->element_type_list=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::TriaRef(int* types,int nummodels){{{*/
+-TriaRef::TriaRef(const int nummodels){
++TriaRef::TriaRef(const int nummodels){/*{{{*/
+ 
+ 	/*Only allocate pointer*/
+ 	element_type_list=xNew<int>(nummodels);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::~TriaRef(){{{*/
+-TriaRef::~TriaRef(){
++TriaRef::~TriaRef(){/*{{{*/
+ 	xDelete<int>(element_type_list);
+ }
+ /*}}}*/
+ 
+ /*Management*/
+-/*FUNCTION TriaRef::SetElementType{{{*/
+-void TriaRef::SetElementType(int type,int type_counter){
++void TriaRef::SetElementType(int type,int type_counter){/*{{{*/
+ 
+ 	/*initialize element type*/
+ 	this->element_type_list[type_counter]=type;
+@@ -50,8 +46,7 @@
+ /*}}}*/
+ 
+ /*Reference Element numerics*/
+-/*FUNCTION TriaRef::GetSegmentBFlux{{{*/
+-void TriaRef::GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2){
++void TriaRef::GetSegmentBFlux(IssmDouble* B,Gauss* gauss, int index1,int index2){/*{{{*/
+ 	/*Compute B  matrix. B=[phi1 phi2 -phi3 -phi4]
+ 	 *
+ 	 * and phi1=phi3 phi2=phi4
+@@ -76,8 +71,7 @@
+ 	xDelete<IssmDouble>(basis);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetSegmentBprimeFlux{{{*/
+-void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2){
++void TriaRef::GetSegmentBprimeFlux(IssmDouble* Bprime,Gauss* gauss, int index1,int index2){/*{{{*/
+ 	/*Compute Bprime  matrix. Bprime=[phi1 phi2 phi3 phi4]
+ 	 *
+ 	 * and phi1=phi3 phi2=phi4
+@@ -102,8 +96,7 @@
+ 	xDelete<IssmDouble>(basis);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetJacobian{{{*/
+-void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss){
++void TriaRef::GetJacobian(IssmDouble* J, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*The Jacobian is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 
+@@ -120,8 +113,7 @@
+ 	J[2*1+1] = SQRT3/6.0*(2*y3-y1-y2);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetSegmentJacobianDeterminant{{{*/
+-void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){
++void TriaRef::GetSegmentJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated*/
+ 
+@@ -135,8 +127,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetJacobianDeterminant{{{*/
+-void TriaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){
++void TriaRef::GetJacobianDeterminant(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	/*The Jacobian determinant is constant over the element, discard the gaussian points. 
+ 	 * J is assumed to have been allocated of size NDOF2xNDOF2.*/
+ 	IssmDouble J[2][2];
+@@ -150,8 +141,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetJacobianInvert{{{*/
+-void TriaRef::GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss){
++void TriaRef::GetJacobianInvert(IssmDouble*  Jinv, IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	/*Jacobian*/
+ 	IssmDouble J[2][2];
+@@ -164,8 +154,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){{{*/
+-void TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){
++void TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -173,8 +162,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss,int finiteelement){{{*/
+-void TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){
++void TriaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(basis);
+@@ -215,8 +203,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetSegmentNodalFunctions{{{*/
+-void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss,int index1,int index2){
++void TriaRef::GetSegmentNodalFunctions(IssmDouble* basis,Gauss* gauss,int index1,int index2){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	_assert_(index1>=0 && index1<3);
+@@ -255,15 +242,13 @@
+ 	xDelete<IssmDouble>(triabasis);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){{{*/
+-void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){
++void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
+ 
+ 	GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss,this->element_type);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){{{*/
+-void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){
++void TriaRef::GetNodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list, Gauss* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * actual coordinate system): */
+@@ -293,8 +278,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){{{*/
+-void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){
++void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss){/*{{{*/
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -302,8 +286,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss,int finiteelement){{{*/
+-void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){
++void TriaRef::GetNodalFunctionsDerivativesReference(IssmDouble* dbasis,Gauss* gauss_in,int finiteelement){/*{{{*/
+ 	/*This routine returns the values of the nodal functions derivatives  (with respect to the 
+ 	 * natural coordinate system) at the gaussian point. */
+ 
+@@ -370,8 +353,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetInputDerivativeValue{{{*/
+-void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss){
++void TriaRef::GetInputDerivativeValue(IssmDouble* p, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss){/*{{{*/
+ 
+ 	/*From node values of parameter p (plist[0],plist[1],plist[2]), return parameter derivative value at gaussian 
+ 	 * point specified by gauss_basis:
+@@ -403,14 +385,12 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss){{{*/
+-void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss){
++void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss){/*{{{*/
+ 
+ 	GetInputValue(p,plist,gauss,this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){{{*/
+-void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){
++void TriaRef::GetInputValue(IssmDouble* p, IssmDouble* plist, Gauss* gauss,int finiteelement){/*{{{*/
+ 
+ 	/*Output*/
+ 	IssmDouble value =0.;
+@@ -430,14 +410,12 @@
+ 	*p = value;
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::NumberofNodes(){{{*/
+-int TriaRef::NumberofNodes(void){
++int  TriaRef::NumberofNodes(void){/*{{{*/
+ 
+ 	return this->NumberofNodes(this->element_type);
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::NumberofNodes(int finiteelement){{{*/
+-int TriaRef::NumberofNodes(int finiteelement){
++int  TriaRef::NumberofNodes(int finiteelement){/*{{{*/
+ 
+ 	switch(finiteelement){
+ 		case P0Enum:                return NUMNODESP0;
+@@ -458,8 +436,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::VelocityInterpolation{{{*/
+-int TriaRef::VelocityInterpolation(void){
++int  TriaRef::VelocityInterpolation(void){/*{{{*/
+ 
+ 	switch(this->element_type){
+ 		case P1P1Enum:          return P1Enum;
+@@ -474,8 +451,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::PressureInterpolation{{{*/
+-int TriaRef::PressureInterpolation(void){
++int  TriaRef::PressureInterpolation(void){/*{{{*/
+ 
+ 	switch(this->element_type){
+ 		case P1P1Enum:          return P1Enum;
+@@ -490,8 +466,7 @@
+ 	return -1;
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::TensorInterpolation{{{*/
+-int TriaRef::TensorInterpolation(void){
++int  TriaRef::TensorInterpolation(void){/*{{{*/
+ 	/*This routine returns the values of the nodal functions  at the gaussian point.*/
+ 
+ 	switch(this->element_type){
+@@ -500,8 +475,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION TriaRef::NodeOnEdgeIndices{{{*/
+-void TriaRef::NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement){
++void TriaRef::NodeOnEdgeIndices(int* pnumindices,int** pindices,int index,int finiteelement){/*{{{*/
+ 
+ 	/*Output*/
+ 	int  numindices;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17962-17963.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17962-17963.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17962-17963.diff	(revision 17986)
@@ -0,0 +1,57 @@
+Index: ../trunk-jpl/src/m/materials/DepthAvgTempCond.py
+===================================================================
+--- ../trunk-jpl/src/m/materials/DepthAvgTempCond.py	(revision 17962)
++++ ../trunk-jpl/src/m/materials/DepthAvgTempCond.py	(revision 17963)
+@@ -1,28 +1,34 @@
+-def Tbar=DepthAvgTempCond(md)
++import numpy as npy
++from TMeltingPoint  import TMeltingPoint
++
++def DepthAvgTempCond(md):
+    ''' compute conduction dependent temperature profile for an ice sheet. 
+-
+    Usage:
+    Tbar=DepthAvgTempCond(md)
+    '''
+ 
+-	Tpmp=TMeltingPoint(md.materials.meltingpoint,0); #pressure melting point at 0 pressure.
+-	k=md.materials.thermalconductivity
+-	G=md.basalforcings.geothermalflux 
+-	H=md.geometry.thickness
+-	Ts=md.initialization.temperature
+-	alpha=G*H/k
++   Tpmp=TMeltingPoint(md.materials.meltingpoint,0) #pressure melting point at 0 pressure.
+ 
+-	Tbar=npy.zeros(md.mesh.numberofvertices,)
++   k=md.materials.thermalconductivity
++   G=md.basalforcings.geothermalflux
++   H=md.geometry.thickness[:,0]
++   Ts=md.initialization.temperature
++   alpha=G*H/k
+ 
+-	#find temperature average when we are below melting point: 
+-	pos=numpy.nonzero( (Ts+alpha) < Tpmp)
+-	Tbar[pos]=Ts[pos]+alpha[pos]/2
++   Tbar=npy.zeros(md.mesh.numberofvertices,)
+ 
+-	pos=numpy.nonzero( (Ts+alpha) >=Tpmp)
+-	Tbar[pos]=Tpmp+(Tpmp**2-Ts[pos]**2)/2./alpha[pos]+ Tpmp*(Ts[pos]-Tpmp)./alpha[pos]
++   #find temperature average when we are below melting point: 
++   pos=npy.nonzero( Ts+alpha < Tpmp)
++   if pos:
++	   Tbar[pos]=Ts[pos]+alpha[pos]/2 
+ 
+-	#on ice shelf, easier: 
+-	pos=numpy.nonzero(md.mask.groundedice_levelset<=0)
+-	Tbar[pos]=(Ts[pos]+Tpmp)/2;
++   pos=npy.nonzero( Ts+alpha>= Tpmp)
++   if pos:
++	   Tbar[pos]=Tpmp+(Tpmp**2-Ts[pos]**2)/2/alpha[pos]+ Tpmp*(Ts[pos]-Tpmp)/alpha[pos]
++   
++   #on ice shelf, easier: 
++   pos=npy.nonzero(md.mask.groundedice_levelset[0]<=0)
++   if pos:
++	   Tbar[pos]=(Ts[pos]+Tpmp)/2
+ 
+-	return Tbar
++   return Tbar
Index: /issm/oecreview/Archive/17802-17983/ISSM-17963-17964.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17963-17964.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17963-17964.diff	(revision 17986)
@@ -0,0 +1,182 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17963)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 17964)
+@@ -287,7 +287,7 @@
+ 			old_wh_input    ->GetInputValue(&water_head,gauss);
+ 			thickness_input ->GetInputValue(&epl_thickness,gauss);
+ 			
+-			/*Dealing with the sediment part of the transfer term*/
++			/*Dealing with the epl part of the transfer term*/
+ 			transfer=GetHydrologyPVectorTransfer(basalelement,gauss,thickness_input,sed_head_input,epl_head_input,sed_trans_input,residual_input);
+ 			scalar = Jdet*gauss->weight*((water_head*epl_specificstoring*epl_thickness)+(transfer*dt));
+ 			for(int i=0;i<numnodes;i++)pe->values[i]+=scalar*basis[i];
+@@ -409,20 +409,20 @@
+ 		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
+ 		residual_input->GetInputValue(&residual,gauss);
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+-
+-		if(epl_head>sed_head){
+-			if(residual>0.0){	
+-				transfer=0.0;
+-			}
+-			else{
+-				transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
+-				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
+-			}
+-		}
+-		else{
+-			transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
+-			//			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
+-		}
++		transfer=(sediment_transmitivity)/(sediment_thickness*leakage); 
++		/* if(epl_head>sed_head){ */
++		/* 	if(residual>0.0){	 */
++		/* 		transfer=0.0; */
++		/* 	} */
++		/* 	else{ */
++		/* 		transfer=(sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* 		//transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* 	} */
++		/* } */
++		/* else{ */
++		/* 	transfer=(sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* 	//transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* } */
+ 		break;
+ 	default:
+ 		_error_("no case higher than 1 for the Transfer method");
+@@ -462,20 +462,20 @@
+ 		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
+ 		residual_input->GetInputValue(&residual,gauss);
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+-		
+-		if(epl_head>sediment_head){
+-			if(residual>0.0){	
+-				transfer=0.0;
+-			}
+-			else{
+-				transfer=(sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
+-				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
+-			}
+-		}
+-		else{
+-			transfer=(sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
+-			//			transfer=(sediment_storing*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
+-		}
++		transfer=(sediment_transmitivity*sediment_head)/(sediment_thickness*leakage);
++		/* if(epl_head>sediment_head){ */
++		/* 	if(residual>0.0){	 */
++		/* 		transfer=0.0; */
++		/* 	} */
++		/* 	else{ */
++		/* 		transfer=(sediment_transmitivity*sediment_head)/(sediment_thickness*leakage); */
++		/* 		//transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage); */
++		/* 	} */
++		/* } */
++		/* else{ */
++		/* 	transfer=(sediment_transmitivity*sediment_head)/(sediment_thickness*leakage); */
++		/* 	//transfer=(sediment_storing*sediment_transmitivity*sediment_head)/(sediment_thickness*leakage); */
++		/* } */
+ 		break;
+ 	default:
+ 		_error_("no case higher than 1 for the Transfer method");
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17963)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17964)
+@@ -328,6 +328,7 @@
+ 		water_input->GetInputValue(&water_load,gauss);
+ 
+ 		scalar = Jdet*gauss->weight*(water_load);
++
+ 		if(dt!=0.) scalar = scalar*dt;
+ 		for(int i=0;i<numnodes;i++){
+ 			pe->values[i]+=scalar*basis[i];
+@@ -600,21 +601,21 @@
+ 		epl_head_input->GetInputValue(&epl_head,gauss);
+ 		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+-	
+-		if(epl_head>sed_head){
+-			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,base_input);
+-			if(sed_head>=h_max){
+-				transfer=0.0;
+-			}
+-			else{
+-				transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
+-				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage);
+-			}
+-		}
+-		else{
+-			transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
+-			//			transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage);
+-		}
++		transfer=(sediment_transmitivity)/(sediment_thickness*leakage);
++		/* if(epl_head>sed_head){ */
++		/* 	h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,base_input); */
++		/* 	if(sed_head>=h_max){ */
++		/* 		transfer=0.0; */
++		/* 	} */
++		/* 	else{ */
++		/* 		transfer=(sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* 		//transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* 	} */
++		/* } */
++		/* else{ */
++		/* 	transfer=(sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* 	//transfer=(sediment_storing*sediment_transmitivity)/(sediment_thickness*leakage); */
++		/* } */
+ 		break;
+ 	default:
+ 		_error_("no case higher than 1 for the Transfer method");
+@@ -657,21 +658,21 @@
+ 		sed_trans_input->GetInputValue(&sediment_transmitivity,gauss);
+ 
+ 		element->FindParam(&leakage,HydrologydcLeakageFactorEnum);
+-
+-		if(epl_head>sediment_head){
+-			h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,base_input);
+-			if(sediment_head>=h_max){
+-				transfer=0.0;
+-			}
+-			else{
+-				transfer=(sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
+-				//				transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
+-			}
+-		}
+-		else{
+-			transfer=(sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
+-			//			transfer=(sediment_storing*sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
+-		}
++ 		transfer=(sediment_transmitivity*epl_head)/(sediment_thickness*leakage);
++		/* if(epl_head>sediment_head){ */
++		/* 	h_max=GetHydrologyDCInefficientHmax(element,gauss,thickness_input,base_input); */
++ 		/* 	if(sediment_head>=h_max){ */
++		/* 		transfer=0.0; */
++		/* 	} */
++		/* 	else{ */
++		/* 		transfer=(sediment_transmitivity*epl_head)/(sediment_thickness*leakage); */
++		/* 		//transfer=(epl_specificstoring*epl_thickness*sediment_transmitivity*epl_head)/(sediment_thickness*leakage); */
++		/* 	} */
++		/* } */
++		/* else{ */
++		/* 	transfer=(sediment_transmitivity*epl_head)/(sediment_thickness*leakage); */
++		/* 	//transfer=(sediment_storing*sediment_transmitivity*epl_head)/(sediment_thickness*leakage); */
++		/* } */
+ 		break;
+ 	default:
+ 		_error_("no case higher than 1 for the Transfer method");
+Index: ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17963)
++++ ../trunk-jpl/src/c/classes/Loads/Pengrid.cpp	(revision 17964)
+@@ -645,7 +645,7 @@
+ 	if(penalty_lock){
+ 		if(zigzag_counter>penalty_lock){
+ 			unstable=0;
+-			active=0;
++			active=1;
+ 		}
+ 	}
+ 	/*Set penalty flag*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17964-17965.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17964-17965.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17964-17965.diff	(revision 17986)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/src/m/mech/analyticaldamage.py
+===================================================================
+--- ../trunk-jpl/src/m/mech/analyticaldamage.py	(revision 17964)
++++ ../trunk-jpl/src/m/mech/analyticaldamage.py	(revision 17965)
+@@ -1,6 +1,6 @@
+ import numpy as npy
+ from averaging import averaging
+-from plotmodel import plotmodel
++#from plotmodel import plotmodel
+ from thomasparams import thomasparams
+ 
+ def analyticaldamage(md,**kwargs):
Index: /issm/oecreview/Archive/17802-17983/ISSM-17965-17966.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17965-17966.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17965-17966.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/m/classes/verbose.py
+===================================================================
+--- ../trunk-jpl/src/m/classes/verbose.py	(revision 17965)
++++ ../trunk-jpl/src/m/classes/verbose.py	(revision 17966)
+@@ -49,7 +49,7 @@
+ 		elif len(args) == 1:
+ 			binary=args[0]
+ 			if   isinstance(binary,(str,unicode)):
+-				if strcmpi(binary,'all'):
++				if binary.lower()=='all':
+ 					binary=2**11-1    #all ones
+ 					self.BinaryToVerbose(binary)
+ 					self.solver=False    #Do not use by default
Index: /issm/oecreview/Archive/17802-17983/ISSM-17966-17967.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17966-17967.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17966-17967.diff	(revision 17986)
@@ -0,0 +1,1340 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17966)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17967)
+@@ -19,13 +19,11 @@
+ #define NUMVERTICES2D 3
+ 
+ /*Constructors/destructor/copy*/
+-/*FUNCTION Penta::~Penta(){{{*/
+-Penta::~Penta(){
++Penta::~Penta(){/*{{{*/
+ 	this->parameters=NULL;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{*/
+-Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels)
++Penta::Penta(int penta_id, int penta_sid, int index, IoModel* iomodel,int nummodels)/*{{{*/
+ 	:PentaRef(nummodels)
+ 	,ElementHook(nummodels,index+1,NUMVERTICES,iomodel){
+ 
+@@ -60,8 +58,7 @@
+ 	this->verticalneighbors = NULL;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::copy {{{*/
+-Object* Penta::copy() {
++Object* Penta::copy() {/*{{{*/
+ 
+ 	int i;
+ 
+@@ -107,15 +104,13 @@
+ /*}}}*/
+ 
+ /*Other*/
+-/*FUNCTION Penta::AddInput{{{*/
+-void  Penta::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){
++void       Penta::AddInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
+ 
+ 	_assert_(this->inputs);
+ 	this->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));
+ }
+ /*}}}*/
+-/*FUNCTION Penta::AddBasalInput{{{*/
+-void  Penta::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){
++void       Penta::AddBasalInput(int input_enum,IssmDouble* values, int interpolation_enum){/*{{{*/
+ 
+ 	_assert_(this->inputs);
+ 	if(!IsOnBase()) return;
+@@ -140,8 +135,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ComputeBasalStress {{{*/
+-void  Penta::ComputeBasalStress(Vector<IssmDouble>* sigma_b){
++void       Penta::ComputeBasalStress(Vector<IssmDouble>* sigma_b){/*{{{*/
+ 
+ 	int         i,j;
+ 	int         dofv[3]={0,1,2};
+@@ -228,8 +222,7 @@
+ 	sigma_b->SetValue(id-1,value,INS_VAL);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ComputeStrainRate {{{*/
+-void  Penta::ComputeStrainRate(){
++void       Penta::ComputeStrainRate(){/*{{{*/
+ 
+ 	IssmDouble      xyz_list[NUMVERTICES][3];
+ 	IssmDouble      epsilon[6]; /* epsilon=[exx,eyy,exy];*/
+@@ -277,8 +270,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ComputeStressTensor {{{*/
+-void  Penta::ComputeStressTensor(){
++void       Penta::ComputeStressTensor(){/*{{{*/
+ 
+ 	IssmDouble      xyz_list[NUMVERTICES][3];
+ 	IssmDouble      pressure,viscosity;
+@@ -331,8 +323,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ComputeDeviatoricStressTensor {{{*/
+-void  Penta::ComputeDeviatoricStressTensor(){
++void       Penta::ComputeDeviatoricStressTensor(){/*{{{*/
+ 
+ 	IssmDouble      xyz_list[NUMVERTICES][3];
+ 	IssmDouble      viscosity;
+@@ -383,8 +374,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::Configure {{{*/
+-void  Penta::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){
++void       Penta::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin){/*{{{*/
+ 
+ 	int analysis_counter;
+ 
+@@ -417,8 +407,7 @@
+ 	this->inputs->Configure(parameters);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::Delta18oParameterization{{{*/
+-void  Penta::Delta18oParameterization(void){
++void       Penta::Delta18oParameterization(void){/*{{{*/
+ 
+ 	/*Are we on the base? If not, return*/
+ 	if(!IsOnBase()) return;
+@@ -492,13 +481,11 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::FiniteElement{{{*/
+-int Penta::FiniteElement(void){
++int        Penta::FiniteElement(void){/*{{{*/
+ 	return this->element_type;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::FSContactMigration{{{*/
+-void Penta::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){
++void       Penta::FSContactMigration(Vector<IssmDouble>* vertexgrounded,Vector<IssmDouble>* vertexfloating){/*{{{*/
+ 
+ 	if(!IsOnBase()) return;
+ 
+@@ -579,15 +566,13 @@
+ 	xDelete<IssmDouble>(xyz_list);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ObjectEnum{{{*/
+-int Penta::ObjectEnum(void){
++int        Penta::ObjectEnum(void){/*{{{*/
+ 
+ 	return PentaEnum;
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetAreaCoordinates{{{*/
+-void Penta::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){
++void       Penta::GetAreaCoordinates(IssmDouble* area_coordinates,IssmDouble* xyz_zero,IssmDouble* xyz_list,int numpoints){/*{{{*/
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	int         i,j,k;
+@@ -622,8 +607,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetUpperPenta{{{*/
+-Penta* Penta::GetUpperPenta(void){
++Penta*     Penta::GetUpperPenta(void){/*{{{*/
+ 
+ 	Penta* upper_penta=NULL;
+ 
+@@ -632,8 +616,7 @@
+ 	return upper_penta;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetLowerPenta{{{*/
+-Penta* Penta::GetLowerPenta(void){
++Penta*     Penta::GetLowerPenta(void){/*{{{*/
+ 
+ 	Penta* lower_penta=NULL;
+ 
+@@ -642,8 +625,7 @@
+ 	return lower_penta;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetSurfacePenta{{{*/
+-Penta* Penta::GetSurfacePenta(void){
++Penta*     Penta::GetSurfacePenta(void){/*{{{*/
+ 
+ 	/*Output*/
+ 	Penta* penta=NULL;
+@@ -663,8 +645,7 @@
+ 	return penta;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetBasalPenta{{{*/
+-Penta* Penta::GetBasalPenta(void){
++Penta*     Penta::GetBasalPenta(void){/*{{{*/
+ 
+ 	/*Output*/
+ 	Penta* penta=NULL;
+@@ -684,24 +665,21 @@
+ 	return penta;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetUpperElement{{{*/
+-Element* Penta::GetUpperElement(void){
++Element*   Penta::GetUpperElement(void){/*{{{*/
+ 
+ 	/*Output*/
+ 	Element* upper_element=this->GetUpperPenta();
+ 	return upper_element;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetBasalElement{{{*/
+-Element* Penta::GetBasalElement(void){
++Element*   Penta::GetBasalElement(void){/*{{{*/
+ 
+ 	/*Output*/
+ 	Element* element=this->GetBasalPenta();
+ 	return element;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetGroundedPart{{{*/
+-void Penta::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){
++void       Penta::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){/*{{{*/
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	bool               floating=true;
+@@ -754,8 +732,7 @@
+ 	*mainlyfloating=floating;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetGroundedPortion{{{*/
+-IssmDouble Penta::GetGroundedPortion(IssmDouble* xyz_list){
++IssmDouble Penta::GetGroundedPortion(IssmDouble* xyz_list){/*{{{*/
+ 	/*Computeportion of the element that is grounded*/ 
+ 
+ 	bool               mainlyfloating = true;
+@@ -856,15 +833,13 @@
+ 	return phi;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetElementType {{{*/
+-int Penta::GetElementType(){
++int        Penta::GetElementType(){/*{{{*/
+ 
+ 	/*return PentaRef field*/
+ 	return this->element_type;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ElementSizes{{{*/
+-void Penta::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){
++void       Penta::ElementSizes(IssmDouble* hx,IssmDouble* hy,IssmDouble* hz){/*{{{*/
+ 
+ 	IssmDouble xyz_list[NUMVERTICES][3];
+ 	IssmDouble xmin,ymin,zmin;
+@@ -890,8 +865,7 @@
+ 	*hz=zmax-zmin;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetNodeIndex {{{*/
+-int Penta::GetNodeIndex(Node* node){
++int        Penta::GetNodeIndex(Node* node){/*{{{*/
+ 
+ 	_assert_(nodes);
+ 	int numnodes = this->NumberofNodes();
+@@ -903,25 +877,21 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetNumberOfNodes;{{{*/
+-int Penta::GetNumberOfNodes(void){
++int        Penta::GetNumberOfNodes(void){/*{{{*/
+ 	return this->NumberofNodes();
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetNumberOfVertices;{{{*/
+-int Penta::GetNumberOfVertices(void){
++int        Penta::GetNumberOfVertices(void){/*{{{*/
+ 	return NUMVERTICES; 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetNode(int node_number) {{{*/
+-Node* Penta::GetNode(int node_number){
++Node* Penta::GetNode(int node_number){/*{{{*/
+ 	_assert_(node_number>=0); 
+ 	_assert_(node_number<this->NumberofNodes()); 
+ 	return this->nodes[node_number];
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/
+-void Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){
++void       Penta::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){/*{{{*/
+ 
+ 	Input* input=inputs->GetInput(enumtype);
+ 	if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
+@@ -933,8 +903,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){{{*/
+-void Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){
++void       Penta::GetVerticesCoordinatesBase(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES2D*3);
+ 	::GetVerticesCoordinates(xyz_list,this->vertices,NUMVERTICES2D);
+@@ -943,8 +912,7 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-/*FUNCTION Penta::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){{{*/
+-void Penta::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){
++void       Penta::GetVerticesCoordinatesTop(IssmDouble** pxyz_list){/*{{{*/
+ 
+ 	IssmDouble* xyz_list = xNew<IssmDouble>(NUMVERTICES2D*3);
+ 	::GetVerticesCoordinates(xyz_list,&this->vertices[3],NUMVERTICES2D);
+@@ -953,8 +921,7 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
+-/*FUNCTION Penta::NormalSection{{{*/
+-void Penta::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){
++void       Penta::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	/*Build unit outward pointing vector*/
+ 	IssmDouble AB[3];
+@@ -974,8 +941,7 @@
+ 	for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::StabilizationParameter {{{*/
+-IssmDouble Penta::StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){
++IssmDouble Penta::StabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa){/*{{{*/
+ 	/*Compute stabilization parameter*/
+ 	/*kappa=thermalconductivity/(rho_ice*hearcapacity) for thermal model*/
+ 	/*kappa=enthalpydiffusionparameter for enthalpy model*/
+@@ -992,8 +958,7 @@
+ 	return tau_parameter;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ZeroLevelsetCoordinates{{{*/
+-void Penta::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){
++void       Penta::ZeroLevelsetCoordinates(IssmDouble** pxyz_zero,IssmDouble* xyz_list,int levelsetenum){/*{{{*/
+ 	/*Compute portion of the element that is grounded*/ 
+ 
+ 	int         normal_orientation=0;
+@@ -1148,8 +1113,7 @@
+ 	*pxyz_zero= xyz_zero;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputDepthAverageAtBase{{{*/
+-void  Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){
++void       Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){/*{{{*/
+ 
+ 	int  step,i;
+ 	IssmDouble  xyz_list[NUMVERTICES][3];
+@@ -1250,8 +1214,7 @@
+ 	this->inputs->AddInput((Input*)depth_averaged_input);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputExtrude {{{*/
+-void  Penta::InputExtrude(int enum_type){
++void       Penta::InputExtrude(int enum_type){/*{{{*/
+ 
+ 	int     i,num_inputs;
+ 	Penta  *penta       = NULL;
+@@ -1294,8 +1257,7 @@
+ 	xDelete<Input*>(base_inputs);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputScale{{{*/
+-void  Penta::InputScale(int enum_type,IssmDouble scale_factor){
++void       Penta::InputScale(int enum_type,IssmDouble scale_factor){/*{{{*/
+ 
+ 	Input* input=NULL;
+ 
+@@ -1307,8 +1269,7 @@
+ 	input->Scale(scale_factor);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromIoModel {{{*/
+-void Penta::InputUpdateFromIoModel(int index,IoModel* iomodel){ 
++void       Penta::InputUpdateFromIoModel(int index,IoModel* iomodel){ /*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int         i,j;
+@@ -1404,8 +1365,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionOneDof{{{*/
+-void  Penta::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){
++void       Penta::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){/*{{{*/
+ 
+ 	/*Intermediary*/
+ 	int* doflist = NULL;
+@@ -1431,8 +1391,7 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromSolutionOneDofCollpased{{{*/
+-void  Penta::InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){
++void       Penta::InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){/*{{{*/
+ 
+ 	const int  numdof   = NDOF1*NUMVERTICES;
+ 	const int  numdof2d = NDOF1*NUMVERTICES2D;
+@@ -1471,8 +1430,7 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromVector(IssmDouble* vector, int name, int type);{{{*/
+-void  Penta::InputUpdateFromVector(IssmDouble* vector, int name, int type){
++void       Penta::InputUpdateFromVector(IssmDouble* vector, int name, int type){/*{{{*/
+ 
+ 	const int   numdof         = NDOF1 *NUMVERTICES;
+ 	int        *doflist        = NULL;
+@@ -1531,8 +1489,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsOnBase{{{*/
+-bool Penta::IsOnBase(void){
++bool       Penta::IsOnBase(void){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -1550,8 +1507,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsOnSurface{{{*/
+-bool Penta::IsOnSurface(void){
++bool       Penta::IsOnSurface(void){/*{{{*/
+ 
+ 	IssmDouble values[NUMVERTICES];
+ 	IssmDouble sum;
+@@ -1569,8 +1525,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsNodeOnShelfFromFlags {{{*/
+-bool   Penta::IsNodeOnShelfFromFlags(IssmDouble* flags){
++bool   Penta::IsNodeOnShelfFromFlags(IssmDouble* flags){/*{{{*/
+ 
+ 	int  i;
+ 	bool shelf=false;
+@@ -1584,48 +1539,42 @@
+ 	return shelf;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::JacobianDeterminant{{{*/
+-void Penta::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){
++void       Penta::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetJacobianDeterminant(pJdet,xyz_list,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::JacobianDeterminantBase{{{*/
+-void Penta::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){
++void       Penta::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetTriaJacobianDeterminant(pJdet,xyz_list_base,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::JacobianDeterminantLine{{{*/
+-void Penta::JacobianDeterminantLine(IssmDouble* pJdet,IssmDouble* xyz_list_line,Gauss* gauss){
++void       Penta::JacobianDeterminantLine(IssmDouble* pJdet,IssmDouble* xyz_list_line,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetSegmentJacobianDeterminant(pJdet,xyz_list_line,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::JacobianDeterminantTop{{{*/
+-void Penta::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_top,Gauss* gauss){
++void       Penta::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_top,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetTriaJacobianDeterminant(pJdet,xyz_list_top,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::JacobianDeterminantSurface{{{*/
+-void Penta::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list_quad,Gauss* gauss){
++void       Penta::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list_quad,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetQuadJacobianDeterminant(pJdet,xyz_list_quad,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MinEdgeLength{{{*/
+-IssmDouble Penta::MinEdgeLength(IssmDouble* xyz_list){
++IssmDouble Penta::MinEdgeLength(IssmDouble* xyz_list){/*{{{*/
+ 	/*Return the minimum lenght of the nine egdes of the penta*/
+ 
+ 	int    i,node0,node1;
+@@ -1646,8 +1595,7 @@
+ 	return minlength;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalValue {{{*/
+-int    Penta::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){
++int    Penta::NodalValue(IssmDouble* pvalue, int index, int natureofdataenum){/*{{{*/
+ 
+ 	int i;
+ 	int found=0;
+@@ -1678,18 +1626,15 @@
+ 	return found;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewGauss(){{{*/
+-Gauss* Penta::NewGauss(void){
++Gauss* Penta::NewGauss(void){/*{{{*/
+ 	return new GaussPenta();
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewGauss(int order){{{*/
+-Gauss* Penta::NewGauss(int order){
++Gauss* Penta::NewGauss(int order){/*{{{*/
+ 	return new GaussPenta(order,order);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){{{*/
+-Gauss* Penta::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){
++Gauss* Penta::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){/*{{{*/
+ 
+ 	IssmDouble  area_coordinates[4][3];
+ 
+@@ -1698,95 +1643,82 @@
+ 	return new GaussPenta(area_coordinates,order_horiz,order_vert);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewGaussBase(int order){{{*/
+-Gauss* Penta::NewGaussBase(int order){
++Gauss* Penta::NewGaussBase(int order){/*{{{*/
+ 	return new GaussPenta(0,1,2,order);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewGaussLine(int vertex1,int vertex2,int order){{{*/
+-Gauss* Penta::NewGaussLine(int vertex1,int vertex2,int order){
++Gauss* Penta::NewGaussLine(int vertex1,int vertex2,int order){/*{{{*/
+ 	return new GaussPenta(vertex1,vertex2,order);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NewGaussTop(int order){{{*/
+-Gauss* Penta::NewGaussTop(int order){
++Gauss* Penta::NewGaussTop(int order){/*{{{*/
+ 	return new GaussPenta(3,4,5,order);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctions{{{*/
+-void Penta::NodalFunctions(IssmDouble* basis, Gauss* gauss){
++void       Penta::NodalFunctions(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctions(basis,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsP1{{{*/
+-void Penta::NodalFunctionsP1(IssmDouble* basis, Gauss* gauss){
++void       Penta::NodalFunctionsP1(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctionsP1(basis,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsDerivatives{{{*/
+-void Penta::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void       Penta::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsP1Derivatives{{{*/
+-void Penta::NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void       Penta::NodalFunctionsP1Derivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctionsP1Derivatives(dbasis,xyz_list,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsMINIDerivatives{{{*/
+-void Penta::NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void       Penta::NodalFunctionsMINIDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctionsMINIDerivatives(dbasis,xyz_list,(GaussPenta*)gauss);
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsDerivativesVelocity{{{*/
+-void Penta::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){
++void       Penta::NodalFunctionsDerivativesVelocity(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussPenta*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsVelocity{{{*/
+-void Penta::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){
++void       Penta::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctions(basis,(GaussPenta*)gauss,this->VelocityInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsPressure{{{*/
+-void Penta::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){
++void       Penta::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctions(basis,(GaussPenta*)gauss,this->PressureInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NodalFunctionsTensor{{{*/
+-void Penta::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){
++void       Penta::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){/*{{{*/
+ 
+ 	_assert_(gauss->Enum()==GaussPentaEnum);
+ 	this->GetNodalFunctions(basis,(GaussPenta*)gauss,this->TensorInterpolation());
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NormalBase {{{*/
+-void Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){
++void       Penta::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	IssmDouble v13[3],v23[3];
+ 	IssmDouble normal[3];
+@@ -1808,8 +1740,7 @@
+ 	bed_normal[2]=-normal[2]/normal_norm;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NormalTop {{{*/
+-void Penta::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){
++void       Penta::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){/*{{{*/
+ 
+ 	int i;
+ 	IssmDouble v13[3],v23[3];
+@@ -1831,18 +1762,15 @@
+ 	top_normal[2]=normal[2]/normal_norm;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NumberofNodesPressure{{{*/
+-int Penta::NumberofNodesPressure(void){
++int        Penta::NumberofNodesPressure(void){/*{{{*/
+ 	return PentaRef::NumberofNodes(this->PressureInterpolation());
+ }
+ /*}}}*/
+-/*FUNCTION Penta::NumberofNodesVelocity{{{*/
+-int Penta::NumberofNodesVelocity(void){
++int        Penta::NumberofNodesVelocity(void){/*{{{*/
+ 	return PentaRef::NumberofNodes(this->VelocityInterpolation());
+ }
+ /*}}}*/
+-/*FUNCTION Penta::PositiveDegreeDay{{{*/
+-void  Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){
++void       Penta::PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){/*{{{*/
+ 
+    IssmDouble agd[NUMVERTICES];             // surface mass balance
+    IssmDouble monthlytemperatures[NUMVERTICES][12],monthlyprec[NUMVERTICES][12];
+@@ -1893,8 +1821,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ReduceMatrices{{{*/
+-void Penta::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){
++void       Penta::ReduceMatrices(ElementMatrix* Ke,ElementVector* pe){/*{{{*/
+ 
+ 	int analysis_type;
+ 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
+@@ -1950,8 +1877,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ResetFSBasalBoundaryCondition{{{*/
+-void  Penta::ResetFSBasalBoundaryCondition(void){
++void       Penta::ResetFSBasalBoundaryCondition(void){/*{{{*/
+ 
+ 	int          approximation;
+ 	int          numindices;
+@@ -2013,14 +1939,12 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SetClone {{{*/
+-void  Penta::SetClone(int* minranks){
++void       Penta::SetClone(int* minranks){/*{{{*/
+ 
+ 	_error_("not implemented yet");
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SetCurrentConfiguration {{{*/
+-void  Penta::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){
++void       Penta::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){/*{{{*/
+ 
+ 	/*go into parameters and get the analysis_counter: */
+ 	int analysis_counter;
+@@ -2035,13 +1959,11 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SetTemporaryElementType{{{*/
+-void Penta::SetTemporaryElementType(int element_type_in){
++void       Penta::SetTemporaryElementType(int element_type_in){/*{{{*/
+ 	this->element_type=element_type_in;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SpawnTria {{{*/
+-Tria*  Penta::SpawnTria(int index1,int index2,int index3){
++Tria*      Penta::SpawnTria(int index1,int index2,int index3){/*{{{*/
+ 
+ 	int analysis_counter;
+ 
+@@ -2068,8 +1990,7 @@
+ 	return tria;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SpawnBasalElement{{{*/
+-Element*  Penta::SpawnBasalElement(void){
++Element*   Penta::SpawnBasalElement(void){/*{{{*/
+ 
+ 	_assert_(this->IsOnBase());
+ 
+@@ -2086,8 +2007,7 @@
+ 	return tria;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SpawnTopElement{{{*/
+-Element*  Penta::SpawnTopElement(void){
++Element*   Penta::SpawnTopElement(void){/*{{{*/
+ 
+ 	_assert_(this->IsOnSurface());
+ 
+@@ -2096,8 +2016,7 @@
+ 	return tria;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SmbGradients{{{*/
+-void Penta::SmbGradients(void){
++void       Penta::SmbGradients(void){/*{{{*/
+ 
+ 	int i;
+ 
+@@ -2142,8 +2061,7 @@
+ 	  this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&smb[0],P1Enum));
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SurfaceArea {{{*/
+-IssmDouble Penta::SurfaceArea(void){
++IssmDouble Penta::SurfaceArea(void){/*{{{*/
+ 
+ 	int    approximation;
+ 	IssmDouble S;
+@@ -2179,8 +2097,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::TimeAdapt{{{*/
+-IssmDouble  Penta::TimeAdapt(void){
++IssmDouble Penta::TimeAdapt(void){/*{{{*/
+ 
+ 	int    i;
+ 	IssmDouble C,dx,dy,dz,dt;
+@@ -2223,8 +2140,7 @@
+ 
+ 	return dt;
+ }/*}}}*/
+-/*FUNCTION Penta::Update {{{*/
+-void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ 
++void       Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ /*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	int        i;
+@@ -2530,8 +2446,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::UpdateConstraintsExtrudeFromBase{{{*/
+-void  Penta::UpdateConstraintsExtrudeFromBase(void){
++void       Penta::UpdateConstraintsExtrudeFromBase(void){/*{{{*/
+ 
+ 	if(!IsOnBase()) return;
+ 
+@@ -2555,8 +2470,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::UpdateConstraintsExtrudeFromTop{{{*/
+-void  Penta::UpdateConstraintsExtrudeFromTop(void){
++void       Penta::UpdateConstraintsExtrudeFromTop(void){/*{{{*/
+ 
+ 	if(!IsOnSurface()) return;
+ 
+@@ -2577,24 +2491,20 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ValueP1OnGauss{{{*/
+-void Penta::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){
++void       Penta::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){/*{{{*/
+ 	PentaRef::GetInputValue(pvalue,values,gauss,P1Enum);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ValueP1DerivativesOnGauss{{{*/
+-void Penta::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){
++void       Penta::ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+ 	PentaRef::GetInputDerivativeValue(dvalue,values,xyz_list,gauss);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::VertexConnectivity{{{*/
+-int Penta::VertexConnectivity(int vertexindex){
++int        Penta::VertexConnectivity(int vertexindex){/*{{{*/
+ 	_assert_(this->vertices);
+ 	return this->vertices[vertexindex]->Connectivity();
+ }
+ /*}}}*/
+-/*FUNCTION Penta::VerticalSegmentIndices{{{*/
+-void Penta::VerticalSegmentIndices(int** pindices,int* pnumseg){
++void       Penta::VerticalSegmentIndices(int** pindices,int* pnumseg){/*{{{*/
+ 
+ 	/*output*/
+ 	int *indices = xNew<int>(3*2);
+@@ -2607,8 +2517,7 @@
+ 	*pnumseg  = 3;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ViscousHeating{{{*/
+-void Penta::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){
++void       Penta::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input* vx_input,Input* vy_input,Input* vz_input){/*{{{*/
+ 
+ 	/*Intermediaries*/
+ 	IssmDouble phi;
+@@ -2624,18 +2533,15 @@
+ 	*pphi = phi;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::VelocityInterpolation{{{*/
+-int Penta::VelocityInterpolation(void){
++int        Penta::VelocityInterpolation(void){/*{{{*/
+ 	return PentaRef::VelocityInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Penta::PressureInterpolation{{{*/
+-int Penta::PressureInterpolation(void){
++int        Penta::PressureInterpolation(void){/*{{{*/
+ 	return PentaRef::PressureInterpolation();
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IsZeroLevelset{{{*/
+-bool Penta::IsZeroLevelset(int levelset_enum){
++bool       Penta::IsZeroLevelset(int levelset_enum){/*{{{*/
+ 
+ 	bool        iszerols;
+ 	IssmDouble  ls[NUMVERTICES];
+@@ -2653,7 +2559,7 @@
+ 	return iszerols;
+ }
+ /*}}}*/
+-bool  Penta::IsIcefront(void){/*{{{*/
++bool       Penta::IsIcefront(void){/*{{{*/
+ 
+ 	bool isicefront;
+ 	int i,nrice;
+@@ -2672,13 +2578,11 @@
+ 	}
+ 	return isicefront;
+ }/*}}}*/
+-/*FUNCTION Penta::AverageOntoPartition {{{*/
+-void  Penta::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){
++void       Penta::AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part){/*{{{*/
+ 	_error_("Not supported yet!");
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IceVolume {{{*/
+-IssmDouble Penta::IceVolume(void){
++IssmDouble Penta::IceVolume(void){/*{{{*/
+ 
+ 	/*The volume of a troncated prism is base * 1/3 sum(length of edges)*/
+ 	IssmDouble base,height;
+@@ -2700,8 +2604,7 @@
+ 	return base*height;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::IceVolumeAboveFloatation {{{*/
+-IssmDouble Penta::IceVolumeAboveFloatation(void){
++IssmDouble Penta::IceVolumeAboveFloatation(void){/*{{{*/
+ 
+ 	/*Volume above floatation: H + rho_water/rho_ice*bathymetry for nodes on the bed*/
+ 	IssmDouble rho_ice,rho_water;
+@@ -2731,8 +2634,7 @@
+ 	return base*(surface - bed + min( rho_water/rho_ice * bathymetry, 0.) );
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MinVel{{{*/
+-void  Penta::MinVel(IssmDouble* pminvel){
++void       Penta::MinVel(IssmDouble* pminvel){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvel=this->inputs->Min(VelEnum);
+@@ -2741,8 +2643,7 @@
+ 	*pminvel=minvel;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MinVx{{{*/
+-void  Penta::MinVx(IssmDouble* pminvx){
++void       Penta::MinVx(IssmDouble* pminvx){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvx=this->inputs->Min(VxEnum);
+@@ -2751,8 +2652,7 @@
+ 	*pminvx=minvx;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MinVy{{{*/
+-void  Penta::MinVy(IssmDouble* pminvy){
++void       Penta::MinVy(IssmDouble* pminvy){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvy=this->inputs->Min(VyEnum);
+@@ -2761,8 +2661,7 @@
+ 	*pminvy=minvy;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MinVz{{{*/
+-void  Penta::MinVz(IssmDouble* pminvz){
++void       Penta::MinVz(IssmDouble* pminvz){/*{{{*/
+ 
+ 	/*Get minimum:*/
+ 	IssmDouble minvz=this->inputs->Min(VzEnum);
+@@ -2771,8 +2670,7 @@
+ 	*pminvz=minvz;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MassFlux {{{*/
+-IssmDouble Penta::MassFlux( IssmDouble* segment){
++IssmDouble Penta::MassFlux( IssmDouble* segment){/*{{{*/
+ 
+ 	IssmDouble mass_flux=0;
+ 
+@@ -2795,8 +2693,7 @@
+ 	return mass_flux;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MassFlux {{{*/
+-IssmDouble Penta::MassFlux( IssmDouble x1, IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id){
++IssmDouble Penta::MassFlux( IssmDouble x1, IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id){/*{{{*/
+ 
+ 	IssmDouble mass_flux=0;
+ 
+@@ -2819,8 +2716,7 @@
+ 	return mass_flux;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MaxAbsVx{{{*/
+-void  Penta::MaxAbsVx(IssmDouble* pmaxabsvx){
++void       Penta::MaxAbsVx(IssmDouble* pmaxabsvx){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxabsvx=this->inputs->MaxAbs(VxEnum);
+@@ -2829,8 +2725,7 @@
+ 	*pmaxabsvx=maxabsvx;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MaxAbsVy{{{*/
+-void  Penta::MaxAbsVy(IssmDouble* pmaxabsvy){
++void       Penta::MaxAbsVy(IssmDouble* pmaxabsvy){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxabsvy=this->inputs->MaxAbs(VyEnum);
+@@ -2839,8 +2734,7 @@
+ 	*pmaxabsvy=maxabsvy;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MaxAbsVz{{{*/
+-void  Penta::MaxAbsVz(IssmDouble* pmaxabsvz){
++void       Penta::MaxAbsVz(IssmDouble* pmaxabsvz){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxabsvz=this->inputs->MaxAbs(VzEnum);
+@@ -2849,8 +2743,7 @@
+ 	*pmaxabsvz=maxabsvz;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MaxVel{{{*/
+-void  Penta::MaxVel(IssmDouble* pmaxvel){
++void       Penta::MaxVel(IssmDouble* pmaxvel){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvel=this->inputs->Max(VelEnum);
+@@ -2860,8 +2753,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MaxVx{{{*/
+-void  Penta::MaxVx(IssmDouble* pmaxvx){
++void       Penta::MaxVx(IssmDouble* pmaxvx){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvx=this->inputs->Max(VxEnum);
+@@ -2870,8 +2762,7 @@
+ 	*pmaxvx=maxvx;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MaxVy{{{*/
+-void  Penta::MaxVy(IssmDouble* pmaxvy){
++void       Penta::MaxVy(IssmDouble* pmaxvy){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvy=this->inputs->Max(VyEnum);
+@@ -2880,8 +2771,7 @@
+ 	*pmaxvy=maxvy;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MaxVz{{{*/
+-void  Penta::MaxVz(IssmDouble* pmaxvz){
++void       Penta::MaxVz(IssmDouble* pmaxvz){/*{{{*/
+ 
+ 	/*Get maximum:*/
+ 	IssmDouble maxvz=this->inputs->Max(VzEnum);
+@@ -2890,8 +2780,7 @@
+ 	*pmaxvz=maxvz;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ElementResponse{{{*/
+-void Penta::ElementResponse(IssmDouble* presponse,int response_enum){
++void       Penta::ElementResponse(IssmDouble* presponse,int response_enum){/*{{{*/
+ 
+ 	switch(response_enum){
+ 		case MaterialsRheologyBbarEnum:
+@@ -2920,8 +2809,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::TotalSmb {{{*/
+-IssmDouble Penta::TotalSmb(void){
++IssmDouble Penta::TotalSmb(void){/*{{{*/
+ 
+ 	/*The smb[Gt yr-1] of one element is area[m2] * smb [ m ice yr^-1] * rho_ice [kg m-3] / 1e+10^12 */
+ 	IssmDouble base,smb,rho_ice;
+@@ -2952,15 +2840,13 @@
+ /*}}}*/
+ 
+ #ifdef _HAVE_GIA_
+-/*FUNCTION Penta::GiaDeflection {{{*/
+-void Penta::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){
++void       Penta::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){/*{{{*/
+ 	_error_("GIA deflection not implemented yet!");
+ }
+ /*}}}*/
+ #endif
+ 
+-/*FUNCTION Penta::ControlInputGetGradient{{{*/
+-void Penta::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){
++void       Penta::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){/*{{{*/
+ 
+ 	int vertexpidlist[NUMVERTICES];
+ 	Input* input=NULL;
+@@ -2983,8 +2869,7 @@
+ 	((ControlInput*)input)->GetGradient(gradient,&vertexpidlist[0]);
+ 
+ }/*}}}*/
+-/*FUNCTION Penta::ControlInputScaleGradient{{{*/
+-void Penta::ControlInputScaleGradient(int enum_type,IssmDouble scale){
++void       Penta::ControlInputScaleGradient(int enum_type,IssmDouble scale){/*{{{*/
+ 
+ 	Input* input=NULL;
+ 
+@@ -3002,8 +2887,7 @@
+ 
+ 	((ControlInput*)input)->ScaleGradient(scale);
+ }/*}}}*/
+-/*FUNCTION Penta::ControlInputSetGradient{{{*/
+-void Penta::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){
++void       Penta::ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){/*{{{*/
+ 
+ 	int    vertexpidlist[NUMVERTICES];
+ 	IssmDouble grad_list[NUMVERTICES];
+@@ -3028,8 +2912,7 @@
+ 	((ControlInput*)input)->SetGradient(grad_input);
+ 
+ }/*}}}*/
+-/*FUNCTION Penta::ControlToVectors{{{*/
+-void Penta::ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){
++void       Penta::ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){/*{{{*/
+ 
+ 	Input* input=NULL;
+ 
+@@ -3070,8 +2953,7 @@
+ 	vector_gradient->SetValues(NUMVERTICES,&sidlist[0],&gradients[0],ADD_VAL);
+ 
+ }/*}}}*/
+-/*FUNCTION Penta::GradientIndexing{{{*/
+-void Penta::GradientIndexing(int* indexing,int control_index){
++void       Penta::GradientIndexing(int* indexing,int control_index){/*{{{*/
+ 
+ 	/*Get some parameters*/
+ 	int num_controls;
+@@ -3084,8 +2966,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::Gradj {{{*/
+-void  Penta::Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){
++void       Penta::Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){/*{{{*/
+ 	/*dJ/dalpha = ∂L/∂alpha = ∂J/∂alpha + ∂/∂alpha(KU-F)*/
+ 
+ 	int   approximation;
+@@ -3177,8 +3058,7 @@
+ 	xDelete<int>(responses);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GradjDragSSA {{{*/
+-void  Penta::GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){
++void       Penta::GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Gradient is 0 if on shelf or not on bed*/
+ 	if(IsFloating() || !IsOnBase()) return;
+@@ -3189,8 +3069,7 @@
+ 	delete tria->material; delete tria;
+ 
+ } /*}}}*/
+-/*FUNCTION Penta::GradjDragHO {{{*/
+-void  Penta::GradjDragHO(Vector<IssmDouble>* gradient,int control_index){
++void       Penta::GradjDragHO(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	int        i,j;
+ 	int        analysis_type;
+@@ -3260,8 +3139,7 @@
+ 	delete friction;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GradjDragFS {{{*/
+-void  Penta::GradjDragFS(Vector<IssmDouble>* gradient,int control_index){
++void       Penta::GradjDragFS(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	int        i,j;
+ 	int        analysis_type;
+@@ -3352,8 +3230,7 @@
+ 	delete gauss;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GradjBbarSSA {{{*/
+-void  Penta::GradjBbarSSA(Vector<IssmDouble>* gradient,int control_index){
++void       Penta::GradjBbarSSA(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*This element should be collapsed into a tria element at its base*/
+ 	if (!IsOnBase()) return; 
+@@ -3372,8 +3249,7 @@
+ 	this->inputs->DeleteInput(DamageDbarEnum);
+ 
+ } /*}}}*/
+-/*FUNCTION Penta::GradjBbarHO {{{*/
+-void  Penta::GradjBbarHO(Vector<IssmDouble>* gradient,int control_index){
++void       Penta::GradjBbarHO(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Gradient is computed on bed only (Bbar)*/
+ 	if (!IsOnBase()) return;
+@@ -3391,8 +3267,7 @@
+ 	this->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+ 	this->inputs->DeleteInput(DamageDbarEnum);
+ } /*}}}*/
+-/*FUNCTION Penta::GradjBbarFS {{{*/
+-void  Penta::GradjBbarFS(Vector<IssmDouble>* gradient,int control_index){
++void       Penta::GradjBbarFS(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	/*Gradient is computed on bed only (Bbar)*/
+ 	if (!IsOnBase()) return;
+@@ -3410,8 +3285,7 @@
+ 	this->inputs->DeleteInput(MaterialsRheologyBbarEnum);
+ 	this->inputs->DeleteInput(DamageDbarEnum);
+ } /*}}}*/
+-/*FUNCTION Penta::InputControlUpdate{{{*/
+-void  Penta::InputControlUpdate(IssmDouble scalar,bool save_parameter){
++void       Penta::InputControlUpdate(IssmDouble scalar,bool save_parameter){/*{{{*/
+ 
+ 	/*Intermediary*/
+ 	int    num_controls;
+@@ -3454,8 +3328,7 @@
+ 	xDelete<int>(control_type);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SurfaceAverageVelMisfit {{{*/
+-IssmDouble Penta::SurfaceAverageVelMisfit(void){
++IssmDouble Penta::SurfaceAverageVelMisfit(void){/*{{{*/
+ 
+ 	int    approximation;
+ 	IssmDouble J;
+@@ -3491,8 +3364,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SurfaceAbsVelMisfit {{{*/
+-IssmDouble Penta::SurfaceAbsVelMisfit(void){
++IssmDouble Penta::SurfaceAbsVelMisfit(void){/*{{{*/
+ 
+ 	int    approximation;
+ 	IssmDouble J;
+@@ -3528,8 +3400,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SurfaceLogVelMisfit {{{*/
+-IssmDouble Penta::SurfaceLogVelMisfit(void){
++IssmDouble Penta::SurfaceLogVelMisfit(void){/*{{{*/
+ 
+ 	int    approximation;
+ 	IssmDouble J;
+@@ -3565,8 +3436,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SurfaceLogVxVyMisfit {{{*/
+-IssmDouble Penta::SurfaceLogVxVyMisfit(void){
++IssmDouble Penta::SurfaceLogVxVyMisfit(void){/*{{{*/
+ 
+ 	IssmDouble J;
+ 	Tria* tria=NULL;
+@@ -3604,8 +3474,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SurfaceRelVelMisfit {{{*/
+-IssmDouble Penta::SurfaceRelVelMisfit(void){
++IssmDouble Penta::SurfaceRelVelMisfit(void){/*{{{*/
+ 
+ 	int    approximation;
+ 	IssmDouble J;
+@@ -3641,14 +3510,12 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ThicknessAbsGradient{{{*/
+-IssmDouble Penta::ThicknessAbsGradient(void){
++IssmDouble Penta::ThicknessAbsGradient(void){/*{{{*/
+ 
+ 	_error_("Not implemented yet");
+ }
+ /*}}}*/
+-/*FUNCTION Penta::ThicknessAbsMisfit {{{*/
+-IssmDouble Penta::ThicknessAbsMisfit(void){
++IssmDouble Penta::ThicknessAbsMisfit(void){/*{{{*/
+ 
+ 	int    approximation;
+ 	IssmDouble J;
+@@ -3667,8 +3534,7 @@
+ 	return J;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::DragCoefficientAbsGradient{{{*/
+-IssmDouble Penta::DragCoefficientAbsGradient(void){
++IssmDouble Penta::DragCoefficientAbsGradient(void){/*{{{*/
+ 
+ 	IssmDouble J;
+ 	Tria*  tria=NULL;
+@@ -3682,8 +3548,7 @@
+ 	return J;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::RheologyBbarAbsGradient{{{*/
+-IssmDouble Penta::RheologyBbarAbsGradient(void){
++IssmDouble Penta::RheologyBbarAbsGradient(void){/*{{{*/
+ 
+ 	IssmDouble J;
+ 	Tria*  tria=NULL;
+@@ -3697,8 +3562,7 @@
+ 	return J;
+ }
+ /*}}}*/
+-/*FUNCTION Penta::GetVectorFromControlInputs{{{*/
+-void  Penta::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){
++void       Penta::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){/*{{{*/
+ 
+ 	int vertexpidlist[NUMVERTICES];
+ 
+@@ -3720,8 +3584,7 @@
+ 	((ControlInput*)input)->GetVectorFromInputs(vector,&vertexpidlist[0],data);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::SetControlInputsFromVector{{{*/
+-void  Penta::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){
++void       Penta::SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index){/*{{{*/
+ 
+ 	IssmDouble  values[NUMVERTICES];
+ 	int     vertexpidlist[NUMVERTICES];
+@@ -3750,8 +3613,7 @@
+ /*}}}*/
+ 
+ #ifdef _HAVE_DAKOTA_
+-/*FUNCTION Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type);{{{*/
+-void  Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){
++void       Penta::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){/*{{{*/
+ 
+ 	int i,j;
+ 
+@@ -3851,8 +3713,7 @@
+ 
+ }
+ /*}}}*/
+-/*FUNCTION Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type);{{{*/
+-void  Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){
++void       Penta::InputUpdateFromMatrixDakota(IssmDouble* matrix, int nrows, int ncols, int name, int type){/*{{{*/
+ 
+ 	int             i,t,row;
+ 	IssmDouble      time;
+@@ -3891,8 +3752,7 @@
+ }
+ /*}}}*/
+ #endif
+-/*FUNCTION Penta::GetSolutionFromInputsOneDof {{{*/
+-void Penta::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){
++void       Penta::GetSolutionFromInputsOneDof(Vector<IssmDouble>* solution, int enum_type){/*{{{*/
+ 
+ 	const int    numdof=NDOF1*NUMVERTICES;
+ 
+@@ -3922,8 +3782,7 @@
+ 	xDelete<int>(doflist);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::MigrateGroundingLine{{{*/
+-void  Penta::MigrateGroundingLine(IssmDouble* phi_ungrounding){
++void       Penta::MigrateGroundingLine(IssmDouble* phi_ungrounding){/*{{{*/
+ 
+ 	int        i,migration_style;
+ 	bool       oldfloating;
+@@ -4027,8 +3886,7 @@
+ 	this->InputExtrude(BaseEnum);
+ }
+ /*}}}*/
+-/*FUNCTION Penta::PotentialUngrounding{{{*/
+-void  Penta::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){
++void       Penta::PotentialUngrounding(Vector<IssmDouble>* potential_ungrounding){/*{{{*/
+ 
+ 	IssmDouble  h[NUMVERTICES],r[NUMVERTICES],gl[NUMVERTICES];
+ 	IssmDouble  bed_hydro;
+@@ -4055,8 +3913,7 @@
+ 	}
+ }
+ /*}}}*/
+-/*FUNCTION Penta::UpdatePotentialUngrounding{{{*/
+-int Penta::UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
++int        Penta::UpdatePotentialUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){/*{{{*/
+ 
+ 	int i;
+ 	int nflipped=0;
Index: /issm/oecreview/Archive/17802-17983/ISSM-17967-17968.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17967-17968.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17967-17968.diff	(revision 17986)
@@ -0,0 +1,15 @@
+Index: ../trunk-jpl/src/m/classes/m1qn3inversion.m
+===================================================================
+--- ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17967)
++++ ../trunk-jpl/src/m/classes/m1qn3inversion.m	(revision 17968)
+@@ -86,7 +86,9 @@
+ 				md = checkfield(md,'fieldname','inversion.thickness_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+ 			else
+ 				md = checkfield(md,'fieldname','inversion.vx_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
+-				md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				if ~strcmp(domaintype(md.mesh),'2Dvertical'),
++					md = checkfield(md,'fieldname','inversion.vy_obs','size',[md.mesh.numberofvertices 1],'NaN',1);
++				end
+ 			end
+ 		end % }}}
+ 		function disp(obj) % {{{
Index: /issm/oecreview/Archive/17802-17983/ISSM-17968-17969.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17968-17969.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17968-17969.diff	(revision 17986)
@@ -0,0 +1,206 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17968)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17969)
+@@ -207,15 +207,21 @@
+ 
+ 	/*Intermediaries */
+ 	bool        incomplete_adjoint;
++	int         dim,epssize;
+ 	IssmDouble  Jdet,mu_prime;
+ 	IssmDouble  eps1dotdphii,eps1dotdphij,eps2dotdphii,eps2dotdphij,eps3dotdphii,eps3dotdphij;
+ 	IssmDouble  eps1[3],eps2[3],eps3[3],epsilon[5];/* epsilon=[exx,eyy,exy,exz,eyz];*/
+ 	IssmDouble *xyz_list = NULL;
+ 
++	/*Get problem dimension*/
++	element->FindParam(&dim,DomainDimensionEnum);
++	if(dim==2) epssize = 3;
++	else       epssize = 6;
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+ 	int pnumnodes = element->NumberofNodesPressure();
+-	int numdof    = vnumnodes*3 + pnumnodes;
++	int numdof    = vnumnodes*dim + pnumnodes;
+ 
+ 	/*Initialize Jacobian with regular FS (first part of the Gateau derivative)*/
+ 	element->FindParam(&incomplete_adjoint,InversionIncompleteAdjointEnum);
+@@ -228,10 +234,16 @@
+ 	element->GetVerticesCoordinates(&xyz_list);
+ 	Input* vx_input = element->GetInput(VxEnum);_assert_(vx_input);
+ 	Input* vy_input = element->GetInput(VyEnum);_assert_(vy_input);
+-	Input* vz_input = element->GetInput(VzEnum);_assert_(vz_input);
++	Input* vz_input = NULL;
++	if(dim==3){
++		vz_input = element->GetInput(VzEnum);
++	}
++	else{
++		_error_("Not implemented yet");
++	}
+ 
+ 	/*Allocate dbasis*/
+-	IssmDouble* dbasis = xNew<IssmDouble>(3*vnumnodes);
++	IssmDouble* dbasis = xNew<IssmDouble>(dim*vnumnodes);
+ 
+ 	/* Start  looping on the number of gaussian points: */
+ 	Gauss* gauss=element->NewGauss(5);
+@@ -375,9 +387,11 @@
+ 					 */
+ 					for(i=0;i<vnumnodes;i++){
+ 						dux=vxobs-vx;
+-						duy=vyobs-vy;
+ 						pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
+-						pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++						if(dim==3){
++							duy=vyobs-vy;
++							pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++						}
+ 					}
+ 					break;
+ 				case SurfaceRelVelMisfitEnum:
+@@ -414,13 +428,22 @@
+ 					 *            
+ 					 */
+ 					for(i=0;i<vnumnodes;i++){
+-						velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
+-						obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
+-						scale=-8*pow(meanvel,2)/pow(velocity_mag,2)*log(velocity_mag/obs_velocity_mag);
+-						dux=scale*vx;
+-						duy=scale*vy;
+-						pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
+-						pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++						if(dim==3){
++							velocity_mag    =sqrt(vx*vx+vy*vy)+epsvel;
++							obs_velocity_mag=sqrt(vxobs*vxobs+vyobs*vyobs)+epsvel;
++							scale=-8.*meanvel*meanvel/(velocity_mag*velocity_mag)*log(velocity_mag/obs_velocity_mag);
++							dux=scale*vx;
++							duy=scale*vy;
++							pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
++							pe->values[i*dim+1]+=duy*weight*Jdet*gauss->weight*vbasis[i]; 
++						}
++						else{
++							velocity_mag    =fabs(vx)+epsvel;
++							obs_velocity_mag=fabs(vxobs)+epsvel;
++							scale=-8.*meanvel*meanvel/(velocity_mag*velocity_mag)*log(velocity_mag/obs_velocity_mag);
++							dux=scale*vx;
++							pe->values[i*dim+0]+=dux*weight*Jdet*gauss->weight*vbasis[i]; 
++						}
+ 					}
+ 					break;
+ 				case SurfaceAverageVelMisfitEnum:
+Index: ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h	(revision 17968)
++++ ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h	(revision 17969)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void SurfaceAbsVelMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble SurfaceAbsVelMisfit(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 17968)
++++ ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 17969)
+@@ -20,7 +20,7 @@
+ 	/*Compute Misfit: */
+ 	for (i=0;i<elements->Size();i++){
+ 		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->SurfaceAbsVelMisfit();
++		J+=SurfaceAbsVelMisfit(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +31,91 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble SurfaceAbsVelMisfit(Element* element){
++
++	int        domaintype,numcomponents;
++	bool       surfaceintegral;
++	IssmDouble Jelem=0.;
++	IssmDouble misfit,Jdet;
++	IssmDouble vx,vy,vxobs,vyobs,weight;
++	IssmDouble* xyz_list_top = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnSurface()) return 0.;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/*Get problem dimension*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:
++			surfaceintegral = true;
++			numcomponents   = 1;
++			break;
++		case Domain3DEnum:
++			surfaceintegral = true;
++			numcomponents   = 2;
++			break;
++		case Domain2DhorizontalEnum:
++			surfaceintegral = false;
++			numcomponents   = 2;
++			break;
++		default: _error_("not supported yet");
++	}
++
++	/* Get node coordinates*/
++	if(surfaceintegral) element->GetVerticesCoordinatesTop(&xyz_list_top);
++	else                element->GetVerticesCoordinates(&xyz_list_top);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input=element->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
++	Input* vx_input     =element->GetInput(VxEnum);        _assert_(vx_input);
++	Input* vxobs_input  =element->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
++	Input* vy_input     = NULL;
++	Input* vyobs_input  = NULL;
++	if(numcomponents==2){
++		vy_input    =element->GetInput(VyEnum);              _assert_(vy_input);
++		vyobs_input =element->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=NULL;
++	if(surfaceintegral) gauss=element->NewGaussTop(2);
++	else                gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		if(surfaceintegral) element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
++		else                element->JacobianDeterminant(&Jdet,xyz_list_top,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,SurfaceAbsVelMisfitEnum);
++		vx_input->GetInputValue(&vx,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		if(numcomponents==2){
++			vy_input->GetInputValue(&vy,gauss);
++			vyobs_input->GetInputValue(&vyobs,gauss);
++		}
++
++		/*Compute SurfaceAbsVelMisfitEnum:
++		 *
++		 *      1  [           2              2 ]
++		 * J = --- | (u - u   )  +  (v - v   )  |
++		 *      2  [       obs            obs   ]
++		 *
++		 */
++		misfit=0.5*(vx-vxobs)*(vx-vxobs);
++		if(numcomponents==2) misfit+=0.5*(vy-vyobs)*(vy-vyobs);
++
++		/*Add to cost function*/
++		Jelem+=misfit*weight*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	delete gauss;
++	return Jelem;
++}
Index: /issm/oecreview/Archive/17802-17983/ISSM-17969-17970.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17969-17970.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17969-17970.diff	(revision 17986)
@@ -0,0 +1,12 @@
+Index: ../trunk-jpl/test/Archives/Archive215.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive213.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive511.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: /issm/oecreview/Archive/17802-17983/ISSM-17970-17971.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17970-17971.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17970-17971.diff	(revision 17986)
@@ -0,0 +1,234 @@
+Index: ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17970)
++++ ../trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp	(revision 17971)
+@@ -331,7 +331,8 @@
+ 
+ 	/*Prepare coordinate system list*/
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i]           = XYZEnum;
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+ 
+ 	/*Initialize Element vector and vectors*/
+@@ -512,7 +513,6 @@
+ 	xDelete<IssmDouble>(vbasis);
+ 	delete gauss;
+ 	return pe;
+-	_error_("S");
+ }/*}}}*/
+ ElementVector* AdjointHorizAnalysis::CreatePVectorHO(Element* element){/*{{{*/
+ 
+@@ -950,15 +950,17 @@
+ 	xDelete<int>(doflist);
+ }/*}}}*/
+ void AdjointHorizAnalysis::InputUpdateFromSolutionFS(IssmDouble* solution,Element* element){/*{{{*/
+-	int          i;
++	int          i,dim;
+ 	int*         vdoflist=NULL;
+ 	int*         pdoflist=NULL;
+ 	IssmDouble   FSreconditioning;
+ 
++	element->FindParam(&dim,DomainDimensionEnum);
++
+ 	/*Fetch number of nodes and dof for this finite element*/
+ 	int vnumnodes = element->NumberofNodesVelocity();
+ 	int pnumnodes = element->NumberofNodesPressure();
+-	int vnumdof   = vnumnodes*3;
++	int vnumdof   = vnumnodes*dim;
+ 	int pnumdof   = pnumnodes*1;
+ 
+ 	/*Initialize values*/
+@@ -969,7 +971,8 @@
+ 	IssmDouble* lambdap = xNew<IssmDouble>(pnumnodes);
+ 
+ 	int* cs_list = xNew<int>(vnumnodes+pnumnodes);
+-	for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
++	if(dim==2) for(i=0;i<vnumnodes;i++) cs_list[i] = XYEnum;
++	else       for(i=0;i<vnumnodes;i++) cs_list[i] = XYZEnum;
+ 	for(i=0;i<pnumnodes;i++) cs_list[vnumnodes+i] = PressureEnum;
+ 
+ 	/*Get dof list: */
+Index: ../trunk-jpl/src/c/cores/adjointstressbalance_core.cpp
+===================================================================
+--- ../trunk-jpl/src/c/cores/adjointstressbalance_core.cpp	(revision 17970)
++++ ../trunk-jpl/src/c/cores/adjointstressbalance_core.cpp	(revision 17971)
+@@ -37,8 +37,10 @@
+ 	if(save_results || true){
+ 		if(VerboseSolution()) _printf0_("   saving results\n");
+ 		if (isFS){
+-			int outputs[4] = {AdjointxEnum,AdjointyEnum,AdjointzEnum,AdjointpEnum};
+-			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],4);
++			//int outputs[4] = {AdjointxEnum,AdjointyEnum,AdjointzEnum,AdjointpEnum};
++			//femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],4);
++			int outputs[3] = {AdjointxEnum,AdjointyEnum,AdjointpEnum};
++			femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],3);
+ 		}
+ 		else{
+ 			int outputs[2] = {AdjointxEnum,AdjointyEnum};
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17970)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17971)
+@@ -2862,12 +2862,30 @@
+ void       Tria::Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){/*{{{*/
+ 	/*dJ/dalpha = ∂L/∂alpha = ∂J/∂alpha + ∂/∂alpha(KU-F)*/
+ 
++	int   approximation;
++	Seg*  seg=NULL;
++
+ 	/*If on water, grad = 0: */
+ 	if(!IsIceInElement()) return;
+ 
+ 	/*First deal with ∂/∂alpha(KU-F)*/
+ 	switch(control_type){
+ 		case FrictionCoefficientEnum:
++			inputs->GetInputValue(&approximation,ApproximationEnum);
++			switch(approximation){
++				case SSAApproximationEnum:
++					GradjDragSSA(gradient,control_index);
++					break;
++				case FSApproximationEnum:
++					GradjDragFS(gradient,control_index);
++					break;
++				case NoneApproximationEnum:
++					/*Gradient is 0*/
++					break;
++				default:
++					_error_("approximation " << EnumToStringx(approximation) << " not supported yet");
++			}
++			break;
+ 			GradjDragSSA(gradient,control_index);
+ 			break;
+ 		case MaterialsRheologyBbarEnum:
+@@ -3164,6 +3182,18 @@
+ 	delete friction;
+ }
+ /*}}}*/
++void       Tria::GradjDragFS(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
++
++	/*Gradient is 0 if on shelf or not on bed*/
++	if(IsFloating() || !IsOnBase()) return;
++
++	int index1,index2;
++	this->EdgeOnBaseIndices(&index1,&index2);
++	Seg* seg = SpawnSeg(index1,index2);
++	seg->GradjDragFS(gradient,control_index);
++	seg->DeleteMaterials(); delete seg;
++}
++/*}}}*/
+ void       Tria::GradjDragGradient(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
+ 
+ 	int        i;
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17970)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17971)
+@@ -115,6 +115,85 @@
+ 	*pxyz_list = xyz_list;
+ 
+ }/*}}}*/
++void       Seg::GradientIndexing(int* indexing,int control_index){/*{{{*/
++
++	/*Get some parameters*/
++	int num_controls;
++	parameters->FindParam(&num_controls,InversionNumControlParametersEnum);
++
++	/*get gradient indices*/
++	for(int i=0;i<NUMVERTICES;i++){
++		indexing[i]=num_controls*this->vertices[i]->Pid() + control_index;
++	}
++
++}
++/*}}}*/
++void       Seg::GradjDragFS(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
++
++	int        i;
++	int        analysis_type;
++	int        vertexpidlist[NUMVERTICES];
++	int        connectivity[NUMVERTICES];
++	IssmDouble vx,lambda,alpha_complement,drag,Jdet;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble dk[NDOF2]; 
++	IssmDouble grade_g[NUMVERTICES]={0.0};
++	IssmDouble grade_g_gaussian[NUMVERTICES];
++	IssmDouble basis[3];
++	Friction*  friction=NULL;
++	GaussSeg  *gauss=NULL;
++
++	if(IsFloating())return;
++
++	/*retrive parameters: */
++	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	GradientIndexing(&vertexpidlist[0],control_index);
++	this->GetVerticesConnectivityList(&connectivity[0]);
++
++	/*Build frictoin element, needed later: */
++	friction=new Friction(this,1);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* adjointx_input=inputs->GetInput(AdjointxEnum);                   _assert_(adjointx_input);
++	Input* vx_input=inputs->GetInput(VxEnum);                               _assert_(vx_input);
++	Input* dragcoefficient_input=inputs->GetInput(FrictionCoefficientEnum); _assert_(dragcoefficient_input);
++
++	/* Start  looping on the number of gaussian points: */
++	gauss=new GaussSeg(4);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
++		GetNodalFunctions(basis, gauss);
++
++		/*Build alpha_complement_list: */
++		friction->GetAlphaComplement(&alpha_complement,gauss);
++
++		dragcoefficient_input->GetInputValue(&drag, gauss);
++		adjointx_input->GetInputValue(&lambda, gauss);
++		vx_input->GetInputValue(&vx,gauss);
++		dragcoefficient_input->GetInputDerivativeValue(&dk[0],&xyz_list[0][0],gauss);
++
++		/*Build gradje_g_gaussian vector (actually -dJ/ddrag): */
++		for (i=0;i<NUMVERTICES;i++){
++			grade_g_gaussian[i]=-2*drag*alpha_complement*(lambda*vx)*Jdet*gauss->weight*basis[i];
++		}
++
++		/*Add gradje_g_gaussian vector to gradje_g: */
++		for(i=0;i<NUMVERTICES;i++){
++			_assert_(!xIsNan<IssmDouble>(grade_g[i]));
++			grade_g[i]+=grade_g_gaussian[i];
++		}
++	}
++	gradient->SetValues(NUMVERTICES,vertexpidlist,grade_g,ADD_VAL);
++
++	/*Clean up and return*/
++	delete gauss;
++	delete friction;
++}
++/*}}}*/
+ bool       Seg::IsIcefront(void){/*{{{*/
+ 
+ 	bool isicefront;
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17970)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17971)
+@@ -168,14 +168,14 @@
+ #endif
+ 
+ 		IssmDouble DragCoefficientAbsGradient(void){_error_("not implemented yet");};
+-		void       GradientIndexing(int* indexing,int control_index){_error_("not implemented yet");};
++		void       GradientIndexing(int* indexing,int control_index);
+ 		void       Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){_error_("not implemented yet");};
+ 		void       GradjBGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjDGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjBSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjDSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+-		void       GradjDragFS(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDragFS(Vector<IssmDouble>* gradient,int control_index);
+ 		void       GradjDragGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
Index: /issm/oecreview/Archive/17802-17983/ISSM-17971-17972.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17971-17972.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17971-17972.diff	(revision 17986)
@@ -0,0 +1,306 @@
+Index: ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 17971)
++++ ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 17972)
+@@ -9,17 +9,13 @@
+ 
+ void SurfaceAbsVelMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+ 		J+=SurfaceAbsVelMisfit(element);
+ 	}
+ 
+@@ -39,7 +35,7 @@
+ 	IssmDouble Jelem=0.;
+ 	IssmDouble misfit,Jdet;
+ 	IssmDouble vx,vy,vxobs,vyobs,weight;
+-	IssmDouble* xyz_list_top = NULL;
++	IssmDouble* xyz_list = NULL;
+ 
+ 	/*Get basal element*/
+ 	if(!element->IsOnSurface()) return 0.;
+@@ -65,32 +61,31 @@
+ 		default: _error_("not supported yet");
+ 	}
+ 
++	/*Spawn surface element*/
++	Element* topelement = element->SpawnTopElement();
++
+ 	/* Get node coordinates*/
+-	if(surfaceintegral) element->GetVerticesCoordinatesTop(&xyz_list_top);
+-	else                element->GetVerticesCoordinates(&xyz_list_top);
++	topelement->GetVerticesCoordinates(&xyz_list);
+ 
+ 	/*Retrieve all inputs we will be needing: */
+-	Input* weights_input=element->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =element->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vxobs_input  =element->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
++	Input* weights_input=topelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
+ 	Input* vy_input     = NULL;
+ 	Input* vyobs_input  = NULL;
+ 	if(numcomponents==2){
+-		vy_input    =element->GetInput(VyEnum);              _assert_(vy_input);
+-		vyobs_input =element->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
++		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
++		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
+ 	}
+ 
+ 	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=NULL;
+-	if(surfaceintegral) gauss=element->NewGaussTop(2);
+-	else                gauss=element->NewGauss(2);
++	Gauss* gauss=topelement->NewGauss(2);
+ 	for(int ig=gauss->begin();ig<gauss->end();ig++){
+ 
+ 		gauss->GaussPoint(ig);
+ 
+ 		/* Get Jacobian determinant: */
+-		if(surfaceintegral) element->JacobianDeterminantTop(&Jdet,xyz_list_top,gauss);
+-		else                element->JacobianDeterminant(&Jdet,xyz_list_top,gauss);
++		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+ 
+ 		/*Get all parameters at gaussian point*/
+ 		weights_input->GetInputValue(&weight,gauss,SurfaceAbsVelMisfitEnum);
+@@ -116,6 +111,8 @@
+ 	}
+ 
+ 	/*clean up and Return: */
++	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	xDelete<IssmDouble>(xyz_list);
+ 	delete gauss;
+ 	return Jelem;
+ }
+Index: ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp	(revision 17971)
++++ ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp	(revision 17972)
+@@ -9,18 +9,14 @@
+ 
+ void DragCoefficientAbsGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->DragCoefficientAbsGradient();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=DragCoefficientAbsGradient(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,72 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble DragCoefficientAbsGradient(Element* element){
++
++	int         domaintype,numcomponents;
++	bool        surfaceintegral;
++	IssmDouble  Jelem=0.;
++	IssmDouble  misfit,Jdet;
++	IssmDouble  dp[2],weight;
++	IssmDouble* xyz_list      = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBase()) return 0.;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/*Get problem dimension*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:
++			surfaceintegral = true;
++			numcomponents   = 1;
++			break;
++		case Domain3DEnum:
++			surfaceintegral = true;
++			numcomponents   = 2;
++			break;
++		case Domain2DhorizontalEnum:
++			surfaceintegral = false;
++			numcomponents   = 2;
++			break;
++		default: _error_("not supported yet");
++	}
++
++	/*Spawn basal element*/
++	Element* basalelement = element->SpawnBasalElement();
++
++	/* Get node coordinates*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input=basalelement->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
++	Input* drag_input   =basalelement->GetInput(FrictionCoefficientEnum); _assert_(drag_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,DragCoefficientAbsGradientEnum);
++		drag_input->GetInputDerivativeValue(&dp[0],xyz_list,gauss);
++
++		/*Compute Tikhonov regularization J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */
++		Jelem+=weight*.5*dp[0]*dp[0]*Jdet*gauss->weight;
++		if(numcomponents==2) Jelem+=weight*.5*dp[1]*dp[1]*Jdet*gauss->weight;
++
++	}
++
++	/*clean up and Return: */
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h	(revision 17971)
++++ ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h	(revision 17972)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void DragCoefficientAbsGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble DragCoefficientAbsGradient(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17971)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17972)
+@@ -2886,8 +2886,6 @@
+ 					_error_("approximation " << EnumToStringx(approximation) << " not supported yet");
+ 			}
+ 			break;
+-			GradjDragSSA(gradient,control_index);
+-			break;
+ 		case MaterialsRheologyBbarEnum:
+ 			GradjBSSA(gradient,control_index);
+ 			break;
+@@ -2932,7 +2930,26 @@
+ 			/*Nothing, J does not depends on the parameter being inverted for*/
+ 			break;
+ 		case DragCoefficientAbsGradientEnum:
+-			GradjDragGradient(gradient,control_index);
++			inputs->GetInputValue(&approximation,ApproximationEnum);
++			switch(approximation){
++				case SSAApproximationEnum:
++					GradjDragGradient(gradient,control_index);
++					break;
++				case FSApproximationEnum:{
++					if(IsFloating() || !IsOnBase()) return;
++					int index1,index2;
++					this->EdgeOnBaseIndices(&index1,&index2);
++					Seg* seg = SpawnSeg(index1,index2);
++					seg->GradjDragGradient(gradient,control_index);
++					seg->DeleteMaterials(); delete seg;
++					break;
++												 }
++				case NoneApproximationEnum:
++					/*Gradient is 0*/
++					break;
++				default:
++					_error_("approximation " << EnumToStringx(approximation) << " not supported yet");
++			}
+ 			break;
+ 		case RheologyBbarAbsGradientEnum:
+ 			GradjBGradient(gradient,control_index);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17971)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.cpp	(revision 17972)
+@@ -194,6 +194,49 @@
+ 	delete friction;
+ }
+ /*}}}*/
++void       Seg::GradjDragGradient(Vector<IssmDouble>* gradient,int control_index){/*{{{*/
++
++	int        i;
++	int        vertexpidlist[NUMVERTICES];
++	IssmDouble Jdet,weight;
++	IssmDouble xyz_list[NUMVERTICES][3];
++	IssmDouble dbasis[NDOF2][NUMVERTICES];
++	IssmDouble dk[NDOF2]; 
++	IssmDouble grade_g[NUMVERTICES]={0.0};
++	GaussSeg  *gauss=NULL;
++
++	/*Retrieve all inputs we will be needing: */
++	if(IsFloating())return;
++	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
++	GradientIndexing(&vertexpidlist[0],control_index);
++	Input* dragcoefficient_input=inputs->GetInput(FrictionCoefficientEnum); _assert_(dragcoefficient_input);
++	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);                 _assert_(weights_input);
++
++	/* Start  looping on the number of gaussian points: */
++	gauss=new GaussSeg(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
++		GetNodalFunctionsDerivatives(&dbasis[0][0],&xyz_list[0][0],gauss);
++		weights_input->GetInputValue(&weight,gauss,DragCoefficientAbsGradientEnum);
++
++		/*Build alpha_complement_list: */
++		dragcoefficient_input->GetInputDerivativeValue(&dk[0],&xyz_list[0][0],gauss);
++
++		/*Build gradje_g_gaussian vector (actually -dJ/ddrag): */
++		for (i=0;i<NUMVERTICES;i++){
++			grade_g[i]+=-weight*Jdet*gauss->weight*dbasis[0][i]*dk[0];
++			_assert_(!xIsNan<IssmDouble>(grade_g[i]));
++		}
++	}
++	gradient->SetValues(NUMVERTICES,vertexpidlist,grade_g,ADD_VAL);
++
++	/*Clean up and return*/
++	delete gauss;
++}
++/*}}}*/
+ bool       Seg::IsIcefront(void){/*{{{*/
+ 
+ 	bool isicefront;
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17971)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17972)
+@@ -176,7 +176,7 @@
+ 		void       GradjDSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjDragSSA(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjDragFS(Vector<IssmDouble>* gradient,int control_index);
+-		void       GradjDragGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
++		void       GradjDragGradient(Vector<IssmDouble>* gradient,int control_index);
+ 		void       GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+ 		void       GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
Index: /issm/oecreview/Archive/17802-17983/ISSM-17972-17973.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17972-17973.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17972-17973.diff	(revision 17986)
@@ -0,0 +1,24 @@
+Index: ../trunk-jpl/test/Archives/Archive215.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive513.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive213.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive415.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive511.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/test/Archives/Archive512.nc
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
Index: /issm/oecreview/Archive/17802-17983/ISSM-17973-17974.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17973-17974.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17973-17974.diff	(revision 17986)
@@ -0,0 +1,17 @@
+Index: ../trunk-jpl/test/NightlyRun/test703.m
+===================================================================
+--- ../trunk-jpl/test/NightlyRun/test703.m	(revision 17973)
++++ ../trunk-jpl/test/NightlyRun/test703.m	(revision 17974)
+@@ -71,9 +71,9 @@
+ 	'Vx2_damp','Vy2_damp','Vel2_damp','Pressure2_damp','Bed2_damp','Surface2_damp','Thickness2_damp',...
+ 	'Vx3_damp','Vy3_damp','Vel3_damp','Pressure3_damp','Bed3_damp','Surface3_damp','Thickness3_damp'};
+ field_tolerances={...
+-	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+-	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
+-	1e-08,1e-08,1e-08,1e-08,1e-10,1e-10,1e-10,...
++	2e-08,2e-08,2e-08,1e-08,1e-10,1e-10,1e-10,...
++	2e-08,2e-08,2e-08,1e-08,1e-10,1e-10,1e-10,...
++	2e-08,2e-08,2e-08,1e-08,1e-10,1e-10,1e-10,...
+ 	5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10,...
+ 	5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10,...
+ 	5e-08,5e-08,5e-08,1e-08,1e-10,1e-10,1e-10};
Index: /issm/oecreview/Archive/17802-17983/ISSM-17974-17975.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17974-17975.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17974-17975.diff	(revision 17986)
@@ -0,0 +1,784 @@
+Index: ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp	(revision 17974)
++++ ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp	(revision 17975)
+@@ -9,18 +9,14 @@
+ 
+ void SurfaceLogVelMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->SurfaceLogVelMisfit();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=SurfaceLogVelMisfit(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,102 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble SurfaceLogVelMisfit(Element* element){
++
++	int        domaintype,numcomponents;
++	bool       surfaceintegral;
++	IssmDouble Jelem=0.;
++	IssmDouble epsvel=2.220446049250313e-16;
++	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
++	IssmDouble velocity_mag,obs_velocity_mag;
++	IssmDouble misfit,Jdet;
++	IssmDouble vx,vy,vxobs,vyobs,weight;
++	IssmDouble* xyz_list = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnSurface()) return 0.;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/*Get problem dimension*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:
++			surfaceintegral = true;
++			numcomponents   = 1;
++			break;
++		case Domain3DEnum:
++			surfaceintegral = true;
++			numcomponents   = 2;
++			break;
++		case Domain2DhorizontalEnum:
++			surfaceintegral = false;
++			numcomponents   = 2;
++			break;
++		default: _error_("not supported yet");
++	}
++
++	/*Spawn surface element*/
++	Element* topelement = element->SpawnTopElement();
++
++	/* Get node coordinates*/
++	topelement->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input=topelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
++	Input* vy_input     = NULL;
++	Input* vyobs_input  = NULL;
++	if(numcomponents==2){
++		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
++		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=topelement->NewGauss(4);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,SurfaceLogVelMisfitEnum);
++		vx_input->GetInputValue(&vx,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		if(numcomponents==2){
++			vy_input->GetInputValue(&vy,gauss);
++			vyobs_input->GetInputValue(&vyobs,gauss);
++		}
++
++		/*Compute SurfaceLogVelMisfit:
++		 *                 [        vel + eps     ] 2
++		 * J = 4 \bar{v}^2 | log ( -----------  ) |  
++		 *                 [       vel   + eps    ]
++		 *                            obs
++		 */
++		if(numcomponents==1){
++			velocity_mag    =fabs(vx)+epsvel;
++			obs_velocity_mag=fabs(vxobs)+epsvel;
++		}
++		else{
++			velocity_mag    =sqrt(vx*vx+vy*vy)+epsvel;
++			obs_velocity_mag=sqrt(vxobs*vxobs+vyobs*vyobs)+epsvel;
++		}
++
++		misfit=4*pow(meanvel,2)*pow(log(velocity_mag/obs_velocity_mag),2);
++
++		/*Add to cost function*/
++		Jelem+=misfit*weight*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h	(revision 17974)
++++ ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h	(revision 17975)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void SurfaceLogVelMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble SurfaceLogVelMisfit(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp	(revision 17974)
++++ ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp	(revision 17975)
+@@ -9,18 +9,14 @@
+ 
+ void SurfaceRelVelMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->SurfaceRelVelMisfit();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=SurfaceRelVelMisfit(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,102 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble SurfaceRelVelMisfit(Element* element){
++
++	int        domaintype,numcomponents;
++	bool       surfaceintegral;
++	IssmDouble Jelem=0.;
++	IssmDouble misfit,Jdet,scalex,scaley;
++	IssmDouble epsvel=2.220446049250313e-16;
++	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
++	IssmDouble vx,vy,vxobs,vyobs,weight;
++	IssmDouble* xyz_list = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnSurface()) return 0.;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/*Get problem dimension*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:
++			surfaceintegral = true;
++			numcomponents   = 1;
++			break;
++		case Domain3DEnum:
++			surfaceintegral = true;
++			numcomponents   = 2;
++			break;
++		case Domain2DhorizontalEnum:
++			surfaceintegral = false;
++			numcomponents   = 2;
++			break;
++		default: _error_("not supported yet");
++	}
++
++	/*Spawn surface element*/
++	Element* topelement = element->SpawnTopElement();
++
++	/* Get node coordinates*/
++	topelement->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input=topelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
++	Input* vy_input     = NULL;
++	Input* vyobs_input  = NULL;
++	if(numcomponents==2){
++		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
++		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=topelement->NewGauss(4);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,SurfaceRelVelMisfitEnum);
++		vx_input->GetInputValue(&vx,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		if(numcomponents==2){
++			vy_input->GetInputValue(&vy,gauss);
++			vyobs_input->GetInputValue(&vyobs,gauss);
++		}
++
++		/*Compute SurfaceRelVelMisfit:
++		 *                        
++		 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
++		 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
++		 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
++		 *              obs                        obs                      
++		 */
++
++		if(numcomponents==2){
++			scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
++			scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
++			misfit=0.5*(scalex*pow((vx-vxobs),2)+scaley*pow((vy-vyobs),2));
++		}
++		else{
++			scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
++			misfit=0.5*(scalex*pow((vx-vxobs),2));
++		}
++
++		/*Add to cost function*/
++		Jelem+=misfit*weight*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h	(revision 17974)
++++ ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h	(revision 17975)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void SurfaceRelVelMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble SurfaceRelVelMisfit(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17974)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17975)
+@@ -276,9 +276,6 @@
+ 
+ 		virtual void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index)=0;
+ 		virtual IssmDouble ThicknessAbsMisfit(void)=0;
+-		virtual IssmDouble SurfaceAbsVelMisfit(void)=0;
+-		virtual IssmDouble SurfaceRelVelMisfit(void)=0;
+-		virtual IssmDouble SurfaceLogVelMisfit(void)=0;
+ 		virtual IssmDouble SurfaceLogVxVyMisfit(void)=0;
+ 		virtual IssmDouble SurfaceAverageVelMisfit(void)=0;
+ 		virtual IssmDouble ThicknessAbsGradient(void)=0;
+@@ -286,7 +283,6 @@
+ 		virtual IssmDouble ThicknessAcrossGradient(void)=0;
+ 		virtual IssmDouble BalancethicknessMisfit(void)=0;
+ 		virtual IssmDouble RheologyBbarAbsGradient(void)=0;
+-		virtual IssmDouble DragCoefficientAbsGradient(void)=0;
+ 		virtual void   ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index)=0;
+ 		virtual void   ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index)=0;
+ 		virtual void   ControlInputScaleGradient(int enum_type, IssmDouble scale)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17974)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17975)
+@@ -3570,65 +3570,6 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-IssmDouble Tria::SurfaceLogVelMisfit(void){/*{{{*/
+-
+-	IssmDouble Jelem=0.;
+-	IssmDouble misfit,Jdet;
+-	IssmDouble epsvel=2.220446049250313e-16;
+-	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
+-	IssmDouble velocity_mag,obs_velocity_mag;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble vx,vy,vxobs,vyobs,weight;
+-	GaussTria *gauss=NULL;
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Retrieve all inputs we will be needing: */
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input     =inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vxobs_input  =inputs->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
+-	Input* vyobs_input  =inputs->GetInput(InversionVyObsEnum);     _assert_(vyobs_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(4);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,SurfaceLogVelMisfitEnum);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-
+-		/*Compute SurfaceLogVelMisfit:
+-		 *        4         [        vel + eps     ] 2
+-		 * J = 4 \bar{v}^2 | log ( -----------  ) |  
+-		 *                 [       vel   + eps    ]
+-		 *                            obs
+-		 */
+-		velocity_mag    =sqrt(pow(vx,   2)+pow(vy,   2))+epsvel;
+-		obs_velocity_mag=sqrt(pow(vxobs,2)+pow(vyobs,2))+epsvel;
+-		misfit=4*pow(meanvel,2)*pow(log(velocity_mag/obs_velocity_mag),2);
+-
+-		/*Add to cost function*/
+-		Jelem+=misfit*weight*Jdet*gauss->weight;
+-	}
+-
+-	/*clean-up and Return: */
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+ IssmDouble Tria::SurfaceLogVxVyMisfit(void){/*{{{*/
+ 
+ 	IssmDouble Jelem=0, S=0;
+@@ -3688,121 +3629,6 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-IssmDouble Tria::SurfaceAbsVelMisfit(void){/*{{{*/
+-
+-	IssmDouble Jelem=0;
+-	IssmDouble misfit,Jdet;
+-	IssmDouble vx,vy,vxobs,vyobs,weight;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	GaussTria *gauss=NULL;
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Retrieve all inputs we will be needing: */
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input     =inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vxobs_input  =inputs->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
+-	Input* vyobs_input  =inputs->GetInput(InversionVyObsEnum);     _assert_(vyobs_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,SurfaceAbsVelMisfitEnum);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-
+-		/*Compute SurfaceAbsVelMisfitEnum:
+-		 *
+-		 *      1  [           2              2 ]
+-		 * J = --- | (u - u   )  +  (v - v   )  |
+-		 *      2  [       obs            obs   ]
+-		 *
+-		 */
+-		misfit=0.5*( pow(vx-vxobs,2) + pow(vy-vyobs,2) );
+-
+-		/*Add to cost function*/
+-		Jelem+=misfit*weight*Jdet*gauss->weight;
+-	}
+-
+-	/*clean up and Return: */
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+-IssmDouble Tria::SurfaceRelVelMisfit(void){/*{{{*/
+-
+-	IssmDouble  Jelem=0;
+-	IssmDouble  scalex=1,scaley=1;
+-	IssmDouble  misfit,Jdet;
+-	IssmDouble  epsvel=2.220446049250313e-16;
+-	IssmDouble  meanvel=3.170979198376458e-05; /*1000 m/yr*/
+-	IssmDouble  vx,vy,vxobs,vyobs,weight;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	GaussTria *gauss=NULL;
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Retrieve all inputs we will be needing: */
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input     =inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vxobs_input  =inputs->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
+-	Input* vyobs_input  =inputs->GetInput(InversionVyObsEnum);     _assert_(vyobs_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(4);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,SurfaceRelVelMisfitEnum);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-
+-		/*Compute SurfaceRelVelMisfit:
+-		 *                        
+-		 *      1  [     \bar{v}^2             2   \bar{v}^2              2 ]
+-		 * J = --- | -------------  (u - u   ) + -------------  (v - v   )  |
+-		 *      2  [  (u   + eps)^2       obs    (v   + eps)^2       obs    ]
+-		 *              obs                        obs                      
+-		 */
+-		scalex=pow(meanvel/(vxobs+epsvel),2); if(vxobs==0)scalex=0;
+-		scaley=pow(meanvel/(vyobs+epsvel),2); if(vyobs==0)scaley=0;
+-		misfit=0.5*(scalex*pow((vx-vxobs),2)+scaley*pow((vy-vyobs),2));
+-
+-		/*Add to cost function*/
+-		Jelem+=misfit*weight*Jdet*gauss->weight;
+-	}
+-
+-	/*clean up and Return: */
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+ IssmDouble Tria::ThicknessAbsGradient(void){/*{{{*/
+ 
+ 	/* Intermediaries */
+@@ -3988,48 +3814,6 @@
+ 	return Jelem;
+ }
+ /*}}}*/
+-IssmDouble Tria::DragCoefficientAbsGradient(void){/*{{{*/
+-
+-	/* Intermediaries */
+-	IssmDouble Jelem = 0;
+-	IssmDouble weight;
+-	IssmDouble Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dp[NDOF2];
+-	GaussTria *gauss = NULL;
+-
+-	/*retrieve parameters and inputs*/
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement()) return 0;
+-
+-	/*Retrieve all inputs we will be needing: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);         _assert_(weights_input);
+-	Input* drag_input   =inputs->GetInput(FrictionCoefficientEnum); _assert_(drag_input);
+-
+-	/* Start looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,DragCoefficientAbsGradientEnum);
+-		drag_input->GetInputDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
+-
+-		/*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */ 
+-		Jelem+=weight*1/2*(dp[0]*dp[0]+dp[1]*dp[1])*Jdet*gauss->weight;
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+ void       Tria::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){/*{{{*/
+ 
+ 	int vertexpidlist[NUMVERTICES];
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17974)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17975)
+@@ -136,7 +136,6 @@
+ 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
+ 		#endif
+ 
+-		IssmDouble DragCoefficientAbsGradient(void);
+ 		void       GradientIndexing(int* indexing,int control_index);
+ 		void       Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index);
+ 		void       GradjBGradient(Vector<IssmDouble>* gradient,int control_index);
+@@ -158,13 +157,10 @@
+ 		void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
+ 		IssmDouble RheologyBbarAbsGradient(void);
+ 		IssmDouble ThicknessAbsMisfit(void);
+-		IssmDouble SurfaceAbsVelMisfit(void);
+ 		IssmDouble ThicknessAbsGradient(void);
+ 		IssmDouble ThicknessAlongGradient(void);
+ 		IssmDouble ThicknessAcrossGradient(void);
+ 		IssmDouble BalancethicknessMisfit(void);
+-		IssmDouble SurfaceRelVelMisfit(void);
+-		IssmDouble SurfaceLogVelMisfit(void);
+ 		IssmDouble SurfaceLogVxVyMisfit(void);
+ 		IssmDouble SurfaceAverageVelMisfit(void);
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17974)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17975)
+@@ -3364,78 +3364,6 @@
+ 	}
+ }
+ /*}}}*/
+-IssmDouble Penta::SurfaceAbsVelMisfit(void){/*{{{*/
+-
+-	int    approximation;
+-	IssmDouble J;
+-	Tria*  tria=NULL;
+-
+-	/*retrieve inputs :*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/*Bail out if this element if:
+-	 * -> Non SSA and not on the surface
+-	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+-		return 0;
+-	}
+-	else if (approximation==SSAApproximationEnum){
+-
+-		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+-		 * and compute SurfaceAbsVelMisfit*/
+-		tria=(Tria*)SpawnTria(0,1,2);
+-		J=tria->SurfaceAbsVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-	else{
+-
+-		tria=(Tria*)SpawnTria(3,4,5);
+-		J=tria->SurfaceAbsVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-}
+-/*}}}*/
+-IssmDouble Penta::SurfaceLogVelMisfit(void){/*{{{*/
+-
+-	int    approximation;
+-	IssmDouble J;
+-	Tria*  tria=NULL;
+-
+-	/*retrieve inputs :*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/*Bail out if this element if:
+-	 * -> Non SSA and not on the surface
+-	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+-		return 0;
+-	}
+-	else if (approximation==SSAApproximationEnum){
+-
+-		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+-		 * and compute SurfaceLogVelMisfit*/
+-		tria=(Tria*)SpawnTria(0,1,2); //lower face is 0, upper face is 1.
+-		J=tria->SurfaceLogVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-	else{
+-
+-		tria=(Tria*)SpawnTria(3,4,5); //lower face is 0, upper face is 1.
+-		J=tria->SurfaceLogVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-}
+-/*}}}*/
+ IssmDouble Penta::SurfaceLogVxVyMisfit(void){/*{{{*/
+ 
+ 	IssmDouble J;
+@@ -3474,42 +3402,6 @@
+ 	}
+ }
+ /*}}}*/
+-IssmDouble Penta::SurfaceRelVelMisfit(void){/*{{{*/
+-
+-	int    approximation;
+-	IssmDouble J;
+-	Tria*  tria=NULL;
+-
+-	/*retrieve inputs :*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/*Bail out if this element if:
+-	 * -> Non SSA and not on the surface
+-	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+-		return 0;
+-	}
+-	else if (approximation==SSAApproximationEnum){
+-
+-		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+-		 * and compute SurfaceRelVelMisfit*/
+-		tria=(Tria*)SpawnTria(0,1,2);
+-		J=tria->SurfaceRelVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-	else{
+-
+-		tria=(Tria*)SpawnTria(3,4,5);
+-		J=tria->SurfaceRelVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-}
+-/*}}}*/
+ IssmDouble Penta::ThicknessAbsGradient(void){/*{{{*/
+ 
+ 	_error_("Not implemented yet");
+@@ -3534,20 +3426,6 @@
+ 	return J;
+ }
+ /*}}}*/
+-IssmDouble Penta::DragCoefficientAbsGradient(void){/*{{{*/
+-
+-	IssmDouble J;
+-	Tria*  tria=NULL;
+-
+-	/*If on water, on shelf or not on bed, skip: */
+-	if(!IsIceInElement()|| IsFloating() || !IsOnBase()) return 0;
+-
+-	tria=(Tria*)SpawnTria(0,1,2); //lower face is 0, upper face is 1
+-	J=tria->DragCoefficientAbsGradient();
+-	delete tria->material; delete tria;
+-	return J;
+-}
+-/*}}}*/
+ IssmDouble Penta::RheologyBbarAbsGradient(void){/*{{{*/
+ 
+ 	IssmDouble J;
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17974)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17975)
+@@ -131,7 +131,6 @@
+ 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y);
+ 		#endif
+ 
+-		IssmDouble DragCoefficientAbsGradient(void);
+ 		void   GradientIndexing(int* indexing,int control_index);
+ 		void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index);
+ 		void   GradjDragSSA(Vector<IssmDouble>* gradient,int control_index);
+@@ -148,9 +147,6 @@
+ 		void   ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
+ 		IssmDouble RheologyBbarAbsGradient(void);
+ 		IssmDouble ThicknessAbsMisfit(void);
+-		IssmDouble SurfaceAbsVelMisfit(void);
+-		IssmDouble SurfaceRelVelMisfit(void);
+-		IssmDouble SurfaceLogVelMisfit(void);
+ 		IssmDouble SurfaceLogVxVyMisfit(void);
+ 		IssmDouble SurfaceAverageVelMisfit(void);
+ 		IssmDouble ThicknessAbsGradient(void);
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17974)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17975)
+@@ -167,7 +167,6 @@
+ 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
+ #endif
+ 
+-		IssmDouble DragCoefficientAbsGradient(void){_error_("not implemented yet");};
+ 		void       GradientIndexing(int* indexing,int control_index);
+ 		void       Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index){_error_("not implemented yet");};
+ 		void       GradjBGradient(Vector<IssmDouble>* gradient,int control_index){_error_("not implemented yet");};
+@@ -189,13 +188,10 @@
+ 		void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
+ 		IssmDouble RheologyBbarAbsGradient(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAbsMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceAbsVelMisfit(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAbsGradient(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAlongGradient(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAcrossGradient(void){_error_("not implemented yet");};
+ 		IssmDouble BalancethicknessMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceRelVelMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceLogVelMisfit(void){_error_("not implemented yet");};
+ 		IssmDouble SurfaceLogVxVyMisfit(void){_error_("not implemented yet");};
+ 		IssmDouble SurfaceAverageVelMisfit(void){_error_("not implemented yet");};
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17974)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17975)
+@@ -193,13 +193,10 @@
+ 		void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
+ 		IssmDouble RheologyBbarAbsGradient(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAbsMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceAbsVelMisfit(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAbsGradient(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAlongGradient(void){_error_("not implemented yet");};
+ 		IssmDouble ThicknessAcrossGradient(void){_error_("not implemented yet");};
+ 		IssmDouble BalancethicknessMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceRelVelMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceLogVelMisfit(void){_error_("not implemented yet");};
+ 		IssmDouble SurfaceLogVxVyMisfit(void){_error_("not implemented yet");};
+ 		IssmDouble SurfaceAverageVelMisfit(void){_error_("not implemented yet");};
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter){_error_("not implemented yet");};
Index: /issm/oecreview/Archive/17802-17983/ISSM-17975-17976.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17975-17976.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17975-17976.diff	(revision 17986)
@@ -0,0 +1,1530 @@
+Index: ../trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp	(revision 17976)
+@@ -10,20 +10,14 @@
+ 
+ void SurfaceAverageVelMisfitx(IssmDouble* pJ,FemModel* femmodel){
+ 
+-	/*Intermediary*/
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J = 0.;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+-	/*Compute surface area and add to elements inputs */
+-	SurfaceAreax(NULL,femmodel);
+-
+ 	/*Compute Misfit: */
+ 	for(int i=0;i<femmodel->elements->Size();i++){
+-		element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
+-		J+=element->SurfaceAverageVelMisfit();
++		Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i));
++		J+=SurfaceAverageVelMisfit(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -34,3 +28,92 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble SurfaceAverageVelMisfit(Element* element){
++
++	int        domaintype,numcomponents;
++	IssmDouble Jelem=0.;
++	IssmDouble misfit,S,Jdet;
++	IssmDouble vx,vy,vxobs,vyobs,weight;
++	IssmDouble* xyz_list = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnSurface()) return 0.;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/*Get problem dimension*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:
++			numcomponents   = 1;
++			break;
++		case Domain3DEnum:
++			numcomponents   = 2;
++			break;
++		case Domain2DhorizontalEnum:
++			numcomponents   = 2;
++			break;
++		default: _error_("not supported yet");
++	}
++
++	/*Spawn surface element*/
++	Element* topelement = element->SpawnTopElement();
++
++	/* Get node coordinates*/
++	topelement->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	topelement->GetInputValue(&S,SurfaceAreaEnum);
++	Input* weights_input=topelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
++	Input* vy_input     = NULL;
++	Input* vyobs_input  = NULL;
++	if(numcomponents==2){
++		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
++		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=topelement->NewGauss(3);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,SurfaceAverageVelMisfitEnum);
++		vx_input->GetInputValue(&vx,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		if(numcomponents==2){
++			vy_input->GetInputValue(&vy,gauss);
++			vyobs_input->GetInputValue(&vyobs,gauss);
++		}
++
++		/*Compute SurfaceAverageVelMisfitEnum:
++		 *
++		 *      1                    2              2
++		 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
++		 *      S                obs            obs
++		 */
++		if(numcomponents==1){
++			misfit=1/S*(vx-vxobs)*(vx-vxobs);
++		}
++		else{
++			misfit=1/S*sqrt( pow(vx-vxobs,2) + pow(vy-vyobs,2));
++		}
++
++		/*Add to cost function*/
++		Jelem+=misfit*weight*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h	(revision 17975)
++++ ../trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h	(revision 17976)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void SurfaceAverageVelMisfitx(IssmDouble* pJ,FemModel* femmodel);
++IssmDouble SurfaceAverageVelMisfit(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp	(revision 17976)
+@@ -9,18 +9,14 @@
+ 
+ void ThicknessAlongGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->ThicknessAlongGradient();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=ThicknessAlongGradient(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,53 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble ThicknessAlongGradient(Element* element){
++
++	IssmDouble  thickness,thicknessobs,weight;
++	IssmDouble  Jelem=0.;
++	IssmDouble  misfit,Jdet;
++	IssmDouble* xyz_list = NULL;
++	IssmDouble  dp[3];
++	IssmDouble  vx,vy,vel;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/* Get node coordinates*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input   =element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* thickness_input =element->GetInput(ThicknessEnum);                          _assert_(thickness_input);
++	Input* vx_input        =element->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vy_input        =element->GetInput(VyEnum);                                 _assert_(vy_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,ThicknessAlongGradientEnum);
++		thickness_input->GetInputValue(&thickness,gauss);
++		thickness_input->GetInputDerivativeValue(&dp[0],xyz_list,gauss);
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vel = sqrt(vx*vx+vy*vy);
++		vx  = vx/(vel+1.e-9);
++		vy  = vy/(vel+1.e-9);
++
++		/*J = 1/2 ( vx*dH/dx + vy*dH/dy )^2 */
++		Jelem+=weight*1/2*(vx*dp[0] + vy*dp[1])*(vx*dp[0] + vy*dp[1])*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h	(revision 17975)
++++ ../trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h	(revision 17976)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void ThicknessAlongGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble ThicknessAlongGradient(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp	(revision 17976)
+@@ -9,18 +9,14 @@
+ 
+ void ThicknessAbsMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->ThicknessAbsMisfit();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=ThicknessAbsMisfit(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,45 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble ThicknessAbsMisfit(Element* element){
++
++	IssmDouble  thickness,thicknessobs,weight;
++	IssmDouble  Jelem=0.;
++	IssmDouble  misfit,Jdet;
++	IssmDouble* xyz_list = NULL;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/* Get node coordinates*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input     =element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* thickness_input   =element->GetInput(ThicknessEnum);                          _assert_(thickness_input);
++	Input* thicknessobs_input=element->GetInput(InversionThicknessObsEnum);              _assert_(thicknessobs_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,ThicknessAbsMisfitEnum);
++		thickness_input->GetInputValue(&thickness,gauss);
++		thicknessobs_input->GetInputValue(&thicknessobs,gauss);
++
++		/*Compute ThicknessAbsMisfitEnum*/
++		Jelem+=0.5*(thickness-thicknessobs)*(thickness-thicknessobs)*weight*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h	(revision 17975)
++++ ../trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h	(revision 17976)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void ThicknessAbsMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble ThicknessAbsMisfit(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h	(revision 17975)
++++ ../trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h	(revision 17976)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void SurfaceLogVxVyMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble SurfaceLogVxVyMisfit(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp	(revision 17976)
+@@ -9,18 +9,14 @@
+ 
+ void SurfaceLogVxVyMisfitx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->SurfaceLogVxVyMisfit();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=SurfaceLogVxVyMisfit(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,91 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble SurfaceLogVxVyMisfit(Element* element){
++
++	int        domaintype,numcomponents;
++	IssmDouble Jelem=0.;
++	IssmDouble epsvel=2.220446049250313e-16;
++	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
++	IssmDouble misfit,Jdet;
++	IssmDouble vx,vy,vxobs,vyobs,weight;
++	IssmDouble* xyz_list = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnSurface()) return 0.;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/*Get problem dimension*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:   numcomponents   = 1; break;
++		case Domain3DEnum:           numcomponents   = 2; break;
++		case Domain2DhorizontalEnum: numcomponents   = 2; break;
++		default: _error_("not supported yet");
++	}
++
++	/*Spawn surface element*/
++	Element* topelement = element->SpawnTopElement();
++
++	/* Get node coordinates*/
++	topelement->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input=topelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* vx_input     =topelement->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vxobs_input  =topelement->GetInput(InversionVxObsEnum);                     _assert_(vxobs_input);
++	Input* vy_input     = NULL;
++	Input* vyobs_input  = NULL;
++	if(numcomponents==2){
++		vy_input    =topelement->GetInput(VyEnum);              _assert_(vy_input);
++		vyobs_input =topelement->GetInput(InversionVyObsEnum);  _assert_(vyobs_input);
++	}
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=topelement->NewGauss(4);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		topelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,SurfaceLogVxVyMisfitEnum);
++		vx_input->GetInputValue(&vx,gauss);
++		vxobs_input->GetInputValue(&vxobs,gauss);
++		if(numcomponents==2){
++			vy_input->GetInputValue(&vy,gauss);
++			vyobs_input->GetInputValue(&vyobs,gauss);
++		}
++
++		/*Compute SurfaceRelVelMisfit:
++		 *
++		 *      1            [        |u| + eps     2          |v| + eps     2  ]
++		 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
++		 *      2            [       |u    |+ eps              |v    |+ eps     ]
++		 *                              obs                       obs
++		 */
++
++		if(numcomponents==1){
++			misfit=0.5*meanvel*meanvel*pow(log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)),2);
++		}
++		else{
++			misfit=0.5*meanvel*meanvel*(
++						pow(log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)),2) +
++						pow(log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)),2) );
++		}
++
++		/*Add to cost function*/
++		Jelem+=misfit*weight*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	if(domaintype!=Domain2DhorizontalEnum){topelement->DeleteMaterials(); delete topelement;};
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp	(revision 17976)
+@@ -31,7 +31,6 @@
+ IssmDouble SurfaceLogVelMisfit(Element* element){
+ 
+ 	int        domaintype,numcomponents;
+-	bool       surfaceintegral;
+ 	IssmDouble Jelem=0.;
+ 	IssmDouble epsvel=2.220446049250313e-16;
+ 	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
+@@ -49,18 +48,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Domain2DverticalEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 1;
+-			break;
+-		case Domain3DEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 2;
+-			break;
+-		case Domain2DhorizontalEnum:
+-			surfaceintegral = false;
+-			numcomponents   = 2;
+-			break;
++		case Domain2DverticalEnum:   numcomponents   = 1; break;
++		case Domain3DEnum:           numcomponents   = 2; break;
++		case Domain2DhorizontalEnum: numcomponents   = 2; break;
+ 		default: _error_("not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp	(revision 17976)
+@@ -31,7 +31,6 @@
+ IssmDouble SurfaceRelVelMisfit(Element* element){
+ 
+ 	int        domaintype,numcomponents;
+-	bool       surfaceintegral;
+ 	IssmDouble Jelem=0.;
+ 	IssmDouble misfit,Jdet,scalex,scaley;
+ 	IssmDouble epsvel=2.220446049250313e-16;
+@@ -48,18 +47,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Domain2DverticalEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 1;
+-			break;
+-		case Domain3DEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 2;
+-			break;
+-		case Domain2DhorizontalEnum:
+-			surfaceintegral = false;
+-			numcomponents   = 2;
+-			break;
++		case Domain2DverticalEnum:   numcomponents   = 1; break;
++		case Domain3DEnum:           numcomponents   = 2; break;
++		case Domain2DhorizontalEnum: numcomponents   = 2; break;
+ 		default: _error_("not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp	(revision 17976)
+@@ -31,7 +31,6 @@
+ IssmDouble SurfaceAbsVelMisfit(Element* element){
+ 
+ 	int        domaintype,numcomponents;
+-	bool       surfaceintegral;
+ 	IssmDouble Jelem=0.;
+ 	IssmDouble misfit,Jdet;
+ 	IssmDouble vx,vy,vxobs,vyobs,weight;
+@@ -46,18 +45,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Domain2DverticalEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 1;
+-			break;
+-		case Domain3DEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 2;
+-			break;
+-		case Domain2DhorizontalEnum:
+-			surfaceintegral = false;
+-			numcomponents   = 2;
+-			break;
++		case Domain2DverticalEnum:   numcomponents   = 1; break;
++		case Domain3DEnum:           numcomponents   = 2; break;
++		case Domain2DhorizontalEnum: numcomponents   = 2; break;
+ 		default: _error_("not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp	(revision 17976)
+@@ -31,7 +31,6 @@
+ IssmDouble DragCoefficientAbsGradient(Element* element){
+ 
+ 	int         domaintype,numcomponents;
+-	bool        surfaceintegral;
+ 	IssmDouble  Jelem=0.;
+ 	IssmDouble  misfit,Jdet;
+ 	IssmDouble  dp[2],weight;
+@@ -46,18 +45,9 @@
+ 	/*Get problem dimension*/
+ 	element->FindParam(&domaintype,DomainTypeEnum);
+ 	switch(domaintype){
+-		case Domain2DverticalEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 1;
+-			break;
+-		case Domain3DEnum:
+-			surfaceintegral = true;
+-			numcomponents   = 2;
+-			break;
+-		case Domain2DhorizontalEnum:
+-			surfaceintegral = false;
+-			numcomponents   = 2;
+-			break;
++		case Domain2DverticalEnum:   numcomponents   = 1; break;
++		case Domain3DEnum:           numcomponents   = 2; break;
++		case Domain2DhorizontalEnum: numcomponents   = 2; break;
+ 		default: _error_("not supported yet");
+ 	}
+ 
+Index: ../trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h	(revision 17975)
++++ ../trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h	(revision 17976)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void RheologyBbarAbsGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble RheologyBbarAbsGradient(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp	(revision 17976)
+@@ -9,18 +9,14 @@
+ 
+ void RheologyBbarAbsGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->RheologyBbarAbsGradient();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=RheologyBbarAbsGradient(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,60 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble RheologyBbarAbsGradient(Element* element){
++
++	int         domaintype,numcomponents;
++	IssmDouble  Jelem=0.;
++	IssmDouble  misfit,Jdet;
++	IssmDouble  dp[2],weight;
++	IssmDouble* xyz_list      = NULL;
++
++	/*Get basal element*/
++	if(!element->IsOnBase()) return 0.;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/*Get problem dimension*/
++	element->FindParam(&domaintype,DomainTypeEnum);
++	switch(domaintype){
++		case Domain2DverticalEnum:   numcomponents   = 1; break;
++		case Domain3DEnum:           numcomponents   = 2; break;
++		case Domain2DhorizontalEnum: numcomponents   = 2; break;
++		default: _error_("not supported yet");
++	}
++
++	/*Spawn basal element*/
++	Element* basalelement = element->SpawnBasalElement();
++
++	/* Get node coordinates*/
++	basalelement->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input=basalelement->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* rheologyb_input=basalelement->GetInput(MaterialsRheologyBbarEnum);                  _assert_(rheologyb_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=basalelement->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,RheologyBbarAbsGradientEnum);
++		rheologyb_input->GetInputDerivativeValue(&dp[0],xyz_list,gauss);
++
++		/*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */ 
++		Jelem+=weight*1/2*(dp[0]*dp[0] + dp[1]*dp[1])*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h
+===================================================================
+--- ../trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h	(revision 17975)
++++ ../trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h	(revision 17976)
+@@ -9,5 +9,6 @@
+ 
+ /* local prototypes: */
+ void ThicknessAcrossGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters);
++IssmDouble ThicknessAcrossGradient(Element* element);
+ 
+ #endif
+Index: ../trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp
+===================================================================
+--- ../trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp	(revision 17976)
+@@ -9,18 +9,14 @@
+ 
+ void ThicknessAcrossGradientx( IssmDouble* pJ, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters){
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->ThicknessAcrossGradient();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++		J+=ThicknessAcrossGradient(element);
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+@@ -31,3 +27,53 @@
+ 	/*Assign output pointers: */
+ 	*pJ=J;
+ }
++
++IssmDouble ThicknessAcrossGradient(Element* element){
++
++	IssmDouble  thickness,thicknessobs,weight;
++	IssmDouble  Jelem=0.;
++	IssmDouble  misfit,Jdet;
++	IssmDouble* xyz_list = NULL;
++	IssmDouble  dp[3];
++	IssmDouble  vx,vy,vel;
++
++	/*If on water, return 0: */
++	if(!element->IsIceInElement()) return 0.;
++
++	/* Get node coordinates*/
++	element->GetVerticesCoordinates(&xyz_list);
++
++	/*Retrieve all inputs we will be needing: */
++	Input* weights_input   =element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++	Input* thickness_input =element->GetInput(ThicknessEnum);                          _assert_(thickness_input);
++	Input* vx_input        =element->GetInput(VxEnum);                                 _assert_(vx_input);
++	Input* vy_input        =element->GetInput(VyEnum);                                 _assert_(vy_input);
++
++	/* Start  looping on the number of gaussian points: */
++	Gauss* gauss=element->NewGauss(2);
++	for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++		gauss->GaussPoint(ig);
++
++		/* Get Jacobian determinant: */
++		element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++		/*Get all parameters at gaussian point*/
++		weights_input->GetInputValue(&weight,gauss,ThicknessAcrossGradientEnum);
++		thickness_input->GetInputValue(&thickness,gauss);
++		thickness_input->GetInputDerivativeValue(&dp[0],xyz_list,gauss);
++		vx_input->GetInputValue(&vx,gauss);
++		vy_input->GetInputValue(&vy,gauss);
++		vel = sqrt(vx*vx+vy*vy);
++		vx  = vx/(vel+1.e-9);
++		vy  = vy/(vel+1.e-9);
++
++		/*J = 1/2 ( -vy*dH/dx + vx*dH/dy )^2 */
++		Jelem+=weight*1/2*(-vy*dp[0] + vx*dp[1])*(-vy*dp[0] + vx*dp[1])*Jdet*gauss->weight;
++	}
++
++	/*clean up and Return: */
++	xDelete<IssmDouble>(xyz_list);
++	delete gauss;
++	return Jelem;
++}
+Index: ../trunk-jpl/src/c/classes/FemModel.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/classes/FemModel.cpp	(revision 17976)
+@@ -1133,13 +1133,64 @@
+ }/*}}}*/
+ void FemModel::BalancethicknessMisfitx(IssmDouble* presponse){/*{{{*/
+ 
+-	IssmDouble J = 0;
++	/*output: */
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
+-	for(int i=0;i<this->elements->Size();i++){
+-		Element* element=dynamic_cast<Element*>(this->elements->GetObjectByOffset(i));
+-		J+=element->BalancethicknessMisfit();
++	IssmDouble  weight,vx,vy,H,dvx[2],dvy[2],dH[2];
++	IssmDouble  temp,Jdet,dhdt,basal_melting,surface_mass_balance;
++	IssmDouble* xyz_list = NULL;
++	IssmDouble  dp[3];
++
++	/*Compute Misfit: */
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++
++		/*If on water, return 0: */
++		if(!element->IsIceInElement()) continue;
++
++		/* Get node coordinates*/
++		element->GetVerticesCoordinates(&xyz_list);
++		Input* weights_input              = element->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
++		Input* thickness_input            = element->GetInput(ThicknessEnum); _assert_(thickness_input);
++		Input* vx_input                   = element->GetInput(VxEnum);                                 _assert_(vx_input);
++		Input* vy_input                   = element->GetInput(VyEnum);                                 _assert_(vy_input);
++		Input* surface_mass_balance_input = element->GetInput(SurfaceforcingsMassBalanceEnum);         _assert_(surface_mass_balance_input);
++		Input* basal_melting_input        = element->GetInput(BasalforcingsMeltingRateEnum);           _assert_(basal_melting_input);
++		Input* dhdt_input                 = element->GetInput(BalancethicknessThickeningRateEnum);     _assert_(dhdt_input);
++
++		/* Start  looping on the number of gaussian points: */
++		Gauss* gauss=element->NewGauss(2);
++		for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++			gauss->GaussPoint(ig);
++
++			/* Get Jacobian determinant: */
++			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++			/*Get all parameters at gaussian point*/
++			weights_input->GetInputValue(&weight,gauss,BalancethicknessMisfitEnum);
++			thickness_input->GetInputValue(&H, gauss);
++			thickness_input->GetInputDerivativeValue(&dH[0],xyz_list,gauss);
++			surface_mass_balance_input->GetInputValue(&surface_mass_balance,gauss);
++			basal_melting_input->GetInputValue(&basal_melting,gauss);
++			dhdt_input->GetInputValue(&dhdt,gauss);
++			vx_input->GetInputValue(&vx,gauss);
++			vx_input->GetInputDerivativeValue(&dvx[0],xyz_list,gauss);
++			vy_input->GetInputValue(&vy,gauss);
++			vy_input->GetInputDerivativeValue(&dvy[0],xyz_list,gauss);
++
++			/*Balance thickness soft constraint J = 1/2 (div(Hv)-a)^2*/
++			temp  = vx*dH[0]+vy*dH[1]+H*(dvx[0]+dvy[1]) - (surface_mass_balance-basal_melting-dhdt);
++			J    +=weight*1/2*temp*temp*Jdet*gauss->weight;
++		}
++
++		/*clean up and Return: */
++		xDelete<IssmDouble>(xyz_list);
++		delete gauss;
+ 	}
++
++	/*Sum all J from all cpus of the cluster:*/
+ 	ISSM_MPI_Reduce (&J,&J_sum,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,0,IssmComm::GetComm() );
+ 	ISSM_MPI_Bcast(&J_sum,1,ISSM_MPI_DOUBLE,0,IssmComm::GetComm());
+ 	J=J_sum;
+@@ -1150,18 +1201,49 @@
+ }/*}}}*/
+ void FemModel::ThicknessAbsGradientx( IssmDouble* pJ){/*{{{*/
+ 
+-	/*Intermediary*/
+-	int i;
+-	Element* element=NULL;
+-
+ 	/*output: */
+-	IssmDouble J=0;
++	IssmDouble J=0.;
+ 	IssmDouble J_sum;
+ 
++	IssmDouble  thickness,thicknessobs,weight;
++	IssmDouble  Jdet;
++	IssmDouble* xyz_list = NULL;
++	IssmDouble  dp[3];
++
+ 	/*Compute Misfit: */
+-	for (i=0;i<elements->Size();i++){
+-		element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
+-		J+=element->ThicknessAbsGradient();
++	for(int i=0;i<elements->Size();i++){
++		Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
++
++		/*If on water, return 0: */
++		if(!element->IsIceInElement()) continue;
++
++		/* Get node coordinates*/
++		element->GetVerticesCoordinates(&xyz_list);
++
++		/*Retrieve all inputs we will be needing: */
++		Input* weights_input   =element->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
++		Input* thickness_input =element->GetInput(ThicknessEnum);                          _assert_(thickness_input);
++
++		/* Start  looping on the number of gaussian points: */
++		Gauss* gauss=element->NewGauss(2);
++		for(int ig=gauss->begin();ig<gauss->end();ig++){
++
++			gauss->GaussPoint(ig);
++
++			/* Get Jacobian determinant: */
++			element->JacobianDeterminant(&Jdet,xyz_list,gauss);
++
++			/*Get all parameters at gaussian point*/
++			weights_input->GetInputValue(&weight,gauss,ThicknessAcrossGradientEnum);
++			thickness_input->GetInputDerivativeValue(&dp[0],xyz_list,gauss);
++
++			/*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */ 
++			J+=weight*1/2*(dp[0]*dp[0]+dp[1]*dp[1])*Jdet*gauss->weight;
++		}
++
++		/*clean up and Return: */
++		xDelete<IssmDouble>(xyz_list);
++		delete gauss;
+ 	}
+ 
+ 	/*Sum all J from all cpus of the cluster:*/
+Index: ../trunk-jpl/src/c/classes/Elements/Element.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17975)
++++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 17976)
+@@ -275,14 +275,6 @@
+ 		#endif
+ 
+ 		virtual void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index)=0;
+-		virtual IssmDouble ThicknessAbsMisfit(void)=0;
+-		virtual IssmDouble SurfaceLogVxVyMisfit(void)=0;
+-		virtual IssmDouble SurfaceAverageVelMisfit(void)=0;
+-		virtual IssmDouble ThicknessAbsGradient(void)=0;
+-		virtual IssmDouble ThicknessAlongGradient(void)=0;
+-		virtual IssmDouble ThicknessAcrossGradient(void)=0;
+-		virtual IssmDouble BalancethicknessMisfit(void)=0;
+-		virtual IssmDouble RheologyBbarAbsGradient(void)=0;
+ 		virtual void   ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index)=0;
+ 		virtual void   ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index)=0;
+ 		virtual void   ControlInputScaleGradient(int enum_type, IssmDouble scale)=0;
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 17976)
+@@ -2707,63 +2707,6 @@
+ /*}}}*/
+ #endif
+ 
+-IssmDouble Tria::BalancethicknessMisfit(void){/*{{{*/
+-
+-	/* Intermediaries */
+-	IssmDouble Jelem = 0;
+-	IssmDouble weight;
+-	IssmDouble Jdet,temp;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dH[2];
+-	IssmDouble vx,vy,H;
+-	IssmDouble dvx[2],dvy[2];
+-	IssmDouble dhdt,basal_melting,surface_mass_balance;
+-	GaussTria *gauss = NULL;
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement()) return 0;
+-
+-	/*Retrieve all inputs we will be needing: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* weights_input              = inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* thickness_input            = inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-	Input* vx_input                   = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+-	Input* vy_input                   = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
+-	Input* surface_mass_balance_input = inputs->GetInput(SurfaceforcingsMassBalanceEnum);         _assert_(surface_mass_balance_input);
+-	Input* basal_melting_input        = inputs->GetInput(BasalforcingsMeltingRateEnum);           _assert_(basal_melting_input);
+-	Input* dhdt_input                 = inputs->GetInput(BalancethicknessThickeningRateEnum);     _assert_(dhdt_input);
+-
+-	/* Start looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,BalancethicknessMisfitEnum);
+-		thickness_input->GetInputValue(&H, gauss);
+-		thickness_input->GetInputDerivativeValue(&dH[0],&xyz_list[0][0],gauss);
+-		surface_mass_balance_input->GetInputValue(&surface_mass_balance,gauss);
+-		basal_melting_input->GetInputValue(&basal_melting,gauss);
+-		dhdt_input->GetInputValue(&dhdt,gauss);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vx_input->GetInputDerivativeValue(&dvx[0],&xyz_list[0][0],gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vy_input->GetInputDerivativeValue(&dvy[0],&xyz_list[0][0],gauss);
+-
+-		/*Balance thickness soft constraint J = 1/2 (div(Hv)-a)^2*/
+-		temp  = vx*dH[0]+vy*dH[1]+H*(dvx[0]+dvy[1]) - (surface_mass_balance-basal_melting-dhdt);
+-		Jelem+=weight*1/2*temp*temp*Jdet*gauss->weight;
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+ void       Tria::InputControlUpdate(IssmDouble scalar,bool save_parameter){/*{{{*/
+ 
+ 	/*Intermediary*/
+@@ -3473,347 +3416,6 @@
+ 
+ }
+ /*}}}*/
+-IssmDouble Tria::RheologyBbarAbsGradient(void){/*{{{*/
+-
+-	/* Intermediaries */
+-	IssmDouble Jelem = 0;
+-	IssmDouble weight;
+-	IssmDouble Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dp[NDOF2];
+-	GaussTria *gauss = NULL;
+-
+-	/*retrieve parameters and inputs*/
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement()) return 0;
+-
+-	/*Retrieve all inputs we will be needing: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* weights_input  =inputs->GetInput(InversionCostFunctionsCoefficientsEnum);              _assert_(weights_input);
+-	Input* rheologyb_input=inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);
+-
+-	/* Start looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,RheologyBbarAbsGradientEnum);
+-		rheologyb_input->GetInputDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
+-
+-		/*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */ 
+-		Jelem+=weight*1/2*(dp[0]*dp[0] + dp[1]*dp[1])*Jdet*gauss->weight;
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+-IssmDouble Tria::SurfaceAverageVelMisfit(void){/*{{{*/
+-
+-	IssmDouble Jelem=0,S,Jdet;
+-	IssmDouble misfit;
+-	IssmDouble vx,vy,vxobs,vyobs,weight;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	GaussTria *gauss=NULL;
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Retrieve all inputs we will be needing: */
+-	inputs->GetInputValue(&S,SurfaceAreaEnum);
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input     =inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vxobs_input  =inputs->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
+-	Input* vyobs_input  =inputs->GetInput(InversionVyObsEnum);     _assert_(vyobs_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(3);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,SurfaceAverageVelMisfitEnum);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-
+-		/*Compute SurfaceAverageVelMisfitEnum:
+-		 *
+-		 *      1                    2              2
+-		 * J = ---  sqrt(  (u - u   )  +  (v - v   )  )
+-		 *      S                obs            obs
+-		 */
+-		misfit=1/S*sqrt( pow(vx-vxobs,2) + pow(vy-vyobs,2));
+-
+-		/*Add to cost function*/
+-		Jelem+=misfit*weight*Jdet*gauss->weight;
+-	}
+-
+-	/*clean-up and Return: */
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+-IssmDouble Tria::SurfaceLogVxVyMisfit(void){/*{{{*/
+-
+-	IssmDouble Jelem=0, S=0;
+-	IssmDouble epsvel=2.220446049250313e-16;
+-	IssmDouble meanvel=3.170979198376458e-05; /*1000 m/yr*/
+-	IssmDouble misfit, Jdet;
+-	IssmDouble vx,vy,vxobs,vyobs,weight;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	GaussTria *gauss=NULL;
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/* Get node coordinates and dof list: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-
+-	/*Retrieve all inputs we will be needing: */
+-	Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* vx_input     =inputs->GetInput(VxEnum);        _assert_(vx_input);
+-	Input* vy_input     =inputs->GetInput(VyEnum);        _assert_(vy_input);
+-	Input* vxobs_input  =inputs->GetInput(InversionVxObsEnum);     _assert_(vxobs_input);
+-	Input* vyobs_input  =inputs->GetInput(InversionVyObsEnum);     _assert_(vyobs_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(4);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,SurfaceLogVxVyMisfitEnum);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vxobs_input->GetInputValue(&vxobs,gauss);
+-		vyobs_input->GetInputValue(&vyobs,gauss);
+-
+-		/*Compute SurfaceRelVelMisfit:
+-		 *
+-		 *      1            [        |u| + eps     2          |v| + eps     2  ]
+-		 * J = --- \bar{v}^2 | log ( -----------  )   +  log ( -----------  )   |  
+-		 *      2            [       |u    |+ eps              |v    |+ eps     ]
+-		 *                              obs                       obs
+-		 */
+-		misfit=0.5*pow(meanvel,2)*(
+-					pow(log((fabs(vx)+epsvel)/(fabs(vxobs)+epsvel)),2) +
+-					pow(log((fabs(vy)+epsvel)/(fabs(vyobs)+epsvel)),2) );
+-
+-		/*Add to cost function*/
+-		Jelem+=misfit*weight*Jdet*gauss->weight;
+-	}
+-
+-	/*clean-up and Return: */
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+-IssmDouble Tria::ThicknessAbsGradient(void){/*{{{*/
+-
+-	/* Intermediaries */
+-	IssmDouble Jelem = 0;
+-	IssmDouble weight;
+-	IssmDouble Jdet;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	IssmDouble dp[NDOF2];
+-	GaussTria *gauss = NULL;
+-
+-	/*retrieve parameters and inputs*/
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement()) return 0;
+-
+-	/*Retrieve all inputs we will be needing: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* weights_input  =inputs->GetInput(InversionCostFunctionsCoefficientsEnum);   _assert_(weights_input);
+-	Input* thickness_input=inputs->GetInput(ThicknessEnum); _assert_(thickness_input);
+-
+-	/* Start looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,ThicknessAbsGradientEnum);
+-		thickness_input->GetInputDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
+-
+-		/*Tikhonov regularization: J = 1/2 ((dp/dx)^2 + (dp/dy)^2) */ 
+-		Jelem+=weight*1/2*(dp[0]*dp[0]+dp[1]*dp[1])*Jdet*gauss->weight;
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+-IssmDouble Tria::ThicknessAlongGradient(void){/*{{{*/
+-
+-	/* Intermediaries */
+-	IssmDouble  Jelem = 0;
+-	IssmDouble  weight;
+-	IssmDouble  Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  dp[NDOF2];
+-	IssmDouble  vx,vy,vel;
+-	GaussTria  *gauss                    = NULL;
+-
+-	/*retrieve parameters and inputs*/
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement()) return 0;
+-
+-	/*Retrieve all inputs we will be needing: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* weights_input  = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+-	Input* thickness_input= inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+-	Input* vx_input       = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+-	Input* vy_input       = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
+-
+-	/* Start looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,ThicknessAlongGradientEnum);
+-		thickness_input->GetInputDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vel = sqrt(vx*vx+vy*vy);
+-		vx  = vx/(vel+1.e-9);
+-		vy  = vy/(vel+1.e-9);
+-
+-		/*J = 1/2 ( vx*dH/dx + vy*dH/dy )^2 */
+-		Jelem+=weight*1/2*(vx*dp[0] + vy*dp[1])*(vx*dp[0] + vy*dp[1])*Jdet*gauss->weight;
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+-IssmDouble Tria::ThicknessAcrossGradient(void){/*{{{*/
+-
+-	/* Intermediaries */
+-	IssmDouble  Jelem = 0;
+-	IssmDouble  weight;
+-	IssmDouble  Jdet;
+-	IssmDouble  xyz_list[NUMVERTICES][3];
+-	IssmDouble  dp[NDOF2];
+-	IssmDouble  vx,vy,vel;
+-	GaussTria  *gauss                    = NULL;
+-
+-	/*retrieve parameters and inputs*/
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement()) return 0;
+-
+-	/*Retrieve all inputs we will be needing: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* weights_input  = inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input);
+-	Input* thickness_input= inputs->GetInput(ThicknessEnum);                          _assert_(thickness_input);
+-	Input* vx_input       = inputs->GetInput(VxEnum);                                 _assert_(vx_input);
+-	Input* vy_input       = inputs->GetInput(VyEnum);                                 _assert_(vy_input);
+-
+-	/* Start looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get all parameters at gaussian point*/
+-		weights_input->GetInputValue(&weight,gauss,ThicknessAcrossGradientEnum);
+-		thickness_input->GetInputDerivativeValue(&dp[0],&xyz_list[0][0],gauss);
+-		vx_input->GetInputValue(&vx,gauss);
+-		vy_input->GetInputValue(&vy,gauss);
+-		vel = sqrt(vx*vx+vy*vy);
+-		vx  = vx/(vel+1.e-9);
+-		vy  = vy/(vel+1.e-9);
+-
+-		/*J = 1/2 ( -vy*dH/dx + vx*dH/dy )^2 */
+-		Jelem+=weight*1/2*(-vy*dp[0] + vx*dp[1])*(-vy*dp[0] + vx*dp[1])*Jdet*gauss->weight;
+-	}
+-
+-	/*Clean up and return*/
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+-IssmDouble Tria::ThicknessAbsMisfit(void){/*{{{*/
+-
+-	/*Intermediaries*/
+-	IssmDouble thickness,thicknessobs,weight;
+-	IssmDouble Jdet;
+-	IssmDouble Jelem = 0;
+-	IssmDouble xyz_list[NUMVERTICES][3];
+-	GaussTria *gauss = NULL;
+-	IssmDouble dH[2];
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/*Retrieve all inputs we will be needing: */
+-	::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES);
+-	Input* thickness_input   =inputs->GetInput(ThicknessEnum);   _assert_(thickness_input);
+-	Input* thicknessobs_input=inputs->GetInput(InversionThicknessObsEnum);_assert_(thicknessobs_input);
+-	Input* weights_input     =inputs->GetInput(InversionCostFunctionsCoefficientsEnum);     _assert_(weights_input);
+-
+-	/* Start  looping on the number of gaussian points: */
+-	gauss=new GaussTria(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-
+-		gauss->GaussPoint(ig);
+-
+-		/* Get Jacobian determinant: */
+-		GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
+-
+-		/*Get parameters at gauss point*/
+-		thickness_input->GetInputValue(&thickness,gauss);
+-		thickness_input->GetInputDerivativeValue(&dH[0],&xyz_list[0][0],gauss);
+-		thicknessobs_input->GetInputValue(&thicknessobs,gauss);
+-		weights_input->GetInputValue(&weight,gauss,ThicknessAbsMisfitEnum);
+-
+-		/*compute ThicknessAbsMisfit*/
+-		Jelem+=0.5*(thickness-thicknessobs)*(thickness-thicknessobs)*weight*Jdet*gauss->weight;
+-	}
+-
+-	/* clean up and Return: */
+-	delete gauss;
+-	return Jelem;
+-}
+-/*}}}*/
+ void       Tria::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){/*{{{*/
+ 
+ 	int vertexpidlist[NUMVERTICES];
+Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17975)
++++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 17976)
+@@ -155,14 +155,6 @@
+ 		void       ControlInputScaleGradient(int enum_type,IssmDouble scale);
+ 		void       ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
+ 		void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
+-		IssmDouble RheologyBbarAbsGradient(void);
+-		IssmDouble ThicknessAbsMisfit(void);
+-		IssmDouble ThicknessAbsGradient(void);
+-		IssmDouble ThicknessAlongGradient(void);
+-		IssmDouble ThicknessAcrossGradient(void);
+-		IssmDouble BalancethicknessMisfit(void);
+-		IssmDouble SurfaceLogVxVyMisfit(void);
+-		IssmDouble SurfaceAverageVelMisfit(void);
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter);
+ 
+ 		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17975)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17976)
+@@ -3328,118 +3328,6 @@
+ 	xDelete<int>(control_type);
+ }
+ /*}}}*/
+-IssmDouble Penta::SurfaceAverageVelMisfit(void){/*{{{*/
+-
+-	int    approximation;
+-	IssmDouble J;
+-	Tria*  tria=NULL;
+-
+-	/*retrieve inputs :*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/*Bail out if this element if:
+-	 * -> Non SSA and not on the surface
+-	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+-		return 0;
+-	}
+-	else if (approximation==SSAApproximationEnum){
+-
+-		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+-		 * and compute SurfaceAverageVelMisfit*/
+-		tria=(Tria*)SpawnTria(0,1,2);
+-		J=tria->SurfaceAverageVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-	else{
+-
+-		tria=(Tria*)SpawnTria(3,4,5);
+-		J=tria->SurfaceAverageVelMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-}
+-/*}}}*/
+-IssmDouble Penta::SurfaceLogVxVyMisfit(void){/*{{{*/
+-
+-	IssmDouble J;
+-	Tria* tria=NULL;
+-
+-	/*inputs: */
+-	int  approximation;
+-
+-	/*retrieve inputs :*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-
+-	/*Bail out if this element if:
+-	 * -> Non SSA and not on the surface
+-	 * -> SSA (2d model) and not on bed) */
+-	if ((approximation!=SSAApproximationEnum && !IsOnSurface()) || (approximation==SSAApproximationEnum && !IsOnBase())){
+-		return 0;
+-	}
+-	else if (approximation==SSAApproximationEnum){
+-
+-		/*This element should be collapsed into a tria element at its base. Create this tria element, 
+-		 * and compute SurfaceLogVxVyMisfit*/
+-		tria=(Tria*)SpawnTria(0,1,2);
+-		J=tria->SurfaceLogVxVyMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-	else{
+-
+-		tria=(Tria*)SpawnTria(3,4,5);
+-		J=tria->SurfaceLogVxVyMisfit();
+-		delete tria->material; delete tria;
+-		return J;
+-	}
+-}
+-/*}}}*/
+-IssmDouble Penta::ThicknessAbsGradient(void){/*{{{*/
+-
+-	_error_("Not implemented yet");
+-}
+-/*}}}*/
+-IssmDouble Penta::ThicknessAbsMisfit(void){/*{{{*/
+-
+-	int    approximation;
+-	IssmDouble J;
+-	Tria*  tria=NULL;
+-
+-	/*retrieve inputs :*/
+-	inputs->GetInputValue(&approximation,ApproximationEnum);
+-
+-	/*If on water, return 0: */
+-	if(!IsIceInElement())return 0;
+-	_error_("Not implemented yet");
+-
+-	tria=(Tria*)SpawnTria(0,1,2);
+-	J=tria->ThicknessAbsMisfit();
+-	delete tria->material; delete tria;
+-	return J;
+-}
+-/*}}}*/
+-IssmDouble Penta::RheologyBbarAbsGradient(void){/*{{{*/
+-
+-	IssmDouble J;
+-	Tria*  tria=NULL;
+-
+-	/*If on water, on shelf or not on bed, skip: */
+-	if(!IsIceInElement() || !IsOnBase()) return 0;
+-
+-	tria=(Tria*)SpawnTria(0,1,2);
+-	J=tria->RheologyBbarAbsGradient();
+-	delete tria->material; delete tria;
+-	return J;
+-}
+-/*}}}*/
+ void       Penta::GetVectorFromControlInputs(Vector<IssmDouble>* vector,int control_enum,int control_index,const char* data){/*{{{*/
+ 
+ 	int vertexpidlist[NUMVERTICES];
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17975)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 17976)
+@@ -145,14 +145,6 @@
+ 		void   ControlInputScaleGradient(int enum_type,IssmDouble scale);
+ 		void   ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
+ 		void   ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum);
+-		IssmDouble RheologyBbarAbsGradient(void);
+-		IssmDouble ThicknessAbsMisfit(void);
+-		IssmDouble SurfaceLogVxVyMisfit(void);
+-		IssmDouble SurfaceAverageVelMisfit(void);
+-		IssmDouble ThicknessAbsGradient(void);
+-		IssmDouble ThicknessAlongGradient(void){_error_("not supported");};
+-		IssmDouble ThicknessAcrossGradient(void){_error_("not supported");};
+-		IssmDouble BalancethicknessMisfit(void){_error_("not supported");};
+ 		void   InputControlUpdate(IssmDouble scalar,bool save_parameter);
+ 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
+ 		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17975)
++++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 17976)
+@@ -186,14 +186,6 @@
+ 		void       ControlInputScaleGradient(int enum_type,IssmDouble scale){_error_("not implemented yet");};
+ 		void       ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){_error_("not implemented yet");};
+ 		void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
+-		IssmDouble RheologyBbarAbsGradient(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAbsMisfit(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAbsGradient(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAlongGradient(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAcrossGradient(void){_error_("not implemented yet");};
+-		IssmDouble BalancethicknessMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceLogVxVyMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceAverageVelMisfit(void){_error_("not implemented yet");};
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter){_error_("not implemented yet");};
+ 
+ 		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
+Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17975)
++++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 17976)
+@@ -191,14 +191,6 @@
+ 		void       ControlInputScaleGradient(int enum_type,IssmDouble scale){_error_("not implemented yet");};
+ 		void       ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index){_error_("not implemented yet");};
+ 		void       ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){_error_("not implemented yet");};
+-		IssmDouble RheologyBbarAbsGradient(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAbsMisfit(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAbsGradient(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAlongGradient(void){_error_("not implemented yet");};
+-		IssmDouble ThicknessAcrossGradient(void){_error_("not implemented yet");};
+-		IssmDouble BalancethicknessMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceLogVxVyMisfit(void){_error_("not implemented yet");};
+-		IssmDouble SurfaceAverageVelMisfit(void){_error_("not implemented yet");};
+ 		void       InputControlUpdate(IssmDouble scalar,bool save_parameter){_error_("not implemented yet");};
+ 
+ 		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){_error_("not implemented yet");};
Index: /issm/oecreview/Archive/17802-17983/ISSM-17976-17977.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17976-17977.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17976-17977.diff	(revision 17986)
@@ -0,0 +1,40 @@
+Index: ../trunk-jpl/externalpackages/valgrind/issm.supp
+===================================================================
+--- ../trunk-jpl/externalpackages/valgrind/issm.supp	(revision 17976)
++++ ../trunk-jpl/externalpackages/valgrind/issm.supp	(revision 17977)
+@@ -179,4 +179,35 @@
+    fun:PMPI_PACK
+    fun:__dmumps_comm_buffer_MOD_dmumps_62
+ }
++{
++	<mumps11>
++	  Memcheck:User
++	  fun:check_mem_is_defined_untyped
++	  fun:PMPI_Isend
++	  fun:libparmetis__gkMPI_Isend
++	  fun:libparmetis__CommInterfaceData
++	  fun:libparmetis__CompactGraph
++	  fun:libparmetis__MultilevelOrder
++	  fun:ParMETIS_V32_NodeND
++	  fun:ParMETIS_V3_NodeND
++	  fun:mumps_parmetis_
++}
++{
++	<mumps12>
++	  Memcheck:User
++	  fun:check_mem_is_defined_untyped
++	  fun:PMPI_Bcast
++	  fun:MPI_BCAST
++	  fun:__dmumps_parallel_analysis_MOD_dmumps_718
++	  fun:__dmumps_parallel_analysis_MOD_dmumps_717
++	  fun:__dmumps_parallel_analysis_MOD_dmumps_715
++}
++{
++	<mumps13>
++	  Memcheck:Leak
++	  fun:malloc
++	  fun:__dmumps_parallel_analysis_MOD_dmumps_775
++	  fun:__dmumps_parallel_analysis_MOD_dmumps_720
++	  fun:__dmumps_parallel_analysis_MOD_dmumps_715
++}
+ #}}}
Index: /issm/oecreview/Archive/17802-17983/ISSM-17977-17978.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17977-17978.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17977-17978.diff	(revision 17986)
@@ -0,0 +1,28 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Element.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17977)
++++ ../trunk-jpl/src/c/classes/Elements/Element.cpp	(revision 17978)
+@@ -569,6 +569,7 @@
+ 	for(int i=0;i<numvertices;i++) x_list[i]=xyz_list[i*3+0];
+ 	ValueP1OnGauss(&x,x_list,gauss);
+ 
++	xDelete<IssmDouble>(x_list);
+ 	return x;
+ }/*}}}*/
+ IssmDouble Element::GetYcoord(IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+@@ -583,6 +584,7 @@
+ 	for(int i=0;i<numvertices;i++) y_list[i]=xyz_list[i*3+1];
+ 	ValueP1OnGauss(&y,y_list,gauss);
+ 
++	xDelete<IssmDouble>(y_list);
+ 	return y;
+ }/*}}}*/
+ IssmDouble Element::GetZcoord(IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
+@@ -597,6 +599,7 @@
+ 	for(int i=0;i<numvertices;i++) z_list[i]=xyz_list[i*3+2];
+ 	ValueP1OnGauss(&z,z_list,gauss);
+ 
++	xDelete<IssmDouble>(z_list);
+ 	return z;
+ }/*}}}*/
+ bool       Element::HasNodeOnBase(){/*{{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17978-17979.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17978-17979.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17978-17979.diff	(revision 17986)
@@ -0,0 +1,18 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17978)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17979)
+@@ -448,12 +448,11 @@
+ 			GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->GetNode(i));
+ 			if(values[i]>h_max) {
+ 				residual[i] = kappa*(values[i]-h_max);
+-				pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(values[i]-base[i]));
+ 			}
+ 			else{
+ 				residual[i] = 0.;
+-				pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(h_max-base[i]));
+ 			}
++			pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(min(hmax,values[i])-base[i]));
+ 		}
+ 		xDelete<IssmDouble>(thickness);
+ 		xDelete<IssmDouble>(base);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17979-17980.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17979-17980.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17979-17980.diff	(revision 17986)
@@ -0,0 +1,13 @@
+Index: ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17979)
++++ ../trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 17980)
+@@ -452,7 +452,7 @@
+ 			else{
+ 				residual[i] = 0.;
+ 			}
+-			pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(min(hmax,values[i])-base[i]));
++			pressure[i]=(rho_ice*g*thickness[i])-(rho_freshwater*g*(min(h_max,values[i])-base[i]));
+ 		}
+ 		xDelete<IssmDouble>(thickness);
+ 		xDelete<IssmDouble>(base);
Index: /issm/oecreview/Archive/17802-17983/ISSM-17980-17981.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17980-17981.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17980-17981.diff	(revision 17986)
@@ -0,0 +1,20 @@
+Index: ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17980)
++++ ../trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp	(revision 17981)
+@@ -1046,6 +1046,7 @@
+ 	/*Clean up and return*/
+ 	delete gauss;
+ 	delete friction;
++	xDelete<int>(pairindices);
+ 	xDelete<IssmDouble>(enthalpy);
+ 	xDelete<IssmDouble>(pressure);
+ 	xDelete<IssmDouble>(watercolumn);
+@@ -1053,6 +1054,7 @@
+ 	xDelete<IssmDouble>(meltingrate_enthalpy);
+ 	xDelete<IssmDouble>(heating);
+ 	xDelete<IssmDouble>(xyz_list);
++	xDelete<IssmDouble>(xyz_list_base);
+ }/*}}}*/
+ void EnthalpyAnalysis::DrainWaterfractionIcecolumn(Element* element){/*{{{*/
+ 
Index: /issm/oecreview/Archive/17802-17983/ISSM-17981-17982.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17981-17982.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17981-17982.diff	(revision 17986)
@@ -0,0 +1,58 @@
+Index: ../trunk-jpl/src/c/classes/Elements/Penta.cpp
+===================================================================
+--- ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17981)
++++ ../trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 17982)
+@@ -1216,45 +1216,31 @@
+ /*}}}*/
+ void       Penta::InputExtrude(int enum_type){/*{{{*/
+ 
+-	int     i,num_inputs;
+-	Penta  *penta       = NULL;
+-	Input  *copy        = NULL;
+-	Input **base_inputs = NULL;
+-
+ 	/*Are we on the base, not on the surface?:*/
+ 	if(!IsOnBase()) return;
+ 
+ 	/*Step1: Get and Extrude original input: */
+-	num_inputs=1;
+-	base_inputs=xNew<Input*>(num_inputs);
+-	base_inputs[0]=(Input*)this->inputs->GetInput(enum_type);
+-	for(i=0;i<num_inputs;i++){
+-		if(!base_inputs[i]) _error_("could not find input with enum " << EnumToStringx(enum_type));
+-		base_inputs[i]->Extrude();
+-	}
++	Input* base_input=(Input*)this->inputs->GetInput(enum_type);
++	if(!base_input) _error_("could not find input with enum " << EnumToStringx(enum_type));
++	base_input->Extrude();
+ 
+ 	/*Stop if there is only one layer of element*/
+-	if (this->IsOnSurface()) return;
++	if(this->IsOnSurface()) return;
+ 
+ 	/*Step 2: this input has been extruded for this element, now follow the upper element*/
+-	penta=this;
++	Penta* penta=this;
+ 	for(;;){
+ 		/* get upper Penta*/
+ 		penta=penta->GetUpperPenta();
+ 		_assert_(penta->Id()!=this->id);
+ 
+ 		/*Add input of the basal element to penta->inputs*/
+-		for(i=0;i<num_inputs;i++){
+-			copy=(Input*)base_inputs[i]->copy();
+-			penta->inputs->AddInput((Input*)copy);
+-		}
++		Input* copy=(Input*)base_input->copy();
++		penta->inputs->AddInput((Input*)copy);
+ 
+ 		/*Stop if we have reached the surface*/
+-		if (penta->IsOnSurface()) break;
++		if(penta->IsOnSurface()) break;
+ 	}
+-
+-	/*clean-up and return*/
+-	xDelete<Input*>(base_inputs);
+ }
+ /*}}}*/
+ void       Penta::InputScale(int enum_type,IssmDouble scale_factor){/*{{{*/
Index: /issm/oecreview/Archive/17802-17983/ISSM-17982-17983.diff
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-17982-17983.diff	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-17982-17983.diff	(revision 17986)
@@ -0,0 +1,12424 @@
+Index: ../trunk-jpl/src/java/build.xml
+===================================================================
+--- ../trunk-jpl/src/java/build.xml	(revision 17982)
++++ ../trunk-jpl/src/java/build.xml	(revision 17983)
+@@ -1,126 +0,0 @@
+-<project name="inishell" default="help" basedir=".">
+-	<description>
+-	Build and run the inishell Application from the command line.
+-	</description>
+-
+-
+-	<!-- set global properties for the build -->
+-	<property name="src" location="src"/>
+-	<property name="examples" location="doc/examples"/>
+-	<property name="build" location="build"/>
+-	<property name="dist"  location="dist"/>
+-	<property name="lib.dir" location="lib"/>
+-	<tstamp prefix="build-info">
+-		<format property="date" pattern="yyyy-MM-dd" locale="en" />
+-		<format property="time" pattern="HH:mm:ss" locale="en" />
+-		<format property="num-date" pattern="yyyyMMdd" locale="en" />
+-	</tstamp>
+-	<property name="version.num" value="1.0.0" />
+-	<!--<buildnumber file="dist/build.num"/>-->
+-	<!--<property name="version-number" value="${version.num}-${build.number}" />-->
+-	<property name="version-number" value="${version.num}" />
+-	<property name="version-full" value="${version.num}-${build-info.num-date}" />
+-
+-	<path id="classpath">
+-		<fileset dir="${lib.dir}" includes="**/*.jar"/>
+-	</path>
+-
+-
+-	<!-- targets -->
+-	<target name="help">
+-		<echo>You can use the following targets:</echo>
+-		<echo> </echo>
+-		<echo>  help     : (default) Prints this message </echo>
+-		<echo>  init     : create necessary directories</echo>
+-		<echo>  clean    : Deletes work directories</echo>
+-		<echo>  compile  : Compiles into class files</echo>
+-		<echo>  dist     : pack all necessary files into a JAR file</echo>
+-		<echo>  issm 	 : create inishell GUI using issm.xml</echo>
+-		<echo>  snowpack : dist tailored for snowpack</echo>
+-		<echo>  meteoio  : dist tailored for meteoio</echo>
+-		<echo>  run      : run the previously compiled version</echo>
+-		<echo>  pack     : pack all in a zip file for a release</echo>
+-		<echo></echo>
+-	</target>
+-
+-	<target name="init">
+-		<mkdir dir="${build}"/>
+-		<mkdir dir="${dist}"/>
+-	</target>
+-
+-	<target name="snowpack" depends="init" description="Make doc/examples/snowpack_config.xml the default XML config">
+-		<copy file="${examples}/snowpack_config.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
+-		<antcall target="dist"/>
+-	</target>
+-
+-	<target name="meteoio" depends="init" description="Make doc/examples/meteoio_config.xml the default XML config">
+-		<copy file="${examples}/meteoio_config.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
+-		<antcall target="dist"/>
+-	</target>
+-	
+-	<target name="issm" depends="init" description="Make doc/examples/issm.xml the default XML config">
+-		<copy file="./doc/examples/issm.xml" tofile="${build}/resources/default_config.xml" overwrite="true"/>
+-		<antcall target="dist"/>
+-	</target>
+-
+-	<target name="compile" depends="init" description="Compile from ${src} to ${build}">
+-		<javac srcdir="${src}" destdir="${build}" includeantruntime="false">
+-			<classpath>
+-				<fileset dir="lib">
+-				<include name="**/*.jar"/>
+-				</fileset>
+-			</classpath>
+-		</javac>
+-		<copy todir="${build}/resources">
+-		<fileset dir="${src}/resources" includes="**"/>
+-	</copy>
+-	</target>
+-
+-	<target name="dist" depends="compile" description="generate the distribution" >
+-		<!-- Create the distribution directory -->
+-		<delete file="MANIFEST.MF"/>
+-		<manifest file="MANIFEST.MF">
+-			<attribute name="Built-By" value="${user.name}"/>
+-			<attribute name="Built-On" value="${build-info.date}" />
+-			<attribute name="Built-At" value="${build-info.time}" />
+-			<attribute name="Main-Class" value="main/GUIBuilder"/>
+-			<attribute name="Specification-Title" value="INI file generator"/>
+-			<attribute name="Specification-Version" value="${version-full}"/>
+-			<attribute name="Specification-Vendor" value="SLF, www.slf.ch"/>
+-			<attribute name="Implementation-Title" value="INIshell ini creator"/>
+-			<attribute name="Implementation-Version" value="${version-number}"/>
+-			<attribute name="Implementation-Vendor" value="SLF, www.slf.ch"/>
+-		</manifest>
+-
+-		<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
+-		<jar jarfile="${dist}/inishell.jar" basedir="${build}" manifest="MANIFEST.MF" index="true" >
+-			<zipfileset src="${lib.dir}/miglayout-4.0.jar" includes="**/*.class"/>
+-		</jar>
+-	</target>
+-
+-	<target name="run" depends="dist">
+-		<java fork="true" classname="main/GUIBuilder">
+-			<classpath>
+-				<path refid="classpath"/>
+-				<path location="${dist}/inishell.jar"/>
+-			</classpath>
+-		</java>
+-	</target>
+-
+-	<target name="clean" description="clean up" >
+-		<!-- Delete the ${build} and ${dist} directory trees -->
+-		<delete file="MANIFEST.MF"/>
+-		<delete dir="${build}"/>
+-		<delete dir="${dist}"/>
+-	</target>
+-
+-	<target name="pack" depends="dist" description="pack for distribution">
+-		<zip destfile="inishell-${version.num}.zip">
+-			<zipfileset dir="doc/examples" prefix="inishell-${version.num}/doc/examples"/>
+-			<zipfileset dir="dist" prefix="inishell-${version.num}/bin"/>
+-			<zipfileset dir="." includes="inishell.sh" prefix="inishell-${version.num}/bin"/>
+-			<zipfileset dir="." includes="Changelog_${version.num}.txt" prefix="inishell-${version.num}/doc"/>
+-		</zip>
+-	</target>
+-
+-</project>
+Index: ../trunk-jpl/src/java/build/resources/icons/advancedsettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/mydocuments.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/readme.txt
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/icons/readme.txt	(revision 17982)
++++ ../trunk-jpl/src/java/build/resources/icons/readme.txt	(revision 17983)
+@@ -1,10 +0,0 @@
+-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+-This copyright and license notice covers the images in this directory.
+-************************************************************************
+-
+-TITLE:	Crystal Project Icons
+-AUTHOR:	Everaldo Coelho
+-SITE:	http://www.everaldo.com
+-CONTACT: everaldo@everaldo.com
+-
+-Copyright (c)  2006-2007  Everaldo Coelho.
+Index: ../trunk-jpl/src/java/build/resources/icons/kghostview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/file_ops.xcf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/filesave.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/viewmag.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/ini_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/fileopen.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/xml_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/filesaveas.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/opensettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/icons/reset.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd	(revision 17982)
++++ ../trunk-jpl/src/java/build/resources/config_schema-0.1.1.xsd	(revision 17983)
+@@ -1,154 +0,0 @@
+-<?xml version="1.0"?>
+-<!-- 
+-*   
+-*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*    	
+-* -->
+-<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+-  <xsd:element name="inishell_config" type="general" />
+-  
+-  <xsd:complexType name="general">
+-    <xsd:choice maxOccurs="unbounded">
+-      <xsd:element name="parameter" type="parametertype" />
+-      <xsd:element name="parametergroup" type="pargroup" />
+-      <xsd:element name="include" type="pathonly" /> 
+-      <xsd:element name="frame" type="framegroup" /> 
+-    </xsd:choice>
+-    <xsd:attribute name="application" />
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="framegroup">
+-    <xsd:choice minOccurs="1" maxOccurs="unbounded">
+-      <xsd:element name="parameter" type="parametertype" />
+-      <xsd:element name="reference" type="nameonly" />
+-      <xsd:element name="section" type="nameonly"/>
+-    </xsd:choice>
+-    <xsd:attribute name="key" />
+-    <xsd:attribute name="label" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="parametertype">
+-    <xsd:complexContent>
+-      <xsd:extension base="parbasetype">
+-		<xsd:attribute name="key" type="xsd:string" use="required"/> 
+-		<xsd:attribute name="default" type="xsd:string" />
+-		<xsd:attribute name="counter" type="xsd:integer" />
+-      </xsd:extension>
+-    </xsd:complexContent>		
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="nameonly">
+-	<xsd:attribute name="name" />   
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="optionvalue">
+-	<xsd:attribute name="value" />   
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="pathonly">
+-	<xsd:attribute name="path" />   
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="pargroup">
+-	<xsd:choice minOccurs="1" maxOccurs="unbounded">
+-	  <xsd:element name="parameter" type="parametertype" />
+-	  <xsd:element name="reference" type="nameonly" />
+-	  <xsd:element name="option" type="optionvalue" />
+-	  <xsd:element name="frame" type="framegroup" /> 
+-	</xsd:choice>
+-	<xsd:attribute name="name" />
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="parbasetype">
+-	<xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="section" type="nameonly"/>
+-	  </xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="replace" type="nameonly"/>
+-	  </xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="parameter" type="parametertype" />
+-	  </xsd:sequence>
+-	  <xsd:choice minOccurs="0" maxOccurs="unbounded">				
+-		<xsd:element name="option" minOccurs="0">
+-		  <xsd:complexType>
+-			<xsd:complexContent>
+-			  <xsd:extension base="parbasetype">
+-				<xsd:attribute name="value" type="xsd:string" use="required" />
+-				<xsd:attribute name="label" type="xsd:string" use="optional" />
+-				<xsd:attribute name="default" type="xsd:boolean" use="optional"/>
+-			  </xsd:extension>
+-			</xsd:complexContent>
+-		  </xsd:complexType>
+-		</xsd:element>
+-	  </xsd:choice>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="reference" type="nameonly" />
+-	  </xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="help" type="helptype"/>	
+-	  </xsd:sequence>
+-	</xsd:sequence>
+-	
+-	<xsd:attribute name="type" use="required">
+-	  <xsd:simpleType>
+-		<xsd:restriction base="xsd:string">
+-		  <xsd:enumeration value="integer" />
+-		  <xsd:enumeration value="integer+" />
+-		  <xsd:enumeration value="decimal" />
+-		  <xsd:enumeration value="path" />
+-		  <xsd:enumeration value="file" />
+-		  <xsd:enumeration value="choice" />
+-		  <xsd:enumeration value="alternative" />
+-		  <xsd:enumeration value="dropdown" />
+-		  <xsd:enumeration value="string" />
+-		  <xsd:enumeration value="combination" />
+-		  <xsd:enumeration value="selector" />
+-		</xsd:restriction>
+-	  </xsd:simpleType>
+-	</xsd:attribute>
+-	
+-	<xsd:attribute name="maximum" type="xsd:integer"/>
+-	<xsd:attribute name="minimum" type="xsd:integer"/>
+-	<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
+-	<xsd:attribute name="optional" type="xsd:boolean" default="true" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="needstype">
+-	<xsd:attribute name="type" type="xsd:string" use="required" />
+-	<xsd:attribute name="name" type="xsd:string" use="required" />
+-	
+-	<xsd:attribute name="value" />
+-	<xsd:attribute name="optional" type="xsd:boolean" />
+-	<xsd:attribute name="minoccur" type="xsd:integer" />
+-	<xsd:attribute name="maxoccur" type="xsd:string" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="baseType">
+-	<xsd:sequence minOccurs="0" maxOccurs="1">
+-	  <xsd:element name="help" type="helptype" />		
+-	</xsd:sequence>
+-	<xsd:attribute name="key" type="xsd:string" use="required" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="helptype" mixed="true">
+-	<xsd:choice minOccurs="0" maxOccurs="unbounded">
+-	  <xsd:element name="section" type="nameonly" />
+-	  <xsd:element name="replace" type="nameonly" />
+-	</xsd:choice>
+-  </xsd:complexType> 
+-</xsd:schema>
+Index: ../trunk-jpl/src/java/build/resources/document-open-2.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/document-preview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/document-export-4.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/resources/config_schema.xsd
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/config_schema.xsd	(revision 17982)
++++ ../trunk-jpl/src/java/build/resources/config_schema.xsd	(revision 17983)
+@@ -1,141 +0,0 @@
+-<?xml version="1.0"?>
+-<!-- 
+-*   
+-*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*    	
+-* -->
+-
+-<xsd:schema version="1.0"
+-xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+-
+-  <xsd:element name="inishell_config" type="general" />
+-  
+-	<xsd:complexType name="general">
+-      <xsd:choice maxOccurs="unbounded">
+-			<xsd:element name="parameter" type="parametertype" />
+-			<xsd:element name="parametergroup" type="pargroup" />
+-			<xsd:element name="include" type="pathonly" /> 
+-      </xsd:choice>
+-	  <xsd:attribute name="application" />
+-    </xsd:complexType>
+-	
+-	<xsd:complexType name="parametertype">
+-		<xsd:complexContent>
+-			<xsd:extension base="parbasetype">
+-				<xsd:attribute name="key" type="xsd:string" use="required"/> 
+-				<xsd:attribute name="default" type="xsd:string" />
+-				<xsd:attribute name="counter" type="xsd:integer" />
+-			</xsd:extension>
+-		</xsd:complexContent>		
+-	</xsd:complexType>
+-   
+-   <xsd:complexType name="nameonly">
+-		<xsd:attribute name="name" />   
+-   </xsd:complexType>
+-   
+-   <xsd:complexType name="pathonly">
+-		<xsd:attribute name="path" />   
+-   </xsd:complexType>
+-   
+-	<xsd:complexType name="pargroup">
+-		<xsd:choice minOccurs="1" maxOccurs="unbounded">
+-			<xsd:element name="parameter" type="parametertype" />
+-			<xsd:element name="reference" type="nameonly" />
+-		</xsd:choice>
+-		<xsd:attribute name="name" />
+-	</xsd:complexType>
+-  
+-	
+-	<xsd:complexType name="parbasetype">
+-		<xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="section" type="nameonly"/>
+-			</xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="replace" type="nameonly"/>
+-			</xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="parameter" type="parametertype" />
+-			</xsd:sequence>
+-			<xsd:choice minOccurs="0" maxOccurs="unbounded">				
+-				<xsd:element name="option" minOccurs="0">
+-					<xsd:complexType>
+-						<xsd:complexContent>
+-							<xsd:extension base="parbasetype">
+-								<xsd:attribute name="value" type="xsd:string" use="required" />
+-								<xsd:attribute name="label" type="xsd:string" use="optional" />
+-								<xsd:attribute name="default" type="xsd:boolean"/>
+-							</xsd:extension>
+-						</xsd:complexContent>
+-					</xsd:complexType>
+-				</xsd:element>
+-			</xsd:choice>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="reference" type="nameonly" />
+-			</xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="help" type="helptype"/>	
+-			</xsd:sequence>
+-		</xsd:sequence>
+-		
+-		<xsd:attribute name="type" use="required">
+-		     <xsd:simpleType>
+-				<xsd:restriction base="xsd:string">
+-					<xsd:enumeration value="integer" />
+-					<xsd:enumeration value="integer+" />
+-					<xsd:enumeration value="decimal" />
+-					<xsd:enumeration value="path" />
+-					<xsd:enumeration value="file" />
+-					<xsd:enumeration value="choice" />
+-					<xsd:enumeration value="alternative" />
+-					<xsd:enumeration value="string" />
+-					<xsd:enumeration value="combination" />
+-					<xsd:enumeration value="selector" />
+-				</xsd:restriction>
+-			</xsd:simpleType>
+-		</xsd:attribute>
+-		
+-		<xsd:attribute name="maximum" type="xsd:integer"/>
+-		<xsd:attribute name="minimum" type="xsd:integer"/>
+-		<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
+-		<xsd:attribute name="optional" type="xsd:boolean" default="true" />
+-	</xsd:complexType>
+-	
+-	<xsd:complexType name="needstype">
+-		<xsd:attribute name="type" type="xsd:string" use="required" />
+-		<xsd:attribute name="name" type="xsd:string" use="required" />
+-	
+-		<xsd:attribute name="value" />
+-		<xsd:attribute name="optional" type="xsd:boolean" />
+-		<xsd:attribute name="minoccur" type="xsd:integer" />
+-		<xsd:attribute name="maxoccur" type="xsd:string" />
+-	</xsd:complexType>
+-	
+-	<xsd:complexType name="baseType">
+-		<xsd:sequence minOccurs="0" maxOccurs="1">
+-			<xsd:element name="help" type="helptype" />		
+-		</xsd:sequence>
+-		<xsd:attribute name="key" type="xsd:string" use="required" />
+-	</xsd:complexType>
+-	
+-	<xsd:complexType name="helptype" mixed="true">
+-		<xsd:choice minOccurs="0" maxOccurs="unbounded">
+-			<xsd:element name="section" type="nameonly" />
+-			<xsd:element name="replace" type="nameonly" />
+-		</xsd:choice>
+-	</xsd:complexType>
+-	
+-</xsd:schema>
+Index: ../trunk-jpl/src/java/build/resources/default_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/build/resources/default_config.xml	(revision 17982)
++++ ../trunk-jpl/src/java/build/resources/default_config.xml	(revision 17983)
+@@ -1,1284 +0,0 @@
+-<inishell_config application="ISSM prototype">
+-
+-<!-- mesh -->
+-<parameter key ="Dimension" type="alternative" optional="false">
+-     <section name="mesh" />
+-     <option value="0" type="string" default="true">
+-        <help> dimension is 0 </help>
+-     </option>
+-     <option value="3" type="string">
+-        <help> dimension is 3 </help>
+-       <!-- Elements and vertices of the original 2d mesh -->
+-          <parameter key ="x2d" type="double" default="N/A">
+-              <help> vertices x coordinate [m] </help>
+-          </parameter>
+-          <parameter key ="y2d" type="double" default="N/A">
+-              <help> vertices y coordinate [m] </help>
+-          </parameter>
+-          <parameter key ="elements2d" type="double" default="N/A">
+-              <help> vertex indices of the mesh elements </help>
+-          </parameter>
+-          <parameter key ="numberofvertices2d" type="double" default="0">
+-              <help> number of vertices </help>
+-          </parameter>
+-          <parameter key ="numberofelements2d" type="double" default="0">
+-              <help> number of elements </help>
+-          </parameter>
+-     </option>
+-     <help> select a mesh dimension 0(default) or 3 </help>
+-</parameter>
+-<frame key="1" label="Elements and vertices">
+-<section name="mesh" />
+-  <parameter key ="numberofelements" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of elements </help>
+-  </parameter>
+-  <parameter key ="numberofvertices" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of verticies </help>
+-  </parameter>
+-  <parameter key ="elements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertex indices of the mesh elements </help>
+-  </parameter>
+-  <parameter key ="x" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices x coordinate [m] </help>
+-  </parameter>
+-  <parameter key ="y" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices y coordinate [m] </help>
+-  </parameter>
+-  <parameter key ="z" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices z coordinate [m] </help>
+-  </parameter>
+-  <parameter key ="edges" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>
+-  </parameter>
+-  <parameter key ="numberofedges" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of edges of the 2d mesh </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Properties">
+-<section name="mesh" />
+-  <parameter key ="selected dimension" type="double" default="0">
+-     <section name="mesh" />
+-     <help> mesh dimension </help>
+-  </parameter>
+-  <parameter key ="numberoflayers" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of extrusion layers </help>
+-  </parameter>
+-  <parameter key ="vertexonbed" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower vertices flags list </help>
+-  </parameter>
+-  <parameter key ="elementonbed" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower elements flags list </help>
+-  </parameter>
+-  <parameter key ="vertexonsurface" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper vertices flags list </help>
+-  </parameter>
+-  <parameter key ="elementonsurface" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper element flag list </help>
+-  </parameter>
+-  <parameter key ="uppervertex" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper vertex list (NaN for vertex on the upper surface) </help>
+-  </parameter>
+-  <parameter key ="upperelements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper element list (NaN for element on the upper layer) </help>
+-  </parameter>
+-  <parameter key ="lowervertex" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower vertex list (NaN for vertex on the lower surface) </help>
+-  </parameter>
+-  <parameter key ="lowerelements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower element list (NaN for element on the lower layer </help>
+-  </parameter>
+-  <parameter key ="vertexonboundary" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices on the boundary of the domain flag list </help>
+-  </parameter>
+-  <parameter key ="segments" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> edges on domain boundary (vertex1 vertex2 element) </help>
+-  </parameter>
+-  <parameter key ="segmentmarkers" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> number associated to each segment </help>
+-  </parameter>
+-  <parameter key ="vertexconnectivity" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> list of vertices connected to vertex_i </help>
+-  </parameter>
+-  <parameter key ="elementconnectivity" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> list of vertices connected to element_i </help>
+-  </parameter>
+-  <parameter key ="average_vertex_connectivity" type="double" default="25">
+-     <section name="mesh" />
+-     <help> average number of vertices connected to one vertex </help>
+-  </parameter>
+-</frame>
+-<frame key="3" label="Extracted Model">
+-<section name="mesh" />
+-  <parameter key ="extractedvertices" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices extracted from the model </help>
+-  </parameter>
+-  <parameter key ="extractedelements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> elements extracted from the model </help>
+-  </parameter>
+-</frame>
+-<frame key="4" label="Projection">
+-<section name="mesh" />
+-  <parameter key ="lat" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices latitude [degrees] </help>
+-  </parameter>
+-  <parameter key ="long" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> verticies longitude [degrees] </help>
+-  </parameter>
+-  <parameter key ="hemisphere" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> Indicate hemisphere 'n' or 's' </help>
+-  </parameter></frame>
+-
+-
+-<!-- mask -->
+-<parameter key ="groundedice_levelset" type="double" default="NaN">
+-     <section name="mask" />
+-     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &amp;lt; 0 </help>
+-</parameter>
+-<parameter key ="ice_levelset" type="double" default="NaN">
+-     <section name="mask" />
+-     <help> presence of ice if > 0, icefront position if = 0, no ice if &amp;lt; 0 </help>
+-</parameter>
+-
+-<!-- geometry -->
+-<frame key="1" label="Geometry parameters">
+-<section name="geometry" />
+-<parameter key ="surface" type="path" optional="false">
+-     <section name="geometry" />
+-     <help> surface elevation [m] </help>
+-</parameter>
+-<parameter key ="thickness" type="path" optional="false">
+-     <section name="geometry" />
+-     <help> ice thickness [m] </help>
+-</parameter>
+-<parameter key ="bed" type="path" optional="false">
+-     <section name="geometry" />
+-     <help> bed elevation [m] </help>
+-</parameter>
+-<parameter key ="bathymetry" type="double" default="N/A">
+-     <section name="geometry" />
+-     <help> bathymetry elevation [m] </help>
+-</parameter>
+-<parameter key ="hydrostatic_ratio" type="double" default="N/A">
+-     <section name="geometry" />
+-     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>
+-</parameter></frame>
+-
+-
+-<!-- constants -->
+-<parameter key ="g" type="double" default="9.81">
+-     <section name="constants" />
+-     <help> gravitational acceleration [m/s^2] </help>
+-</parameter>
+-<parameter key ="yts" type="double" default="31536000">
+-     <section name="constants" />
+-     <help> number of seconds in a year [s/yr] </help>
+-</parameter>
+-<parameter key ="referencetemperature" type="double" default="223.15">
+-     <section name="constants" />
+-     <help> reference temperature used in the enthalpy model [K] </help>
+-</parameter>
+-
+-<!-- surfaceforcings(SMB) -->
+-<parameter key ="mass_balance" type="double" default="NaN">
+-     <section name="surfaceforcings(SMB)" />
+-     <help> surface mass balance [m/yr ice eq] </help>
+-</parameter>
+-
+-<!-- basalforcings -->
+-<parameter key ="melting_rate" type="double" default="NaN">
+-     <section name="basalforcings" />
+-     <help> basal melting rate (positive if melting) [m/yr] </help>
+-</parameter>
+-<parameter key ="melting_rate_correction" type="double" default="NaN">
+-     <section name="basalforcings" />
+-     <help> additional melting applied to compensate for dh/dt [m/yr] </help>
+-</parameter>
+-<parameter key ="geothermalflux" type="double" default="NaN">
+-     <section name="basalforcings" />
+-     <help> geothermal heat flux [W/m^2] </help>
+-</parameter>
+-
+-<!-- materials -->
+-<parameter key ="rho_ice" type="double" default="917">
+-     <section name="materials" />
+-     <help> ice density [kg/m^3] </help>
+-</parameter>
+-<parameter key ="rho_water" type="double" default="1023">
+-     <section name="materials" />
+-     <help> ocean water density [kg/m^3] </help>
+-</parameter>
+-<parameter key ="rho_freshwater" type="double" default="1000">
+-     <section name="materials" />
+-     <help> fresh water density [kg/m^3] </help>
+-</parameter>
+-<parameter key ="mu_water" type="double" default="0.001787">
+-     <section name="materials" />
+-     <help> water viscosity [N s/m^2] </help>
+-</parameter>
+-<parameter key ="heatcapacity" type="double" default="2093">
+-     <section name="materials" />
+-     <help> heat capacity [J/kg/K] </help>
+-</parameter>
+-<parameter key ="latentheat" type="double" default="334000">
+-     <section name="materials" />
+-     <help> latent heat of fusion [J/kg] </help>
+-</parameter>
+-<parameter key ="thermalconductivity" type="double" default="2.4">
+-     <section name="materials" />
+-     <help> ice thermal conductivity [W/m/K] </help>
+-</parameter>
+-<parameter key ="temperateiceconductivity" type="double" default="0.24">
+-     <section name="materials" />
+-     <help> temperate ice thermal conductivity [W/m/K] </help>
+-</parameter>
+-<parameter key ="meltingpoint" type="double" default="273.15">
+-     <section name="materials" />
+-     <help> melting point of ice at 1atm in K </help>
+-</parameter>
+-<parameter key ="beta" type="double" default="9.8e-08">
+-     <section name="materials" />
+-     <help> rate of change of melting point with pressure [K/Pa] </help>
+-</parameter>
+-<parameter key ="mixed_layer_capacity" type="double" default="3974">
+-     <section name="materials" />
+-     <help> mixed layer capacity [W/kg/K] </help>
+-</parameter>
+-<parameter key ="thermal_exchange_velocity" type="double" default="0.0001">
+-     <section name="materials" />
+-     <help> thermal exchange velocity [m/s] </help>
+-</parameter>
+-<parameter key ="rheology_B" type="double" default="N/A">
+-     <section name="materials" />
+-     <help> flow law parameter [Pa/s^(1/n)] </help>
+-</parameter>
+-<parameter key ="rheology_n" type="double" default="N/A">
+-     <section name="materials" />
+-     <help> Glens flow law exponent </help>
+-</parameter>
+-<parameter key ="rheology_law" type="char" default="'Paterson'">
+-     <section name="materials" />
+-     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>
+-</parameter>
+-<parameter key ="lithosphere_shear_modulus" type="double" default="67000000000">
+-     <section name="materials" />
+-     <help> Lithosphere shear modulus [Pa] </help>
+-</parameter>
+-<parameter key ="lithosphere_density" type="double" default="3.32">
+-     <section name="materials" />
+-     <help> Lithosphere density [g/cm^-3] </help>
+-</parameter>
+-<parameter key ="mantle_shear_modulus" type="double" default="145000000000">
+-     <section name="materials" />
+-     <help> Mantle shear modulus [Pa] </help>
+-</parameter>
+-<parameter key ="mantle_density" type="double" default="3.34">
+-     <section name="materials" />
+-     <help> Mantle density [g/cm^-3] </help>
+-</parameter>
+-
+-
+-<!-- damage -->
+-<!-- Note: this class depends on different input of law -->
+-<parameter key ="law" type="alternative" optional="false">
+-	<section name="damage" />
+-	<option value="undamage" type="string" default="true">
+-		<help> law = undamage </help>
+-	</option>
+-	<option value="pralong" type="string" default="false">
+-		<help> law = pralong </help>
+-		<parameter key ="stress_threshold" type="double" default="0">
+-			<help> damage stress threshold [Pa] </help>
+-		</parameter>
+-		<parameter key ="c1" type="double" default="0">
+-			<help> damage parameter 1 </help>
+-		</parameter>
+-		<parameter key ="c2" type="double" default="0">
+-			<help> damage parameter 2 </help>
+-		</parameter>
+-		<parameter key ="c3" type="double" default="0">
+-			<help> damage parameter 3 [W/m^2] </help>
+-		</parameter>
+-		<parameter key ="c4" type="double" default="0">
+-			<help> damage parameter 4 </help>
+-		</parameter>
+-		<parameter key ="healing" type="double" default="0">
+-			<help> damage healing parameter 1 </help>
+-		</parameter>
+-		<parameter key ="equiv_stress" type="double" default="0">
+-			<help> 0: von Mises </help>
+-		</parameter>
+-		<parameter key ="requested_outputs" type="cell" default="{'default'}">
+-			<help> additional outputs requested </help>
+-		</parameter>
+-	</option>
+-	<help> damage law (string) from {"undamaged","pralong"} </help>
+-</parameter>
+-<parameter key ="D" type="double" default="0">
+-     <section name="damage" />
+-     <help> damage tensor (scalar) </help>
+-</parameter>
+-<parameter key ="law" type="char" default="undamaged">
+-     <section name="damage" />
+-     <help> damage law (string) from {"undamaged","pralong"} </help>
+-</parameter>
+-<parameter key ="spcdamage" type="double" default="NaN">
+-     <section name="damage" />
+-     <help> damage constraints (NaN means no constraint) </help>
+-</parameter>
+-<parameter key ="max_damage" type="double" default="0.99999">
+-     <section name="damage" />
+-     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>
+-</parameter>
+-<parameter key ="stabilization" type="double" default="2">
+-     <section name="damage" />
+-     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
+-</parameter>
+-<parameter key ="maxiter" type="double" default="100">
+-     <section name="damage" />
+-     <help> maximum number of non linear iterations </help>
+-</parameter>
+-<parameter key ="penalty_lock" type="double" default="0">
+-     <section name="damage" />
+-     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
+-</parameter>
+-<parameter key ="penalty_threshold" type="double" default="0">
+-     <section name="damage" />
+-     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>
+-</parameter>
+-<parameter key ="penalty_factor" type="double" default="3">
+-     <section name="damage" />
+-     <help> scaling exponent (default is 3) </help>
+-</parameter>
+-
+-
+-<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->
+-<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">
+-<section name="friction" />
+-<parameter key ="coefficient" type="double" default="N/A">
+-     <section name="friction" />
+-     <help> friction coefficient [SI] </help>
+-</parameter>
+-<parameter key ="p" type="double" default="N/A">
+-     <section name="friction" />
+-     <help> p exponent </help>
+-</parameter>
+-<parameter key ="q" type="double" default="N/A">
+-     <section name="friction" />
+-     <help> q exponent </help>
+-</parameter></frame>
+-
+-
+-<!-- flowequation -->
+-<frame key="1" label="Flow equation parameters">
+-<section name="flowequation" />
+-<parameter key ="isSIA" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the Shallow Ice Approximation (SIA) used ? </help>
+-</parameter>
+-<parameter key ="isSSA" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>
+-</parameter>
+-<parameter key ="isL1L2" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the L1L2 approximation used ? </help>
+-</parameter>
+-<parameter key ="isHO" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the Higher-Order (HO) approximation used ? </help>
+-</parameter>
+-<parameter key ="isFS" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> are the Full-FS (FS) equations used ? </help>
+-</parameter>
+-<parameter key ="fe_SSA" type="char" default="'P1'">
+-     <section name="flowequation" />
+-     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>
+-</parameter>
+-<parameter key ="fe_HO" type="char" default="'P1'">
+-     <section name="flowequation" />
+-     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>
+-</parameter>
+-<parameter key ="fe_FS" type="char" default="'MINIcondensed'">
+-     <section name="flowequation" />
+-     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>
+-</parameter>
+-<parameter key ="vertex_equation" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> flow equation for each vertex </help>
+-</parameter>
+-<parameter key ="element_equation" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> flow equation for each element </help>
+-</parameter>
+-<parameter key ="borderSSA" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> vertices on SSAs border (for tiling) </help>
+-</parameter>
+-<parameter key ="borderHO" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> vertices on HOs border (for tiling) </help>
+-</parameter>
+-<parameter key ="borderFS" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> vertices on FS border (for tiling) </help>
+-</parameter></frame>
+-
+-
+-<!-- Timestepping -->
+-<parameter key ="start_time" type="double" default="0">
+-     <section name="timestepping" />
+-     <help> simulation starting time [yr] </help>
+-</parameter>
+-<parameter key ="final_time" type="double" default="5">
+-     <section name="timestepping" />
+-     <help> final time to stop the simulation [yr] </help>
+-</parameter>
+-<parameter key ="time_step" type="double" default="0.5">
+-     <section name="timestepping" />
+-     <help> length of time steps [yr] </help>
+-</parameter>
+-<parameter key ="time_adapt" type="double" default="0">
+-     <section name="timestepping" />
+-     <help> use cfl condition to define time step ? (0 or 1)  </help>
+-</parameter>
+-<parameter key ="cfl_coefficient" type="double" default="0.5">
+-     <section name="timestepping" />
+-     <help> coefficient applied to cfl condition </help>
+-</parameter>
+-
+-
+-<!-- initialization -->
+-<frame key="1" label="Initial field values">
+-<section name="initialization" />
+-<parameter key ="vx" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> x component of velocity [m/yr] </help>
+-</parameter>
+-<parameter key ="vy" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> y component of velocity [m/yr] </help>
+-</parameter>
+-<parameter key ="vz" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> z component of velocity [m/yr] </help>
+-</parameter>
+-<parameter key ="vel" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> velocity norm [m/yr] </help>
+-</parameter>
+-<parameter key ="pressure" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> pressure field [Pa] </help>
+-</parameter>
+-<parameter key ="temperature" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> fraction of water in the ice </help>
+-</parameter>
+-<parameter key ="waterfraction" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> ice thickness [m] </help>
+-</parameter>
+-<parameter key ="sediment_head" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> sediment water head of subglacial system [m] </help>
+-</parameter>
+-<parameter key ="epl_head" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> epl water head of subglacial system [m] </help>
+-</parameter>
+-<parameter key ="watercolumn" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> thickness of subglacial water [m] </help>
+-</parameter></frame>
+-
+-
+-<!-- rifts -->
+-<parameter key ="riftstruct" type="double" default="NaN">
+-     <section name="rifts" />
+-     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>
+-</parameter>
+-<parameter key ="riftproperties" type="double" default="NaN">
+-     <section name="rifts" />
+-     <help> N/A </help>
+-</parameter>
+-
+-
+-<!-- Debug -->
+-<parameter key ="valgrind" type="logical" optional="false">
+-     <section name="debug" />
+-        <option value="false" type="string" default="true"></option>
+-     <help> use Valgrind to debug (0 or 1) </help>
+-</parameter>
+-<parameter key ="gprof" type="logical" optional="false">
+-     <section name="debug" />
+-        <option value="false" type="string" default="true"></option>
+-     <help> use gnu-profiler to find out where the time is spent </help>
+-</parameter>
+-<parameter key ="profiling" type="logical" optional="false">
+-     <section name="debug" />
+-        <option value="false" type="string" default="true"></option>
+-     <help> enables profiling (memory, flops, time) </help>
+-</parameter>
+-
+-<!-- verbose -->
+-<parameter key ="mprocessor" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="module" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="solution" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="true" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="solver" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="convergence" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="control" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="true" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="qmu" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="true" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="autodiff" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-
+-<!-- settings -->
+-<parameter key ="results_on_nodes" type="double" default="0">
+-     <section name="settings" />
+-     <help> results are output for all the nodes of each element </help>
+-</parameter>
+-<parameter key ="io_gather" type="double" default="1">
+-     <section name="settings" />
+-     <help> I/O gathering strategy for result outputs (default 1) </help>
+-</parameter>
+-<parameter key ="lowmem" type="double" default="0">
+-     <section name="settings" />
+-     <help> is the memory limited ? (0 or 1) </help>
+-</parameter>
+-<parameter key ="output_frequency" type="double" default="1">
+-     <section name="settings" />
+-     <help> frequency at which results are saved in all solutions with multiple time_steps </help>
+-</parameter>
+-<parameter key ="waitonlock" type="double" default="Inf">
+-     <section name="settings" />
+-     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>
+-</parameter>
+-<parameter key ="upload_server" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> server hostname where model should be uploaded </help>
+-</parameter>
+-<parameter key ="upload_path" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> path on server where model should be uploaded </help>
+-</parameter>
+-<parameter key ="upload_login" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> server login </help>
+-</parameter>
+-<parameter key ="upload_port" type="double" default="0">
+-     <section name="settings" />
+-     <help> port login (default is 0) </help>
+-</parameter>
+-<parameter key ="upload_filename" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> unique id generated when uploading the file to server </help>
+-</parameter>
+-
+-<!-- generic -->
+-<parameter key ="name" type="char" default="'XPS'">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="login" type="char" default="N/A">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="np" type="double" default="1">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="port" type="double" default="0">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="codepath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/bin">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="executionpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/execution">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="etcpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/etc">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="valgrind" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/bin/valgrind">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="valgrindlib" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/lib/libmpidebug.so">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="valgrindsup" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/issm.supp">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="verbose" type="double" default="1">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-
+-<!-- balancethickness -->
+-<parameter key ="spcthickness" type="double" default="N/A">
+-     <section name="balancethickness" />
+-     <help> thickness constraints (NaN means no constraint) [m] </help>
+-</parameter>
+-<parameter key ="thickening_rate" type="double" default="N/A">
+-     <section name="balancethickness" />
+-     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>
+-</parameter>
+-<parameter key ="stabilization" type="double" default="1">
+-     <section name="balancethickness" />
+-     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>
+-</parameter>
+-
+-<!-- StressBalance solution parameters: -->
+-<frame key="1" label="Convergence criteria">
+-<section name="stressbalance" />
+-<parameter key ="restol" type="double" default="0.0001">
+-     <section name="stressbalance" />
+-     <help> mechanical equilibrium residual convergence criterion </help>
+-</parameter>
+-<parameter key ="reltol" type="double" default="0.01">
+-     <section name="stressbalance" />
+-     <help> velocity relative convergence criterion, NaN: not applied </help>
+-</parameter>
+-<parameter key ="abstol" type="double" default="10">
+-     <section name="stressbalance" />
+-     <help> velocity absolute convergence criterion, NaN: not applied </help>
+-</parameter>
+-<parameter key ="isnewton" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>
+-</parameter>
+-<parameter key ="maxiter" type="double" default="100">
+-     <section name="stressbalance" />
+-     <help> maximum number of nonlinear iterations </help>
+-</parameter>
+-<parameter key ="viscosity_overshoot" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> over-shooting constant new=new+C*(new-old) </help>
+-</parameter>
+-</frame>
+-<frame key="2" label="Boundary conditions">
+-<section name="stressbalance" />
+-<parameter key ="spcvx" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>
+-</parameter>
+-<parameter key ="spcvy" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>
+-</parameter>
+-<parameter key ="spcvz" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>
+-</parameter>
+-</frame>
+-<frame key="3" label="Rift options">
+-<section name="stressbalance" />
+-<parameter key ="rift_penalty_threshold" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> threshold for instability of mechanical constraints </help>
+-</parameter>
+-<parameter key ="rift_penalty_lock" type="double" default="10">
+-     <section name="stressbalance" />
+-     <help> number of iterations before rift penalties are locked </help>
+-</parameter>
+-</frame>
+-<frame key="4" label="Other">
+-<section name="stressbalance" />
+-<parameter key ="shelf_dampening" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> use dampening for floating ice ? Only for FS model </help>
+-</parameter>
+-<parameter key ="FSreconditioning" type="double" default="10000000000000">
+-     <section name="stressbalance" />
+-     <help> multiplier for incompressibility equation. Only for FS model </help>
+-</parameter>
+-<parameter key ="referential" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> local referential </help>
+-</parameter>
+-<parameter key ="loadingforce" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> loading force applied on each point [N/m^3] </help>
+-</parameter>
+-<parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="stressbalance" />
+-     <help> additional outputs requested </help>
+-</parameter>
+-</frame>
+-
+-
+-<!-- groundingline -->
+-<frame key="1" label="Grounding line migration parameters">
+-<section name="groundingline" />
+-<parameter key ="migration" type="char" default="'None'">
+-     <section name="groundingline" />
+-     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>
+-</parameter>
+-<parameter key ="melting_rate" type="double" default="0">
+-     <section name="groundingline" />
+-     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>
+-</parameter></frame>
+-
+-
+-<!-- Hydrology -->
+-<frame key="1" label="Hydrologyshreve solution parameters">
+-<section name="hydrologyshreve" />
+-<parameter key ="spcwatercolumn" type="double" default="N/A">
+-     <section name="hydrologyshreve" />
+-     <help> water thickness constraints (NaN means no constraint) [m] </help>
+-</parameter>
+-<parameter key ="n" type="double" default="0.02">
+-     <section name="hydrologyshreve" />
+-     <help> Manning roughness coefficient </help>
+-</parameter>
+-<parameter key ="CR" type="double" default="0.01">
+-     <section name="hydrologyshreve" />
+-     <help> tortuosity parameter </help>
+-</parameter>
+-<parameter key ="p" type="double" default="2">
+-     <section name="hydrologyshreve" />
+-     <help> dimensionless exponent in Manning velocity formula </help>
+-</parameter>
+-<parameter key ="q" type="double" default="1">
+-     <section name="hydrologyshreve" />
+-     <help> dimensionless exponent in Manning velocity formula </help>
+-</parameter>
+-<parameter key ="kn" type="double" default="0">
+-     <section name="hydrologyshreve" />
+-     <help> parameter in effective pressure formula </help>
+-</parameter>
+-<parameter key ="stabilization" type="double" default="1">
+-     <section name="hydrologyshreve" />
+-     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>
+-</parameter>
+-</frame>
+-<!-- masstransport -->
+-<frame key="1" label="Masstransport solution parameters">
+-<section name="masstransport" />
+-  <parameter key ="spcthickness" type="double" default="N/A">
+-     <section name="masstransport" />
+-     <help> thickness constraints (NaN means no constraint) [m] </help>
+-  </parameter>
+-  <parameter key ="calvingrate" type="double" default="N/A">
+-     <section name="masstransport" />
+-     <help> calving rate at given location [m/a] </help>
+-  </parameter>
+-  <parameter key ="isfreesurface" type="double" default="0">
+-     <section name="masstransport" />
+-     <help> do we use free surfaces (FS only) are mass conservation </help>
+-  </parameter>
+-  <parameter key ="min_thickness" type="double" default="1">
+-     <section name="masstransport" />
+-     <help> minimum ice thickness allowed [m] </help>
+-  </parameter>
+-  <parameter key ="hydrostatic_adjustment" type="char" default="'Absolute'">
+-     <section name="masstransport" />
+-     <help> adjustment of ice shelves surface and bed elevations: 'Incremental' or 'Absolute'  </help>
+-  </parameter>
+-  <parameter key ="stabilization" type="double" default="1">
+-     <section name="masstransport" />
+-     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Penalty options">
+-<section name="masstransport" />
+-  <parameter key ="vertex_pairing" type="double" default="N/A">
+-     <section name="masstransport" />
+-     <help> offset used by penalties: penalty = Kmax*10^offset </help>
+-  </parameter>
+-  <parameter key ="penalty_factor" type="double" default="3">
+-     <section name="masstransport" />
+-     <help> pairs of vertices that are penalized </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="masstransport" />
+-     <help> additional outputs requested </help>
+-  </parameter>
+-</frame>
+-<!-- thermal -->
+-<frame key="1" label="Thermal solution parameters">
+-<section name="thermal" />
+-  <parameter key ="spctemperature" type="double" default="N/A">
+-     <section name="thermal" />
+-     <help> temperature constraints (NaN means no constraint) [K] </help>
+-  </parameter>
+-  <parameter key ="penalty_threshold" type="double" default="0">
+-     <section name="thermal" />
+-     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
+-  </parameter>
+-  <parameter key ="stabilization" type="double" default="1">
+-     <section name="thermal" />
+-     <help> maximum number of non linear iterations </help>
+-  </parameter>
+-  <parameter key ="maxiter" type="double" default="100">
+-     <section name="thermal" />
+-     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
+-  </parameter>
+-  <parameter key ="penalty_lock" type="double" default="0">
+-     <section name="thermal" />
+-     <help> threshold to declare convergence of thermal solution (default is 0)  </help>
+-  </parameter>
+-  <parameter key ="penalty_factor" type="double" default="3">
+-     <section name="thermal" />
+-     <help> scaling exponent (default is 3) </help>
+-  </parameter>
+-  <parameter key ="isenthalpy" type="double" default="0">
+-     <section name="thermal" />
+-     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
+-  </parameter>
+-  <parameter key ="isdynamicbasalspc" type="double" default="0">
+-     <section name="thermal" />
+-     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="thermal" />
+-     <help> additional outputs requested </help>
+-  </parameter>
+-</frame>
+-<!-- steadystate -->
+-<frame key="1" label="steadystate solution parameters">
+-<section name="steadystate" />
+-  <parameter key ="reltol" type="double" default="0.01">
+-     <section name="steadystate" />
+-     <help> relative tolerance criterion [K] </help>
+-  </parameter>
+-  <parameter key ="maxiter" type="double" default="100">
+-     <section name="steadystate" />
+-     <help> maximum number of iterations </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="steadystate" />
+-     <help> additional requested outputs </help>
+-  </parameter>
+-</frame>
+-<!-- transient -->
+-<frame key="1" label="transient solution parameters">
+-<section name="transient" />
+-  <parameter key ="ismasstransport" type="double" default="1">
+-     <section name="transient" />
+-     <help> indicates whether a masstransport solution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isstressbalance" type="double" default="1">
+-     <section name="transient" />
+-     <help> indicates whether a stressbalance solution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isthermal" type="double" default="1">
+-     <section name="transient" />
+-     <help> indicates whether a thermal solution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isgroundingline" type="double" default="0">
+-     <section name="transient" />
+-     <help> indicates whether a groundingline migration is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isgia" type="double" default="0">
+-     <section name="transient" />
+-     <help> indicates whether a postglacial rebound model is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isdamage" type="double" default="0">
+-     <section name="transient" />
+-     <help> indicates whether damage evolution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="islevelset" type="double" default="0">
+-     <section name="transient" />
+-     <help> LEVEL SET DESCRIPTION...  </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="transient" />
+-     <help> list of additional outputs requested </help>
+-  </parameter>
+-</frame>
+-<!-- gia -->
+-<frame key="1" label="gia parameters">
+-<section name="gia" />
+-  <parameter key ="mantle_viscosity" type="double" default="N/A">
+-     <section name="gia" />
+-     <help> mantle viscosity[Pa s] </help>
+-  </parameter>
+-  <parameter key ="lithosphere_thickness" type="double" default="N/A">
+-     <section name="gia" />
+-     <help> lithosphere thickness (km) </help>
+-  </parameter>
+-  <parameter key ="cross_section_shape" type="double" default="1">
+-     <section name="gia" />
+-     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>
+-  </parameter>
+-</frame>
+-<!-- autodiff -->
+-<frame key="1" label="automatic differentiation parameters">
+-<section name="autodiff" />
+-  <parameter key ="isautodiff" type="logical" optional="false">
+-     <section name="autodiff" />
+-         <option value="false" type="string" default="true"></option>
+-     <help> indicates if the automatic differentiation is activated </help>
+-  </parameter>
+-  <parameter key ="dependents" type="cell" default="(0x0)">
+-     <section name="autodiff" />
+-     <help> list of dependent variables </help>
+-  </parameter>
+-  <parameter key ="independents" type="cell" default="(0x0)">
+-     <section name="autodiff" />
+-     <help> list of independent variables </help>
+-  </parameter>
+-  <parameter key ="driver" type="char" default="'fos_forward'">
+-     <section name="autodiff" />
+-     <help> ADOLC driver ('fos_forward' or 'fov_forward') </help>
+-  </parameter>
+-  <parameter key ="obufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>
+-  </parameter>
+-  <parameter key ="lbufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>
+-  </parameter>
+-  <parameter key ="cbufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>
+-  </parameter>
+-  <parameter key ="tbufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of taylors per buffer (&amp;lt;=TBUFSIZE in usrparms.h) </help>
+-  </parameter>
+-  <parameter key ="gcTriggerRatio" type="double" default="2">
+-     <section name="autodiff" />
+-     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>
+-  </parameter>
+-  <parameter key ="gcTriggerRatio" type="double" default="2">
+-     <section name="autodiff" />
+-     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>
+-  </parameter>
+-</frame>
+-<!-- flaim -->
+-<frame key="1" label="Input:">
+-<section name="flaim" />
+-  <parameter key ="targets" type="char" default="N/A">
+-     <section name="flaim" />
+-     <help> name of kml output targets file </help>
+-  </parameter>
+-  <parameter key ="tracks" type="char" default="N/A">
+-     <section name="flaim" />
+-     <help> name of kml input tracks file </help>
+-  </parameter>
+-  <parameter key ="flightreqs" type="struct" default="N/A">
+-     <section name="flaim" />
+-     <help> structure of kml flight requirements (not used yet) </help>
+-  </parameter>
+-  <parameter key ="criterion" type="double" default="N/A">
+-     <section name="flaim" />
+-     <help> element or nodal criterion for flight path evaluation (metric) </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Arguments:">
+-<section name="flaim" />
+-  <parameter key ="gridsatequator" type="double" default="200000">
+-     <section name="flaim" />
+-     <help> number of grids at equator (determines resolution) </help>
+-  </parameter>
+-  <parameter key ="usevalueordering" type="logical" optional="false">
+-     <section name="flaim" />
+-         <option value="true" type="string" default="true"></option>
+-     <help> flag to consider target values for flight path evaluation </help>
+-  </parameter>
+-  <parameter key ="split_antimeridian" type="logical" optional="false">
+-     <section name="flaim" />
+-         <option value="true" type="string" default="true"></option>
+-     <help> flag to split polygons on the antimeridian </help>
+-  </parameter>
+-</frame>
+-<frame key="3" label="Optimization:">
+-<section name="flaim" />
+-  <parameter key ="path_optimize" type="logical" optional="false">
+-     <section name="flaim" />
+-         <option value="false" type="string" default="true"></option>
+-     <help> optimize? (default false) </help>
+-  </parameter>
+-  <parameter key ="opt_ndir" type="double" default="1">
+-     <section name="flaim" />
+-     <help> 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] </help>
+-  </parameter>
+-  <parameter key ="opt_dist" type="double" default="25">
+-     <section name="flaim" />
+-     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>
+-  </parameter>
+-  <parameter key ="opt_niter" type="double" default="30000">
+-     <section name="flaim" />
+-     <help> 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. </help>
+-  </parameter>
+-</frame>
+-<frame key="4" label="Output:">
+-<section name="flaim" />
+-  <parameter key ="solution" type="char" default="N/A">
+-     <section name="flaim" />
+-     <help> name of kml solution file </help>
+-  </parameter>
+-  <parameter key ="quality" type="double" default="0">
+-     <section name="flaim" />
+-     <help> quality of kml solution </help>
+-  </parameter>
+-</frame>
+-<!-- inversion -->
+-<frame key="1" label="inversion parameters">
+-<section name="inversion" />
+-  <parameter key ="iscontrol" type="double" default="0">
+-     <section name="inversion" />
+-     <help> is inversion activated? </help>
+-  </parameter>
+-  <parameter key ="incomplete_adjoint" type="double" default="1">
+-     <section name="inversion" />
+-     <help> 1: linear viscosity, 0: non-linear viscosity </help>
+-  </parameter>
+-  <parameter key ="control_parameters" type="cell" default="{'FrictionCoefficient'}">
+-     <section name="inversion" />
+-     <help> ex: {'FrictionCoefficient'}, or {'MaterialsRheologyBbar'} </help>
+-  </parameter>
+-  <parameter key ="nsteps" type="double" default="20">
+-     <section name="inversion" />
+-     <help> number of optimization searches </help>
+-  </parameter>
+-  <parameter key ="cost_functions" type="double" default="101">
+-     <section name="inversion" />
+-     <help> indicate the type of response for each optimization step  </help>
+-  </parameter>
+-  <parameter key ="cost_functions_coefficients" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>
+-  </parameter>
+-  <parameter key ="cost_function_threshold" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>
+-  </parameter>
+-  <parameter key ="maxiter_per_step" type="double" default="(20x1)">
+-     <section name="inversion" />
+-     <help> maximum iterations during each optimization step  </help>
+-  </parameter>
+-  <parameter key ="gradient_scaling" type="double" default="(20x1)">
+-     <section name="inversion" />
+-     <help> scaling factor on gradient direction during optimization, for each optimization step </help>
+-  </parameter>
+-  <parameter key ="step_threshold" type="double" default="(20x1)">
+-     <section name="inversion" />
+-     <help> decrease threshold for misfit, default is 30% </help>
+-  </parameter>
+-  <parameter key ="min_parameters" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>
+-  </parameter>
+-  <parameter key ="max_parameters" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>
+-  </parameter>
+-  <parameter key ="vx_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed velocity x component [m/yr] </help>
+-  </parameter>
+-  <parameter key ="vy_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed velocity y component [m/yr]  </help>
+-  </parameter>
+-  <parameter key ="vel_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed velocity magnitude [m/yr] </help>
+-  </parameter>
+-  <parameter key ="thickness_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed thickness [m]) </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Available cost functions">
+-<section name="inversion" />
+-  <parameter key ="SurfaceAbsVelMisfit" type="string" default="101">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="SurfaceRelVelMisfit" type="string" default="102">
+-     <section name="inversion" />
+-     <help>   </help>
+-  </parameter>
+-  <parameter key ="SurfaceLogVelMisfit" type="string" default="103">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="SurfaceLogVxVyMisfit" type="string" default="104">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="SurfaceAverageVelMisfit" type="string" default="105">
+-     <section name="inversion" />
+-     <help>   </help>
+-  </parameter>
+-  <parameter key ="ThicknessAbsMisfit" type="string" default="106">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="DragCoefficientAbsGradient" type="string" default="107">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="RheologyBbarAbsGradient" type="string" default="108">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="ThicknessAbsGradient" type="string" default="109">
+-     <section name="inversion" />
+-     <help> </help>
+-  </parameter>
+-</frame>
+-<!-- qmu -->
+-<frame key="1" label="qmu parameters">
+-<section name="qmu" />
+-  <parameter key ="isdakota" type="double" default="0">
+-     <section name="qmu" />
+-     <help> is qmu analysis activated? </help>
+-  </parameter>
+-  <parameter key ="variables" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (arrays of each variable class) </help>
+-  </parameter>
+-  <parameter key ="responses" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (arrays of each response class) </help>
+-  </parameter>
+-  <parameter key ="numberofresponses" type="double" default="0">
+-     <section name="qmu" />
+-     <help> number of responses </help>
+-  </parameter>
+-  <parameter key ="params" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (array of method-independent parameters)  </help>
+-  </parameter>
+-  <parameter key ="results" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (information from dakota files) </help>
+-  </parameter>
+-  <parameter key ="partition" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> user provided mesh partitioning, defaults to metis if not specified </help>
+-  </parameter>
+-  <parameter key ="numberofpartitions" type="double" default="0">
+-     <section name="qmu" />
+-     <help> number of partitions for semi-discrete qmu  </help>
+-  </parameter>
+-  <parameter key ="variabledescriptors" type="cell" default="(0x0)">
+-     <section name="qmu" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="responsedescriptors" type="cell" default="(0x0)">
+-     <section name="qmu" />
+-     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
+-  </parameter>
+-  <parameter key ="method" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> array of dakota_method class </help>
+-  </parameter>
+-  <parameter key ="mass_flux_profile_directory" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> directory for mass flux profiles </help>
+-  </parameter>
+-  <parameter key ="mass_flux_profiles" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="mass_flux_segments" type="cell" default="(0x0)">
+-     <section name="qmu" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="adjacency" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> additional outputs requested </help>
+-  </parameter>
+-  <parameter key ="vertex_weight" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> weight applied to each mesh vertex </help>
+-  </parameter>
+-</frame>
+-<!-- outputdefinition -->
+-<frame key="1" label="outputdefinition">
+-<section name="outputdefinition" />
+-  <parameter key ="definitions" type="cell" default="(0x0)">
+-     <section name="outputdefinition" />
+-     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>
+-  </parameter>
+-</frame>
+-<!-- miscellaneous -->
+-<frame key="1" label="miscellaneous parameters">
+-<section name="miscellaneous" />
+-  <parameter key ="notes" type="char" default="N/A">
+-     <section name="miscellaneous" />
+-     <help> notes in a cell of strings </help>
+-  </parameter>
+-  <parameter key ="name" type="char" default="N/A">
+-     <section name="miscellaneous" />
+-     <help> model name </help>
+-  </parameter>
+-  <parameter key ="dummy" type="struct" default="N/A">
+-     <section name="miscellaneous" />
+-     <help> empty field to store some data </help>
+-  </parameter>
+-</frame>
+-
+-
+-</inishell_config>
+\ No newline at end of file
+Index: ../trunk-jpl/src/java/build/gui_elements/ColorCellRenderer.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CheckBoxPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$Type.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/TextfieldPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/FramePanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/PathPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/IntegerPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/DecimalPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/GUIBuildException.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel$1.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/ControlledPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/DuplicatorPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/OptionPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/AlternativePanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/CombinedPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/gui_elements/SelectorPanel.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder$1.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/PanelControl.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/XMLHelper.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/GUI.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/PanelNode.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/build/main/GUIBuilder.class
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/License.txt
+===================================================================
+--- ../trunk-jpl/src/java/License.txt	(revision 17982)
++++ ../trunk-jpl/src/java/License.txt	(revision 17983)
+@@ -1,674 +0,0 @@
+-                    GNU GENERAL PUBLIC LICENSE
+-                       Version 3, 29 June 2007
+-
+- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+- Everyone is permitted to copy and distribute verbatim copies
+- of this license document, but changing it is not allowed.
+-
+-                            Preamble
+-
+-  The GNU General Public License is a free, copyleft license for
+-software and other kinds of works.
+-
+-  The licenses for most software and other practical works are designed
+-to take away your freedom to share and change the works.  By contrast,
+-the GNU General Public License is intended to guarantee your freedom to
+-share and change all versions of a program--to make sure it remains free
+-software for all its users.  We, the Free Software Foundation, use the
+-GNU General Public License for most of our software; it applies also to
+-any other work released this way by its authors.  You can apply it to
+-your programs, too.
+-
+-  When we speak of free software, we are referring to freedom, not
+-price.  Our General Public Licenses are designed to make sure that you
+-have the freedom to distribute copies of free software (and charge for
+-them if you wish), that you receive source code or can get it if you
+-want it, that you can change the software or use pieces of it in new
+-free programs, and that you know you can do these things.
+-
+-  To protect your rights, we need to prevent others from denying you
+-these rights or asking you to surrender the rights.  Therefore, you have
+-certain responsibilities if you distribute copies of the software, or if
+-you modify it: responsibilities to respect the freedom of others.
+-
+-  For example, if you distribute copies of such a program, whether
+-gratis or for a fee, you must pass on to the recipients the same
+-freedoms that you received.  You must make sure that they, too, receive
+-or can get the source code.  And you must show them these terms so they
+-know their rights.
+-
+-  Developers that use the GNU GPL protect your rights with two steps:
+-(1) assert copyright on the software, and (2) offer you this License
+-giving you legal permission to copy, distribute and/or modify it.
+-
+-  For the developers' and authors' protection, the GPL clearly explains
+-that there is no warranty for this free software.  For both users' and
+-authors' sake, the GPL requires that modified versions be marked as
+-changed, so that their problems will not be attributed erroneously to
+-authors of previous versions.
+-
+-  Some devices are designed to deny users access to install or run
+-modified versions of the software inside them, although the manufacturer
+-can do so.  This is fundamentally incompatible with the aim of
+-protecting users' freedom to change the software.  The systematic
+-pattern of such abuse occurs in the area of products for individuals to
+-use, which is precisely where it is most unacceptable.  Therefore, we
+-have designed this version of the GPL to prohibit the practice for those
+-products.  If such problems arise substantially in other domains, we
+-stand ready to extend this provision to those domains in future versions
+-of the GPL, as needed to protect the freedom of users.
+-
+-  Finally, every program is threatened constantly by software patents.
+-States should not allow patents to restrict development and use of
+-software on general-purpose computers, but in those that do, we wish to
+-avoid the special danger that patents applied to a free program could
+-make it effectively proprietary.  To prevent this, the GPL assures that
+-patents cannot be used to render the program non-free.
+-
+-  The precise terms and conditions for copying, distribution and
+-modification follow.
+-
+-                       TERMS AND CONDITIONS
+-
+-  0. Definitions.
+-
+-  "This License" refers to version 3 of the GNU General Public License.
+-
+-  "Copyright" also means copyright-like laws that apply to other kinds of
+-works, such as semiconductor masks.
+-
+-  "The Program" refers to any copyrightable work licensed under this
+-License.  Each licensee is addressed as "you".  "Licensees" and
+-"recipients" may be individuals or organizations.
+-
+-  To "modify" a work means to copy from or adapt all or part of the work
+-in a fashion requiring copyright permission, other than the making of an
+-exact copy.  The resulting work is called a "modified version" of the
+-earlier work or a work "based on" the earlier work.
+-
+-  A "covered work" means either the unmodified Program or a work based
+-on the Program.
+-
+-  To "propagate" a work means to do anything with it that, without
+-permission, would make you directly or secondarily liable for
+-infringement under applicable copyright law, except executing it on a
+-computer or modifying a private copy.  Propagation includes copying,
+-distribution (with or without modification), making available to the
+-public, and in some countries other activities as well.
+-
+-  To "convey" a work means any kind of propagation that enables other
+-parties to make or receive copies.  Mere interaction with a user through
+-a computer network, with no transfer of a copy, is not conveying.
+-
+-  An interactive user interface displays "Appropriate Legal Notices"
+-to the extent that it includes a convenient and prominently visible
+-feature that (1) displays an appropriate copyright notice, and (2)
+-tells the user that there is no warranty for the work (except to the
+-extent that warranties are provided), that licensees may convey the
+-work under this License, and how to view a copy of this License.  If
+-the interface presents a list of user commands or options, such as a
+-menu, a prominent item in the list meets this criterion.
+-
+-  1. Source Code.
+-
+-  The "source code" for a work means the preferred form of the work
+-for making modifications to it.  "Object code" means any non-source
+-form of a work.
+-
+-  A "Standard Interface" means an interface that either is an official
+-standard defined by a recognized standards body, or, in the case of
+-interfaces specified for a particular programming language, one that
+-is widely used among developers working in that language.
+-
+-  The "System Libraries" of an executable work include anything, other
+-than the work as a whole, that (a) is included in the normal form of
+-packaging a Major Component, but which is not part of that Major
+-Component, and (b) serves only to enable use of the work with that
+-Major Component, or to implement a Standard Interface for which an
+-implementation is available to the public in source code form.  A
+-"Major Component", in this context, means a major essential component
+-(kernel, window system, and so on) of the specific operating system
+-(if any) on which the executable work runs, or a compiler used to
+-produce the work, or an object code interpreter used to run it.
+-
+-  The "Corresponding Source" for a work in object code form means all
+-the source code needed to generate, install, and (for an executable
+-work) run the object code and to modify the work, including scripts to
+-control those activities.  However, it does not include the work's
+-System Libraries, or general-purpose tools or generally available free
+-programs which are used unmodified in performing those activities but
+-which are not part of the work.  For example, Corresponding Source
+-includes interface definition files associated with source files for
+-the work, and the source code for shared libraries and dynamically
+-linked subprograms that the work is specifically designed to require,
+-such as by intimate data communication or control flow between those
+-subprograms and other parts of the work.
+-
+-  The Corresponding Source need not include anything that users
+-can regenerate automatically from other parts of the Corresponding
+-Source.
+-
+-  The Corresponding Source for a work in source code form is that
+-same work.
+-
+-  2. Basic Permissions.
+-
+-  All rights granted under this License are granted for the term of
+-copyright on the Program, and are irrevocable provided the stated
+-conditions are met.  This License explicitly affirms your unlimited
+-permission to run the unmodified Program.  The output from running a
+-covered work is covered by this License only if the output, given its
+-content, constitutes a covered work.  This License acknowledges your
+-rights of fair use or other equivalent, as provided by copyright law.
+-
+-  You may make, run and propagate covered works that you do not
+-convey, without conditions so long as your license otherwise remains
+-in force.  You may convey covered works to others for the sole purpose
+-of having them make modifications exclusively for you, or provide you
+-with facilities for running those works, provided that you comply with
+-the terms of this License in conveying all material for which you do
+-not control copyright.  Those thus making or running the covered works
+-for you must do so exclusively on your behalf, under your direction
+-and control, on terms that prohibit them from making any copies of
+-your copyrighted material outside their relationship with you.
+-
+-  Conveying under any other circumstances is permitted solely under
+-the conditions stated below.  Sublicensing is not allowed; section 10
+-makes it unnecessary.
+-
+-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+-
+-  No covered work shall be deemed part of an effective technological
+-measure under any applicable law fulfilling obligations under article
+-11 of the WIPO copyright treaty adopted on 20 December 1996, or
+-similar laws prohibiting or restricting circumvention of such
+-measures.
+-
+-  When you convey a covered work, you waive any legal power to forbid
+-circumvention of technological measures to the extent such circumvention
+-is effected by exercising rights under this License with respect to
+-the covered work, and you disclaim any intention to limit operation or
+-modification of the work as a means of enforcing, against the work's
+-users, your or third parties' legal rights to forbid circumvention of
+-technological measures.
+-
+-  4. Conveying Verbatim Copies.
+-
+-  You may convey verbatim copies of the Program's source code as you
+-receive it, in any medium, provided that you conspicuously and
+-appropriately publish on each copy an appropriate copyright notice;
+-keep intact all notices stating that this License and any
+-non-permissive terms added in accord with section 7 apply to the code;
+-keep intact all notices of the absence of any warranty; and give all
+-recipients a copy of this License along with the Program.
+-
+-  You may charge any price or no price for each copy that you convey,
+-and you may offer support or warranty protection for a fee.
+-
+-  5. Conveying Modified Source Versions.
+-
+-  You may convey a work based on the Program, or the modifications to
+-produce it from the Program, in the form of source code under the
+-terms of section 4, provided that you also meet all of these conditions:
+-
+-    a) The work must carry prominent notices stating that you modified
+-    it, and giving a relevant date.
+-
+-    b) The work must carry prominent notices stating that it is
+-    released under this License and any conditions added under section
+-    7.  This requirement modifies the requirement in section 4 to
+-    "keep intact all notices".
+-
+-    c) You must license the entire work, as a whole, under this
+-    License to anyone who comes into possession of a copy.  This
+-    License will therefore apply, along with any applicable section 7
+-    additional terms, to the whole of the work, and all its parts,
+-    regardless of how they are packaged.  This License gives no
+-    permission to license the work in any other way, but it does not
+-    invalidate such permission if you have separately received it.
+-
+-    d) If the work has interactive user interfaces, each must display
+-    Appropriate Legal Notices; however, if the Program has interactive
+-    interfaces that do not display Appropriate Legal Notices, your
+-    work need not make them do so.
+-
+-  A compilation of a covered work with other separate and independent
+-works, which are not by their nature extensions of the covered work,
+-and which are not combined with it such as to form a larger program,
+-in or on a volume of a storage or distribution medium, is called an
+-"aggregate" if the compilation and its resulting copyright are not
+-used to limit the access or legal rights of the compilation's users
+-beyond what the individual works permit.  Inclusion of a covered work
+-in an aggregate does not cause this License to apply to the other
+-parts of the aggregate.
+-
+-  6. Conveying Non-Source Forms.
+-
+-  You may convey a covered work in object code form under the terms
+-of sections 4 and 5, provided that you also convey the
+-machine-readable Corresponding Source under the terms of this License,
+-in one of these ways:
+-
+-    a) Convey the object code in, or embodied in, a physical product
+-    (including a physical distribution medium), accompanied by the
+-    Corresponding Source fixed on a durable physical medium
+-    customarily used for software interchange.
+-
+-    b) Convey the object code in, or embodied in, a physical product
+-    (including a physical distribution medium), accompanied by a
+-    written offer, valid for at least three years and valid for as
+-    long as you offer spare parts or customer support for that product
+-    model, to give anyone who possesses the object code either (1) a
+-    copy of the Corresponding Source for all the software in the
+-    product that is covered by this License, on a durable physical
+-    medium customarily used for software interchange, for a price no
+-    more than your reasonable cost of physically performing this
+-    conveying of source, or (2) access to copy the
+-    Corresponding Source from a network server at no charge.
+-
+-    c) Convey individual copies of the object code with a copy of the
+-    written offer to provide the Corresponding Source.  This
+-    alternative is allowed only occasionally and noncommercially, and
+-    only if you received the object code with such an offer, in accord
+-    with subsection 6b.
+-
+-    d) Convey the object code by offering access from a designated
+-    place (gratis or for a charge), and offer equivalent access to the
+-    Corresponding Source in the same way through the same place at no
+-    further charge.  You need not require recipients to copy the
+-    Corresponding Source along with the object code.  If the place to
+-    copy the object code is a network server, the Corresponding Source
+-    may be on a different server (operated by you or a third party)
+-    that supports equivalent copying facilities, provided you maintain
+-    clear directions next to the object code saying where to find the
+-    Corresponding Source.  Regardless of what server hosts the
+-    Corresponding Source, you remain obligated to ensure that it is
+-    available for as long as needed to satisfy these requirements.
+-
+-    e) Convey the object code using peer-to-peer transmission, provided
+-    you inform other peers where the object code and Corresponding
+-    Source of the work are being offered to the general public at no
+-    charge under subsection 6d.
+-
+-  A separable portion of the object code, whose source code is excluded
+-from the Corresponding Source as a System Library, need not be
+-included in conveying the object code work.
+-
+-  A "User Product" is either (1) a "consumer product", which means any
+-tangible personal property which is normally used for personal, family,
+-or household purposes, or (2) anything designed or sold for incorporation
+-into a dwelling.  In determining whether a product is a consumer product,
+-doubtful cases shall be resolved in favor of coverage.  For a particular
+-product received by a particular user, "normally used" refers to a
+-typical or common use of that class of product, regardless of the status
+-of the particular user or of the way in which the particular user
+-actually uses, or expects or is expected to use, the product.  A product
+-is a consumer product regardless of whether the product has substantial
+-commercial, industrial or non-consumer uses, unless such uses represent
+-the only significant mode of use of the product.
+-
+-  "Installation Information" for a User Product means any methods,
+-procedures, authorization keys, or other information required to install
+-and execute modified versions of a covered work in that User Product from
+-a modified version of its Corresponding Source.  The information must
+-suffice to ensure that the continued functioning of the modified object
+-code is in no case prevented or interfered with solely because
+-modification has been made.
+-
+-  If you convey an object code work under this section in, or with, or
+-specifically for use in, a User Product, and the conveying occurs as
+-part of a transaction in which the right of possession and use of the
+-User Product is transferred to the recipient in perpetuity or for a
+-fixed term (regardless of how the transaction is characterized), the
+-Corresponding Source conveyed under this section must be accompanied
+-by the Installation Information.  But this requirement does not apply
+-if neither you nor any third party retains the ability to install
+-modified object code on the User Product (for example, the work has
+-been installed in ROM).
+-
+-  The requirement to provide Installation Information does not include a
+-requirement to continue to provide support service, warranty, or updates
+-for a work that has been modified or installed by the recipient, or for
+-the User Product in which it has been modified or installed.  Access to a
+-network may be denied when the modification itself materially and
+-adversely affects the operation of the network or violates the rules and
+-protocols for communication across the network.
+-
+-  Corresponding Source conveyed, and Installation Information provided,
+-in accord with this section must be in a format that is publicly
+-documented (and with an implementation available to the public in
+-source code form), and must require no special password or key for
+-unpacking, reading or copying.
+-
+-  7. Additional Terms.
+-
+-  "Additional permissions" are terms that supplement the terms of this
+-License by making exceptions from one or more of its conditions.
+-Additional permissions that are applicable to the entire Program shall
+-be treated as though they were included in this License, to the extent
+-that they are valid under applicable law.  If additional permissions
+-apply only to part of the Program, that part may be used separately
+-under those permissions, but the entire Program remains governed by
+-this License without regard to the additional permissions.
+-
+-  When you convey a copy of a covered work, you may at your option
+-remove any additional permissions from that copy, or from any part of
+-it.  (Additional permissions may be written to require their own
+-removal in certain cases when you modify the work.)  You may place
+-additional permissions on material, added by you to a covered work,
+-for which you have or can give appropriate copyright permission.
+-
+-  Notwithstanding any other provision of this License, for material you
+-add to a covered work, you may (if authorized by the copyright holders of
+-that material) supplement the terms of this License with terms:
+-
+-    a) Disclaiming warranty or limiting liability differently from the
+-    terms of sections 15 and 16 of this License; or
+-
+-    b) Requiring preservation of specified reasonable legal notices or
+-    author attributions in that material or in the Appropriate Legal
+-    Notices displayed by works containing it; or
+-
+-    c) Prohibiting misrepresentation of the origin of that material, or
+-    requiring that modified versions of such material be marked in
+-    reasonable ways as different from the original version; or
+-
+-    d) Limiting the use for publicity purposes of names of licensors or
+-    authors of the material; or
+-
+-    e) Declining to grant rights under trademark law for use of some
+-    trade names, trademarks, or service marks; or
+-
+-    f) Requiring indemnification of licensors and authors of that
+-    material by anyone who conveys the material (or modified versions of
+-    it) with contractual assumptions of liability to the recipient, for
+-    any liability that these contractual assumptions directly impose on
+-    those licensors and authors.
+-
+-  All other non-permissive additional terms are considered "further
+-restrictions" within the meaning of section 10.  If the Program as you
+-received it, or any part of it, contains a notice stating that it is
+-governed by this License along with a term that is a further
+-restriction, you may remove that term.  If a license document contains
+-a further restriction but permits relicensing or conveying under this
+-License, you may add to a covered work material governed by the terms
+-of that license document, provided that the further restriction does
+-not survive such relicensing or conveying.
+-
+-  If you add terms to a covered work in accord with this section, you
+-must place, in the relevant source files, a statement of the
+-additional terms that apply to those files, or a notice indicating
+-where to find the applicable terms.
+-
+-  Additional terms, permissive or non-permissive, may be stated in the
+-form of a separately written license, or stated as exceptions;
+-the above requirements apply either way.
+-
+-  8. Termination.
+-
+-  You may not propagate or modify a covered work except as expressly
+-provided under this License.  Any attempt otherwise to propagate or
+-modify it is void, and will automatically terminate your rights under
+-this License (including any patent licenses granted under the third
+-paragraph of section 11).
+-
+-  However, if you cease all violation of this License, then your
+-license from a particular copyright holder is reinstated (a)
+-provisionally, unless and until the copyright holder explicitly and
+-finally terminates your license, and (b) permanently, if the copyright
+-holder fails to notify you of the violation by some reasonable means
+-prior to 60 days after the cessation.
+-
+-  Moreover, your license from a particular copyright holder is
+-reinstated permanently if the copyright holder notifies you of the
+-violation by some reasonable means, this is the first time you have
+-received notice of violation of this License (for any work) from that
+-copyright holder, and you cure the violation prior to 30 days after
+-your receipt of the notice.
+-
+-  Termination of your rights under this section does not terminate the
+-licenses of parties who have received copies or rights from you under
+-this License.  If your rights have been terminated and not permanently
+-reinstated, you do not qualify to receive new licenses for the same
+-material under section 10.
+-
+-  9. Acceptance Not Required for Having Copies.
+-
+-  You are not required to accept this License in order to receive or
+-run a copy of the Program.  Ancillary propagation of a covered work
+-occurring solely as a consequence of using peer-to-peer transmission
+-to receive a copy likewise does not require acceptance.  However,
+-nothing other than this License grants you permission to propagate or
+-modify any covered work.  These actions infringe copyright if you do
+-not accept this License.  Therefore, by modifying or propagating a
+-covered work, you indicate your acceptance of this License to do so.
+-
+-  10. Automatic Licensing of Downstream Recipients.
+-
+-  Each time you convey a covered work, the recipient automatically
+-receives a license from the original licensors, to run, modify and
+-propagate that work, subject to this License.  You are not responsible
+-for enforcing compliance by third parties with this License.
+-
+-  An "entity transaction" is a transaction transferring control of an
+-organization, or substantially all assets of one, or subdividing an
+-organization, or merging organizations.  If propagation of a covered
+-work results from an entity transaction, each party to that
+-transaction who receives a copy of the work also receives whatever
+-licenses to the work the party's predecessor in interest had or could
+-give under the previous paragraph, plus a right to possession of the
+-Corresponding Source of the work from the predecessor in interest, if
+-the predecessor has it or can get it with reasonable efforts.
+-
+-  You may not impose any further restrictions on the exercise of the
+-rights granted or affirmed under this License.  For example, you may
+-not impose a license fee, royalty, or other charge for exercise of
+-rights granted under this License, and you may not initiate litigation
+-(including a cross-claim or counterclaim in a lawsuit) alleging that
+-any patent claim is infringed by making, using, selling, offering for
+-sale, or importing the Program or any portion of it.
+-
+-  11. Patents.
+-
+-  A "contributor" is a copyright holder who authorizes use under this
+-License of the Program or a work on which the Program is based.  The
+-work thus licensed is called the contributor's "contributor version".
+-
+-  A contributor's "essential patent claims" are all patent claims
+-owned or controlled by the contributor, whether already acquired or
+-hereafter acquired, that would be infringed by some manner, permitted
+-by this License, of making, using, or selling its contributor version,
+-but do not include claims that would be infringed only as a
+-consequence of further modification of the contributor version.  For
+-purposes of this definition, "control" includes the right to grant
+-patent sublicenses in a manner consistent with the requirements of
+-this License.
+-
+-  Each contributor grants you a non-exclusive, worldwide, royalty-free
+-patent license under the contributor's essential patent claims, to
+-make, use, sell, offer for sale, import and otherwise run, modify and
+-propagate the contents of its contributor version.
+-
+-  In the following three paragraphs, a "patent license" is any express
+-agreement or commitment, however denominated, not to enforce a patent
+-(such as an express permission to practice a patent or covenant not to
+-sue for patent infringement).  To "grant" such a patent license to a
+-party means to make such an agreement or commitment not to enforce a
+-patent against the party.
+-
+-  If you convey a covered work, knowingly relying on a patent license,
+-and the Corresponding Source of the work is not available for anyone
+-to copy, free of charge and under the terms of this License, through a
+-publicly available network server or other readily accessible means,
+-then you must either (1) cause the Corresponding Source to be so
+-available, or (2) arrange to deprive yourself of the benefit of the
+-patent license for this particular work, or (3) arrange, in a manner
+-consistent with the requirements of this License, to extend the patent
+-license to downstream recipients.  "Knowingly relying" means you have
+-actual knowledge that, but for the patent license, your conveying the
+-covered work in a country, or your recipient's use of the covered work
+-in a country, would infringe one or more identifiable patents in that
+-country that you have reason to believe are valid.
+-
+-  If, pursuant to or in connection with a single transaction or
+-arrangement, you convey, or propagate by procuring conveyance of, a
+-covered work, and grant a patent license to some of the parties
+-receiving the covered work authorizing them to use, propagate, modify
+-or convey a specific copy of the covered work, then the patent license
+-you grant is automatically extended to all recipients of the covered
+-work and works based on it.
+-
+-  A patent license is "discriminatory" if it does not include within
+-the scope of its coverage, prohibits the exercise of, or is
+-conditioned on the non-exercise of one or more of the rights that are
+-specifically granted under this License.  You may not convey a covered
+-work if you are a party to an arrangement with a third party that is
+-in the business of distributing software, under which you make payment
+-to the third party based on the extent of your activity of conveying
+-the work, and under which the third party grants, to any of the
+-parties who would receive the covered work from you, a discriminatory
+-patent license (a) in connection with copies of the covered work
+-conveyed by you (or copies made from those copies), or (b) primarily
+-for and in connection with specific products or compilations that
+-contain the covered work, unless you entered into that arrangement,
+-or that patent license was granted, prior to 28 March 2007.
+-
+-  Nothing in this License shall be construed as excluding or limiting
+-any implied license or other defenses to infringement that may
+-otherwise be available to you under applicable patent law.
+-
+-  12. No Surrender of Others' Freedom.
+-
+-  If conditions are imposed on you (whether by court order, agreement or
+-otherwise) that contradict the conditions of this License, they do not
+-excuse you from the conditions of this License.  If you cannot convey a
+-covered work so as to satisfy simultaneously your obligations under this
+-License and any other pertinent obligations, then as a consequence you may
+-not convey it at all.  For example, if you agree to terms that obligate you
+-to collect a royalty for further conveying from those to whom you convey
+-the Program, the only way you could satisfy both those terms and this
+-License would be to refrain entirely from conveying the Program.
+-
+-  13. Use with the GNU Affero General Public License.
+-
+-  Notwithstanding any other provision of this License, you have
+-permission to link or combine any covered work with a work licensed
+-under version 3 of the GNU Affero General Public License into a single
+-combined work, and to convey the resulting work.  The terms of this
+-License will continue to apply to the part which is the covered work,
+-but the special requirements of the GNU Affero General Public License,
+-section 13, concerning interaction through a network will apply to the
+-combination as such.
+-
+-  14. Revised Versions of this License.
+-
+-  The Free Software Foundation may publish revised and/or new versions of
+-the GNU General Public License from time to time.  Such new versions will
+-be similar in spirit to the present version, but may differ in detail to
+-address new problems or concerns.
+-
+-  Each version is given a distinguishing version number.  If the
+-Program specifies that a certain numbered version of the GNU General
+-Public License "or any later version" applies to it, you have the
+-option of following the terms and conditions either of that numbered
+-version or of any later version published by the Free Software
+-Foundation.  If the Program does not specify a version number of the
+-GNU General Public License, you may choose any version ever published
+-by the Free Software Foundation.
+-
+-  If the Program specifies that a proxy can decide which future
+-versions of the GNU General Public License can be used, that proxy's
+-public statement of acceptance of a version permanently authorizes you
+-to choose that version for the Program.
+-
+-  Later license versions may give you additional or different
+-permissions.  However, no additional obligations are imposed on any
+-author or copyright holder as a result of your choosing to follow a
+-later version.
+-
+-  15. Disclaimer of Warranty.
+-
+-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+-
+-  16. Limitation of Liability.
+-
+-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+-SUCH DAMAGES.
+-
+-  17. Interpretation of Sections 15 and 16.
+-
+-  If the disclaimer of warranty and limitation of liability provided
+-above cannot be given local legal effect according to their terms,
+-reviewing courts shall apply local law that most closely approximates
+-an absolute waiver of all civil liability in connection with the
+-Program, unless a warranty or assumption of liability accompanies a
+-copy of the Program in return for a fee.
+-
+-                     END OF TERMS AND CONDITIONS
+-
+-            How to Apply These Terms to Your New Programs
+-
+-  If you develop a new program, and you want it to be of the greatest
+-possible use to the public, the best way to achieve this is to make it
+-free software which everyone can redistribute and change under these terms.
+-
+-  To do so, attach the following notices to the program.  It is safest
+-to attach them to the start of each source file to most effectively
+-state the exclusion of warranty; and each file should have at least
+-the "copyright" line and a pointer to where the full notice is found.
+-
+-    <one line to give the program's name and a brief idea of what it does.>
+-    Copyright (C) <year>  <name of author>
+-
+-    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 3 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, see <http://www.gnu.org/licenses/>.
+-
+-Also add information on how to contact you by electronic and paper mail.
+-
+-  If the program does terminal interaction, make it output a short
+-notice like this when it starts in an interactive mode:
+-
+-    <program>  Copyright (C) <year>  <name of author>
+-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+-    This is free software, and you are welcome to redistribute it
+-    under certain conditions; type `show c' for details.
+-
+-The hypothetical commands `show w' and `show c' should show the appropriate
+-parts of the General Public License.  Of course, your program's commands
+-might be different; for a GUI interface, you would use an "about box".
+-
+-  You should also get your employer (if you work as a programmer) or school,
+-if any, to sign a "copyright disclaimer" for the program, if necessary.
+-For more information on this, and how to apply and follow the GNU GPL, see
+-<http://www.gnu.org/licenses/>.
+-
+-  The GNU General Public License does not permit incorporating your program
+-into proprietary programs.  If your program is a subroutine library, you
+-may consider it more useful to permit linking proprietary applications with
+-the library.  If this is what you want to do, use the GNU Lesser General
+-Public License instead of this License.  But first, please read
+-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+Index: ../trunk-jpl/src/java/inishell.sh
+===================================================================
+--- ../trunk-jpl/src/java/inishell.sh	(revision 17982)
++++ ../trunk-jpl/src/java/inishell.sh	(revision 17983)
+@@ -1,8 +0,0 @@
+-#/bin/bash
+-#This is just the necessary command line to run a jar file
+-
+-#recover file name: 
+-xmlfilename=$1
+-
+-#call inishell
+-java -jar dist/inishell.jar $xmlfilename
+Index: ../trunk-jpl/src/java/Changelog_1.0.0.txt
+===================================================================
+--- ../trunk-jpl/src/java/Changelog_1.0.0.txt	(revision 17982)
++++ ../trunk-jpl/src/java/Changelog_1.0.0.txt	(revision 17983)
+@@ -1,29 +0,0 @@
+-This is the changelog for Inishell release 1.0.0
+-	*editing existing ini file:
+-		+populate the GUI according to the values in an existing ini file
+-		+show progress bar while loading
+-		+Comments are preserved, nested template parameters properly handled, unknown keys are preserved
+-
+-	*usability improvements:
+-		+the file dialogs remember the last path they pointed to
+-		+add ".ini" extension when saving to a config file if necessary
+-		+new icons, hoping to make their meaning clearer
+-		+reset button on the GUI to revert to defaults
+-
+-	*layout improvements:
+-		+fixed help text horizontal alignements issues
+-		+the help text is now verticaly aligned with the top of the widget
+-		+Notion of hierarchy for an easier handling of layout issues
+-		+layout now consistent between Linux and Windows, still some small spacing differences with osX
+-		+possibility to group parameters in a frame with a frame title
+-
+-	*bug fixes:
+-		+default value in comboBox is honored
+-		+mandatory comboBox properly handled on osX
+-		+better help text handling
+-
+-	*others:
+-		+keys are printed in the order they appear on the GUI
+-		+code cleanup and optimizations
+-		+add version information in MANIFEST and title bar
+-		+clean up and reorganization in build.xml, add help and pack targets
+Index: ../trunk-jpl/src/java/dist/inishell.jar
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/doc/examples/snowpack_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/snowpack_config.xml	(revision 17982)
++++ ../trunk-jpl/src/java/doc/examples/snowpack_config.xml	(revision 17983)
+@@ -1,1084 +0,0 @@
+-<inishell_config application="SNOWPACK">
+-	<!-- <include path="doc/examples/meteoio_config.xml" /> -->
+-
+-	<!-- General Parameters -->
+-	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
+-		<section name="general" />
+-		<help>Size in days of a chunk of data to read at once.</help>
+-	</parameter>
+-
+-	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
+-		<section name="general" />
+-		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
+-		beginning of the buffer (therefore, it takes a value in days).</help>
+-	</parameter>
+-
+-	<!-- Coordinate systems, time zones -->
+-	<parameter key="COORDSYS" type="alternative" optional="false">
+-		<section name="input" />
+-		<section name="output" />
+-		<option value="CH1903" type="string">
+-			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
+-		</option>
+-		<option value="UTM" type="string">
+-			<parameter key="COORDPARAM" type="string">
+-				<help>specify the zone with the zone letter (for example, 32T)</help>
+-			</parameter>
+-			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
+-		</option>
+-		<option value="UPS" type="string">
+-			<parameter key="COORDPARAM" type="string">
+-				<help>specify the hemisphere (either N or S)</help>
+-			</parameter>
+-			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
+-		</option>
+-		<option value="PROJ4" type="string">
+-			<parameter key="COORDPARAM" type="string" optional="false" />
+-			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
+-		</option>
+-		<option value="LOCAL"  type="string">
+-			<help>uses the horizontal and vertical distance from a reference point</help>
+-		</option>
+-		<help>coordinate system</help>
+-	</parameter>
+-
+-	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
+-		<section name="input" />
+-		<section name="output" />
+-	</parameter>
+-
+-	<!-- Datatypes: Meteo Data -->
+-	<frame key="meteo_frame" label="Meteorological Data">
+-	<section name="input"/>
+-	<parameter key="METEO" type="alternative" optional="false">
+-		<section name="input" />
+-
+-		<option value="A3D" type="string">
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string containing the path to the meteorological files</help>
+-			</parameter>
+-		</option>
+-		<option value="BORMA" type="string">
+-			<section name="input" />
+-			<reference name="BORMA" />
+-		</option>
+-		<option value="COSMO" type="string">
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string containing the path to the meteorological files</help>
+-			</parameter>
+-		</option>
+-		<option value="GEOTOP" type="string">
+-			<section name="input" />
+-			<reference name="GEOTOP_IN" />
+-		</option>
+-		<option value="GRIB" type="string">
+-			<section name="input" />
+-			<reference name="GRIB_METEO" />
+-		</option>
+-		<option value="GSN" type="string">
+-			<section name="input" />
+-			<reference name="GSN" />
+-		</option>
+-		<option value="IMIS" type="string">
+-			<section name="input" />
+-			<reference name="IMIS" />
+-		</option>
+-		<option value="SMET" type="string">
+-			<section name="input" />
+-			<reference name="SMET_IN" />
+-		</option>
+-		<option value="SNOWPACK" type="string">
+-			<section name="input" />
+-			<reference name="SNIO_IN" />
+-		</option>
+-
+-		<help>plugin for METEO data </help>
+-	</parameter>
+-	<parameter key="Add Meteo parameter copy" type="selector">
+-		<section name="input"/>
+-		<parameter key="COPY::%" type="string" optional="false" template="true">
+-			<help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
+-		</parameter>
+-		<help>Copy a meteo parameter into a new one (you should not need this)</help>
+-	</parameter>
+-	</frame>
+-
+-	<!-- Extra Input Parameters -->
+-	<frame key="snow_frame" label="Initial Snow Profiles">
+-	<section name="input"/>
+-	<parameter key="SNOWPATH" type="path" default="./current_snow">
+-		<section name="input" />
+-		<help>Path to the land surface and snow input parameters</help>
+-	</parameter>
+-	<parameter key="SNOW" type="alternative" default="SMET" optional="true">
+-		<section name="input" />
+-		<option value="SNOWPACK" type="string" />
+-		<option value="SMET" type="string" />
+-		<help>Plugin to use for reading SNO data</help>
+-	</parameter>
+-	<parameter key="SNOWFILE#" type="file" counter="1" optional="false">
+-		<section name="input" />
+-		<help>file name for the initial profile for station number #</help>
+-	</parameter>
+-	<!-- <parameter key="NUMBER_OF_SOLUTES" type="integer" default="0" minimum="0" maximum="0">
+-		<section name="input" />
+-		<help>SNOWPACK can transport an arbitrary number of trace components in its snow and water phases [special use]</help>
+-	</parameter> -->
+-	</frame>
+-
+-	<!-- Output Parameters -->
+-	<parameter key="METEOPATH" type="path" default="./output">
+-		<section name="output" />
+-		<help>Path to the outputs (this path MUST exist, it won't be created)</help>
+-	</parameter>
+-	<parameter key="EXPERIMENT" type="string" optional="false">
+-		<section name="output" />
+-		<help>Option to give an additional simulation specific output name to the run in addition to "STATION_NAME")</help>
+-	</parameter>
+-	<frame key="TS_frame" label="Time Series">
+-	<section name="output"/>
+-	<parameter key="TS_WRITE" type="alternative" optional="false">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write meteo data out?</help>
+-	</parameter>
+-	<parameter key="TS_START" type="decimal" default="0" minimum="0" maximum="360">
+-		<section name="output" />
+-		<help>When to start writing meteo data out (offset, in days)</help>
+-	</parameter>
+-	<parameter key="TS_DAYS_BETWEEN" type="decimal" default="4.1666e-2" minimum="0" maximum="360">
+-		<section name="output" />
+-		<help>How often to write meteo data out (in days: 3 hours=.125, 1 hour=4.1666e-2)</help>
+-	</parameter>
+-	<parameter key="AVGSUM_TIME_SERIES" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>If AVGSUM_TIME_SERIES is set, mean fluxes and cumulated masses since last dump are written, else current energy fluxes, cumulated masses over last COMPUTATION_STEP_LENGTH (recommended setting in operational mode).</help>
+-	</parameter>
+-	<parameter key="CUMSUM_MASS" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>If CUMSUM_MASS is set, current value of cumulated masses since begin of run are dumped. Precipitations (rain and snow, rain) are always dumped as rates (kg m-2 h-1).</help>
+-	</parameter>
+-	<parameter key="PRECIP_RATES" type="alternative" optional="true" default="TRUE">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write precipitation as rates (kg m-2 h-1, default) or as sums over the output time step. Please note that the units label in the output file and in SN_GUI &lt;b&gt;will remain kg m-2 h-1&lt;/b&gt; and will therefore not match sums.</help>
+-	</parameter>
+-	</frame>
+-	<frame key="profiles_frame" label="Snow Profiles">
+-	<section name="output"/>
+-	<parameter key="PROFILE" type="alternative" default="ASCII" optional="false">
+-		<section name="output" />
+-		<option value="ASCII" type="string" />
+-		<option value="IMIS" type="string" />
+-		<option value="ASCII IMIS" type="string" />
+-		<help>How to write the profiles (default: ASCII)</help>
+-	</parameter>
+-	<parameter key="PROF_WRITE" type="alternative" optional="false">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write profile data out?</help>
+-	</parameter>
+-	<parameter key="PROF_START" type="decimal" default="0" minimum="0" maximum="360">
+-		<section name="output" />
+-		<help>When to start writing profile data out (offset, in days)</help>
+-	</parameter>
+-	<parameter key="PROF_DAYS_BETWEEN" type="decimal" default="4.1666e-2" minimum="0" maximum="360">
+-		<section name="output" />
+-		<help>How often to write profile data out (in days: 3 hours=.125, 1 hour=4.1666e-2)</help>
+-	</parameter>
+-	<parameter key="HARDNESS_IN_NEWTON" type="alternative" default="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write the hand hardness in newtons (default) or as index</help>
+-	</parameter>
+-	<parameter key="CLASSIFY_PROFILE" type="alternative" default="false">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Classify the profile (default=false)? This is according to Schweizer, J. and M. Luetschg, &lt;i&gt;Characteristics of human-triggered avalanches&lt;/i&gt;, 2001, Cold Reg. Sci. Technol. &lt;b&gt;33&lt;/b&gt;(2-3)</help>
+-	</parameter>
+-	</frame>
+-	<frame key="sno_frame" label="Status files">
+-	<section name="output"/>
+-	<parameter key="SNOW" type="alternative" default="SMET" optional="true">
+-		<section name="output" />
+-		<option value="SNOWPACK" type="string" />
+-		<option value="SMET" type="string" />
+-		<help>Plugin to use for reading SNO data</help>
+-	</parameter>
+-	<parameter key="BACKUP_DAYS_BETWEEN" type="decimal" default="365" minimum="0">
+-		<section name="output" />
+-		<help>Dump snow files every BACKUP_DAYS_BETWEEN days</help>
+-	</parameter>
+-	<parameter key="FIRST_BACKUP" type="decimal" default="400" minimum="0">
+-		<section name="output" />
+-		<help>First dump of sno files happens at end of run or after FIRST_BACKUP days, whichever happens first</help>
+-	</parameter>
+-	</frame>
+-
+-	<frame key="switch_frame" label="Outputs Selection">
+-	<section name="output"/>
+-	<parameter key="OUT_CANOPY" type="alternative" default="FALSE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write canopy data out? To be set to TRUE only if CANOPY=TRUE</help>
+-	</parameter>
+-	<parameter key="OUT_HAZ" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write hazard data out? This must be FALSE for Alpine3D</help>
+-	</parameter>
+-	<parameter key="OUT_HEAT" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write turbulent fluxes out?</help>
+-	</parameter>
+-	<parameter key="OUT_T" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write snow/soil temperatures out?</help>
+-	</parameter>
+-	<!-- <parameter key="OUT_LOAD" type="alternative" default="FALSE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write solutes load data out?</help>
+-	</parameter> -->
+-	<parameter key="OUT_LW" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write long wave radiation out?</help>
+-	</parameter>
+-	<parameter key="OUT_SW" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write short wave radiation out?</help>
+-	</parameter>
+-	<parameter key="OUT_MASS" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write mass balance terms out?</help>
+-	</parameter>
+-	<parameter key="OUT_METEO" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write meteo parameters out?</help>
+-	</parameter>
+-	<parameter key="OUT_STAB" type="alternative" default="TRUE" optional="true">
+-		<section name="output" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Write stability parameters out?</help>
+-	</parameter>
+-	</frame>
+-
+-
+-	<!-- Snowpack Parameters -->
+-	<frame key="sn_parameters_frame" label="Model Parameters">
+-	<section name="Snowpack"/>
+-	<parameter key="CALCULATION_STEP_LENGTH" type="decimal" default="15" minimum="5" maximum="180">
+-		<section name="Snowpack" />
+-		<help>Internal time step (in minutes) used for model simulation. Please note that this MUST be the same as HNW::accumulate (the latter being in seconds) if re-acumulating precipitation, otherwise it would lead to wrong results.</help>
+-	</parameter>
+-	<parameter key="ROUGHNESS_LENGTH" type="decimal" default="0.002">
+-		<section name="Snowpack" />
+-		<help>Aerodynamic roughness length as a parameter for the Monin-Obukhov bulk formulation; A typical value for complex terrain is 0.01 m and for snow covered flat sites 0.001 m.</help>
+-	</parameter>
+-	<parameter key="HEIGHT_OF_METEO_VALUES" type="decimal" default="5.0">
+-		<section name="Snowpack" />
+-		<help>The instrument height (or model layer height) for meteorological input data except for wind, which may be at a different height; note that height is above ground for a standard SNOWPACK application but above surface (snow or ground) for Alpine3D applications.</help>
+-	</parameter>
+-	<parameter key="HEIGHT_OF_WIND_VALUE" type="decimal" default="5.0">
+-		<section name="Snowpack" />
+-		<help>The instrument height (or model layer height) for wind input data; note that height is above ground for a standard SNOWPACK application but above surface (snow or ground) for Alpine3D applications</help>
+-	</parameter>
+-	</frame>
+-	<frame key="sn_switch_frame" label="Models Selection">
+-	<section name="Snowpack"/>
+-	<parameter key="ENFORCE_MEASURED_SNOW_HEIGHTS" type="alternative" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Input mode by which a measurement of snow depth is used to drive the snow cover mass balance</help>
+-	</parameter>
+-	<parameter key="SW_MODE" type="integer" default="0" minimum="0" maximum="2" optional="false">
+-		<section name="Snowpack" />
+-		<help>Define the shortwave radiation input: &lt;ol&gt; &lt;li value="0"&gt;Incoming shortwave radiation is measured and albedo estimated by the model;&lt;/li&gt; &lt;li&gt;Reflected shortwave radiation is available as input and albedo is estimated by the model (IMIS standard);&lt;/li&gt; &lt;li&gt;Incoming and reflected shortwave radiation are both measured and the albedo is estimated from both measurements subject to plausibility checks.&lt;/li&gt; &lt;/ol&gt;</help>
+-	</parameter>
+-	<parameter key="NEUTRAL" type="integer" default="1" minimum="-1" maximum="1" optional="false">
+-		<section name="Snowpack" />
+-		<help>Select the atmospheric stability correction model:&lt;ol&gt; &lt;li value="-1"&gt; use a simplified Richardson number stability correction;&lt;/li&gt; &lt;li&gt;assume standard Monin-Obukhov bulk formulation for surface exchange iteration with Paulson, Stearns and Weidner (can be used with BC_CHANGE=0); &lt;/li&gt; &lt;li&gt; force Monin-Obukhov formulation to assume neutral conditions regardless of the actual stratification; it has been shown to work well in complex terrain settings. It should be used with BC_CHANGE=1, i.e., Dirichlet bc but also is recommended with Neumann b.c., i.e., BC_CHANGE=0.&lt;/li&gt; &lt;/ol&gt;</help>
+-	</parameter>
+-	<parameter key="CANOPY" type="alternative" default="FALSE" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Switch to tell the model that canopy is present (note that Canopy parameters should then be provided in the *.sno file)</help>
+-	</parameter>
+-	<parameter key="MEAS_TSS" type="alternative" default="TRUE" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>A measured surface temperature is available and can be reliably used for various consistency tests (it needs to be set to true if enabling CHANGE_BC).</help>
+-	</parameter>
+-	<parameter key="CHANGE_BC" type="alternative" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Use measured surface temperature as Dirichlet temperature BC for sub-freezing snowpacks and switch to Neumann only for melting snowpacks. If set to false, assumes Neumann boundary conditions.</help>
+-	</parameter>
+-	<parameter key="THRESH_CHANGE_BC" type="decimal" default="-1.3">
+-		<section name="Snowpack" />
+-		<help>Threshold value (small number below freezing), which switches from Dirichlet to Neumann BCs if CHANGE_BC is selected</help>
+-	</parameter>
+-	</frame>
+-	<frame key="sn_slopes_frame" label="Virtual slopes">
+-	<section name="Snowpack"/>
+-	<parameter key="NUMBER_SLOPES" type="alternative" default="1" optional="false">
+-		<section name="Snowpack" />
+-		<option value="1" type="string" />
+-		<option value="5" type="string" />
+-		<option value="3" type="string" />
+-		<option value="9" type="string" />
+-		<help>Based on meteorological input from a (flat field) automatic station or numerical weather model, up to 8 expositions can be calculated in addition to the flat field if the corresponding *.sno files are provided. For example, if you provide a flat field *.snow file (mandatory), which is named KLO3.sno and you want 4 slopes to be calculated the corresponding slope files should be named KLO21.sno, …,KLO24.sno</help>
+-	</parameter>
+-	<parameter key="INCOMING_LONGWAVE" type="alternative" default="FALSE" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Use the provided incoming long wave on the virtual slopes?</help>
+-	</parameter>
+-	<parameter key="SNOW_REDISTRIBUTION" type="alternative" default="FALSE" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Specifies if redistribution of snow is allowed from (upwind) expositions to lee slopes. In case just the flat field is calculated, snow erosion is enabled but only for "ENFORCE_MEASURED_SNOW_HEIGHTS".</help>
+-	</parameter>
+-	</frame>
+-	<frame key="soil_frame" label="Soil Modeling">
+-	<section name="Snowpack"/>
+-	<parameter key="SNP_SOIL" type="alternative" default="TRUE" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Soil layers as defined by the *.sno files are included in the simulation</help>
+-	</parameter>
+-	<parameter key="SOIL_FLUX" type="alternative" default="FALSE" optional="false">
+-		<section name="Snowpack" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Assume that the lower temperature boundary condition is given by GEO_HEAT (Neumann) and not by a measured temperature</help>
+-	</parameter>
+-	<parameter key="GEO_HEAT" type="decimal" default="0.06">
+-		<section name="Snowpack" />
+-		<help>Constant geothermal heat flux at great) depth W m-2): Lower flux boundary condition for temperature equation if BC is Neumann</help>
+-	</parameter>
+-	</frame>
+-
+-
+-	<!-- SnowpackAdvanced Parameters -->
+-	<parameter key="ASSUME_RESPONSIBILITY" type="alternative" default="AGREE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="AGREE" type="string" />
+-		<help>&lt;font color="FF0000"&gt;The keys in this section deeply affect the operation of the SNOWPACK model. This could lead to unexpected behavior or surprising results. If you are not an experienced Snowpack user, please do NOT change any keys below!&lt;/font&gt;</help>
+-	</parameter>
+-	<parameter key="VARIANT" type="alternative">
+-		<section name="SnowpackAdvanced" />
+-		<option value="DEFAULT" type="string" />
+-		<option value="JAPAN" type="string" />
+-		<option value="ANTARTICA" type="string" />
+-		<!-- <option value="CALIBRATION" type="string" /> -->
+-		<help>variant selection (includes a choice of specific models)</help>
+-	</parameter>
+-	<!-- <parameter key="RESEARCH" type="alternative" optional="true" default="TRUE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>research_mode</help>
+-	</parameter> -->
+-	<!-- <parameter key="NUMBER_FIXED_RATES" type="integer" default="0">
+-		<section name="SnowpackAdvanced" />
+-		<help>number_fixed_rates</help>
+-	</parameter> -->
+-	<parameter key="PERP_TO_SLOPE" type="alternative" optional="true" default="FALSE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>perp_to_slope</help>
+-	</parameter>
+-	<frame key="wind_frame" label="Wind Handling">
+-	<section name="SnowpackAdvanced"/>
+-	<parameter key="PREVAILING_WIND_DIR" type="decimal" default="0">
+-		<section name="SnowpackAdvanced" />
+-		<help>Shifts the origin of the wind rose for snow redistribution and slope simulations: e.g. choose 45° to have NE/SE/SW/NW</help>
+-	</parameter>
+-	<parameter key="WIND_SCALING_FACTOR" type="decimal" default="1.0" minimum="0" maximum="2">
+-		<section name="SnowpackAdvanced" />
+-		<help>Scaling factor to apply to wind values in case of drifting snow</help>
+-	</parameter>
+-	</frame>
+-	<frame key="hnw_frame" label="Precipitation Handling">
+-	<section name="SnowpackAdvanced"/>
+-	<parameter key="FORCE_RH_WATER" type="alternative" optional="true">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Tell the model that relative humidity values are with respect to water regardless of the temperature</help>
+-	</parameter>
+-	<parameter key="THRESH_RAIN" type="decimal" default="1.2">
+-		<section name="SnowpackAdvanced" />
+-		<help>Temperature threshold for rain/snow transition</help>
+-	</parameter>
+-	<parameter key="THRESH_RH" type="decimal" default="0.5">
+-		<section name="SnowpackAdvanced" />
+-		<help>If ENFORCE_MEASURED_SNOW_HEIGHTS, relative humidity threshold for precipitation to occur</help>
+-	</parameter>
+-	<parameter key="THRESH_DT_AIR_SNOW" type="decimal" default="3.0">
+-		<section name="SnowpackAdvanced" />
+-		<help>If ENFORCE_MEASURED_SNOW_HEIGHTS, (TA-TSS) threshold for precipitation to occur</help>
+-	</parameter>
+-	</frame>
+-	<frame key="hoar_frame" label="Hoar Handling">
+-	<section name="SnowpackAdvanced"/>
+-	<parameter key="HOAR_THRESH_RH" type="decimal" default="0.97">
+-		<section name="SnowpackAdvanced" />
+-		<help>Relative humidity threshold above which no surface hoar is allowed to form (because at very high humidity, typically no hoar crystals can form)</help>
+-	</parameter>
+-	<parameter key="HOAR_THRESH_VW" type="decimal" default="3.5">
+-		<section name="SnowpackAdvanced" />
+-		<help>Wind speed threshold above which no surface hoar is allowed to form (because it will drift away)</help>
+-	</parameter>
+-	<parameter key="HOAR_DENSITY_BURIED" type="decimal" default="125.0">
+-		<section name="SnowpackAdvanced" />
+-		<help>Define the initial density for surface hoar at the time it gets buried by new snow</help>
+-	</parameter>
+-	<parameter key="HOAR_MIN_SIZE_BURIED" type="decimal" default="2.0">
+-		<section name="SnowpackAdvanced" />
+-		<help>Define a threshold below which any traces of surface hoar will not be given a separate hoar layer when buried.</help>
+-	</parameter>
+-	<parameter key="HOAR_DENSITY_SURF" type="decimal" default="100.0">
+-		<section name="SnowpackAdvanced" />
+-		<help>Assumed density of surface hoar while exposed at the surface and not buried</help>
+-	</parameter>
+-	</frame>
+-	<frame key="temps_frame" label="Temperatures Handling">
+-	<section name="SnowpackAdvanced"/>
+-	<parameter key="FIXED_POSITIONS" type="string" default="">
+-		<section name="SnowpackAdvanced" />
+-		<help>positions of temperatur sensors in snow or soil: positive values refer to heigths measured from the ground surface (snow only), negative values refer to depths measured from either the ground surface or the snow surface in case no soil layers are present. A sensor must at least be covered by MIN_DEPTH_SUBSURF (m) snow for its temperature to be output.</help>
+-	</parameter>
+-	<!-- <parameter key="MAX_NUMBER_MEAS_TEMPERATURES" type="integer" default="5">
+-		<section name="SnowpackAdvanced" />
+-		<help></help>
+-	</parameter> -->
+-	<parameter key="MIN_DEPTH_SUBSURF" type="decimal" default="0.07">
+-		<section name="SnowpackAdvanced" />
+-		<help>Minimum snow depth above a temperature sensor to accept the measurement</help>
+-	</parameter>
+-	<parameter key="T_CRAZY_MIN" type="decimal" default="210.">
+-		<section name="SnowpackAdvanced" />
+-		<help>If you go to Antarctica or the tropics you may expect different reasonable temperatures</help>
+-	</parameter>
+-	<parameter key="T_CRAZY_MAX" type="decimal" default="340.">
+-		<section name="SnowpackAdvanced" />
+-		<help>If you go to Antarctica or the tropics you may expect different reasonable temperatures</help>
+-	</parameter>
+-	</frame>
+-	<frame key="sn_models_frame" label="Models Selection">
+-	<section name="SnowpackAdvanced"/>
+-	<parameter key="HN_DENSITY_MODEL" type="alternative" default="LEHNING_NEW">
+-		<section name="SnowpackAdvanced" />
+-		<option value="LEHNING_NEW" type="string" />
+-		<option value="ZWART" type="string" />
+-		<option value="BELLAIRE" type="string" />
+-		<option value="LEHNING_OLD" type="string" />
+-		<option value="PAHAUT" type="string" />
+-		<help>Choice of new snow density model (diverse statistical models)</help>
+-	</parameter>
+-	<parameter key="HN_DENSITY" type="string" default="PARAMETERIZED">
+-		<section name="SnowpackAdvanced" />
+-		<help>Fixed value to be used as new snow density if a constant density model is chosen, otherwise the choices are "PARAMETERIZED" "EVENT" "MEASURED"</help>
+-	</parameter>
+-	<parameter key="METAMORPHISM_MODEL" type="alternative">
+-		<section name="SnowpackAdvanced" />
+-		<option value="DEFAULT" type="string" />
+-		<option value="NIED" type="string" />
+-		<help>metamorphism_model</help>
+-	</parameter>
+-	<parameter key="NEW_SNOW_GRAIN_RAD" type="decimal" default="0.15">
+-		<section name="SnowpackAdvanced" />
+-		<help>new_snow_grain_rad</help>
+-	</parameter>
+-	<parameter key="STRENGTH_MODEL" type="alternative">
+-		<section name="SnowpackAdvanced" />
+-		<option value="DEFAULT" type="string" />
+-		<option value="NIED" type="string" />
+-		<help>strength_model</help>
+-	</parameter>
+-	<parameter key="VISCOSITY_MODEL" type="alternative">
+-		<section name="SnowpackAdvanced" />
+-		<option value="DEFAULT" type="string" />
+-		<option value="NIED" type="string" />
+-		<help>viscosity_model</help>
+-	</parameter>
+-	<parameter key="HARDNESS_MODEL" type="alternative">
+-		<section name="SnowpackAdvanced" />
+-		<option value="MONTI" type="string" />
+-		<option value="BELLAIRE" type="string" />
+-		<option value="ASARC" type="string" />
+-		<help>hardness_model</help>
+-	</parameter>
+-	<parameter key="DOORSCHOT" type="alternative" optional="true" default="FALSE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Choose the Doorschot saltation model over the simple Sorenson parameterization</help>
+-	</parameter>
+-	<parameter key="MULTISTREAM" type="alternative" optional="true">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Select a multi stream model for shortwave radiation penetration into the snow cover</help>
+-	</parameter>
+-	<parameter key="FIXED_ALBEDO" type="alternative" optional="true">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Force the model to work with a fixed albedo</help>
+-	</parameter>
+-	<!-- <parameter key="SURFACECODE" type="alternative" optional="true">
+-		<section name="SnowpackAdvanced" />
+-		<option value="NEUMANN_BC" type="string" />
+-		<option value="DIRICHLET_BC" type="string" />
+-		<help>Select the boundary conditions to use</help>
+-	</parameter> -->
+-	</frame>
+-	<frame key="sn_extra_frame" label="Extra Models Selection">
+-	<section name="SnowpackAdvanced"/>
+-	<parameter key="DETECT_GRASS" type="alternative" optional="true" default="TRUE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Identify grass growing under the snow height sensor. This usually works well but might sometimes lead to problems</help>
+-	</parameter>
+-	<parameter key="PLASTIC" type="alternative" optional="true" default="FALSE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Switch to tell the model that a impermeable layer should be simulated on top of some snow or ice: this requires that the *.sno file contains this layer, which is characterized via the soil parameters; the option has successfully been used to simulate snow and ice protection using geo-textiles and saw dust.</help>
+-	</parameter>
+-	<parameter key="JAM" type="alternative" optional="true" default="FALSE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>If switched on, you can also simulate ponding on impermeable ice surfaces below the snow cover</help>
+-	</parameter>
+-	<parameter key="WATER_LAYER" type="alternative" optional="true" default="FALSE">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Assuming an impermeable surface such as on a road or on geo-textiles (e.g. for snow farming), a liquid water layer is allowed to form on this surface</help>
+-	</parameter>
+-	</frame>
+-	<frame key="elements_frame" label="Elements Handling">
+-	<section name="SnowpackAdvanced"/>
+-	<parameter key="HEIGHT_NEW_ELEM" type="decimal" default="0.02">
+-		<section name="SnowpackAdvanced" />
+-		<help>Standard size of a new element added to the stack of elements (layers) during snowfall events</help>
+-	</parameter>
+-	<parameter key="MINIMUM_L_ELEMENT" type="decimal" default="0">
+-		<section name="SnowpackAdvanced" />
+-		<help>Threshold value for enforcing the layer to be merged with the layer above or below</help>
+-	</parameter>
+-	<parameter key="COMBINE_ELEMENTS" type="alternative" optional="true">
+-		<section name="SnowpackAdvanced" />
+-		<option value="TRUE" type="string" />
+-		<option value="FALSE" type="string" />
+-		<help>Combine neighboring elements based on a set of similarity conditions which are hard-coded</help>
+-	</parameter>
+-	</frame>
+-
+-	<!--Parameter group for list of stations -->
+-	<parametergroup name="stationgroup_files">
+-		<parameter key="STATION#" type="file" counter="1" optional="false">
+-			<help>filename for station number # </help>
+-		</parameter>
+-	</parametergroup>
+-	<parametergroup name="stationgroup_names">
+-		<parameter key="STATION#" type="string" counter="1" optional="false">
+-			<help>station id for the given station number # </help>
+-		</parameter>
+-	</parametergroup>
+-	<parametergroup name="stationgroup_pos">
+-		<parameter key="STATION#" type="string" counter="1">
+-			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<!-- Plugins for Meteo Data-->
+-	<parametergroup name="BORMA">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the xml files</help>
+-		</parameter>
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="IMIS">
+-		<parameter key="DBNAME" type="string" optional="false">
+-			<help>database name, as provided by your database administrator</help>
+-		</parameter>
+-		<parameter key="DBUSER" type="string" optional="false">
+-			<help>database user name</help>
+-		</parameter>
+-		<parameter key="DBPASS" type="string" optional="false">
+-			<help>database password associated with the user name</help>
+-		</parameter>
+-		<parameter key="USEANETZ" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
+-		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
+-		  average to get what should be its local precipitations</help>
+-		</parameter>
+-		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
+-		</parameter>
+-		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="GRIB_METEO">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the grib files</help>
+-		</parameter>
+-		<parameter key="METEOEXT" type="string" optional="true">
+-			<help>grib file extension, or none for no file extension (default: .grb)</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_pos" />
+-	</parametergroup>
+-
+-	<parametergroup name="GEOTOP_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the data files</help>
+-		</parameter>
+-		<parameter key="METAFILE" type="file" optional="false">
+-			<help>absolute filename of the geotop.inpts file</help>
+-		</parameter>
+-		<parameter key="METEOPREFIX" type="string" optional="true">
+-			<help>prefix to append when generating a file name for reading</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="GSN">
+-		<parameter key="ENDPOINT" type="string" optional="false">
+-			<help>webserver running GSN with its port number and full path. For example:
+-			http://montblanc.slf.ch:22001/services/A3DWebService</help>
+-		</parameter>
+-		<parameter key="PROXY" type="string" optional="true">
+-			<help>Should the connection go through a proxy? This is useful for servers
+-			filtering on domains but usually not necessary.</help>
+-		</parameter>
+-		<parameter key="PROXYPORT" type="string" optional="true" />
+-		<parameter key="PROXYUSER" type="string" optional="true" />
+-		<parameter key="PROXYPASS" type="string" optional="true" />
+-
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="SMET_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the smet files</help>
+-		</parameter>
+-		<reference name="stationgroup_files" />
+-	</parametergroup>
+-
+-	<parametergroup name="SNIO_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the SNOWPACK files</help>
+-		</parameter>
+-		<parameter key="METAFILE" type="file" optional="true">
+-			<help>filename of the meta data file (in METEOPATH)</help>
+-		</parameter>
+-		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
+-		  <help>the number of measured snow temperatures that are provided</help>
+-		</parameter>
+-		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
+-		  <help>the number of solutes for which input data are provided</help>
+-		</parameter>
+-
+-		<parameter key="RSWR_INP" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		</parameter>
+-		<parameter key="ISWR_INP" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		</parameter>
+-		<parameter key="VW_DRIFT" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
+-		</parameter>
+-		<parameter key="RHO_HN" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: measured new snow density is provided</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_files" />
+-	</parametergroup>
+-
+-	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
+-	<parametergroup name="METEOIOPARAMETERS">
+-		<option value="TA"/>
+-		<option value="RH"/>
+-		<option value="VW"/>
+-		<option value="DW"/>
+-		<option value="VW_MAX"/>
+-		<option value="ISWR"/>
+-		<option value="RSWR"/>
+-		<option value="ILWR"/>
+-		<option value="HS"/>
+-		<option value="HNW"/>
+-		<option value="TSG"/>
+-		<option value="TSS"/>
+-		<option value="P"/>
+-	</parametergroup>
+-
+-	<!-- Filters -->
+-	<parameter key="Add/Remove Filter" type="selector">
+-		<section name="filters" />
+-
+-		<parameter key="%::filter#" type="alternative" counter="1" template="true">
+-			<section name="filters" />
+-
+-			<option label="MeanAvg" value="mean_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
+-			</option>
+-
+-
+-			<option label="MedianAvg" value="median_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="decimal" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
+-			</option>
+-
+-			<option label="Std Deviation Filter" value="std_dev" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
+-			</option>
+-
+-			<option label="MAD" value="mad" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
+-			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
+-			</option>
+-
+-			<option label="Tukey 53H Filter" value="Tukey" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
+-			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
+-			    </help>
+-			  </parameter>
+-			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
+-			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
+-			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
+-			</option>
+-
+-			<option label="Wind Averaging Filter" value="wind_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
+-			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
+-			</option>
+-
+-			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
+-			    </help>
+-			  </parameter>
+-			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
+-			</option>
+-
+-			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			      Please note that the standard filter works with a left window!
+-			    </help>
+-			  </parameter>
+-			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
+-			</option>
+-
+-			<option label="Min Range Filter" value="min" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Min:" value="" type="decimal" />
+-			    <option label="Adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
+-			    assigned the minimum permissible value or another value given as an extra argument</help>
+-			  </parameter>
+-			  <help>Min range filter. Reject all values smaller than the min.</help>
+-			</option>
+-
+-			<option label="Max Range Filter" value="max" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Max:" value="" type="decimal" />
+-			    <option label="Adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
+-			    assigned the maximum permissible value or another value given as an extra argument</help>
+-			  </parameter>
+-			  <help>Max range filter. Reject all values greater than the max.</help>
+-			</option>
+-
+-			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Min:" value="" type="decimal" />
+-			    <option label="Max:" value="" type="decimal" />
+-			    <option label="Min adjust to:" value="" type="decimal" />
+-			    <option label="Max adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
+-			    the maximum permissible value and all data smaller than the min would be assigned the minimum
+-			    permissible value or an optional extra set of two user provided values</help>
+-			  </parameter>
+-			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
+-			</option>
+-
+-			<option label="Rate Filter (1 argument)" value="rate" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
+-			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
+-			  </parameter>
+-			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
+-			</option>
+-
+-			<option label="Rate Filter (2 arguments)" value="rate" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
+-			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
+-			    <help>the minimum and maximum permissible rate of change (per second)</help>
+-			  </parameter>
+-			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
+-			</option>
+-
+-			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
+-			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
+-			  </parameter>
+-			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
+-			</option>
+-
+-			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option value="Gage type" type="dropdown">
+-					<option value="Nipher" type="string" />
+-					<option value="Tretyakov" type="string" />
+-					<option value="US8sh" type="string" />
+-					<option value="US8unsh" type="string" />
+-					<option value="Hellmann" type="string" />
+-					<option value="Hellmannsh" type="string" />
+-				</option>
+-			  </parameter>
+-			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
+-			</option>
+-
+-			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option value="Kind" type="dropdown">
+-					<option value="Cst" type="string" />
+-				</option>
+-				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
+-				<option label="Mixed precipitation factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
+-			  </parameter>
+-			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
+-			</option>
+-
+-			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="albedo:" value="0.23" type="decimal" />
+-			    <option value="soft" type="choice" />
+-			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
+-			  </parameter>
+-			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
+-			</option>
+-
+-			<option label="Add an offset" value="add" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option label="offset:" value="0." type="decimal" />
+-			  </parameter>
+-			  <help>This adds a given offset to the data.</help>
+-			</option>
+-
+-			<option label="Multiply by a factor" value="mult" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option label="factor:" value="1." type="decimal" />
+-			  </parameter>
+-			  <help>This multiplies the data by a given factor.</help>
+-			</option>
+-
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-
+-	<!-- 1D Interpolation -->
+-	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
+-		<section name="Interpolations1D" />
+-		<help>Affects resampling: expresses (in seconds) how far a valid point can be
+-		searched for when re-interpolating a missing value</help>
+-	</parameter>
+-
+-	<parameter key="Add/Remove 1D Interpolation" type="selector">
+-		<section name="Interpolations1D" />
+-
+-		<parameter key="%::resample" type="alternative" template="true">
+-			<section name="Interpolations1D" />
+-			<option label="No Interpolation" value="none" type="string" />
+-			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
+-			<option label="Linear" value="linear" type="string">
+-			  <parameter key="%::args" type="combination">
+-			    <option value="extrapolate" type="choice" />
+-			    <help>
+-			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
+-			      Otherwise, a data point will only be calculated between the original date range.
+-			    </help>
+-			  </parameter>
+-			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
+-			</option>
+-			<option label="Accumulate" value="accumulate" type="string">
+-			  <parameter key="%::args" type="combination">
+-			    <option value="strict" type="choice" />
+-			    <option label="Seconds:" value="900" type="integer" minimum="1" />
+-			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
+-			  </parameter>
+-			  <help>Accumulation over a user given period (filter argument, in seconds -
+-			  should coincide with your calculation step!).</help>
+-			</option>
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-
+-</inishell_config>
+\ No newline at end of file
+Index: ../trunk-jpl/src/java/doc/examples/issm.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/issm.xml	(revision 17982)
++++ ../trunk-jpl/src/java/doc/examples/issm.xml	(revision 17983)
+@@ -1,1284 +0,0 @@
+-<inishell_config application="ISSM prototype">
+-
+-<!-- mesh -->
+-<parameter key ="Dimension" type="alternative" optional="false">
+-     <section name="mesh" />
+-     <option value="0" type="string" default="true">
+-        <help> dimension is 0 </help>
+-     </option>
+-     <option value="3" type="string">
+-        <help> dimension is 3 </help>
+-       <!-- Elements and vertices of the original 2d mesh -->
+-          <parameter key ="x2d" type="double" default="N/A">
+-              <help> vertices x coordinate [m] </help>
+-          </parameter>
+-          <parameter key ="y2d" type="double" default="N/A">
+-              <help> vertices y coordinate [m] </help>
+-          </parameter>
+-          <parameter key ="elements2d" type="double" default="N/A">
+-              <help> vertex indices of the mesh elements </help>
+-          </parameter>
+-          <parameter key ="numberofvertices2d" type="double" default="0">
+-              <help> number of vertices </help>
+-          </parameter>
+-          <parameter key ="numberofelements2d" type="double" default="0">
+-              <help> number of elements </help>
+-          </parameter>
+-     </option>
+-     <help> select a mesh dimension 0(default) or 3 </help>
+-</parameter>
+-<frame key="1" label="Elements and vertices">
+-<section name="mesh" />
+-  <parameter key ="numberofelements" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of elements </help>
+-  </parameter>
+-  <parameter key ="numberofvertices" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of verticies </help>
+-  </parameter>
+-  <parameter key ="elements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertex indices of the mesh elements </help>
+-  </parameter>
+-  <parameter key ="x" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices x coordinate [m] </help>
+-  </parameter>
+-  <parameter key ="y" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices y coordinate [m] </help>
+-  </parameter>
+-  <parameter key ="z" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices z coordinate [m] </help>
+-  </parameter>
+-  <parameter key ="edges" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> edges of the 2d mesh (vertex1 vertex2 element1 element2) </help>
+-  </parameter>
+-  <parameter key ="numberofedges" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of edges of the 2d mesh </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Properties">
+-<section name="mesh" />
+-  <parameter key ="selected dimension" type="double" default="0">
+-     <section name="mesh" />
+-     <help> mesh dimension </help>
+-  </parameter>
+-  <parameter key ="numberoflayers" type="double" default="0">
+-     <section name="mesh" />
+-     <help> number of extrusion layers </help>
+-  </parameter>
+-  <parameter key ="vertexonbed" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower vertices flags list </help>
+-  </parameter>
+-  <parameter key ="elementonbed" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower elements flags list </help>
+-  </parameter>
+-  <parameter key ="vertexonsurface" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper vertices flags list </help>
+-  </parameter>
+-  <parameter key ="elementonsurface" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper element flag list </help>
+-  </parameter>
+-  <parameter key ="uppervertex" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper vertex list (NaN for vertex on the upper surface) </help>
+-  </parameter>
+-  <parameter key ="upperelements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> upper element list (NaN for element on the upper layer) </help>
+-  </parameter>
+-  <parameter key ="lowervertex" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower vertex list (NaN for vertex on the lower surface) </help>
+-  </parameter>
+-  <parameter key ="lowerelements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> lower element list (NaN for element on the lower layer </help>
+-  </parameter>
+-  <parameter key ="vertexonboundary" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices on the boundary of the domain flag list </help>
+-  </parameter>
+-  <parameter key ="segments" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> edges on domain boundary (vertex1 vertex2 element) </help>
+-  </parameter>
+-  <parameter key ="segmentmarkers" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> number associated to each segment </help>
+-  </parameter>
+-  <parameter key ="vertexconnectivity" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> list of vertices connected to vertex_i </help>
+-  </parameter>
+-  <parameter key ="elementconnectivity" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> list of vertices connected to element_i </help>
+-  </parameter>
+-  <parameter key ="average_vertex_connectivity" type="double" default="25">
+-     <section name="mesh" />
+-     <help> average number of vertices connected to one vertex </help>
+-  </parameter>
+-</frame>
+-<frame key="3" label="Extracted Model">
+-<section name="mesh" />
+-  <parameter key ="extractedvertices" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices extracted from the model </help>
+-  </parameter>
+-  <parameter key ="extractedelements" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> elements extracted from the model </help>
+-  </parameter>
+-</frame>
+-<frame key="4" label="Projection">
+-<section name="mesh" />
+-  <parameter key ="lat" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> vertices latitude [degrees] </help>
+-  </parameter>
+-  <parameter key ="long" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> verticies longitude [degrees] </help>
+-  </parameter>
+-  <parameter key ="hemisphere" type="double" default="N/A">
+-     <section name="mesh" />
+-     <help> Indicate hemisphere 'n' or 's' </help>
+-  </parameter></frame>
+-
+-
+-<!-- mask -->
+-<parameter key ="groundedice_levelset" type="double" default="NaN">
+-     <section name="mask" />
+-     <help> is ice grounded ? grounded ice if > 0, grounding line position if = 0, floating ice if &amp;lt; 0 </help>
+-</parameter>
+-<parameter key ="ice_levelset" type="double" default="NaN">
+-     <section name="mask" />
+-     <help> presence of ice if > 0, icefront position if = 0, no ice if &amp;lt; 0 </help>
+-</parameter>
+-
+-<!-- geometry -->
+-<frame key="1" label="Geometry parameters">
+-<section name="geometry" />
+-<parameter key ="surface" type="path" optional="false">
+-     <section name="geometry" />
+-     <help> surface elevation [m] </help>
+-</parameter>
+-<parameter key ="thickness" type="path" optional="false">
+-     <section name="geometry" />
+-     <help> ice thickness [m] </help>
+-</parameter>
+-<parameter key ="bed" type="path" optional="false">
+-     <section name="geometry" />
+-     <help> bed elevation [m] </help>
+-</parameter>
+-<parameter key ="bathymetry" type="double" default="N/A">
+-     <section name="geometry" />
+-     <help> bathymetry elevation [m] </help>
+-</parameter>
+-<parameter key ="hydrostatic_ratio" type="double" default="N/A">
+-     <section name="geometry" />
+-     <help> coefficient for ice shelves; thickness correction: hydrostatic_ratio H_obs+ (1-hydrostatic_ratio) H_hydro </help>
+-</parameter></frame>
+-
+-
+-<!-- constants -->
+-<parameter key ="g" type="double" default="9.81">
+-     <section name="constants" />
+-     <help> gravitational acceleration [m/s^2] </help>
+-</parameter>
+-<parameter key ="yts" type="double" default="31536000">
+-     <section name="constants" />
+-     <help> number of seconds in a year [s/yr] </help>
+-</parameter>
+-<parameter key ="referencetemperature" type="double" default="223.15">
+-     <section name="constants" />
+-     <help> reference temperature used in the enthalpy model [K] </help>
+-</parameter>
+-
+-<!-- surfaceforcings(SMB) -->
+-<parameter key ="mass_balance" type="double" default="NaN">
+-     <section name="surfaceforcings(SMB)" />
+-     <help> surface mass balance [m/yr ice eq] </help>
+-</parameter>
+-
+-<!-- basalforcings -->
+-<parameter key ="melting_rate" type="double" default="NaN">
+-     <section name="basalforcings" />
+-     <help> basal melting rate (positive if melting) [m/yr] </help>
+-</parameter>
+-<parameter key ="melting_rate_correction" type="double" default="NaN">
+-     <section name="basalforcings" />
+-     <help> additional melting applied to compensate for dh/dt [m/yr] </help>
+-</parameter>
+-<parameter key ="geothermalflux" type="double" default="NaN">
+-     <section name="basalforcings" />
+-     <help> geothermal heat flux [W/m^2] </help>
+-</parameter>
+-
+-<!-- materials -->
+-<parameter key ="rho_ice" type="double" default="917">
+-     <section name="materials" />
+-     <help> ice density [kg/m^3] </help>
+-</parameter>
+-<parameter key ="rho_water" type="double" default="1023">
+-     <section name="materials" />
+-     <help> ocean water density [kg/m^3] </help>
+-</parameter>
+-<parameter key ="rho_freshwater" type="double" default="1000">
+-     <section name="materials" />
+-     <help> fresh water density [kg/m^3] </help>
+-</parameter>
+-<parameter key ="mu_water" type="double" default="0.001787">
+-     <section name="materials" />
+-     <help> water viscosity [N s/m^2] </help>
+-</parameter>
+-<parameter key ="heatcapacity" type="double" default="2093">
+-     <section name="materials" />
+-     <help> heat capacity [J/kg/K] </help>
+-</parameter>
+-<parameter key ="latentheat" type="double" default="334000">
+-     <section name="materials" />
+-     <help> latent heat of fusion [J/kg] </help>
+-</parameter>
+-<parameter key ="thermalconductivity" type="double" default="2.4">
+-     <section name="materials" />
+-     <help> ice thermal conductivity [W/m/K] </help>
+-</parameter>
+-<parameter key ="temperateiceconductivity" type="double" default="0.24">
+-     <section name="materials" />
+-     <help> temperate ice thermal conductivity [W/m/K] </help>
+-</parameter>
+-<parameter key ="meltingpoint" type="double" default="273.15">
+-     <section name="materials" />
+-     <help> melting point of ice at 1atm in K </help>
+-</parameter>
+-<parameter key ="beta" type="double" default="9.8e-08">
+-     <section name="materials" />
+-     <help> rate of change of melting point with pressure [K/Pa] </help>
+-</parameter>
+-<parameter key ="mixed_layer_capacity" type="double" default="3974">
+-     <section name="materials" />
+-     <help> mixed layer capacity [W/kg/K] </help>
+-</parameter>
+-<parameter key ="thermal_exchange_velocity" type="double" default="0.0001">
+-     <section name="materials" />
+-     <help> thermal exchange velocity [m/s] </help>
+-</parameter>
+-<parameter key ="rheology_B" type="double" default="N/A">
+-     <section name="materials" />
+-     <help> flow law parameter [Pa/s^(1/n)] </help>
+-</parameter>
+-<parameter key ="rheology_n" type="double" default="N/A">
+-     <section name="materials" />
+-     <help> Glens flow law exponent </help>
+-</parameter>
+-<parameter key ="rheology_law" type="char" default="'Paterson'">
+-     <section name="materials" />
+-     <help> law for the temperature dependance of the rheology: "None", "Paterson",  "Arrhenius" or "LliboutryDuval" </help>
+-</parameter>
+-<parameter key ="lithosphere_shear_modulus" type="double" default="67000000000">
+-     <section name="materials" />
+-     <help> Lithosphere shear modulus [Pa] </help>
+-</parameter>
+-<parameter key ="lithosphere_density" type="double" default="3.32">
+-     <section name="materials" />
+-     <help> Lithosphere density [g/cm^-3] </help>
+-</parameter>
+-<parameter key ="mantle_shear_modulus" type="double" default="145000000000">
+-     <section name="materials" />
+-     <help> Mantle shear modulus [Pa] </help>
+-</parameter>
+-<parameter key ="mantle_density" type="double" default="3.34">
+-     <section name="materials" />
+-     <help> Mantle density [g/cm^-3] </help>
+-</parameter>
+-
+-
+-<!-- damage -->
+-<!-- Note: this class depends on different input of law -->
+-<parameter key ="law" type="alternative" optional="false">
+-	<section name="damage" />
+-	<option value="undamage" type="string" default="true">
+-		<help> law = undamage </help>
+-	</option>
+-	<option value="pralong" type="string" default="false">
+-		<help> law = pralong </help>
+-		<parameter key ="stress_threshold" type="double" default="0">
+-			<help> damage stress threshold [Pa] </help>
+-		</parameter>
+-		<parameter key ="c1" type="double" default="0">
+-			<help> damage parameter 1 </help>
+-		</parameter>
+-		<parameter key ="c2" type="double" default="0">
+-			<help> damage parameter 2 </help>
+-		</parameter>
+-		<parameter key ="c3" type="double" default="0">
+-			<help> damage parameter 3 [W/m^2] </help>
+-		</parameter>
+-		<parameter key ="c4" type="double" default="0">
+-			<help> damage parameter 4 </help>
+-		</parameter>
+-		<parameter key ="healing" type="double" default="0">
+-			<help> damage healing parameter 1 </help>
+-		</parameter>
+-		<parameter key ="equiv_stress" type="double" default="0">
+-			<help> 0: von Mises </help>
+-		</parameter>
+-		<parameter key ="requested_outputs" type="cell" default="{'default'}">
+-			<help> additional outputs requested </help>
+-		</parameter>
+-	</option>
+-	<help> damage law (string) from {"undamaged","pralong"} </help>
+-</parameter>
+-<parameter key ="D" type="double" default="0">
+-     <section name="damage" />
+-     <help> damage tensor (scalar) </help>
+-</parameter>
+-<parameter key ="law" type="char" default="undamaged">
+-     <section name="damage" />
+-     <help> damage law (string) from {"undamaged","pralong"} </help>
+-</parameter>
+-<parameter key ="spcdamage" type="double" default="NaN">
+-     <section name="damage" />
+-     <help> damage constraints (NaN means no constraint) </help>
+-</parameter>
+-<parameter key ="max_damage" type="double" default="0.99999">
+-     <section name="damage" />
+-     <help> maximum possible damage (0&amp;lt;=max_damage&amp;lt;1) </help>
+-</parameter>
+-<parameter key ="stabilization" type="double" default="2">
+-     <section name="damage" />
+-     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
+-</parameter>
+-<parameter key ="maxiter" type="double" default="100">
+-     <section name="damage" />
+-     <help> maximum number of non linear iterations </help>
+-</parameter>
+-<parameter key ="penalty_lock" type="double" default="0">
+-     <section name="damage" />
+-     <help> stabilize unstable damage constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
+-</parameter>
+-<parameter key ="penalty_threshold" type="double" default="0">
+-     <section name="damage" />
+-     <help> threshold to declare convergence of damage evolution solution (default is 0) </help>
+-</parameter>
+-<parameter key ="penalty_factor" type="double" default="3">
+-     <section name="damage" />
+-     <help> scaling exponent (default is 3) </help>
+-</parameter>
+-
+-
+-<!-- Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p -->
+-<frame key="1" label="Friction: Sigma= drag^2 * Neff ^r * u ^s, with Neff=rho_ice*g*thickness+rho_water*g*bed, r=q/p and s=1/p">
+-<section name="friction" />
+-<parameter key ="coefficient" type="double" default="N/A">
+-     <section name="friction" />
+-     <help> friction coefficient [SI] </help>
+-</parameter>
+-<parameter key ="p" type="double" default="N/A">
+-     <section name="friction" />
+-     <help> p exponent </help>
+-</parameter>
+-<parameter key ="q" type="double" default="N/A">
+-     <section name="friction" />
+-     <help> q exponent </help>
+-</parameter></frame>
+-
+-
+-<!-- flowequation -->
+-<frame key="1" label="Flow equation parameters">
+-<section name="flowequation" />
+-<parameter key ="isSIA" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the Shallow Ice Approximation (SIA) used ? </help>
+-</parameter>
+-<parameter key ="isSSA" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the Shelfy-Stream Approximation (SSA) used ? </help>
+-</parameter>
+-<parameter key ="isL1L2" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the L1L2 approximation used ? </help>
+-</parameter>
+-<parameter key ="isHO" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> is the Higher-Order (HO) approximation used ? </help>
+-</parameter>
+-<parameter key ="isFS" type="double" default="0">
+-     <section name="flowequation" />
+-     <help> are the Full-FS (FS) equations used ? </help>
+-</parameter>
+-<parameter key ="fe_SSA" type="char" default="'P1'">
+-     <section name="flowequation" />
+-     <help> Finite Element for SSA  "P1", "P1bubble" "P1bubblecondensed" "P2" </help>
+-</parameter>
+-<parameter key ="fe_HO" type="char" default="'P1'">
+-     <section name="flowequation" />
+-     <help> Finite Element for HO   "P1" "P1bubble" "P1bubblecondensed" "P1xP2" "P2xP1" "P2" </help>
+-</parameter>
+-<parameter key ="fe_FS" type="char" default="'MINIcondensed'">
+-     <section name="flowequation" />
+-     <help> Finite Element for FS   "P1P1" (debugging only) "P1P1GLS" "MINIcondensed" "MINI" "TaylorHood" </help>
+-</parameter>
+-<parameter key ="vertex_equation" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> flow equation for each vertex </help>
+-</parameter>
+-<parameter key ="element_equation" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> flow equation for each element </help>
+-</parameter>
+-<parameter key ="borderSSA" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> vertices on SSAs border (for tiling) </help>
+-</parameter>
+-<parameter key ="borderHO" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> vertices on HOs border (for tiling) </help>
+-</parameter>
+-<parameter key ="borderFS" type="double" default="N/A">
+-     <section name="flowequation" />
+-     <help> vertices on FS border (for tiling) </help>
+-</parameter></frame>
+-
+-
+-<!-- Timestepping -->
+-<parameter key ="start_time" type="double" default="0">
+-     <section name="timestepping" />
+-     <help> simulation starting time [yr] </help>
+-</parameter>
+-<parameter key ="final_time" type="double" default="5">
+-     <section name="timestepping" />
+-     <help> final time to stop the simulation [yr] </help>
+-</parameter>
+-<parameter key ="time_step" type="double" default="0.5">
+-     <section name="timestepping" />
+-     <help> length of time steps [yr] </help>
+-</parameter>
+-<parameter key ="time_adapt" type="double" default="0">
+-     <section name="timestepping" />
+-     <help> use cfl condition to define time step ? (0 or 1)  </help>
+-</parameter>
+-<parameter key ="cfl_coefficient" type="double" default="0.5">
+-     <section name="timestepping" />
+-     <help> coefficient applied to cfl condition </help>
+-</parameter>
+-
+-
+-<!-- initialization -->
+-<frame key="1" label="Initial field values">
+-<section name="initialization" />
+-<parameter key ="vx" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> x component of velocity [m/yr] </help>
+-</parameter>
+-<parameter key ="vy" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> y component of velocity [m/yr] </help>
+-</parameter>
+-<parameter key ="vz" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> z component of velocity [m/yr] </help>
+-</parameter>
+-<parameter key ="vel" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> velocity norm [m/yr] </help>
+-</parameter>
+-<parameter key ="pressure" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> pressure field [Pa] </help>
+-</parameter>
+-<parameter key ="temperature" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> fraction of water in the ice </help>
+-</parameter>
+-<parameter key ="waterfraction" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> ice thickness [m] </help>
+-</parameter>
+-<parameter key ="sediment_head" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> sediment water head of subglacial system [m] </help>
+-</parameter>
+-<parameter key ="epl_head" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> epl water head of subglacial system [m] </help>
+-</parameter>
+-<parameter key ="watercolumn" type="double" default="NaN">
+-     <section name="initialization" />
+-     <help> thickness of subglacial water [m] </help>
+-</parameter></frame>
+-
+-
+-<!-- rifts -->
+-<parameter key ="riftstruct" type="double" default="NaN">
+-     <section name="rifts" />
+-     <help> structure containing all rift information (vertices coordinates, segments, type of melange, ...) </help>
+-</parameter>
+-<parameter key ="riftproperties" type="double" default="NaN">
+-     <section name="rifts" />
+-     <help> N/A </help>
+-</parameter>
+-
+-
+-<!-- Debug -->
+-<parameter key ="valgrind" type="logical" optional="false">
+-     <section name="debug" />
+-        <option value="false" type="string" default="true"></option>
+-     <help> use Valgrind to debug (0 or 1) </help>
+-</parameter>
+-<parameter key ="gprof" type="logical" optional="false">
+-     <section name="debug" />
+-        <option value="false" type="string" default="true"></option>
+-     <help> use gnu-profiler to find out where the time is spent </help>
+-</parameter>
+-<parameter key ="profiling" type="logical" optional="false">
+-     <section name="debug" />
+-        <option value="false" type="string" default="true"></option>
+-     <help> enables profiling (memory, flops, time) </help>
+-</parameter>
+-
+-<!-- verbose -->
+-<parameter key ="mprocessor" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="module" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="solution" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="true" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="solver" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="convergence" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="control" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="true" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="qmu" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="true" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-<parameter key ="autodiff" type="logical" optional="false">
+-     <section name="verbose" />
+-        <option value="false" type="string" default="true"></option>
+-     <help>  </help>
+-</parameter>
+-
+-<!-- settings -->
+-<parameter key ="results_on_nodes" type="double" default="0">
+-     <section name="settings" />
+-     <help> results are output for all the nodes of each element </help>
+-</parameter>
+-<parameter key ="io_gather" type="double" default="1">
+-     <section name="settings" />
+-     <help> I/O gathering strategy for result outputs (default 1) </help>
+-</parameter>
+-<parameter key ="lowmem" type="double" default="0">
+-     <section name="settings" />
+-     <help> is the memory limited ? (0 or 1) </help>
+-</parameter>
+-<parameter key ="output_frequency" type="double" default="1">
+-     <section name="settings" />
+-     <help> frequency at which results are saved in all solutions with multiple time_steps </help>
+-</parameter>
+-<parameter key ="waitonlock" type="double" default="Inf">
+-     <section name="settings" />
+-     <help> maximum number of minutes to wait for batch results (NaN to deactivate) </help>
+-</parameter>
+-<parameter key ="upload_server" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> server hostname where model should be uploaded </help>
+-</parameter>
+-<parameter key ="upload_path" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> path on server where model should be uploaded </help>
+-</parameter>
+-<parameter key ="upload_login" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> server login </help>
+-</parameter>
+-<parameter key ="upload_port" type="double" default="0">
+-     <section name="settings" />
+-     <help> port login (default is 0) </help>
+-</parameter>
+-<parameter key ="upload_filename" type="char" default="N/A">
+-     <section name="settings" />
+-     <help> unique id generated when uploading the file to server </help>
+-</parameter>
+-
+-<!-- generic -->
+-<parameter key ="name" type="char" default="'XPS'">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="login" type="char" default="N/A">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="np" type="double" default="1">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="port" type="double" default="0">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="codepath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/bin">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="executionpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/execution">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="etcpath" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/etc">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="valgrind" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/bin/valgrind">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="valgrindlib" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/install/lib/libmpidebug.so">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="valgrindsup" type="char" default=":/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk:/home/casper/work/issm/trunk/externalpackages/valgrind/issm.supp">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-<parameter key ="verbose" type="double" default="1">
+-     <section name="cluster" />
+-     <help> N/A </help>
+-</parameter>
+-
+-<!-- balancethickness -->
+-<parameter key ="spcthickness" type="double" default="N/A">
+-     <section name="balancethickness" />
+-     <help> thickness constraints (NaN means no constraint) [m] </help>
+-</parameter>
+-<parameter key ="thickening_rate" type="double" default="N/A">
+-     <section name="balancethickness" />
+-     <help> ice thickening rate used in the mass conservation (dh/dt) [m/yr] </help>
+-</parameter>
+-<parameter key ="stabilization" type="double" default="1">
+-     <section name="balancethickness" />
+-     <help> 0: None, 1: SU, 2: SSAs artificial diffusivity, 3:DG </help>
+-</parameter>
+-
+-<!-- StressBalance solution parameters: -->
+-<frame key="1" label="Convergence criteria">
+-<section name="stressbalance" />
+-<parameter key ="restol" type="double" default="0.0001">
+-     <section name="stressbalance" />
+-     <help> mechanical equilibrium residual convergence criterion </help>
+-</parameter>
+-<parameter key ="reltol" type="double" default="0.01">
+-     <section name="stressbalance" />
+-     <help> velocity relative convergence criterion, NaN: not applied </help>
+-</parameter>
+-<parameter key ="abstol" type="double" default="10">
+-     <section name="stressbalance" />
+-     <help> velocity absolute convergence criterion, NaN: not applied </help>
+-</parameter>
+-<parameter key ="isnewton" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> 0: Picards fixed point, 1: Newtons method, 2: hybrid </help>
+-</parameter>
+-<parameter key ="maxiter" type="double" default="100">
+-     <section name="stressbalance" />
+-     <help> maximum number of nonlinear iterations </help>
+-</parameter>
+-<parameter key ="viscosity_overshoot" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> over-shooting constant new=new+C*(new-old) </help>
+-</parameter>
+-</frame>
+-<frame key="2" label="Boundary conditions">
+-<section name="stressbalance" />
+-<parameter key ="spcvx" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> x-axis velocity constraint (NaN means no constraint) [m/yr] </help>
+-</parameter>
+-<parameter key ="spcvy" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> y-axis velocity constraint (NaN means no constraint) [m/yr] </help>
+-</parameter>
+-<parameter key ="spcvz" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> z-axis velocity constraint (NaN means no constraint) [m/yr] </help>
+-</parameter>
+-</frame>
+-<frame key="3" label="Rift options">
+-<section name="stressbalance" />
+-<parameter key ="rift_penalty_threshold" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> threshold for instability of mechanical constraints </help>
+-</parameter>
+-<parameter key ="rift_penalty_lock" type="double" default="10">
+-     <section name="stressbalance" />
+-     <help> number of iterations before rift penalties are locked </help>
+-</parameter>
+-</frame>
+-<frame key="4" label="Other">
+-<section name="stressbalance" />
+-<parameter key ="shelf_dampening" type="double" default="0">
+-     <section name="stressbalance" />
+-     <help> use dampening for floating ice ? Only for FS model </help>
+-</parameter>
+-<parameter key ="FSreconditioning" type="double" default="10000000000000">
+-     <section name="stressbalance" />
+-     <help> multiplier for incompressibility equation. Only for FS model </help>
+-</parameter>
+-<parameter key ="referential" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> local referential </help>
+-</parameter>
+-<parameter key ="loadingforce" type="double" default="N/A">
+-     <section name="stressbalance" />
+-     <help> loading force applied on each point [N/m^3] </help>
+-</parameter>
+-<parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="stressbalance" />
+-     <help> additional outputs requested </help>
+-</parameter>
+-</frame>
+-
+-
+-<!-- groundingline -->
+-<frame key="1" label="Grounding line migration parameters">
+-<section name="groundingline" />
+-<parameter key ="migration" type="char" default="'None'">
+-     <section name="groundingline" />
+-     <help> type of grounding line migration: "SoftMigration","AgressiveMigration" or "None" </help>
+-</parameter>
+-<parameter key ="melting_rate" type="double" default="0">
+-     <section name="groundingline" />
+-     <help> melting rate applied when previously grounded parts start floating [m/yr] </help>
+-</parameter></frame>
+-
+-
+-<!-- Hydrology -->
+-<frame key="1" label="Hydrologyshreve solution parameters">
+-<section name="hydrologyshreve" />
+-<parameter key ="spcwatercolumn" type="double" default="N/A">
+-     <section name="hydrologyshreve" />
+-     <help> water thickness constraints (NaN means no constraint) [m] </help>
+-</parameter>
+-<parameter key ="n" type="double" default="0.02">
+-     <section name="hydrologyshreve" />
+-     <help> Manning roughness coefficient </help>
+-</parameter>
+-<parameter key ="CR" type="double" default="0.01">
+-     <section name="hydrologyshreve" />
+-     <help> tortuosity parameter </help>
+-</parameter>
+-<parameter key ="p" type="double" default="2">
+-     <section name="hydrologyshreve" />
+-     <help> dimensionless exponent in Manning velocity formula </help>
+-</parameter>
+-<parameter key ="q" type="double" default="1">
+-     <section name="hydrologyshreve" />
+-     <help> dimensionless exponent in Manning velocity formula </help>
+-</parameter>
+-<parameter key ="kn" type="double" default="0">
+-     <section name="hydrologyshreve" />
+-     <help> parameter in effective pressure formula </help>
+-</parameter>
+-<parameter key ="stabilization" type="double" default="1">
+-     <section name="hydrologyshreve" />
+-     <help> artificial diffusivity (default is 1). can be more than 1 to increase diffusivity. </help>
+-</parameter>
+-</frame>
+-<!-- masstransport -->
+-<frame key="1" label="Masstransport solution parameters">
+-<section name="masstransport" />
+-  <parameter key ="spcthickness" type="double" default="N/A">
+-     <section name="masstransport" />
+-     <help> thickness constraints (NaN means no constraint) [m] </help>
+-  </parameter>
+-  <parameter key ="calvingrate" type="double" default="N/A">
+-     <section name="masstransport" />
+-     <help> calving rate at given location [m/a] </help>
+-  </parameter>
+-  <parameter key ="isfreesurface" type="double" default="0">
+-     <section name="masstransport" />
+-     <help> do we use free surfaces (FS only) are mass conservation </help>
+-  </parameter>
+-  <parameter key ="min_thickness" type="double" default="1">
+-     <section name="masstransport" />
+-     <help> minimum ice thickness allowed [m] </help>
+-  </parameter>
+-  <parameter key ="hydrostatic_adjustment" type="char" default="'Absolute'">
+-     <section name="masstransport" />
+-     <help> adjustment of ice shelves surface and bed elevations: 'Incremental' or 'Absolute'  </help>
+-  </parameter>
+-  <parameter key ="stabilization" type="double" default="1">
+-     <section name="masstransport" />
+-     <help> 0: no, 1:  artificial_diffusivity, 2: streamline upwinding, 3: discontinuous Galerkin </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Penalty options">
+-<section name="masstransport" />
+-  <parameter key ="vertex_pairing" type="double" default="N/A">
+-     <section name="masstransport" />
+-     <help> offset used by penalties: penalty = Kmax*10^offset </help>
+-  </parameter>
+-  <parameter key ="penalty_factor" type="double" default="3">
+-     <section name="masstransport" />
+-     <help> pairs of vertices that are penalized </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="masstransport" />
+-     <help> additional outputs requested </help>
+-  </parameter>
+-</frame>
+-<!-- thermal -->
+-<frame key="1" label="Thermal solution parameters">
+-<section name="thermal" />
+-  <parameter key ="spctemperature" type="double" default="N/A">
+-     <section name="thermal" />
+-     <help> temperature constraints (NaN means no constraint) [K] </help>
+-  </parameter>
+-  <parameter key ="penalty_threshold" type="double" default="0">
+-     <section name="thermal" />
+-     <help> 0: no, 1: artificial_diffusivity, 2: SUPG </help>
+-  </parameter>
+-  <parameter key ="stabilization" type="double" default="1">
+-     <section name="thermal" />
+-     <help> maximum number of non linear iterations </help>
+-  </parameter>
+-  <parameter key ="maxiter" type="double" default="100">
+-     <section name="thermal" />
+-     <help> stabilize unstable thermal constraints that keep zigzagging after n iteration (default is 0, no stabilization) </help>
+-  </parameter>
+-  <parameter key ="penalty_lock" type="double" default="0">
+-     <section name="thermal" />
+-     <help> threshold to declare convergence of thermal solution (default is 0)  </help>
+-  </parameter>
+-  <parameter key ="penalty_factor" type="double" default="3">
+-     <section name="thermal" />
+-     <help> scaling exponent (default is 3) </help>
+-  </parameter>
+-  <parameter key ="isenthalpy" type="double" default="0">
+-     <section name="thermal" />
+-     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
+-  </parameter>
+-  <parameter key ="isdynamicbasalspc" type="double" default="0">
+-     <section name="thermal" />
+-     <help> enable dynamic setting of basal forcing. required for enthalpy formulation (default is 0)  </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="thermal" />
+-     <help> additional outputs requested </help>
+-  </parameter>
+-</frame>
+-<!-- steadystate -->
+-<frame key="1" label="steadystate solution parameters">
+-<section name="steadystate" />
+-  <parameter key ="reltol" type="double" default="0.01">
+-     <section name="steadystate" />
+-     <help> relative tolerance criterion [K] </help>
+-  </parameter>
+-  <parameter key ="maxiter" type="double" default="100">
+-     <section name="steadystate" />
+-     <help> maximum number of iterations </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="steadystate" />
+-     <help> additional requested outputs </help>
+-  </parameter>
+-</frame>
+-<!-- transient -->
+-<frame key="1" label="transient solution parameters">
+-<section name="transient" />
+-  <parameter key ="ismasstransport" type="double" default="1">
+-     <section name="transient" />
+-     <help> indicates whether a masstransport solution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isstressbalance" type="double" default="1">
+-     <section name="transient" />
+-     <help> indicates whether a stressbalance solution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isthermal" type="double" default="1">
+-     <section name="transient" />
+-     <help> indicates whether a thermal solution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isgroundingline" type="double" default="0">
+-     <section name="transient" />
+-     <help> indicates whether a groundingline migration is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isgia" type="double" default="0">
+-     <section name="transient" />
+-     <help> indicates whether a postglacial rebound model is used in the transient </help>
+-  </parameter>
+-  <parameter key ="isdamage" type="double" default="0">
+-     <section name="transient" />
+-     <help> indicates whether damage evolution is used in the transient </help>
+-  </parameter>
+-  <parameter key ="islevelset" type="double" default="0">
+-     <section name="transient" />
+-     <help> LEVEL SET DESCRIPTION...  </help>
+-  </parameter>
+-  <parameter key ="requested_outputs" type="cell" default="{'default'}">
+-     <section name="transient" />
+-     <help> list of additional outputs requested </help>
+-  </parameter>
+-</frame>
+-<!-- gia -->
+-<frame key="1" label="gia parameters">
+-<section name="gia" />
+-  <parameter key ="mantle_viscosity" type="double" default="N/A">
+-     <section name="gia" />
+-     <help> mantle viscosity[Pa s] </help>
+-  </parameter>
+-  <parameter key ="lithosphere_thickness" type="double" default="N/A">
+-     <section name="gia" />
+-     <help> lithosphere thickness (km) </help>
+-  </parameter>
+-  <parameter key ="cross_section_shape" type="double" default="1">
+-     <section name="gia" />
+-     <help> 1: square-edged (default). 2: elliptical.  See iedge in GiaDeflectionCore </help>
+-  </parameter>
+-</frame>
+-<!-- autodiff -->
+-<frame key="1" label="automatic differentiation parameters">
+-<section name="autodiff" />
+-  <parameter key ="isautodiff" type="logical" optional="false">
+-     <section name="autodiff" />
+-         <option value="false" type="string" default="true"></option>
+-     <help> indicates if the automatic differentiation is activated </help>
+-  </parameter>
+-  <parameter key ="dependents" type="cell" default="(0x0)">
+-     <section name="autodiff" />
+-     <help> list of dependent variables </help>
+-  </parameter>
+-  <parameter key ="independents" type="cell" default="(0x0)">
+-     <section name="autodiff" />
+-     <help> list of independent variables </help>
+-  </parameter>
+-  <parameter key ="driver" type="char" default="'fos_forward'">
+-     <section name="autodiff" />
+-     <help> ADOLC driver ('fos_forward' or 'fov_forward') </help>
+-  </parameter>
+-  <parameter key ="obufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of operations per buffer (==OBUFSIZE in usrparms.h)  </help>
+-  </parameter>
+-  <parameter key ="lbufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of locations per buffer (==LBUFSIZE in usrparms.h) </help>
+-  </parameter>
+-  <parameter key ="cbufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of values per buffer (==CBUFSIZE in usrparms.h) </help>
+-  </parameter>
+-  <parameter key ="tbufsize" type="double" default="524288">
+-     <section name="autodiff" />
+-     <help> Number of taylors per buffer (&amp;lt;=TBUFSIZE in usrparms.h) </help>
+-  </parameter>
+-  <parameter key ="gcTriggerRatio" type="double" default="2">
+-     <section name="autodiff" />
+-     <help> free location block sorting/consolidation triggered if the ratio between allocated and used locations exceeds gcTriggerRatio </help>
+-  </parameter>
+-  <parameter key ="gcTriggerRatio" type="double" default="2">
+-     <section name="autodiff" />
+-     <help> free location block sorting/consolidation triggered if the allocated locations exceed gcTriggerMaxSize </help>
+-  </parameter>
+-</frame>
+-<!-- flaim -->
+-<frame key="1" label="Input:">
+-<section name="flaim" />
+-  <parameter key ="targets" type="char" default="N/A">
+-     <section name="flaim" />
+-     <help> name of kml output targets file </help>
+-  </parameter>
+-  <parameter key ="tracks" type="char" default="N/A">
+-     <section name="flaim" />
+-     <help> name of kml input tracks file </help>
+-  </parameter>
+-  <parameter key ="flightreqs" type="struct" default="N/A">
+-     <section name="flaim" />
+-     <help> structure of kml flight requirements (not used yet) </help>
+-  </parameter>
+-  <parameter key ="criterion" type="double" default="N/A">
+-     <section name="flaim" />
+-     <help> element or nodal criterion for flight path evaluation (metric) </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Arguments:">
+-<section name="flaim" />
+-  <parameter key ="gridsatequator" type="double" default="200000">
+-     <section name="flaim" />
+-     <help> number of grids at equator (determines resolution) </help>
+-  </parameter>
+-  <parameter key ="usevalueordering" type="logical" optional="false">
+-     <section name="flaim" />
+-         <option value="true" type="string" default="true"></option>
+-     <help> flag to consider target values for flight path evaluation </help>
+-  </parameter>
+-  <parameter key ="split_antimeridian" type="logical" optional="false">
+-     <section name="flaim" />
+-         <option value="true" type="string" default="true"></option>
+-     <help> flag to split polygons on the antimeridian </help>
+-  </parameter>
+-</frame>
+-<frame key="3" label="Optimization:">
+-<section name="flaim" />
+-  <parameter key ="path_optimize" type="logical" optional="false">
+-     <section name="flaim" />
+-         <option value="false" type="string" default="true"></option>
+-     <help> optimize? (default false) </help>
+-  </parameter>
+-  <parameter key ="opt_ndir" type="double" default="1">
+-     <section name="flaim" />
+-     <help> 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] </help>
+-  </parameter>
+-  <parameter key ="opt_dist" type="double" default="25">
+-     <section name="flaim" />
+-     <help> specifies the distance in km (default 25) to move a randomly selected path point on each iteration </help>
+-  </parameter>
+-  <parameter key ="opt_niter" type="double" default="30000">
+-     <section name="flaim" />
+-     <help> 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. </help>
+-  </parameter>
+-</frame>
+-<frame key="4" label="Output:">
+-<section name="flaim" />
+-  <parameter key ="solution" type="char" default="N/A">
+-     <section name="flaim" />
+-     <help> name of kml solution file </help>
+-  </parameter>
+-  <parameter key ="quality" type="double" default="0">
+-     <section name="flaim" />
+-     <help> quality of kml solution </help>
+-  </parameter>
+-</frame>
+-<!-- inversion -->
+-<frame key="1" label="inversion parameters">
+-<section name="inversion" />
+-  <parameter key ="iscontrol" type="double" default="0">
+-     <section name="inversion" />
+-     <help> is inversion activated? </help>
+-  </parameter>
+-  <parameter key ="incomplete_adjoint" type="double" default="1">
+-     <section name="inversion" />
+-     <help> 1: linear viscosity, 0: non-linear viscosity </help>
+-  </parameter>
+-  <parameter key ="control_parameters" type="cell" default="{'FrictionCoefficient'}">
+-     <section name="inversion" />
+-     <help> ex: {'FrictionCoefficient'}, or {'MaterialsRheologyBbar'} </help>
+-  </parameter>
+-  <parameter key ="nsteps" type="double" default="20">
+-     <section name="inversion" />
+-     <help> number of optimization searches </help>
+-  </parameter>
+-  <parameter key ="cost_functions" type="double" default="101">
+-     <section name="inversion" />
+-     <help> indicate the type of response for each optimization step  </help>
+-  </parameter>
+-  <parameter key ="cost_functions_coefficients" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> cost_functions_coefficients applied to the misfit of each vertex and for each control_parameter </help>
+-  </parameter>
+-  <parameter key ="cost_function_threshold" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> misfit convergence criterion. Default is 1%, NaN if not applied </help>
+-  </parameter>
+-  <parameter key ="maxiter_per_step" type="double" default="(20x1)">
+-     <section name="inversion" />
+-     <help> maximum iterations during each optimization step  </help>
+-  </parameter>
+-  <parameter key ="gradient_scaling" type="double" default="(20x1)">
+-     <section name="inversion" />
+-     <help> scaling factor on gradient direction during optimization, for each optimization step </help>
+-  </parameter>
+-  <parameter key ="step_threshold" type="double" default="(20x1)">
+-     <section name="inversion" />
+-     <help> decrease threshold for misfit, default is 30% </help>
+-  </parameter>
+-  <parameter key ="min_parameters" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> absolute minimum acceptable value of the inversed parameter on each vertex </help>
+-  </parameter>
+-  <parameter key ="max_parameters" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> absolute maximum acceptable value of the inversed parameter on each vertex </help>
+-  </parameter>
+-  <parameter key ="vx_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed velocity x component [m/yr] </help>
+-  </parameter>
+-  <parameter key ="vy_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed velocity y component [m/yr]  </help>
+-  </parameter>
+-  <parameter key ="vel_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed velocity magnitude [m/yr] </help>
+-  </parameter>
+-  <parameter key ="thickness_obs" type="double" default="N/A">
+-     <section name="inversion" />
+-     <help> observed thickness [m]) </help>
+-  </parameter>
+-</frame>
+-<frame key="2" label="Available cost functions">
+-<section name="inversion" />
+-  <parameter key ="SurfaceAbsVelMisfit" type="string" default="101">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="SurfaceRelVelMisfit" type="string" default="102">
+-     <section name="inversion" />
+-     <help>   </help>
+-  </parameter>
+-  <parameter key ="SurfaceLogVelMisfit" type="string" default="103">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="SurfaceLogVxVyMisfit" type="string" default="104">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="SurfaceAverageVelMisfit" type="string" default="105">
+-     <section name="inversion" />
+-     <help>   </help>
+-  </parameter>
+-  <parameter key ="ThicknessAbsMisfit" type="string" default="106">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="DragCoefficientAbsGradient" type="string" default="107">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="RheologyBbarAbsGradient" type="string" default="108">
+-     <section name="inversion" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="ThicknessAbsGradient" type="string" default="109">
+-     <section name="inversion" />
+-     <help> </help>
+-  </parameter>
+-</frame>
+-<!-- qmu -->
+-<frame key="1" label="qmu parameters">
+-<section name="qmu" />
+-  <parameter key ="isdakota" type="double" default="0">
+-     <section name="qmu" />
+-     <help> is qmu analysis activated? </help>
+-  </parameter>
+-  <parameter key ="variables" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (arrays of each variable class) </help>
+-  </parameter>
+-  <parameter key ="responses" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (arrays of each response class) </help>
+-  </parameter>
+-  <parameter key ="numberofresponses" type="double" default="0">
+-     <section name="qmu" />
+-     <help> number of responses </help>
+-  </parameter>
+-  <parameter key ="params" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (array of method-independent parameters)  </help>
+-  </parameter>
+-  <parameter key ="results" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> (information from dakota files) </help>
+-  </parameter>
+-  <parameter key ="partition" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> user provided mesh partitioning, defaults to metis if not specified </help>
+-  </parameter>
+-  <parameter key ="numberofpartitions" type="double" default="0">
+-     <section name="qmu" />
+-     <help> number of partitions for semi-discrete qmu  </help>
+-  </parameter>
+-  <parameter key ="variabledescriptors" type="cell" default="(0x0)">
+-     <section name="qmu" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="responsedescriptors" type="cell" default="(0x0)">
+-     <section name="qmu" />
+-     <help> use an enthalpy formulation to include temperate ice (default is 0) </help>
+-  </parameter>
+-  <parameter key ="method" type="struct" default="N/A">
+-     <section name="qmu" />
+-     <help> array of dakota_method class </help>
+-  </parameter>
+-  <parameter key ="mass_flux_profile_directory" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> directory for mass flux profiles </help>
+-  </parameter>
+-  <parameter key ="mass_flux_profiles" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="mass_flux_segments" type="cell" default="(0x0)">
+-     <section name="qmu" />
+-     <help>  </help>
+-  </parameter>
+-  <parameter key ="adjacency" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> additional outputs requested </help>
+-  </parameter>
+-  <parameter key ="vertex_weight" type="double" default="N/A">
+-     <section name="qmu" />
+-     <help> weight applied to each mesh vertex </help>
+-  </parameter>
+-</frame>
+-<!-- outputdefinition -->
+-<frame key="1" label="outputdefinition">
+-<section name="outputdefinition" />
+-  <parameter key ="definitions" type="cell" default="(0x0)">
+-     <section name="outputdefinition" />
+-     <help> list of potential outputs that can be requested, but which need additional data to be defined </help>
+-  </parameter>
+-</frame>
+-<!-- miscellaneous -->
+-<frame key="1" label="miscellaneous parameters">
+-<section name="miscellaneous" />
+-  <parameter key ="notes" type="char" default="N/A">
+-     <section name="miscellaneous" />
+-     <help> notes in a cell of strings </help>
+-  </parameter>
+-  <parameter key ="name" type="char" default="N/A">
+-     <section name="miscellaneous" />
+-     <help> model name </help>
+-  </parameter>
+-  <parameter key ="dummy" type="struct" default="N/A">
+-     <section name="miscellaneous" />
+-     <help> empty field to store some data </help>
+-  </parameter>
+-</frame>
+-
+-
+-</inishell_config>
+\ No newline at end of file
+Index: ../trunk-jpl/src/java/doc/examples/min_example.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/min_example.xml	(revision 17982)
++++ ../trunk-jpl/src/java/doc/examples/min_example.xml	(revision 17983)
+@@ -1,40 +0,0 @@
+-<inishell_config>
+-	<parameter key="SOME_PARAMETER" type="string">
+-		<section name="section1" />
+-		<section name="section2" />
+-		<help>
+-			This is a parameter that asks for a string value and that is present in
+-			both the section "section1" and "section2".
+-		</help>
+-	</parameter>
+-	
+-	<parameter key="NESTED_PARAMETERS" type="alternative" optional="false">
+-		<section name="section1" />
+-		<option value="NONE" type="string" />
+-		<option value="ONE" type="string">
+-			<parameter key="SOME_INTEGER" type="integer" 
+-				minimum="-1" maximum="10" default="2">
+-				<help>
+-					The value for this parameter may be an integer between -1 and 10.
+-					The default value is 2.
+-					The user may use the + and - buttons to increment/decrement 
+-					the number or type the number into the text field.</help>
+-				</parameter>
+-		</option>
+-		<option value="TWO" type="string">
+-			<reference name="a_group_that_can_be_referenced" />
+-			<help>Here is a reference to two parameters.</help>
+-		</option>
+-		<help>
+-			This parameter belongs to section1. 
+-			When the "null" option is selected, the dropdown menu appears
+-			red because this parameter is non-optional.
+-			When the value "ONE" is selected a nested parameter "SOME_INTEGER" appears. 
+-		</help>
+-	</parameter>
+-	
+-	<parametergroup name="a_group_that_can_be_referenced">
+-		<parameter key="SOME_FILE" type="file" />
+-		<parameter key="A_PATH" type="path" />
+-	</parametergroup>
+-</inishell_config>
+\ No newline at end of file
+Index: ../trunk-jpl/src/java/doc/examples/io.ini
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/io.ini	(revision 17982)
++++ ../trunk-jpl/src/java/doc/examples/io.ini	(revision 17983)
+@@ -1,180 +0,0 @@
+-[General]
+-PLUGINPATH	= ../../lib/plugins ;super
+-BUFF_CHUNK_SIZE = 30
+-BUFF_BEFORE	= 1.5
+-
+-[Input]
+-COORDSYS	= CH1903
+-TIME_ZONE	= 1
+-; COORDSYS	= PROJ4
+-; COORDPARAM	= 21781
+-
+-#reading ARC dem
+-DEM		= ARC
+-DEMFILE  	= ./input/surface-grids/Switzerland_1000m.asc
+-
+-#reading ARPS dem
+-; DEM		= ARPS
+-; DEMFILE 	= ./wgrt10r2_vw4.asc
+-; ARPS_X 	= 653400
+-; ARPS_Y 	= 112204
+-
+-#reading PGM image as dem
+-; DEM		= PGM
+-; DEMFILE	= ./Switzerland.pgm
+-; PGM_XCOORD	= 479500.
+-; PGM_YCOORD	= 73500.
+-; PGM_CELLSIZE	= 1000.
+-; PGM_MIN	= 193.
+-; PGM_MAX	= 4204.
+-
+-; LANDUSE	= ARC
+-; LANDUSEFILE	= ch_as97.asc
+-
+-#Alpine3D traditional inputs -> A3D plugin
+-; METEO		= A3D
+-; METEOPATH	= ./input/meteo
+-
+-#Borma
+-; METEO		= BORMA
+-; METEOPATH	= ./input/xml
+-; NROFSTATIONS	= 1
+-; STATION1	= 00.00.00.2
+-
+-#Snowpack input
+-; METEO		= SNOWPACK
+-; METEOPATH	= input
+-; METAFILE	= IMIS_Extracted_Info.txt ;metadata for all stations
+-; STATION1  	= MST96_RR.inp
+-
+-#SMET meteorological file format
+-METEO		= SMET
+-METEOPATH	= ./input/meteo
+-STATION1	= FLU2.smet
+-STATION2	= FIR2.smet
+-STATION3	= FRA2.smet
+-STATION4	= GLA2.smet
+-STATION5	= ILI2.smet
+-STATION6	= OTT2.smet
+-STATION7	= TUJ3.smet
+-
+-#IMIS network database input -> IMIS plugin
+-; METEO		= IMIS
+-; DBNAME		= sdbo
+-; DBUSER		= XXX
+-; DBPASS		= XXX
+-; NROFSTATIONS	= 4
+-; STATION1	= MORN2
+-; STATION2	= DAV3
+-; STATION3	= KLO2
+-; STATION4	= *SAM0
+-
+-#GEOtop traditional inputs -> GEOTOP plugin
+-; METEO		 = GEOTOP
+-; METEOPATH       = meteo/
+-; METEOPREFIX     = _meteo
+-
+-#GSN direct input -> GSN plugin
+-; METEO		= GSN
+-; ENDPOINT	= http://montblanc.slf.ch:22001/services/A3DWebService
+-; STATION1	= wan_sen14_2008
+-; STATION2	= wan2
+-
+-[Output]
+-COORDSYS	= CH1903
+-TIME_ZONE 	= 1
+-
+-GRID2D		= ARC
+-GRID2DPATH	= ./
+-
+-; GRID2D		= PNG
+-; GRID2DPATH	= ./
+-; PNG_MIN_SIZE	= 800x600
+-; PNG_WORLD_FILE	= true
+-; PNG_AUTOSCALE	= false
+-; PNG_SCALING	= nearest
+-
+-METEO		= SMET
+-METEOPATH	= ./
+-
+-[Filters]
+-TA::filter1	= min_max
+-TA::arg1	= 240 320
+-
+-RH::filter1	= min_max
+-RH::arg1 	= 0.01 1.2
+-RH::filter2	= min_max
+-RH::arg2	= soft 0.05 1.0
+-
+-HNW::filter1	= min
+-HNW::arg1	= -0.1
+-HNW::filter2	= min
+-HNW::arg2	= soft 0.
+-
+-ISWR::filter1	= min_max
+-ISWR::arg1	= -10. 1500.
+-ISWR::filter2	= min
+-ISWR::arg2	= soft 0.
+-
+-RSWR::filter1	= min_max
+-RSWR::arg1 	= -10 1500
+-RSWR::filter2	= min
+-RSWR::arg2	= soft 0
+-
+-#for TA between 240 and 320 K
+-ILWR::filter1	= min_max
+-ILWR::arg1	= 188 600
+-ILWR::filter2	= min_max
+-ILWR::arg2	= soft 200 400
+-
+-#we need to consider time with no snow -> TSS>0
+-#min(TSS) in db since 1998: -50C
+-TSS::filter1	= min_max
+-TSS::arg1	= 200 320
+-
+-#idem
+-TSG::filter1	= min_max
+-TSG::arg1	= 200 320
+-
+-HS::filter1	= min
+-HS::arg1	= soft 0.0
+-HS::filter2	= rate
+-HS::arg2	= 5.55e-5 ;0.20 m/h
+-
+-VW::filter1	= min_max
+-VW::arg1	= -2 70
+-VW::filter2	= min_max
+-VW::arg2	= soft 0.2 50.0
+-
+-[Interpolations1D]
+-WINDOW_SIZE	= 86400
+-
+-TA::resample	= linear
+-
+-RH::resample	= linear
+-
+-HS::resample	= linear
+-
+-VW::resample	= nearest_neighbour
+-VW::args	= extrapolate
+-
+-HNW::resample	= linear
+-
+-[Interpolations2D]
+-TA::algorithms	= IDW_LAPSE CST_LAPSE
+-TA::cst_lapse	= -0.008
+-TA::idw_lapse	= -0.008 soft
+-
+-RH::algorithms	= RH IDW_LAPSE CST
+-
+-HNW::algorithms	= IDW_LAPSE CST_LAPSE CST
+-HNW::cst_lapse	= 0.0005 frac
+-
+-VW::algorithms	= IDW_LAPSE CST
+-
+-P::algorithms	= STD_PRESS
+-
+-ILWR::algorithms = CST_LAPSE
+-ILWR::cst_lapse = -0.03125
+-
+-RSWR::algorithms = IDW CST
+Index: ../trunk-jpl/src/java/doc/examples/meteoio_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/doc/examples/meteoio_config.xml	(revision 17982)
++++ ../trunk-jpl/src/java/doc/examples/meteoio_config.xml	(revision 17983)
+@@ -1,919 +0,0 @@
+-<inishell_config application="Meteo IO">
+-
+-	<!-- General Parameters -->
+-	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
+-		<section name="general" />
+-		<help>Size in days of a chunk of data to read at once.</help>
+-	</parameter>
+-
+-	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
+-		<section name="general" />
+-		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
+-		beginning of the buffer (therefore, it takes a value in days).</help>
+-	</parameter>
+-
+-	<!-- Coordinate systems, time zones -->
+-	<parameter key="COORDSYS" type="alternative" optional="false">
+-		<section name="input" />
+-		<section name="output" />
+-		<option value="CH1903" type="string" default="true">
+-			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
+-		</option>
+-		<option value="UTM" type="string">
+-			<parameter key="COORDPARAM" type="string">
+-				<help>specify the zone with the zone letter (for example, 32T)</help>
+-			</parameter>
+-			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
+-		</option>
+-		<option value="UPS" type="string">
+-			<parameter key="COORDPARAM" type="string">
+-				<help>specify the hemisphere (either N or S)</help>
+-			</parameter>
+-			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
+-		</option>
+-		<option value="PROJ4" type="string">
+-			<parameter key="COORDPARAM" type="string" optional="false" />
+-			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
+-		</option>
+-		<option value="LOCAL"  type="string">
+-			<help>uses the horizontal and vertical distance from a reference point</help>
+-		</option>
+-		<help>coordinate system</help>
+-	</parameter>
+-
+-	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
+-		<section name="input" />
+-		<section name="output" />
+-	</parameter>
+-
+-	<!-- Datatypes: special pts -->
+-	<parameter key="SPECIALPTS" type="alternative">
+-		<section name="input" />
+-		<option value="A3D" type="string">
+-			<parameter key="SPECIALPTSFILE" type="file" optional="false">
+-				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
+-			</parameter>
+-		</option>
+-		<option value="SMET" type="string">
+-			<parameter key="SPECIALPTSFILE" type="file" optional="false">
+-				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
+-			</parameter>
+-		</option>
+-	</parameter>
+-
+-	<!-- Datatypes: Meteo Data -->
+-	<parameter key="METEO" type="alternative">
+-		<section name="input" />
+-		<section name="output" />
+-
+-		<option value="A3D" type="string">
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string containing the path to the meteorological files</help>
+-			</parameter>
+-		</option>
+-		<option value="BORMA" type="string">
+-			<section name="input" />
+-			<reference name="BORMA" />
+-		</option>
+-		<option value="COSMO" type="string">
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string containing the path to the meteorological files</help>
+-			</parameter>
+-		</option>
+-		<option value="GEOTOP" type="string">
+-			<section name="input" />
+-			<reference name="GEOTOP_IN" />
+-		</option>
+-		<option value="GEOTOP" type="string">
+-			<section name="output" />
+-			<reference name="GEOTOP_OUT" />
+-		</option>
+-		<option value="GRIB" type="string">
+-			<section name="input" />
+-			<reference name="GRIB_METEO" />
+-		</option>
+-		<option value="GSN" type="string">
+-			<section name="input" />
+-			<reference name="GSN" />
+-		</option>
+-		<option value="IMIS" type="string">
+-			<section name="input" />
+-			<reference name="IMIS" />
+-		</option>
+-		<option value="SMET" type="string">
+-			<section name="input" />
+-			<reference name="SMET_IN" />
+-		</option>
+-		<option value="SMET" type="string">
+-			<section name="output" />
+-			<reference name="SMET_OUT" />
+-		</option>
+-		<option value="SNOWPACK" type="string">
+-			<section name="input" />
+-			<reference name="SNIO_IN" />
+-		</option>
+-		<option value="SNOWPACK" type="string">
+-			<section name="output" />
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string representing path where SNOWPACK files should be saved</help>
+-			</parameter>
+-		</option>
+-
+-		<help>plugin for METEO data </help>
+-	</parameter>
+-
+-	<parameter key="Add Meteo parameter copy" type="selector">
+-		<section name="input"/>
+-		<parameter key="COPY::%" type="string" optional="false" template="true">
+-		  <help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
+-		</parameter>
+-	</parameter>
+-
+-	<!-- Datatypes: DEM -->
+-	<frame key="dem_frame" label="Digital Elevation Model">
+-	<section name="input"/>
+-		<parameter key="DEM" type="alternative">
+-			<section name="input" />
+-			<option value="ARC" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-			</option>
+-			<option value="ARPS" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-				<parameter key="ARPS_XCOORD" type="decimal" optional="false">
+-					<help>x coordinate of the lower left corner of the grids</help>
+-				</parameter>
+-				<parameter key="ARPS_YCOORD" type="decimal" optional="false">
+-					<help>y coordinate of the lower left corner of the grids</help>
+-				</parameter>
+-			</option>
+-			<option value="GRASS" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-			</option>
+-			<option value="GRIB" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-				<parameter key="GRIB_DEM_UPDATE" type="alternative" optional="true">
+-					<option value="TRUE" type="string" />
+-					<option value="FALSE" type="string" />
+-					<help>recompute slope/azimuth from the elevations when reading a DEM (default=false, that is we use the slope and azimuth included in the GRIB file)</help>
+-				</parameter>
+-			</option>
+-			<option value="PGM" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-				<reference name="PGM_IN" />
+-			</option>
+-
+-			<help>plugin for Digital Elevation Model data </help>
+-		</parameter>
+-	</frame>
+-
+-	<!-- Datatypes: Landuse -->
+-	<parameter key="LANDUSE" type="alternative">
+-		<section name="input" />
+-		<option value="ARC" type="string">
+-			<parameter key="LANDUSEFILE" type="file" optional="false">
+-				<help>File containing a grid of landuse codes</help>
+-			</parameter>
+-		</option>
+-
+-		<help>plugin for land cover data </help>
+-	</parameter>
+-
+-	<!-- Datatypes: Grids -->
+-	<parameter key="GRID2D" type="alternative">
+-		<section name="input" />
+-		<section name="output" />
+-		<option value="ARC" type="string">
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="ARC" />
+-		</option>
+-		<option value="ARPS" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="ARPS" />
+-		</option>
+-		<option value="GRASS" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-		</option>
+-		<option value="GRIB" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="GRIB_GRIDS" />
+-		</option>
+-		<option value="PGM" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="PGM_IN" />
+-		</option>
+-		<option value="PGM" type="string">
+-			<section name="output" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-		</option>
+-		<option value="PNG" type="string">
+-			<section name="output" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="PNG" />
+-		</option>
+-		<help>plugin for 2D gridded data </help>
+-	</parameter>
+-
+-	<!--Parameter group for list of stations -->
+-	<parametergroup name="stationgroup_files">
+-		<parameter key="STATION#" type="file" counter="1" optional="false">
+-			<help>filename for station number # </help>
+-		</parameter>
+-	</parametergroup>
+-	<parametergroup name="stationgroup_names">
+-		<parameter key="STATION#" type="string" counter="1" optional="false">
+-			<help>station id for the given station number # </help>
+-		</parameter>
+-	</parametergroup>
+-	<parametergroup name="stationgroup_pos">
+-		<parameter key="STATION#" type="string" counter="1">
+-			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<!-- Plugins for Meteo Data-->
+-	<parametergroup name="BORMA">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the xml files</help>
+-		</parameter>
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="IMIS">
+-		<parameter key="DBNAME" type="string" optional="false">
+-			<help>database name, as provided by your database administrator</help>
+-		</parameter>
+-		<parameter key="DBUSER" type="string" optional="false">
+-			<help>database user name</help>
+-		</parameter>
+-		<parameter key="DBPASS" type="string" optional="false">
+-			<help>database password associated with the user name</help>
+-		</parameter>
+-		<parameter key="USEANETZ" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
+-		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
+-		  average to get what should be its local precipitations</help>
+-		</parameter>
+-		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
+-		</parameter>
+-		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="GRIB_METEO">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the grib files</help>
+-		</parameter>
+-		<parameter key="METEOEXT" type="string" optional="true">
+-			<help>grib file extension, or none for no file extension (default: .grb)</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_pos" />
+-	</parametergroup>
+-
+-	<parametergroup name="GEOTOP_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the data files</help>
+-		</parameter>
+-		<parameter key="METAFILE" type="file" optional="false">
+-			<help>absolute filename of the geotop.inpts file</help>
+-		</parameter>
+-		<parameter key="METEOPREFIX" type="string" optional="true">
+-			<help>prefix to append when generating a file name for reading</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="GEOTOP_OUT">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the data files</help>
+-		</parameter>
+-		<parameter key="METEOSEQ" type="string" optional="false">
+-			<help>specifiy in which order the columns should be printed out</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="GSN">
+-		<parameter key="ENDPOINT" type="string" optional="false">
+-			<help>webserver running GSN with its port number and full path. For example:
+-			http://montblanc.slf.ch:22001/services/A3DWebService</help>
+-		</parameter>
+-		<parameter key="PROXY" type="string" optional="true">
+-			<help>Should the connection go through a proxy? This is useful for servers
+-			filtering on domains but usually not necessary.</help>
+-		</parameter>
+-		<parameter key="PROXYPORT" type="string" optional="true" />
+-		<parameter key="PROXYUSER" type="string" optional="true" />
+-		<parameter key="PROXYPASS" type="string" optional="true" />
+-
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="SMET_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the smet files</help>
+-		</parameter>
+-		<reference name="stationgroup_files" />
+-	</parametergroup>
+-
+-	<parametergroup name="SMET_OUT">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string representing path where SMET files should be saved</help>
+-		</parameter>
+-		<parameter key="METEOPARAM" type="alternative">
+-		  <option value="ASCII" type="string" default="true">
+-		    <help>Write ASCII SMET files</help>
+-		  </option>
+-		  <option value="BINARY" type="string">
+-		    <help>Write BINARY SMET files</help>
+-		  </option>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="SNIO_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the SNOWPACK files</help>
+-		</parameter>
+-		<parameter key="METAFILE" type="file" optional="true">
+-			<help>filename of the meta data file (in METEOPATH)</help>
+-		</parameter>
+-
+-		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
+-		  <help>the number of measured snow temperatures provided</help>
+-		</parameter>
+-
+-		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
+-		  <help>the number of solutes for which input data are provided</help>
+-		</parameter>
+-
+-		<parameter key="RSWR_INP" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		</parameter>
+-		<parameter key="ISWR_INP" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		</parameter>
+-		<parameter key="VW_DRIFT" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
+-		</parameter>
+-		<parameter key="RHO_HN" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: measured new snow density is provided</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_files" />
+-	</parametergroup>
+-
+-	<!-- Plugins for Gridded Data-->
+-	<parametergroup name="ARC">
+-		<parameter key="A3D_VIEW" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate names compatible with Alpine3D's grid viewer?</help>
+-		</parameter>
+-		<parameter key="GRID2DEXT" type="string" optional="true">
+-			<help>grid file extension, or none for no file extension (default: .asc)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="ARPS">
+-		<parameter key="ARPS_XCOORD" type="decimal" optional="false">
+-			<help>x coordinate of the lower left corner of the grids</help>
+-		</parameter>
+-		<parameter key="ARPS_YCOORD" type="decimal" optional="false">
+-			<help>y coordinate of the lower left corner of the grids</help>
+-		</parameter>
+-		<parameter key="GRID2DEXT" type="string" optional="true">
+-			<help>grid file extension, or none for no file extension (default: .asc)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="GRIB_GRIDS">
+-		<parameter key="GRID2DPREFIX" type="string" optional="true">
+-			<help>prefix to append when generating a file name for reading (ie: something like "laf" for Cosmo-Analysis-full domain)</help>
+-		</parameter>
+-		<parameter key="GRID2DEXT" type="string" optional="true">
+-			<help>grib file extension, or none for no file extension (default: .grb)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="PNG">
+-		<parameter key="PNG_WORLD_FILE" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate a world file for each output file? This file contains the geolocalization information</help>
+-		</parameter>
+-		<parameter key="PNG_LEGEND" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate a legend?</help>
+-		</parameter>
+-		<parameter key="PNG_AUTOSCALE" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>autoscale color scale?</help>
+-		</parameter>
+-		<parameter key="PNG_SCALING" type="alternative" optional="true">
+-			<option value="nearest" type="string" />
+-			<option value="bilinear" type="string" />
+-			<help>scaling algorithm (default=bilinear)</help>
+-		</parameter>
+-		<parameter key="PNG_MIN_SIZE" type="string" optional="false">
+-			<help>minimum dimensions of the PNG, like 640x480</help>
+-		</parameter>
+-		<parameter key="PNG_MAX_SIZE" type="string" optional="false">
+-			<help>maximum dimensions of the PNG, like 1024x768</help>
+-		</parameter>
+-		<parameter key="PNG_INDEXED" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate a color indexed file (default=true)</help>
+-		</parameter>
+-		<parameter key="PNG_SPEED_OPTIMIZE" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>optimize for speed (default=false)</help>
+-		</parameter>
+-		<parameter key="PNG_NR_LEVELS" type="integer+" default="+30" maximum="255" minimum="6" optional="true">
+-			<help>number of colors in the palette (default=30)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="PGM_IN">
+-		<parameter key="PGM_XCOORD" type="decimal" optional="false">
+-			<help>lower left x coordinate</help>
+-		</parameter>
+-		<parameter key="PGM_YCOORD" type="decimal" optional="false">
+-			<help>lower left y coordinate</help>
+-		</parameter>
+-		<parameter key="PGM_CELLSIZE" type="decimal" optional="false">
+-			<help>cellsize in meters</help>
+-		</parameter>
+-		<parameter key="PGM_MIN" type="decimal" optional="false">
+-			<help>minimum value in real world coordinates to match with the minimum value read out of the PGM file (such minimum being greater than 0 because 0 is NODATA)</help>
+-		</parameter>
+-		<parameter key="PGM_MAX" type="decimal" optional="false">
+-			<help>maximum value in real world coordinates to match with the maximum value read out of the PGM file</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
+-	<parametergroup name="METEOIOPARAMETERS">
+-		<option value="TA"/>
+-		<option value="RH"/>
+-		<option value="VW"/>
+-		<option value="DW"/>
+-		<option value="VW_MAX"/>
+-		<option value="ISWR"/>
+-		<option value="RSWR"/>
+-		<option value="ILWR"/>
+-		<option value="HS"/>
+-		<option value="HNW"/>
+-		<option value="TSG"/>
+-		<option value="TSS"/>
+-		<option value="P"/>
+-	</parametergroup>
+-
+-	<!-- Filters -->
+-	<parameter key="Add/Remove Filter" type="selector">
+-		<section name="filters" />
+-
+-		<parameter key="%::filter#" type="alternative" counter="1" template="true">
+-			<section name="filters" />
+-
+-			<option label="MeanAvg" value="mean_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
+-			</option>
+-
+-			<option label="MedianAvg" value="median_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="decimal" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
+-			</option>
+-
+-			<option label="Std Deviation Filter" value="std_dev" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
+-			</option>
+-
+-			<option label="MAD" value="mad" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
+-			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
+-			</option>
+-
+-			<option label="Tukey 53H Filter" value="Tukey" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
+-			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
+-			    </help>
+-			  </parameter>
+-			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
+-			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
+-			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
+-			</option>
+-
+-			<option label="Wind Averaging Filter" value="wind_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
+-			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
+-			</option>
+-
+-			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
+-			    </help>
+-			  </parameter>
+-			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
+-			</option>
+-
+-			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			      Please note that the standard filter works with a left window!
+-			    </help>
+-			  </parameter>
+-			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
+-			</option>
+-
+-			<option label="Min Range Filter" value="min" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Min:" value="" type="decimal" />
+-			    <option label="Adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
+-			    assigned the minimum permissible value or another value given as an extra argument</help>
+-			  </parameter>
+-			  <help>Min range filter. Reject all values smaller than the min.</help>
+-			</option>
+-
+-			<option label="Max Range Filter" value="max" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Max:" value="" type="decimal" />
+-			    <option label="Adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
+-			    assigned the maximum permissible value or another value given as an extra argument</help>
+-			  </parameter>
+-			  <help>Max range filter. Reject all values greater than the max.</help>
+-			</option>
+-
+-			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Min:" value="" type="decimal" />
+-			    <option label="Max:" value="" type="decimal" />
+-			    <option label="Min adjust to:" value="" type="decimal" />
+-			    <option label="Max adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
+-			    the maximum permissible value and all data smaller than the min would be assigned the minimum
+-			    permissible value or an optional extra set of two user provided values</help>
+-			  </parameter>
+-			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
+-			</option>
+-
+-			<option label="Rate Filter (1 argument)" value="rate" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
+-			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
+-			  </parameter>
+-			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
+-			</option>
+-
+-			<option label="Rate Filter (2 arguments)" value="rate" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
+-			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
+-			    <help>the minimum and maximum permissible rate of change (per second)</help>
+-			  </parameter>
+-			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
+-			</option>
+-
+-			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
+-			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
+-			  </parameter>
+-			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
+-			</option>
+-
+-			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option value="Gage type" type="dropdown">
+-					<option value="Nipher" type="string" />
+-					<option value="Tretyakov" type="string" />
+-					<option value="US8sh" type="string" />
+-					<option value="US8unsh" type="string" />
+-					<option value="Hellmann" type="string" />
+-					<option value="Hellmannsh" type="string" />
+-				</option>
+-			  </parameter>
+-			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
+-			</option>
+-
+-			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option value="Kind" type="dropdown">
+-					<option value="Cst" type="string" />
+-				</option>
+-				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
+-				<option label="Mixed prec factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
+-			  </parameter>
+-			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
+-			</option>
+-
+-			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="albedo:" value="0.23" type="decimal" />
+-			    <option value="soft" type="choice" />
+-			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
+-			  </parameter>
+-			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
+-			</option>
+-
+-			<option label="Add an offset" value="add" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option label="offset:" value="0." type="decimal" />
+-			  </parameter>
+-			  <help>This adds a given offset to the data.</help>
+-			</option>
+-
+-			<option label="Multiply by a factor" value="mult" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option label="factor:" value="1." type="decimal" />
+-			  </parameter>
+-			  <help>This multiplies the data by a given factor.</help>
+-			</option>
+-
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-
+-	<!-- 1D Interpolation -->
+-	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
+-		<section name="Interpolations1D" />
+-		<help>Affects resampling: expresses (in seconds) how far a valid point can be
+-		searched for when re-interpolating a missing value</help>
+-	</parameter>
+-
+-	<parameter key="Add/Remove 1D Interpolation" type="selector">
+-		<section name="Interpolations1D" />
+-
+-		<parameter key="%::resample" type="alternative" template="true">
+-			<section name="Interpolations1D" />
+-			<option label="No Interpolation" value="none" type="string" />
+-			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
+-			<option label="Linear" value="linear" type="string">
+-			  <parameter key="%::args" type="combination">
+-			    <option value="extrapolate" type="choice" />
+-			    <help>
+-			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
+-			      Otherwise, a data point will only be calculated between the original date range.
+-			    </help>
+-			  </parameter>
+-			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
+-			</option>
+-			<option label="Accumulate" value="accumulate" type="string">
+-			  <parameter key="%::args" type="combination">
+-			    <option value="strict" type="choice" />
+-			    <option label="Seconds:" value="900" type="integer" minimum="1" />
+-			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
+-			  </parameter>
+-			  <help>Accumulation over a user given period (filter argument, in seconds -
+-			  should coincide with your calculation step!).</help>
+-			</option>
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-
+-	<!-- 2D Interpolation -->
+-	<parameter key="Add/Remove 2D Interpolation" type="selector">
+-		<section name="Interpolations2D" />
+-
+-		<parameter key="%::algorithms" type="choice" template="true">
+-			<section name="Interpolations2D" />
+-			<option value="STD_PRESS" type="choice">
+-				<help>Generate a standard atmosphere pressure as a function of the cell's elevation</help>
+-			</option>
+-			<option value="CST" type="choice">
+-				<help>Fill the grid with the average over all the stations</help>
+-			</option>
+-			<option value="CST_LAPSE" type="choice">
+-			  <parameter key="%::cst_lapse" type="combination">
+-			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
+-			    <option value="" type="dropdown">
+-			      <option value="" type="string" />
+-			      <option value="soft" type="string" />
+-			      <option value="frac" type="string" />
+-			    </option>
+-			  </parameter>
+-			  <help>Detrend the measured data, fill the grid with the average over all the stations, reapply the elevation trend</help>
+-			</option>
+-			<option value="IDW" type="choice">
+-				<help>Inverse Distance Weighted average</help>
+-			</option>
+-			<option value="IDW_LAPSE" type="choice">
+-			  <parameter key="%::idw_lapse" type="combination">
+-			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
+-			    <option value="" type="dropdown">
+-			      <option value="" type="string" />
+-			      <option value="soft" type="string" />
+-			      <option value="frac" type="string" />
+-			    </option>
+-			  </parameter>
+-			  <help>Detrend the measured data, apply Inverse Distance Weighted average, reapply elevation trend</help>
+-			</option>
+-			<option value="LIDW_LAPSE" type="choice">
+-			  <parameter key="%::lidw_lapse" type="combination">
+-			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
+-			    <option value="" type="dropdown">
+-			      <option value="" type="string" />
+-			      <option value="soft" type="string" />
+-			      <option value="frac" type="string" />
+-			    </option>
+-			  </parameter>
+-			  <help>Same as IDW_LAPSE, but only considering a given number of neighboring stations</help>
+-			</option>
+-			<option value="RH" type="choice">
+-				<help>Computes the dew point temperature, distribute it with IDW_LAPSE, recompute RH at each pixel</help>
+-			</option>
+-			<option value="ILWR" type="choice">
+-				<help>Compute emissivity, distribute it with IDW_LAPSE, recompute ILWR at each pixel</help>
+-			</option>
+-			<option value="WIND_CURV" type="choice">
+-				<help>Distribute wind velocity with IDW_LAPSE, then apply correction factors as a function of local slope and curvature</help>
+-			</option>
+-			<option value="HNW_SNOW" type="choice">
+-				<parameter key="%::hnw_snow" type="combination">
+-				<option value="IDW_LAPSE" type="dropdown">
+-					<option value="CST" type="string" />
+-					<option value="CST_LAPSE" type="string" />
+-					<option value="IDW" type="string" />
+-					<option value="IDW_LAPSE" type="string" />
+-					<option value="ODKRIG" type="string" />
+-				</option>
+-				<help>Base algorithm (do not forget to add the options for the base algorithm)</help>
+-				</parameter>
+-				<help>Distribute precipitation with a base algorithm (IDW_LAPSE by default), then reduce/remove precipitation on
+-				steep slopes and correct with the local curvature. This is to simulate snow redistribution processes.</help>
+-			</option>
+-			<option value="USER" type="choice">
+-			  <parameter key="%::user" type="path" optional="false"/>
+-			  <help>User provided grids, named as {numeric date}_{capitalized meteo parameter}.asc</help>
+-			</option>
+-			<option value="ODKRIG" type="choice">
+-			  <parameter key="%::odkrig" type="combination">
+-			  	<option value="" type="dropdown">
+-					<option value="LINVARIO" type="string" />
+-					<option value="EXPVARIO" type="string" />
+-					<option value="SPHERICVARIO" type="string" />
+-					<option value="RATQUADVARIO" type="string" />
+-				</option>
+-				<help>Variogram model</help>
+-			  </parameter>
+-			  <help>Ordinary kriging (EXPERIMENTAL)</help>
+-			</option>
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-</inishell_config>
+\ No newline at end of file
+Index: ../trunk-jpl/src/java/lib/miglayout-4.0.jar
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/MANIFEST.MF
+===================================================================
+--- ../trunk-jpl/src/java/MANIFEST.MF	(revision 17982)
++++ ../trunk-jpl/src/java/MANIFEST.MF	(revision 17983)
+@@ -1,14 +0,0 @@
+-Manifest-Version: 1.0
+-Ant-Version: Apache Ant 1.8.4
+-Created-By: 1.6.0_51-b11-457-11M4509 (Apple Inc.)
+-Built-By: larour
+-Built-On: 2014-04-14
+-Built-At: 14:27:23
+-Main-Class: main/GUIBuilder
+-Specification-Title: INI file generator
+-Specification-Version: 1.0.0-20140414
+-Specification-Vendor: SLF, www.slf.ch
+-Implementation-Title: INIshell ini creator
+-Implementation-Version: 1.0.0
+-Implementation-Vendor: SLF, www.slf.ch
+-
+Index: ../trunk-jpl/src/java/src/resources/default_config.xml
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/default_config.xml	(revision 17982)
++++ ../trunk-jpl/src/java/src/resources/default_config.xml	(revision 17983)
+@@ -1,919 +0,0 @@
+-<inishell_config application="Meteo IO">
+-
+-	<!-- General Parameters -->
+-	<parameter key="BUFF_CHUNK_SIZE" type="integer" default="30">
+-		<section name="general" />
+-		<help>Size in days of a chunk of data to read at once.</help>
+-	</parameter>
+-
+-	<parameter key="BUFF_BEFORE" type="decimal" default="1.5">
+-		<section name="general" />
+-		<help>Alternate way of buffer centering: When rebuffering, the new date will be located BUFF_BEFORE days from the
+-		beginning of the buffer (therefore, it takes a value in days).</help>
+-	</parameter>
+-
+-	<!-- Coordinate systems, time zones -->
+-	<parameter key="COORDSYS" type="alternative" optional="false">
+-		<section name="input" />
+-		<section name="output" />
+-		<option value="CH1903" type="string" default="true">
+-			<help>coordinates in the Swiss Grid &lt;a href="http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf"&gt;http://geomatics.ladetto.ch/ch1903_wgs84_de.pdf&lt;/a&gt;</help>
+-		</option>
+-		<option value="UTM" type="string">
+-			<parameter key="COORDPARAM" type="string">
+-				<help>specify the zone with the zone letter (for example, 32T)</help>
+-			</parameter>
+-			<help>UTM coordinates, see &lt;a href="http://www.oc.nps.edu/oc2902w/maps/utmups.pdf"&gt;http://www.oc.nps.edu/oc2902w/maps/utmups.pdf&lt;/a&gt;</help>
+-		</option>
+-		<option value="UPS" type="string">
+-			<parameter key="COORDPARAM" type="string">
+-				<help>specify the hemisphere (either N or S)</help>
+-			</parameter>
+-			<help>Universal Polar Stereographic coordinates, see &lt;a href="https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system"&gt;https://en.wikipedia.org/wiki/Universal_Polar_Stereographic_coordinate_system&lt;/a&gt;</help>
+-		</option>
+-		<option value="PROJ4" type="string">
+-			<parameter key="COORDPARAM" type="string" optional="false" />
+-			<help>external library: see &lt;a href="http://trac.osgeo.org/proj/"&gt;http://trac.osgeo.org/proj/&lt;/a&gt;</help>
+-		</option>
+-		<option value="LOCAL"  type="string">
+-			<help>uses the horizontal and vertical distance from a reference point</help>
+-		</option>
+-		<help>coordinate system</help>
+-	</parameter>
+-
+-	<parameter key="TIME_ZONE" type="integer+" default="+1" maximum="14" minimum="-12" optional="false">
+-		<section name="input" />
+-		<section name="output" />
+-	</parameter>
+-
+-	<!-- Datatypes: special pts -->
+-	<parameter key="SPECIALPTS" type="alternative">
+-		<section name="input" />
+-		<option value="A3D" type="string">
+-			<parameter key="SPECIALPTSFILE" type="file" optional="false">
+-				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
+-			</parameter>
+-		</option>
+-		<option value="SMET" type="string">
+-			<parameter key="SPECIALPTSFILE" type="file" optional="false">
+-				<help>a path+file name to the a file containing grid coordinates of special points of interest (for special outputs)</help>
+-			</parameter>
+-		</option>
+-	</parameter>
+-
+-	<!-- Datatypes: Meteo Data -->
+-	<parameter key="METEO" type="alternative">
+-		<section name="input" />
+-		<section name="output" />
+-
+-		<option value="A3D" type="string">
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string containing the path to the meteorological files</help>
+-			</parameter>
+-		</option>
+-		<option value="BORMA" type="string">
+-			<section name="input" />
+-			<reference name="BORMA" />
+-		</option>
+-		<option value="COSMO" type="string">
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string containing the path to the meteorological files</help>
+-			</parameter>
+-		</option>
+-		<option value="GEOTOP" type="string">
+-			<section name="input" />
+-			<reference name="GEOTOP_IN" />
+-		</option>
+-		<option value="GEOTOP" type="string">
+-			<section name="output" />
+-			<reference name="GEOTOP_OUT" />
+-		</option>
+-		<option value="GRIB" type="string">
+-			<section name="input" />
+-			<reference name="GRIB_METEO" />
+-		</option>
+-		<option value="GSN" type="string">
+-			<section name="input" />
+-			<reference name="GSN" />
+-		</option>
+-		<option value="IMIS" type="string">
+-			<section name="input" />
+-			<reference name="IMIS" />
+-		</option>
+-		<option value="SMET" type="string">
+-			<section name="input" />
+-			<reference name="SMET_IN" />
+-		</option>
+-		<option value="SMET" type="string">
+-			<section name="output" />
+-			<reference name="SMET_OUT" />
+-		</option>
+-		<option value="SNOWPACK" type="string">
+-			<section name="input" />
+-			<reference name="SNIO_IN" />
+-		</option>
+-		<option value="SNOWPACK" type="string">
+-			<section name="output" />
+-			<parameter key="METEOPATH" type="path" optional="false">
+-				<help>string representing path where SNOWPACK files should be saved</help>
+-			</parameter>
+-		</option>
+-
+-		<help>plugin for METEO data </help>
+-	</parameter>
+-
+-	<parameter key="Add Meteo parameter copy" type="selector">
+-		<section name="input"/>
+-		<parameter key="COPY::%" type="string" optional="false" template="true">
+-		  <help>The name of the parameter to copy (e.g. TA, RH, VW, ISWR, etc)</help>
+-		</parameter>
+-	</parameter>
+-
+-	<!-- Datatypes: DEM -->
+-	<frame key="dem_frame" label="Digital Elevation Model">
+-	<section name="input"/>
+-		<parameter key="DEM" type="alternative">
+-			<section name="input" />
+-			<option value="ARC" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-			</option>
+-			<option value="ARPS" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-				<parameter key="ARPS_XCOORD" type="decimal" optional="false">
+-					<help>x coordinate of the lower left corner of the grids</help>
+-				</parameter>
+-				<parameter key="ARPS_YCOORD" type="decimal" optional="false">
+-					<help>y coordinate of the lower left corner of the grids</help>
+-				</parameter>
+-			</option>
+-			<option value="GRASS" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-			</option>
+-			<option value="GRIB" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-				<parameter key="GRIB_DEM_UPDATE" type="alternative" optional="true">
+-					<option value="TRUE" type="string" />
+-					<option value="FALSE" type="string" />
+-					<help>recompute slope/azimuth from the elevations when reading a DEM (default=false, that is we use the slope and azimuth included in the GRIB file)</help>
+-				</parameter>
+-			</option>
+-			<option value="PGM" type="string">
+-				<parameter key="DEMFILE" type="file" optional="false">
+-					<help>For reading the data as a DEMObject</help>
+-				</parameter>
+-				<reference name="PGM_IN" />
+-			</option>
+-
+-			<help>plugin for Digital Elevation Model data </help>
+-		</parameter>
+-	</frame>
+-
+-	<!-- Datatypes: Landuse -->
+-	<parameter key="LANDUSE" type="alternative">
+-		<section name="input" />
+-		<option value="ARC" type="string">
+-			<parameter key="LANDUSEFILE" type="file" optional="false">
+-				<help>File containing a grid of landuse codes</help>
+-			</parameter>
+-		</option>
+-
+-		<help>plugin for land cover data </help>
+-	</parameter>
+-
+-	<!-- Datatypes: Grids -->
+-	<parameter key="GRID2D" type="alternative">
+-		<section name="input" />
+-		<section name="output" />
+-		<option value="ARC" type="string">
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="ARC" />
+-		</option>
+-		<option value="ARPS" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="ARPS" />
+-		</option>
+-		<option value="GRASS" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-		</option>
+-		<option value="GRIB" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="GRIB_GRIDS" />
+-		</option>
+-		<option value="PGM" type="string">
+-			<section name="input" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="PGM_IN" />
+-		</option>
+-		<option value="PGM" type="string">
+-			<section name="output" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-		</option>
+-		<option value="PNG" type="string">
+-			<section name="output" />
+-			<parameter key="GRID2DPATH" type="path" optional="false">
+-				<help>string representing path where grid files should be read from</help>
+-			</parameter>
+-			<reference name="PNG" />
+-		</option>
+-		<help>plugin for 2D gridded data </help>
+-	</parameter>
+-
+-	<!--Parameter group for list of stations -->
+-	<parametergroup name="stationgroup_files">
+-		<parameter key="STATION#" type="file" counter="1" optional="false">
+-			<help>filename for station number # </help>
+-		</parameter>
+-	</parametergroup>
+-	<parametergroup name="stationgroup_names">
+-		<parameter key="STATION#" type="string" counter="1" optional="false">
+-			<help>station id for the given station number # </help>
+-		</parameter>
+-	</parametergroup>
+-	<parametergroup name="stationgroup_pos">
+-		<parameter key="STATION#" type="string" counter="1">
+-			<help>Coordinates are given as "lat lon" or "xcoord ycoord epsg_code"</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<!-- Plugins for Meteo Data-->
+-	<parametergroup name="BORMA">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the xml files</help>
+-		</parameter>
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="IMIS">
+-		<parameter key="DBNAME" type="string" optional="false">
+-			<help>database name, as provided by your database administrator</help>
+-		</parameter>
+-		<parameter key="DBUSER" type="string" optional="false">
+-			<help>database user name</help>
+-		</parameter>
+-		<parameter key="DBPASS" type="string" optional="false">
+-			<help>database password associated with the user name</help>
+-		</parameter>
+-		<parameter key="USEANETZ" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: use ANETZ stations to provide precipitations for normal IMIS stations.
+-		  Each IMIS station is associated with one or two ANETZ stations and does a weighted
+-		  average to get what should be its local precipitations</help>
+-		</parameter>
+-		<parameter key="USE_IMIS_HNW" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: if set to false (default), all IMIS precipitation will be deleted (since IMIS stations don't have heated rain gauges, their precipitation measurements are not good in winter conditions). If set to true, it is strongly advised to use a FilterHNWMelt filter to detect snow melting in the rain gauge and perform winter conditions detection in the application.</help>
+-		</parameter>
+-		<parameter key="USE_SNOWPACK_HNW" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>if set to true, the SNOWPACK simulated Snow Water Equivalent from the database will be used to compute HNW. Data gaps greater than 3 hours on SWE will lead to unchanged hnw while all data that can properly be computed will overwrite hnw. (default=false)</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="GRIB_METEO">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the grib files</help>
+-		</parameter>
+-		<parameter key="METEOEXT" type="string" optional="true">
+-			<help>grib file extension, or none for no file extension (default: .grb)</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_pos" />
+-	</parametergroup>
+-
+-	<parametergroup name="GEOTOP_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the data files</help>
+-		</parameter>
+-		<parameter key="METAFILE" type="file" optional="false">
+-			<help>absolute filename of the geotop.inpts file</help>
+-		</parameter>
+-		<parameter key="METEOPREFIX" type="string" optional="true">
+-			<help>prefix to append when generating a file name for reading</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="GEOTOP_OUT">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the data files</help>
+-		</parameter>
+-		<parameter key="METEOSEQ" type="string" optional="false">
+-			<help>specifiy in which order the columns should be printed out</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="GSN">
+-		<parameter key="ENDPOINT" type="string" optional="false">
+-			<help>webserver running GSN with its port number and full path. For example:
+-			http://montblanc.slf.ch:22001/services/A3DWebService</help>
+-		</parameter>
+-		<parameter key="PROXY" type="string" optional="true">
+-			<help>Should the connection go through a proxy? This is useful for servers
+-			filtering on domains but usually not necessary.</help>
+-		</parameter>
+-		<parameter key="PROXYPORT" type="string" optional="true" />
+-		<parameter key="PROXYUSER" type="string" optional="true" />
+-		<parameter key="PROXYPASS" type="string" optional="true" />
+-
+-		<reference name="stationgroup_names" />
+-	</parametergroup>
+-
+-	<parametergroup name="SMET_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the smet files</help>
+-		</parameter>
+-		<reference name="stationgroup_files" />
+-	</parametergroup>
+-
+-	<parametergroup name="SMET_OUT">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string representing path where SMET files should be saved</help>
+-		</parameter>
+-		<parameter key="METEOPARAM" type="alternative">
+-		  <option value="ASCII" type="string" default="true">
+-		    <help>Write ASCII SMET files</help>
+-		  </option>
+-		  <option value="BINARY" type="string">
+-		    <help>Write BINARY SMET files</help>
+-		  </option>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="SNIO_IN">
+-		<parameter key="METEOPATH" type="path" optional="false">
+-			<help>string containing the path to the SNOWPACK files</help>
+-		</parameter>
+-		<parameter key="METAFILE" type="file" optional="true">
+-			<help>filename of the meta data file (in METEOPATH)</help>
+-		</parameter>
+-
+-		<parameter key="NUMBER_MEAS_TEMPERATURES" type="integer+" minimum="0" default="0">
+-		  <help>the number of measured snow temperatures provided</help>
+-		</parameter>
+-
+-		<parameter key="NUMBER_OF_SOLUTES" type="integer+" minimum="0" default="0">
+-		  <help>the number of solutes for which input data are provided</help>
+-		</parameter>
+-
+-		<parameter key="RSWR_INP" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		</parameter>
+-		<parameter key="ISWR_INP" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		</parameter>
+-		<parameter key="VW_DRIFT" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: wind velocity to use for blowing and drifting snow is provided</help>
+-		</parameter>
+-		<parameter key="RHO_HN" type="alternative" optional="true">
+-		  <option value="TRUE" type="string" />
+-		  <option value="FALSE" type="string" />
+-		  <help>OPTIONAL: measured new snow density is provided</help>
+-		</parameter>
+-
+-		<reference name="stationgroup_files" />
+-	</parametergroup>
+-
+-	<!-- Plugins for Gridded Data-->
+-	<parametergroup name="ARC">
+-		<parameter key="A3D_VIEW" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate names compatible with Alpine3D's grid viewer?</help>
+-		</parameter>
+-		<parameter key="GRID2DEXT" type="string" optional="true">
+-			<help>grid file extension, or none for no file extension (default: .asc)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="ARPS">
+-		<parameter key="ARPS_XCOORD" type="decimal" optional="false">
+-			<help>x coordinate of the lower left corner of the grids</help>
+-		</parameter>
+-		<parameter key="ARPS_YCOORD" type="decimal" optional="false">
+-			<help>y coordinate of the lower left corner of the grids</help>
+-		</parameter>
+-		<parameter key="GRID2DEXT" type="string" optional="true">
+-			<help>grid file extension, or none for no file extension (default: .asc)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="GRIB_GRIDS">
+-		<parameter key="GRID2DPREFIX" type="string" optional="true">
+-			<help>prefix to append when generating a file name for reading (ie: something like "laf" for Cosmo-Analysis-full domain)</help>
+-		</parameter>
+-		<parameter key="GRID2DEXT" type="string" optional="true">
+-			<help>grib file extension, or none for no file extension (default: .grb)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="PNG">
+-		<parameter key="PNG_WORLD_FILE" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate a world file for each output file? This file contains the geolocalization information</help>
+-		</parameter>
+-		<parameter key="PNG_LEGEND" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate a legend?</help>
+-		</parameter>
+-		<parameter key="PNG_AUTOSCALE" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>autoscale color scale?</help>
+-		</parameter>
+-		<parameter key="PNG_SCALING" type="alternative" optional="true">
+-			<option value="nearest" type="string" />
+-			<option value="bilinear" type="string" />
+-			<help>scaling algorithm (default=bilinear)</help>
+-		</parameter>
+-		<parameter key="PNG_MIN_SIZE" type="string" optional="false">
+-			<help>minimum dimensions of the PNG, like 640x480</help>
+-		</parameter>
+-		<parameter key="PNG_MAX_SIZE" type="string" optional="false">
+-			<help>maximum dimensions of the PNG, like 1024x768</help>
+-		</parameter>
+-		<parameter key="PNG_INDEXED" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>generate a color indexed file (default=true)</help>
+-		</parameter>
+-		<parameter key="PNG_SPEED_OPTIMIZE" type="alternative" optional="true">
+-			<option value="TRUE" type="string" />
+-			<option value="FALSE" type="string" />
+-			<help>optimize for speed (default=false)</help>
+-		</parameter>
+-		<parameter key="PNG_NR_LEVELS" type="integer+" default="+30" maximum="255" minimum="6" optional="true">
+-			<help>number of colors in the palette (default=30)</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<parametergroup name="PGM_IN">
+-		<parameter key="PGM_XCOORD" type="decimal" optional="false">
+-			<help>lower left x coordinate</help>
+-		</parameter>
+-		<parameter key="PGM_YCOORD" type="decimal" optional="false">
+-			<help>lower left y coordinate</help>
+-		</parameter>
+-		<parameter key="PGM_CELLSIZE" type="decimal" optional="false">
+-			<help>cellsize in meters</help>
+-		</parameter>
+-		<parameter key="PGM_MIN" type="decimal" optional="false">
+-			<help>minimum value in real world coordinates to match with the minimum value read out of the PGM file (such minimum being greater than 0 because 0 is NODATA)</help>
+-		</parameter>
+-		<parameter key="PGM_MAX" type="decimal" optional="false">
+-			<help>maximum value in real world coordinates to match with the maximum value read out of the PGM file</help>
+-		</parameter>
+-	</parametergroup>
+-
+-	<!-- Meteo Parameters for Filters, resampling, spatial interpolations-->
+-	<parametergroup name="METEOIOPARAMETERS">
+-		<option value="TA"/>
+-		<option value="RH"/>
+-		<option value="VW"/>
+-		<option value="DW"/>
+-		<option value="VW_MAX"/>
+-		<option value="ISWR"/>
+-		<option value="RSWR"/>
+-		<option value="ILWR"/>
+-		<option value="HS"/>
+-		<option value="HNW"/>
+-		<option value="TSG"/>
+-		<option value="TSS"/>
+-		<option value="P"/>
+-	</parametergroup>
+-
+-	<!-- Filters -->
+-	<parameter key="Add/Remove Filter" type="selector">
+-		<section name="filters" />
+-
+-		<parameter key="%::filter#" type="alternative" counter="1" template="true">
+-			<section name="filters" />
+-
+-			<option label="MeanAvg" value="mean_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
+-			</option>
+-
+-			<option label="MedianAvg" value="median_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="decimal" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Median average processing. The median average filter returns the median value of all values within a user given time window.</help>
+-			</option>
+-
+-			<option label="Std Deviation Filter" value="std_dev" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Standard deviation filter. Values outside of mean ± 2 std_dev are rejected.</help>
+-			</option>
+-
+-			<option label="MAD" value="mad" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Median Absolute Deviation. Values outside of median ± 3 σ_MAD are rejected. &lt;br&gt;
+-			  See http://en.wikipedia.org/wiki/Median_absolute_deviation for more information.</help>
+-			</option>
+-
+-			<option label="Tukey 53H Filter" value="Tukey" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      The keyword "soft" maybe added, if the window position is allowed to be adjusted to the data present.
+-			      The two arguments may be preceded by the keywords "left", "center" or "right", indicating the window position.
+-			    </help>
+-			  </parameter>
+-			  <help>Tukey 53H method A smooth time sequence is generated from the median, substracted from the original signal and
+-			  compared with the standard deviation. see "Despiking Acoustic Doppler Velocimeter Data", Derek G. Goring and Vladimir
+-			  L. Nikora, Journal of Hydraulic Engineering, 128, 1, 2002 The deviation factor coeffecient is currently hard-coded as k=1.5. </help>
+-			</option>
+-
+-			<option label="Wind Averaging Filter" value="wind_avg" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			    </help>
+-			  </parameter>
+-			  <help>Wind vector averaging. This calculates the vector average over a user given time period. Each wind vector
+-			  within this period is added and the final sum is normalized by the number of vectors that have been added. </help>
+-			</option>
+-
+-			<option label="Exponential Smoothing" value="exp_smoothing" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <option label="alpha:" value="0.8" type="decimal" minimum="0" maximum="1"/>
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			      Alpha needs to be provided as last argument. Please note that the standard filter works with a left window!
+-			    </help>
+-			  </parameter>
+-			  <help>Exponential smooting processing, exponential moving average s_0 = x_0 s_n = alpha*x_(t-1) + (1-alpha)*s_t-1</help>
+-			</option>
+-
+-			<option label="Weighted Moving Average Smoothing" value="wma_smoothing" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option value="center" type="dropdown">
+-			      <option value="left" type="string" />
+-			      <option value="center" type="string" />
+-			      <option value="right" type="string" />
+-			    </option>
+-			    <option label="# of points:" value="1" type="integer" minimum="1" />
+-			    <option label="Duration:" value="0" type="integer" minimum="0" />
+-			    <help>
+-			      Activate "soft" if the window position is allowed to be adjusted, window position maybe left, center or right.
+-			      Minimal number of points in window and minimal time interval spanning the window (seconds) are required.
+-			      Please note that the standard filter works with a left window!
+-			    </help>
+-			  </parameter>
+-			  <help>Weighted moving average smoothing such as: WMA = (1*X1 + 2*X2 + ... + n*Xn) / sum_of_weights</help>
+-			</option>
+-
+-			<option label="Min Range Filter" value="min" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Min:" value="" type="decimal" />
+-			    <option label="Adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data smaller than the min would be
+-			    assigned the minimum permissible value or another value given as an extra argument</help>
+-			  </parameter>
+-			  <help>Min range filter. Reject all values smaller than the min.</help>
+-			</option>
+-
+-			<option label="Max Range Filter" value="max" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Max:" value="" type="decimal" />
+-			    <option label="Adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be
+-			    assigned the maximum permissible value or another value given as an extra argument</help>
+-			  </parameter>
+-			  <help>Max range filter. Reject all values greater than the max.</help>
+-			</option>
+-
+-			<option label="MinMax (2 or 4 arguments)" value="min_max" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="Min:" value="" type="decimal" />
+-			    <option label="Max:" value="" type="decimal" />
+-			    <option label="Min adjust to:" value="" type="decimal" />
+-			    <option label="Max adjust to:" value="" type="decimal" />
+-			    <help>The keyword "soft" maybe added, in such a case all data greater than the max would be assigned
+-			    the maximum permissible value and all data smaller than the min would be assigned the minimum
+-			    permissible value or an optional extra set of two user provided values</help>
+-			  </parameter>
+-			  <help>Reject all values greater than the max or smaller than the min. &lt;br&gt;</help>
+-			</option>
+-
+-			<option label="Rate Filter (1 argument)" value="rate" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
+-			    <help>the absolute value of the maximum permissible rate of change (per seconds)</help>
+-			  </parameter>
+-			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
+-			</option>
+-
+-			<option label="Rate Filter (2 arguments)" value="rate" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="Min:" value="0.0" type="decimal" minimum="0" maximum="1" />
+-			    <option label="Max:" value="1.0" type="decimal" minimum="0" maximum="1" />
+-			    <help>the minimum and maximum permissible rate of change (per second)</help>
+-			  </parameter>
+-			  <help>Rate of change filter. Calculate the change rate (ie: slope) between two points, if it is above a user given value, reject the point.</help>
+-			</option>
+-
+-			<option label="Unheated Rain Gauge Filter" value="Unheated_RainGauge" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option value="soft" type="choice" />
+-			    <option label="RH threshold:" value="0.5" type="decimal" minimum="0" maximum="1" />
+-			    <option label="Delta_T threshold:" value="3.0" type="decimal" minimum="0" maximum="20" />
+-			  </parameter>
+-			  <help>Filters out snow melting in an unheated rain gauge. This filter can ONLY be applied to precipitation. Non-zero measurements are accepted only if they take place when the relative humidity is greater than RH_threshold and (TA-TSS) smaller than Delta_T_threshold, otherwise they get reset to 0. If none of these conditions could be tested (for lack of data), then the precipitation is reset to nodata (or left unchanged if "soft" has been selected).</help>
+-			</option>
+-
+-			<option label="WMO Undercatch Filter" value="undercatch_wmo" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option value="Gage type" type="dropdown">
+-					<option value="Nipher" type="string" />
+-					<option value="Tretyakov" type="string" />
+-					<option value="US8sh" type="string" />
+-					<option value="US8unsh" type="string" />
+-					<option value="Hellmann" type="string" />
+-					<option value="Hellmannsh" type="string" />
+-				</option>
+-			  </parameter>
+-			  <help>This implements the standard methods for precipitation correction as described in "WMO Solid Precipitation Measurement Intercomparison", B. Goodison, P. Louie and D. Yang, 872, 1998 as well as the overview given by "Literature Study on the Correction of Precipitation Measurements", Annette Wagner, 2009. The correction parameters for the shielded Hellmann gauge (German version) are from "Wind-induced Precipitation Undercatch of the Hellmann Gauges", Daqing Yang et al, Nordic Hydrology, 30, 1999, pp 57-80.</help>
+-			</option>
+-
+-			<option label="WMO Undercatch Filter - simplified" value="undercatch_wmo" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option value="Kind" type="dropdown">
+-					<option value="Cst" type="string" />
+-				</option>
+-				<option label="Snow factor:" value="1.3" type="decimal" minimum="0" maximum="5" />
+-				<option label="Mixed prec factor:" value="1.1" type="decimal" minimum="0" maximum="5" />
+-			  </parameter>
+-			  <help>This applies a constant correction factor to the precipitation, one for pure snow and one for mixed precipitation. The following thresholds are used: pure snow below -2 C; mixed precipitation between -2 and +2 C; pure rain above 2 C. These threshold can be changed (see online documentation).</help>
+-			</option>
+-
+-			<option label="Unventillated temperature sensor" value="Unventilated_T" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-			    <option label="albedo:" value="0.23" type="decimal" />
+-			    <option value="soft" type="choice" />
+-			    <help>If the "soft" option is given, the albedo has a value different according to snow (or no snow) on the ground</help>
+-			  </parameter>
+-			  <help>This implements the correction described in (Reina Nakamura, 2005) with an albedo dependency as introduced in (Huwald, 2009)</help>
+-			</option>
+-
+-			<option label="Add an offset" value="add" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option label="offset:" value="0." type="decimal" />
+-			  </parameter>
+-			  <help>This adds a given offset to the data.</help>
+-			</option>
+-
+-			<option label="Multiply by a factor" value="mult" type="string">
+-			  <parameter key="%::arg#" type="combination">
+-				<option label="factor:" value="1." type="decimal" />
+-			  </parameter>
+-			  <help>This multiplies the data by a given factor.</help>
+-			</option>
+-
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-
+-	<!-- 1D Interpolation -->
+-	<parameter key="WINDOW_SIZE" type="integer+" minimum="1" default="43200">
+-		<section name="Interpolations1D" />
+-		<help>Affects resampling: expresses (in seconds) how far a valid point can be
+-		searched for when re-interpolating a missing value</help>
+-	</parameter>
+-
+-	<parameter key="Add/Remove 1D Interpolation" type="selector">
+-		<section name="Interpolations1D" />
+-
+-		<parameter key="%::resample" type="alternative" template="true">
+-			<section name="Interpolations1D" />
+-			<option label="No Interpolation" value="none" type="string" />
+-			<option label="Nearest Neighbour" value="nearest_neighbour" type="string" />
+-			<option label="Linear" value="linear" type="string">
+-			  <parameter key="%::args" type="combination">
+-			    <option value="extrapolate" type="choice" />
+-			    <help>
+-			      If "extrapolate" is added, then data *outside* of the original date range can be interpolated.
+-			      Otherwise, a data point will only be calculated between the original date range.
+-			    </help>
+-			  </parameter>
+-			  <help>Mean average processing. The mean average filter returns the mean value of all values within a user given time window.</help>
+-			</option>
+-			<option label="Accumulate" value="accumulate" type="string">
+-			  <parameter key="%::args" type="combination">
+-			    <option value="strict" type="choice" />
+-			    <option label="Seconds:" value="900" type="integer" minimum="1" />
+-			    <help>Accumulation period (in seconds). This must usually match the model time step. if enabling "strict", nodatas will propagate (ie. a single nodata in the input will force the re-accumulated value to be nodata). Otherwise, all valid values are aggregated and only pure nodata intervals produce a nodata in the output.</help>
+-			  </parameter>
+-			  <help>Accumulation over a user given period (filter argument, in seconds -
+-			  should coincide with your calculation step!).</help>
+-			</option>
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-
+-	<!-- 2D Interpolation -->
+-	<parameter key="Add/Remove 2D Interpolation" type="selector">
+-		<section name="Interpolations2D" />
+-
+-		<parameter key="%::algorithms" type="choice" template="true">
+-			<section name="Interpolations2D" />
+-			<option value="STD_PRESS" type="choice">
+-				<help>Generate a standard atmosphere pressure as a function of the cell's elevation</help>
+-			</option>
+-			<option value="CST" type="choice">
+-				<help>Fill the grid with the average over all the stations</help>
+-			</option>
+-			<option value="CST_LAPSE" type="choice">
+-			  <parameter key="%::cst_lapse" type="combination">
+-			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
+-			    <option value="" type="dropdown">
+-			      <option value="" type="string" />
+-			      <option value="soft" type="string" />
+-			      <option value="frac" type="string" />
+-			    </option>
+-			  </parameter>
+-			  <help>Detrend the measured data, fill the grid with the average over all the stations, reapply the elevation trend</help>
+-			</option>
+-			<option value="IDW" type="choice">
+-				<help>Inverse Distance Weighted average</help>
+-			</option>
+-			<option value="IDW_LAPSE" type="choice">
+-			  <parameter key="%::idw_lapse" type="combination">
+-			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
+-			    <option value="" type="dropdown">
+-			      <option value="" type="string" />
+-			      <option value="soft" type="string" />
+-			      <option value="frac" type="string" />
+-			    </option>
+-			  </parameter>
+-			  <help>Detrend the measured data, apply Inverse Distance Weighted average, reapply elevation trend</help>
+-			</option>
+-			<option value="LIDW_LAPSE" type="choice">
+-			  <parameter key="%::lidw_lapse" type="combination">
+-			    <option label="Lapse Rate:" value="0.008" type="decimal" optional="false" />
+-			    <option value="" type="dropdown">
+-			      <option value="" type="string" />
+-			      <option value="soft" type="string" />
+-			      <option value="frac" type="string" />
+-			    </option>
+-			  </parameter>
+-			  <help>Same as IDW_LAPSE, but only considering a given number of neighboring stations</help>
+-			</option>
+-			<option value="RH" type="choice">
+-				<help>Computes the dew point temperature, distribute it with IDW_LAPSE, recompute RH at each pixel</help>
+-			</option>
+-			<option value="ILWR" type="choice">
+-				<help>Compute emissivity, distribute it with IDW_LAPSE, recompute ILWR at each pixel</help>
+-			</option>
+-			<option value="WIND_CURV" type="choice">
+-				<help>Distribute wind velocity with IDW_LAPSE, then apply correction factors as a function of local slope and curvature</help>
+-			</option>
+-			<option value="HNW_SNOW" type="choice">
+-				<parameter key="%::hnw_snow" type="combination">
+-				<option value="IDW_LAPSE" type="dropdown">
+-					<option value="CST" type="string" />
+-					<option value="CST_LAPSE" type="string" />
+-					<option value="IDW" type="string" />
+-					<option value="IDW_LAPSE" type="string" />
+-					<option value="ODKRIG" type="string" />
+-				</option>
+-				<help>Base algorithm (do not forget to add the options for the base algorithm)</help>
+-				</parameter>
+-				<help>Distribute precipitation with a base algorithm (IDW_LAPSE by default), then reduce/remove precipitation on
+-				steep slopes and correct with the local curvature. This is to simulate snow redistribution processes.</help>
+-			</option>
+-			<option value="USER" type="choice">
+-			  <parameter key="%::user" type="path" optional="false"/>
+-			  <help>User provided grids, named as {numeric date}_{capitalized meteo parameter}.asc</help>
+-			</option>
+-			<option value="ODKRIG" type="choice">
+-			  <parameter key="%::odkrig" type="combination">
+-			  	<option value="" type="dropdown">
+-					<option value="LINVARIO" type="string" />
+-					<option value="EXPVARIO" type="string" />
+-					<option value="SPHERICVARIO" type="string" />
+-					<option value="RATQUADVARIO" type="string" />
+-				</option>
+-				<help>Variogram model</help>
+-			  </parameter>
+-			  <help>Ordinary kriging (EXPERIMENTAL)</help>
+-			</option>
+-		</parameter>
+-
+-		<reference name="METEOIOPARAMETERS" />
+-	</parameter>
+-</inishell_config>
+\ No newline at end of file
+Index: ../trunk-jpl/src/java/src/resources/icons/advancedsettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/mydocuments.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/readme.txt
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/icons/readme.txt	(revision 17982)
++++ ../trunk-jpl/src/java/src/resources/icons/readme.txt	(revision 17983)
+@@ -1,10 +0,0 @@
+-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+-This copyright and license notice covers the images in this directory.
+-************************************************************************
+-
+-TITLE:	Crystal Project Icons
+-AUTHOR:	Everaldo Coelho
+-SITE:	http://www.everaldo.com
+-CONTACT: everaldo@everaldo.com
+-
+-Copyright (c)  2006-2007  Everaldo Coelho.
+Index: ../trunk-jpl/src/java/src/resources/icons/kghostview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/file_ops.xcf
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/filesave.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/viewmag.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/ini_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/fileopen.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/xml_open.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/filesaveas.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/opensettings.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/icons/reset.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd	(revision 17982)
++++ ../trunk-jpl/src/java/src/resources/config_schema-0.1.1.xsd	(revision 17983)
+@@ -1,154 +0,0 @@
+-<?xml version="1.0"?>
+-<!-- 
+-*   
+-*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*    	
+-* -->
+-<xsd:schema version="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+-  <xsd:element name="inishell_config" type="general" />
+-  
+-  <xsd:complexType name="general">
+-    <xsd:choice maxOccurs="unbounded">
+-      <xsd:element name="parameter" type="parametertype" />
+-      <xsd:element name="parametergroup" type="pargroup" />
+-      <xsd:element name="include" type="pathonly" /> 
+-      <xsd:element name="frame" type="framegroup" /> 
+-    </xsd:choice>
+-    <xsd:attribute name="application" />
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="framegroup">
+-    <xsd:choice minOccurs="1" maxOccurs="unbounded">
+-      <xsd:element name="parameter" type="parametertype" />
+-      <xsd:element name="reference" type="nameonly" />
+-      <xsd:element name="section" type="nameonly"/>
+-    </xsd:choice>
+-    <xsd:attribute name="key" />
+-    <xsd:attribute name="label" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="parametertype">
+-    <xsd:complexContent>
+-      <xsd:extension base="parbasetype">
+-		<xsd:attribute name="key" type="xsd:string" use="required"/> 
+-		<xsd:attribute name="default" type="xsd:string" />
+-		<xsd:attribute name="counter" type="xsd:integer" />
+-      </xsd:extension>
+-    </xsd:complexContent>		
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="nameonly">
+-	<xsd:attribute name="name" />   
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="optionvalue">
+-	<xsd:attribute name="value" />   
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="pathonly">
+-	<xsd:attribute name="path" />   
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="pargroup">
+-	<xsd:choice minOccurs="1" maxOccurs="unbounded">
+-	  <xsd:element name="parameter" type="parametertype" />
+-	  <xsd:element name="reference" type="nameonly" />
+-	  <xsd:element name="option" type="optionvalue" />
+-	  <xsd:element name="frame" type="framegroup" /> 
+-	</xsd:choice>
+-	<xsd:attribute name="name" />
+-  </xsd:complexType>
+-
+-  <xsd:complexType name="parbasetype">
+-	<xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="section" type="nameonly"/>
+-	  </xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="replace" type="nameonly"/>
+-	  </xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="parameter" type="parametertype" />
+-	  </xsd:sequence>
+-	  <xsd:choice minOccurs="0" maxOccurs="unbounded">				
+-		<xsd:element name="option" minOccurs="0">
+-		  <xsd:complexType>
+-			<xsd:complexContent>
+-			  <xsd:extension base="parbasetype">
+-				<xsd:attribute name="value" type="xsd:string" use="required" />
+-				<xsd:attribute name="label" type="xsd:string" use="optional" />
+-				<xsd:attribute name="default" type="xsd:boolean" use="optional"/>
+-			  </xsd:extension>
+-			</xsd:complexContent>
+-		  </xsd:complexType>
+-		</xsd:element>
+-	  </xsd:choice>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="reference" type="nameonly" />
+-	  </xsd:sequence>
+-	  <xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-		<xsd:element name="help" type="helptype"/>	
+-	  </xsd:sequence>
+-	</xsd:sequence>
+-	
+-	<xsd:attribute name="type" use="required">
+-	  <xsd:simpleType>
+-		<xsd:restriction base="xsd:string">
+-		  <xsd:enumeration value="integer" />
+-		  <xsd:enumeration value="integer+" />
+-		  <xsd:enumeration value="decimal" />
+-		  <xsd:enumeration value="path" />
+-		  <xsd:enumeration value="file" />
+-		  <xsd:enumeration value="choice" />
+-		  <xsd:enumeration value="alternative" />
+-		  <xsd:enumeration value="dropdown" />
+-		  <xsd:enumeration value="string" />
+-		  <xsd:enumeration value="combination" />
+-		  <xsd:enumeration value="selector" />
+-		</xsd:restriction>
+-	  </xsd:simpleType>
+-	</xsd:attribute>
+-	
+-	<xsd:attribute name="maximum" type="xsd:integer"/>
+-	<xsd:attribute name="minimum" type="xsd:integer"/>
+-	<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
+-	<xsd:attribute name="optional" type="xsd:boolean" default="true" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="needstype">
+-	<xsd:attribute name="type" type="xsd:string" use="required" />
+-	<xsd:attribute name="name" type="xsd:string" use="required" />
+-	
+-	<xsd:attribute name="value" />
+-	<xsd:attribute name="optional" type="xsd:boolean" />
+-	<xsd:attribute name="minoccur" type="xsd:integer" />
+-	<xsd:attribute name="maxoccur" type="xsd:string" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="baseType">
+-	<xsd:sequence minOccurs="0" maxOccurs="1">
+-	  <xsd:element name="help" type="helptype" />		
+-	</xsd:sequence>
+-	<xsd:attribute name="key" type="xsd:string" use="required" />
+-  </xsd:complexType>
+-  
+-  <xsd:complexType name="helptype" mixed="true">
+-	<xsd:choice minOccurs="0" maxOccurs="unbounded">
+-	  <xsd:element name="section" type="nameonly" />
+-	  <xsd:element name="replace" type="nameonly" />
+-	</xsd:choice>
+-  </xsd:complexType> 
+-</xsd:schema>
+Index: ../trunk-jpl/src/java/src/resources/document-open-2.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/document-preview.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/document-export-4.png
+===================================================================
+Cannot display: file marked as a binary type.
+svn:mime-type = application/octet-stream
+Index: ../trunk-jpl/src/java/src/resources/config_schema.xsd
+===================================================================
+--- ../trunk-jpl/src/java/src/resources/config_schema.xsd	(revision 17982)
++++ ../trunk-jpl/src/java/src/resources/config_schema.xsd	(revision 17983)
+@@ -1,141 +0,0 @@
+-<?xml version="1.0"?>
+-<!-- 
+-*   
+-*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*    	
+-* -->
+-
+-<xsd:schema version="1.0"
+-xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+-
+-  <xsd:element name="inishell_config" type="general" />
+-  
+-	<xsd:complexType name="general">
+-      <xsd:choice maxOccurs="unbounded">
+-			<xsd:element name="parameter" type="parametertype" />
+-			<xsd:element name="parametergroup" type="pargroup" />
+-			<xsd:element name="include" type="pathonly" /> 
+-      </xsd:choice>
+-	  <xsd:attribute name="application" />
+-    </xsd:complexType>
+-	
+-	<xsd:complexType name="parametertype">
+-		<xsd:complexContent>
+-			<xsd:extension base="parbasetype">
+-				<xsd:attribute name="key" type="xsd:string" use="required"/> 
+-				<xsd:attribute name="default" type="xsd:string" />
+-				<xsd:attribute name="counter" type="xsd:integer" />
+-			</xsd:extension>
+-		</xsd:complexContent>		
+-	</xsd:complexType>
+-   
+-   <xsd:complexType name="nameonly">
+-		<xsd:attribute name="name" />   
+-   </xsd:complexType>
+-   
+-   <xsd:complexType name="pathonly">
+-		<xsd:attribute name="path" />   
+-   </xsd:complexType>
+-   
+-	<xsd:complexType name="pargroup">
+-		<xsd:choice minOccurs="1" maxOccurs="unbounded">
+-			<xsd:element name="parameter" type="parametertype" />
+-			<xsd:element name="reference" type="nameonly" />
+-		</xsd:choice>
+-		<xsd:attribute name="name" />
+-	</xsd:complexType>
+-  
+-	
+-	<xsd:complexType name="parbasetype">
+-		<xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="section" type="nameonly"/>
+-			</xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="replace" type="nameonly"/>
+-			</xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="parameter" type="parametertype" />
+-			</xsd:sequence>
+-			<xsd:choice minOccurs="0" maxOccurs="unbounded">				
+-				<xsd:element name="option" minOccurs="0">
+-					<xsd:complexType>
+-						<xsd:complexContent>
+-							<xsd:extension base="parbasetype">
+-								<xsd:attribute name="value" type="xsd:string" use="required" />
+-								<xsd:attribute name="label" type="xsd:string" use="optional" />
+-								<xsd:attribute name="default" type="xsd:boolean"/>
+-							</xsd:extension>
+-						</xsd:complexContent>
+-					</xsd:complexType>
+-				</xsd:element>
+-			</xsd:choice>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="reference" type="nameonly" />
+-			</xsd:sequence>
+-			<xsd:sequence minOccurs="0" maxOccurs="unbounded">
+-				<xsd:element name="help" type="helptype"/>	
+-			</xsd:sequence>
+-		</xsd:sequence>
+-		
+-		<xsd:attribute name="type" use="required">
+-		     <xsd:simpleType>
+-				<xsd:restriction base="xsd:string">
+-					<xsd:enumeration value="integer" />
+-					<xsd:enumeration value="integer+" />
+-					<xsd:enumeration value="decimal" />
+-					<xsd:enumeration value="path" />
+-					<xsd:enumeration value="file" />
+-					<xsd:enumeration value="choice" />
+-					<xsd:enumeration value="alternative" />
+-					<xsd:enumeration value="string" />
+-					<xsd:enumeration value="combination" />
+-					<xsd:enumeration value="selector" />
+-				</xsd:restriction>
+-			</xsd:simpleType>
+-		</xsd:attribute>
+-		
+-		<xsd:attribute name="maximum" type="xsd:integer"/>
+-		<xsd:attribute name="minimum" type="xsd:integer"/>
+-		<xsd:attribute name="template" type="xsd:boolean" default="false" use="optional" />
+-		<xsd:attribute name="optional" type="xsd:boolean" default="true" />
+-	</xsd:complexType>
+-	
+-	<xsd:complexType name="needstype">
+-		<xsd:attribute name="type" type="xsd:string" use="required" />
+-		<xsd:attribute name="name" type="xsd:string" use="required" />
+-	
+-		<xsd:attribute name="value" />
+-		<xsd:attribute name="optional" type="xsd:boolean" />
+-		<xsd:attribute name="minoccur" type="xsd:integer" />
+-		<xsd:attribute name="maxoccur" type="xsd:string" />
+-	</xsd:complexType>
+-	
+-	<xsd:complexType name="baseType">
+-		<xsd:sequence minOccurs="0" maxOccurs="1">
+-			<xsd:element name="help" type="helptype" />		
+-		</xsd:sequence>
+-		<xsd:attribute name="key" type="xsd:string" use="required" />
+-	</xsd:complexType>
+-	
+-	<xsd:complexType name="helptype" mixed="true">
+-		<xsd:choice minOccurs="0" maxOccurs="unbounded">
+-			<xsd:element name="section" type="nameonly" />
+-			<xsd:element name="replace" type="nameonly" />
+-		</xsd:choice>
+-	</xsd:complexType>
+-	
+-</xsd:schema>
+Index: ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/CombinedPanel.java	(revision 17983)
+@@ -1,267 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.event.ItemEvent;
+-import java.text.NumberFormat;
+-import java.util.*;
+-import java.text.DecimalFormat;
+-import java.text.DecimalFormatSymbols;
+-
+-import javax.swing.JCheckBox;
+-import javax.swing.JComponent;
+-import javax.swing.JFormattedTextField;
+-import javax.swing.JTextField;
+-import javax.swing.JLabel;
+-import javax.swing.JComboBox;
+-
+-import main.XMLHelper;
+-
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-import org.w3c.dom.NodeList;
+-import net.miginfocom.swing.MigLayout;
+-
+-/**
+- * @brief The CombinedPanel may contain other panels, such as check and drop down boxes and text fields
+- *
+- * @author Thomas Egger
+- */
+-public class CombinedPanel extends OptionPanel {
+-	enum Type { CHOICE, INTEGER, DECIMAL, STRING, DROPDOWN }
+-
+-	/**
+-	 *
+-	 */
+-	private static final long serialVersionUID = -6751282938445852408L;;
+-
+-	private final LinkedList<JComponent> valueComponents;
+-
+-	/**
+-	 * Constructor for a panel that can hold text, numbers and check boxes. It
+-	 * corresponds to the parameter type "combination" in the configuration file
+-	 * and its subcomponents correspond to the option values.
+-	 *
+-	 * @param element
+-	 * @throws GUIBuildException
+-	 */
+-	public CombinedPanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		super(element, parent, false); //doing layout by itself
+-
+-		//System.out.println("Hierarchy: Parent: " + parent.getKey() + ": "+ parent.getHierarchy() + "  own: " + getHierarchy());
+-
+-		int column1 = 200;
+-		column1 -= getHierarchy() * 5;
+-		this.setLayout(new MigLayout("gapx 6, wrap 8, ins n 5 n n", "["+column1+"!][78!][78!][78!][78!][78!][78!][20!][200:400:400]", ""));
+-
+-		this.add(jlabel, "gapleft " + getHierarchy() * 5);
+-		this.add(help, "cell 8 0, wrap");
+-
+-		valueComponents = new LinkedList<JComponent>();
+-
+-		final Element[] optionElements = XMLHelper.getElementArray(element, "option");
+-
+-		byte lblcounter = 0;
+-
+-		DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
+-		DecimalFormatSymbols custom = new DecimalFormatSymbols();
+-		custom.setDecimalSeparator('.');
+-		format.setDecimalFormatSymbols(custom);
+-		format.setGroupingUsed(false);
+-
+-		DecimalFormat integerFormat = (DecimalFormat)DecimalFormat.getIntegerInstance();
+-		integerFormat.setGroupingUsed(false);
+-
+-		int row = 0;
+-		int column = 1;
+-		
+-		for (int i=0;i<optionElements.length;i++) {
+-			final Type optionType = Type.valueOf(optionElements[i].getAttribute("type").toUpperCase());
+-			final String initialValue = optionElements[i].getAttribute("value");
+-			final String label = optionElements[i].getAttribute("label");
+-
+-			JComponent component = null;
+-			JLabel lblcomponent  = null;
+-
+-			NodeList nodelist = optionElements[i].getChildNodes();
+-
+-			switch (optionType) {
+-			case INTEGER:
+-				component = new JFormattedTextField(integerFormat);
+-				((JFormattedTextField)component).setColumns(8);
+-				if ((initialValue != null) && (!initialValue.equals("")))
+-					((JFormattedTextField)component).setValue(new Integer(initialValue));
+-				break;
+-			case DECIMAL:
+-				component = new JFormattedTextField(format);
+-				((JFormattedTextField)component).setColumns(8);
+-				if ((initialValue != null) && (!initialValue.equals("")))
+-					((JFormattedTextField)component).setValue((new Double(initialValue)));
+-				break;
+-			case STRING:
+-				component = new JTextField(10);
+-				((JTextField)component).setText(initialValue);
+-				break;
+-			case CHOICE:
+-				component = new JCheckBox(optionElements[i].getAttribute("value"));
+-				((JCheckBox)component).addItemListener(this);
+-				break;
+-			case DROPDOWN:
+-				component = new JComboBox();
+-
+-				for (int jj = 0; jj < nodelist.getLength(); jj++) {
+-					if (nodelist.item(jj).getNodeType() == Node.ELEMENT_NODE) {
+-						((JComboBox)component).addItem(((Element)nodelist.item(jj)).getAttribute("value"));
+-					}
+-				}
+-
+-				((JComboBox)component).setSelectedItem(optionElements[i].getAttribute("value"));
+-				((JComboBox)component).addItemListener(this);
+-				break;
+-			}
+-			
+-			int width = 1;
+-
+-			if ((label != null) && (!label.equals(""))){
+-				if (label.length() > 12) width = 2; //for oversize labels
+-
+-				if (column+width >= 7) { 
+-					column = 1; 
+-					row++; 
+-				}
+-				lblcomponent = new JLabel(label);
+-				valueComponents.add(lblcomponent);
+-				
+-				//System.out.println("component: " + component.getClass() + ");
+-				//System.out.println("component: " + lblcomponent.getClass() + "  size: " + lblcomponent.getWidth() + "  col: " + column + " row: " + row);
+-				this.add(lblcomponent, "cell " + column + " " + row + " " + width + " 1");
+-				column += width;
+-				width = 1;
+-				lblcomponent.setVisible(true);
+-			}
+-
+-			if (column >= 7) { 
+-				column = 1; 
+-				row++; 
+-			}
+-			//System.out.println("component: " + component.getClass() + "  size: " + component.getWidth() + "  col: " + column + " row: " + row);
+-			this.add(component, "cell " + column + " " + row + " " + width + " 1");
+-			column++;
+-
+-			valueComponents.add(component);
+-			component.setVisible(true);
+-		}
+-		
+-		//System.out.println("\t-->Instantiated one Combined Panel with " + optionElements.length + " components");
+-	}
+-
+-	@Override
+-	public void close() {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String inkey, String invalue) {
+-		if (!hm.containsKey(hashKey)) return;
+-		String val = (String)hm.get(hashKey);
+-
+-		//System.out.println("\tSetting CombinedPanel: " + hashKey + " = " + val);
+-		//System.out.println("\tThis CombinedPanel has the key: " + this.getKey() + "  should be: " + inkey + " val: " + invalue);
+-
+-		//Now loop through valueComponents and see if the value string can be matched
+-		if (val == null) return;
+-
+-		String[] tokens = val.split("\\s+");
+-		int counter = 0;
+-
+-		//System.out.println("\t\tLooking at VAL param: " + val);
+-		for (final JComponent comp : valueComponents) {
+-			boolean digested = false;
+-			if (tokens.length <= counter) break;
+-			//System.out.println("\t\tLooking at USER param: " + tokens[counter]);
+-
+-			if (comp.getClass() == JCheckBox.class) {
+-				String cbString = ((JCheckBox) comp).getText();
+-				if (tokens[counter].equals(cbString)) {
+-					((JCheckBox) comp).setSelected(true);
+-					digested = true;
+-				}
+-			} else if (comp.getClass() == JComboBox.class) {
+-				JComboBox box = (JComboBox) comp;
+-
+-				for (int ii=0; ii<box.getItemCount(); ii++) {
+-					String itemString = (String) box.getItemAt(ii);
+-					if (itemString.equals(tokens[counter])) {
+-						box.setSelectedIndex(ii);
+-						digested = true;
+-					}
+-				}
+-			} else if (comp.getClass() == JTextField.class) {
+-				((JTextField) comp).setText(tokens[counter]);
+-				digested = true;
+-			} else if (comp.getClass() == JFormattedTextField.class) {
+-				((JFormattedTextField) comp).setText(tokens[counter]);
+-				digested = true;
+-			}
+-
+-			if ((comp.getClass() != JLabel.class) && (digested))
+-				counter++;
+-		}
+-	}
+-
+-	@Override
+-	public String getValue() {
+-		String value = "";
+-
+-		for (final JComponent comp : valueComponents) {
+-			if (comp.getClass() == JTextField.class) {
+-				value += ((JTextField) comp).getText();
+-			} else if (comp.getClass() == JFormattedTextField.class) {
+-				value += ((JFormattedTextField) comp).getText();
+-			} else if (comp.getClass() == JCheckBox.class) {
+-				if (((JCheckBox) comp).isSelected())
+-					value += ((JCheckBox) comp).getText();
+-			} else if (comp.getClass() == JComboBox.class) {
+-				value += ((String)((JComboBox)comp).getSelectedItem());
+-			}
+-
+-			if (value.length() > 0)
+-				value += " ";
+-		}
+-
+-		if (value.equals("")) return null;
+-		else	return value;
+-	}
+-
+-	@Override
+-	public void itemStateChanged(ItemEvent arg0) {
+-		String selectedOption = null;
+-
+-		if (arg0.getItemSelectable().getClass() == JCheckBox.class) {
+-			selectedOption = ((JCheckBox) arg0.getItemSelectable()).getText();
+-			super.handleItemEvent(arg0, selectedOption);
+-		} else if (arg0.getItemSelectable().getClass() == JComboBox.class) {
+-			selectedOption = ((String)((JComboBox)arg0.getItemSelectable()).getSelectedItem());
+-			//HACK: should call super...
+-		}
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/SelectorPanel.java	(revision 17983)
+@@ -1,233 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+- *
+- *   INIshell 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 3 of the License, or
+- *   (at your option) any later version.
+- *
+- *   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+- *
+- */
+-
+-package gui_elements;
+-
+-import java.awt.event.ActionEvent;
+-import java.awt.event.ActionListener;
+-
+-import javax.swing.JButton;
+-import javax.swing.JOptionPane;
+-
+-
+-import main.GUIBuilder;
+-import main.XMLHelper;
+-
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-import org.w3c.dom.NodeList;
+-
+-import java.util.List;
+-import java.util.ArrayList;
+-import java.util.HashMap;
+-
+-/**
+- * This class introduces more flexibility into the inishell interface:
+- * The SelectorPanel offers the user to add a specific parameter to
+- * the interface.
+- *
+- * @author Thomas Egger
+- */
+-public class SelectorPanel extends ControlledPanel implements ActionListener {
+-
+-	private static final long serialVersionUID = 8610877538909126920L;
+-
+-	String[] parameters;
+-
+-	JButton addButton;
+-	JButton removeButton;
+-	Element template;
+-	String  templateKey;
+-	HashMap<String, ControlledPanel> mapOfParameters;
+-	ControlledPanel cp = null;
+-
+-	public SelectorPanel(Element element, ControlledPanel parent) {
+-		super(element, parent);
+-		templateKey = ""; //will store the pattern of the key
+-
+-		addButton = new JButton("+");
+-		this.add(addButton, "cell 1 0, split 2, grow");
+-		addButton.addActionListener(this);
+-
+-		removeButton = new JButton("-");
+-		this.add(removeButton, "cell 1 0, grow, wrap");
+-		removeButton.addActionListener(this);
+-
+-		//The following lines try to extract the template key (e.g. %::filters#, %::resample, COPY::%)
+-		final NodeList nodelist = element.getChildNodes();
+-		for (int ii = 0; ii < nodelist.getLength(); ii++) {
+-			if (nodelist.item(ii).getNodeType() == Node.ELEMENT_NODE) {
+-				Element currentElement = (Element)nodelist.item(ii);
+-				if (currentElement.getAttribute("template").equals("true")){
+-					template = (Element)currentElement.cloneNode(true);
+-					templateKey = template.getAttribute("key");
+-					template.setAttribute("template", "false");
+-				}
+-			}
+-		}
+-
+-		final Element[] options = XMLHelper.getElementArray(element, "option");
+-		parameters = new String[options.length + 1];
+-		for (int ii=0; ii < options.length; ii++) {
+-			parameters[ii] = options[ii].getAttribute("value");
+-		}
+-		parameters[options.length] = "Other...";
+-
+-		key = templateKey; //IMPORTANT: this changes the key only, not the label!
+-		hashKey = this.getSection().toUpperCase() + "::" + this.getKey().toUpperCase();
+-		mapOfParameters  = new HashMap<String, ControlledPanel>();
+-	}
+-
+-	@Override
+-	public void actionPerformed(ActionEvent arg0) {
+-		if (arg0.getSource() == addButton) {
+-			add();
+-		} else if (arg0.getSource() == removeButton) {
+-			remove();
+-		}
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String key, String value) {
+-		//HACK
+-		//System.out.println("\tKEY: " + key + "  VAL: " + value);
+-
+-		String myKey = this.section.toUpperCase() + "::" + templateKey.toUpperCase().replace("%","([a-zA-Z0-9_]+)");
+-		myKey = myKey.replace("#","[1-9]+[0-9]*"); //all integer numbers from 1 to infinity
+-		//System.out.println("PATTERN: " + myKey);
+-		String myKey2 = key.replaceAll(myKey, "$1");
+-		String myKey3 = key.replaceAll(myKey, "$0");
+-
+-		//System.out.println("HUHUI: " + templateKey + " --- " + myKey2 + " -- " + myKey3);
+-
+-		boolean toAdd = true;
+-		if (mapOfParameters.get(myKey2) != null) toAdd = false; //Parameter already exists
+-
+-		if (toAdd) {
+-			ControlledPanel child = add(myKey2, true, hm, key, value);
+-			cp = child;
+-			if (child != null) child.set(hm, key, value);
+-		} else {
+-			if (cp != null) cp.set(hm, key, value);
+-		}
+-	}
+-
+-	public void add() {
+-		String param = "";
+-		String choice = "Other...";
+-
+-		if (parameters.length > 1)
+-			choice = (String)JOptionPane.showInputDialog(this, "Add a parameter", "Add", JOptionPane.QUESTION_MESSAGE, null, parameters, null);
+-
+-		if (choice == null) return;
+-
+-		if (choice.equals("Other...")) {
+-			param = JOptionPane.showInputDialog(this, "Enter the name of a meteo parameter\n(e.g. VW_AVG, P2");
+-		} else {
+-			param = choice;
+-		}
+-
+-		add(param, false, null, null, null);
+-	}
+-
+-	public ControlledPanel add(String param, boolean doSet, HashMap hm, String key, String value) {
+-		//System.out.println("Trying to add SelectorPanel: " + key + " ... " + value);
+-
+-		if ((param == null) || (param.length() == 0)) return null;
+-		param = param.toUpperCase();
+-
+-		if (mapOfParameters.get(param) != null) return null; //Parameter already exists
+-
+-		Element child = (Element)template.cloneNode(true);
+-		recursiveKeyReplace(child, param);
+-		element.appendChild(child);
+-
+-		ControlledPanel childPanel = null;
+-		try {
+-			childPanel = ControlledPanel.createSingleParameterPanel(child, this);
+-			childPanel.setKey(childPanel.getKey());
+-			GUIBuilder.gui.addToTab(childPanel, section, this);
+-			childPanel.hold();
+-			GUIBuilder.control(childPanel);
+-			GUIBuilder.recursiveBuild(child, this, doSet, hm, key, value);
+-
+-			mapOfParameters.put(param, childPanel);
+-		} catch (final GUIBuildException e1) {
+-			e1.printStackTrace();
+-		}
+-
+-		this.invalidate();
+-
+-		return childPanel;
+-	}
+-
+-	@Override
+-	public void close() {
+-
+-	}
+-
+-	@Override
+-	public String getValue() {
+-		return null;
+-	}
+-
+-	public void remove() {
+-		if (mapOfParameters.size() == 0) return;
+-
+-		String choice = (String)JOptionPane.showInputDialog(this, "Remove a parameter", "Remove", JOptionPane.QUESTION_MESSAGE, null, mapOfParameters.keySet().toArray(), null);
+-
+-		if (choice == null) return; //nothing to do
+-
+-		String childKey = templateKey.replaceAll("%", choice);
+-		final Element child = XMLHelper.getCertainChildElement(element, "parameter", "key", childKey);
+-
+-		if (child == null) return;
+-
+-		try { //this makes sure that all child nodes are destroyed
+-			GUIBuilder.recursiveDestruct(child, this);
+-			element.removeChild(child);
+-			final ControlledPanel childPanel = GUIBuilder.panelControl.get(section, childKey);
+-
+-			childPanel.release();
+-			childPanel.close();
+-
+-			if (!childPanel.isNeeded())
+-				GUIBuilder.gui.removeFromTab(childPanel, section, this);
+-
+-			mapOfParameters.remove(choice);
+-		} catch (final GUIBuildException e) {
+-			e.printStackTrace();
+-		}
+-
+-		this.invalidate();
+-	}
+-
+-	private void recursiveKeyReplace(Element element, String string) {
+-		if (element.hasAttribute("key"))
+-			element.setAttribute("key", element.getAttribute("key").replaceAll("%", string));
+-
+-		final NodeList nodelist = element.getChildNodes();
+-		for (int i = 0; i < nodelist.getLength(); i++) {
+-			if (nodelist.item(i).getNodeType() == Node.ELEMENT_NODE) {
+-				recursiveKeyReplace(((Element) nodelist.item(i)), string);
+-			}
+-		}
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/GUIBuildException.java	(revision 17983)
+@@ -1,33 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-public class GUIBuildException extends Exception {
+-
+-	/**
+-	 *
+-	 */
+-	private static final long serialVersionUID = 1L;
+-
+-	public GUIBuildException(String message) {
+-		super(message);
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/ControlledPanel.java	(revision 17983)
+@@ -1,285 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.Color;
+-import java.awt.Component;
+-import java.awt.Font;
+-
+-import javax.swing.JEditorPane;
+-import javax.swing.JLabel;
+-import javax.swing.JPanel;
+-import javax.swing.JSeparator;
+-import javax.swing.*;
+-import java.util.HashMap;
+-import javax.swing.border.*;
+-
+-import main.GUI;
+-import main.GUIBuilder;
+-import main.XMLHelper;
+-import net.miginfocom.swing.MigLayout;
+-
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-
+-/**
+- * Abstract class for JPanels that are maintained with their key and designated
+- * section and can return their current value.
+- */
+-public abstract class ControlledPanel extends JPanel {
+-
+-	private static final long serialVersionUID = 1L;
+-
+-	private int dependencies;
+-
+-	protected JLabel jlabel;
+-
+-	protected String section;
+-	protected String key;
+-	protected String label;
+-	protected String hashKey;
+-
+-	protected Element element;
+-
+-	protected boolean optional;
+-	protected String replace;
+-
+-	protected int hierarchy;
+-	protected String helptext;
+-	protected JEditorPane help;
+-
+-	/**
+-	 * Constructor for a controlled panel.
+-	 *
+-	 * @param element
+-	 */
+-	public ControlledPanel(Element element, ControlledPanel parent) {
+-		this(element, parent, true);
+-	}
+-
+-	public ControlledPanel(Element element, ControlledPanel parent, boolean doLayout) {
+-		super();
+-		initialize(element, parent);
+-
+-		if (doLayout) {
+-			int column1 = 200;
+-			column1 -= getHierarchy() * 5; //Indentation for the label, 5px per hierarchy level
+-
+-			setLayout(new MigLayout("gapx 6, wrap 8, top, ins n 5 n n", "["+ column1 + "!][100!][100!][100!][100!][100!][300:400:400]", ""));
+-			add(jlabel, "growx, ay top, gaptop 5, gapleft " + getHierarchy() * 5);
+-			add(help, "cell 6 0, wrap");
+-		}
+-	}
+-
+-	private void initialize(Element element, ControlledPanel parent) {
+-		dependencies = 0;
+-
+-		this.element = element;
+-		this.key = element.getAttribute("key");
+-		this.label = this.key;
+-
+-		this.section = element.getAttribute("section");
+-		this.hashKey = this.section.toUpperCase() + "::" + this.key.toUpperCase();
+-		this.optional = element.getAttribute("optional").equals("true");
+-
+-		jlabel = new JLabel(this.label + ":      ");
+-		jlabel.setForeground(GUI.LABEL_COLOR);
+-
+-		this.setBackground(Color.white);
+-		this.setVisible(true);
+-
+-		/* Add help to the right side of the panel. */
+-		helptext = XMLHelper.getChildElementContent(element, "help");
+-		help = ControlledPanel.createHelpPane("<html>"+helptext+"</html>");
+-		if (helptext != null) help.setText(helptext);		
+-
+-		if (parent != null) {
+-			setHierarchy(parent.getHierarchy() + 1);
+-		} else {
+-			setHierarchy(0);
+-		}
+-	}
+-
+-	/**
+-	 * Creates a ControlledPanel for a parameter that matches its type. (i.e.
+-	 * radio buttons for an option parameter, ...
+-	 *
+-	 * @param element
+-	 * @return the Controlled Panel
+-	 * @throws GUIBuildException
+-	 */
+-	public static ControlledPanel createSingleParameterPanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		ControlledPanel panel;
+-
+-		//System.out.println("IN create: " + XMLHelper.getString((Node)element));
+-
+-		if (element.hasAttribute("counter")) {
+-			panel = new DuplicatorPanel(element, parent);
+-		} else if (element.getTagName().equals("frame")) {
+-			panel = new FramePanel(element, parent);
+-		} else if (element.getAttribute("type").equals("path")	|| element.getAttribute("type").equals("file")) {
+-			panel = new PathPanel(element, parent);
+-		} else if (element.getAttribute("type").equals("alternative") || element.getAttribute("type").equals("logical")) {
+-			panel = new AlternativePanel(element, parent);
+-		} else if (element.getAttribute("type").equals("choice")) {
+-			panel = new CheckBoxPanel(element, parent);
+-		} else if (element.getAttribute("type").equals("integer") || element.getAttribute("type").equals("integer+")){
+-			panel = new IntegerPanel(element, parent);
+-		} else if (element.getAttribute("type").equals("decimal")) {
+-			panel = new DecimalPanel(element, parent);
+-		} else if (element.getAttribute("type").equals("double")) {
+-			panel = new TextfieldPanel(element, parent);
+-		} else if (element.getAttribute("type").equals("string") || element.getAttribute("type").equals("char") || element.getAttribute("type").equals("cell")){
+-			panel = new TextfieldPanel(element, parent);
+-		} else if (element.getAttribute("type").equals("combination")) {
+-			panel = new CombinedPanel(element, parent);
+-		} else if (element.getAttribute("type").equals("selector")) {
+-			panel = new SelectorPanel(element, parent);
+-		} else {
+-			throw new GUIBuildException("Cannot create a GUI panel for a parameter of type " + element.getAttribute("type"));
+-		}
+-
+-		return panel;
+-	}
+-
+-	public static JEditorPane createHelpPane(String helptext){
+-		JEditorPane help = new JEditorPane();
+-		help.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
+-		help.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
+-		help.setEditable(false);
+-		help.setContentType("text/html");
+-		help.setForeground(Color.GRAY);
+-		help.addHyperlinkListener(GUIBuilder.gui);
+-
+-		if (helptext!=null) {
+-			help.setText("<html>"+helptext+"</html>");
+-		} else {
+-			help.setText("<html></html>");
+-		}
+-
+-		return help;
+-	}
+-
+-	public void setHierarchy(int val) {
+-		hierarchy = val;		
+-	}
+-
+-	public int getHierarchy() {
+-		return hierarchy;
+-	}
+-
+-	/**
+-	 * This method should be called when the panel is removed.
+-	 */
+-	public abstract void close();
+-
+-	/**
+-	 * @return the GUI component.
+-	 */
+-	public Component getComponent() {
+-		return this;
+-	}
+-
+-	/**
+-	 * @return the number of dependencies on the panel.
+-	 */
+-	public int getDependencies() {
+-		return dependencies;
+-	}
+-
+-	/**
+-	 * @return the key of the corresponding key / value set
+-	 */
+-	public String getKey() {
+-		return key;
+-	}
+-
+-	/**
+-	 * @return the current value of the key / value set null if the key value
+-	 *         set should not be printed
+-	 */
+-	public abstract String getValue();
+-
+-	/**
+-	 * This method should be called when another panel depends needs this panel
+-	 * to exist.
+-	 */
+-	public synchronized void hold() {
+-		this.dependencies++;
+-	}
+-
+-	/**
+-	 * @return true if dependencies on this panel exist
+-	 * @throws GUIBuildException
+-	 */
+-	public synchronized boolean isNeeded() throws GUIBuildException {
+-		if (dependencies == 0) {
+-			return false;
+-		} else if (dependencies > 0) {
+-			return true;
+-		} else {
+-			throw new GUIBuildException("Inplausible number of dependencies on panel");
+-		}
+-	}
+-
+-	/**
+-	 * @return true if a value for the underlying parameter is optional
+-	 */
+-	public boolean isOptional() {
+-		return optional;
+-	}
+-
+-	/**
+-	 * This method should be called when a panel no longer needs this panel to
+-	 * exist. The panel will be removed if no dependency exists.
+-	 */
+-	public synchronized void release() {
+-		this.dependencies--;
+-	}
+-
+-	public void set(HashMap hm, String key, String value) {
+-		System.out.println("Set not implemented for ControlledPanel: " + serialVersionUID);
+-	}
+-
+-	public String getHashKey() {
+-		return hashKey;
+-	}
+-
+-	/**
+-	 * This method sets a new key for a panel and changes its label.
+-	 *
+-	 * @param key
+-	 *            the new key
+-	 */
+-	public void setKey(String key) {
+-		this.key = key;
+-		element.setAttribute("key", key);
+-		jlabel.setText(this.label + ":      ");
+-	}
+-
+-	/**
+-	 * Getter method for the section.
+-	 * @return the section
+-	 */
+-	public String getSection() {
+-		return section;
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/CheckBoxPanel.java	(revision 17983)
+@@ -1,139 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import main.*;
+-
+-import java.awt.Color;
+-import java.awt.event.ItemEvent;
+-import java.util.HashMap;
+-
+-import javax.swing.JCheckBox;
+-import javax.swing.JOptionPane;
+-import javax.swing.JLabel;
+-
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-
+-public class CheckBoxPanel extends OptionPanel {
+-
+-	private static final long serialVersionUID = 552186457208697362L;
+-	private final JCheckBox[] boxes;
+-	String concat;
+-	private String setKey = null, setValue = null;
+-	private boolean doSet = false;
+-	private HashMap setMap;
+-
+-
+-	/**
+-	 * Constructor for a panel that can hold a number of checkboxes to compose
+-	 * the value for a key/value set.
+-	 *
+-	 * @param element
+-	 * @throws GUIBuildException
+-	 */
+-	public CheckBoxPanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		super(element, parent);
+-
+-		concat = "";
+-		boxes = new JCheckBox[values.length];
+-		for (int i = 0; i < values.length; i++) {
+-			boxes[i] = new JCheckBox(values[i]);
+-
+-			this.add(boxes[i], "cell 1 " + i + ", wrap, ay top");
+-
+-			String extra = "";
+-			if (i > 0)
+-				extra = ", gapleft 12";
+-
+-			this.add(ControlledPanel.createHelpPane(this.helptexts[i]), "cell 6 "+ i +", width 200:400:400, wrap" + extra);
+-
+-			boxes[i].setBackground(Color.white);
+-			boxes[i].setVisible(true);
+-			boxes[i].addItemListener(this);
+-			if (defaultTrues.contains(values[i])) {
+-				boxes[i].setSelected(true);
+-				concat += values[i] + " ";
+-			}
+-		}
+-	}
+-
+-	@Override
+-	public void close() {
+-		for (final JCheckBox box : boxes)
+-			box.setSelected(false);
+-	}
+-
+-	@Override
+-	public String getValue() {
+-		if (!isOptional() && concat.equals("")) {
+-			JOptionPane.showMessageDialog(null, "No option was selected for "
+-									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
+-									+ ".\nA value is required. Your .ini-file is probably incorrect.",
+-									"Problem when building .ini file",
+-									JOptionPane.WARNING_MESSAGE);
+-		}
+-
+-		if (concat.equals("")) return null;
+-		else	return concat.trim();
+-	}
+-
+-	public synchronized void set(HashMap hm, String key, String value) {
+-		String val = ((String)hm.get(hashKey)).toUpperCase();
+-		//System.out.println("\tABOUT TO CHANGE CHECKBOXPANEL KEY: " + key + "  VAL: " + val);
+-
+-		String[] tokens = val.split("\\s+");
+-		for (final JCheckBox box : boxes) {
+-			box.setSelected(false);
+-			
+-			for (final String token : tokens) {
+-				if (token.equals(box.getText())) {
+-					//System.out.println("\t\tSelecting Checkbox: " + token);
+-					doSet = true;
+-					setKey = key;
+-					setValue = value;
+-					setMap = hm;
+-					box.setSelected(true);
+-				}
+-			}
+-		}
+-	}
+-
+-
+-	@Override
+-	public synchronized void itemStateChanged(ItemEvent arg0) {
+-		final String selectedOption = ((JCheckBox) arg0.getItemSelectable()).getText();
+-
+-		if (arg0.getStateChange() == ItemEvent.SELECTED) {
+-			concat += selectedOption + " ";
+-		} else {
+-			concat = concat.replaceAll(new String(" " + selectedOption + " "), " ");
+-			concat = concat.replaceFirst(new String("^" + selectedOption + " "), ""); //at the beginning of the concat
+-		}
+-
+-		//super.handleItemEvent(arg0, selectedOption);
+-		super.handleItemEvent(arg0, selectedOption, doSet, setMap, setKey, setValue);
+-		doSet = false;
+-		setKey = null;
+-		setMap = null;
+-		setValue = null;
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/DuplicatorPanel.java	(revision 17983)
+@@ -1,175 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.event.ActionEvent;
+-import java.awt.event.ActionListener;
+-import java.util.*;
+-
+-import javax.swing.JButton;
+-
+-import main.GUIBuilder;
+-import main.XMLHelper;
+-
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-import org.w3c.dom.NodeList;
+-
+-public class DuplicatorPanel extends ControlledPanel implements ActionListener {
+-
+-	/**
+-	 *
+-	 */
+-	private static final long serialVersionUID = 6801877538909126920L;
+-	JButton addButton;
+-	Element clone;
+-
+-	JButton removeButton;
+-
+-	public DuplicatorPanel(Element element, ControlledPanel parent) {
+-		super(element, parent);
+-
+-		addButton = new JButton("+");
+-		this.add(addButton, "cell 1 0, split 2, grow");
+-		addButton.addActionListener(this);
+-
+-		removeButton = new JButton("-");
+-		this.add(removeButton, "cell 1 0, grow, wrap");
+-		removeButton.addActionListener(this);
+-
+-		clone = (Element) element.cloneNode(true);
+-		clone.removeAttribute("counter");
+-		clone.setAttribute("counted", "true");
+-	}
+-
+-	@Override
+-	public void actionPerformed(ActionEvent arg0) {
+-		if (arg0.getSource() == addButton) {
+-			add();
+-		} else if (arg0.getSource() == removeButton) {
+-			remove();
+-		}
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String key, String value) {
+-		//System.out.println("Trying to add DUPLICATOR Panel: " + key + " ... " + value + "  HashKey: " + this.getHashKey());
+-
+-		if (key.indexOf('#') == -1) {
+-			ControlledPanel child = add(true, hm, key, value);
+-			child.set(hm, key, value);
+-		}
+-	}
+-
+-	public ControlledPanel add() {
+-		return add(false, null, null, null);
+-	}
+-
+-	public ControlledPanel add(boolean doSet, HashMap hm, String key, String value) {
+-
+-		final Element child = (Element) this.clone.cloneNode(true);
+-		final int counter = Integer.parseInt(element.getAttribute("counter"));
+-		element.setAttribute("counter", (counter + 1) + "");
+-
+-		// child.setAttribute("key",element.getAttribute("key").replaceAll("#",counter+""));
+-
+-		//System.out.println("\t-->Adding a child panel to DUPLICATOR with key: " + key + "  val: " + value + "  HASH: " + this.getHashKey() + "  hier: " + this.getHierarchy());
+-
+-		recursiveKeyReplace(child, counter + "");
+-		element.appendChild(child);
+-
+-		ControlledPanel childPanel = null;
+-		try {
+-			childPanel = ControlledPanel.createSingleParameterPanel(child, this);
+-			childPanel.setKey(childPanel.getKey());
+-			GUIBuilder.gui.addToTab(childPanel, section, this);
+-			childPanel.hold();
+-			GUIBuilder.control(childPanel);
+-			GUIBuilder.recursiveBuild(child, this, doSet, hm, key, value);
+-
+-		} catch (final GUIBuildException e1) {
+-			// TODO Auto-generated catch block
+-			e1.printStackTrace();
+-		}
+-
+-		this.invalidate();
+-		
+-		return childPanel;
+-	}
+-
+-	@Override
+-	public void close() {
+-		boolean doRemove = true;
+-
+-		do {
+-			doRemove = remove();
+-		} while (doRemove);
+-	}
+-
+-	@Override
+-	public String getValue() {
+-		return null;
+-	}
+-
+-	public boolean remove() {
+-		final int counter = Integer.parseInt(element.getAttribute("counter")) - 1;
+-		final String childKey = element.getAttribute("key").replace("#", counter + "");
+-		final Element child = XMLHelper.getCertainChildElement(element, "parameter", "key", childKey);
+-
+-		if (child == null) return false;
+-
+-		element.removeChild(child);
+-		element.setAttribute("counter", (counter) + "");
+-
+-		final ControlledPanel childPanel = GUIBuilder.panelControl.get(section, childKey);
+-
+-		if (childPanel != null) {
+-			childPanel.release();
+-			childPanel.close();
+-
+-			try {
+-				if (!childPanel.isNeeded()) {
+-					GUIBuilder.gui.removeFromTab(childPanel, section, this);
+-				}
+-			} catch (final GUIBuildException e) {
+-				// TODO Auto-generated catch block
+-				e.printStackTrace();
+-			}
+-		}
+-
+-		this.invalidate();
+-
+-		return true;
+-	}
+-
+-	private void recursiveKeyReplace(Element element, String string) {
+-		if (element.hasAttribute("key")) {
+-			element.setAttribute("key", element.getAttribute("key").replaceAll("#", string));
+-		}
+-		final NodeList nodelist = element.getChildNodes();
+-		for (int i = 0; i < nodelist.getLength(); i++) {
+-			if (nodelist.item(i).getNodeType() == Node.ELEMENT_NODE) {
+-				recursiveKeyReplace(((Element) nodelist.item(i)), string);
+-			}
+-		}
+-	}
+-
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/OptionPanel.java	(revision 17983)
+@@ -1,144 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.event.ItemEvent;
+-import java.awt.event.ItemListener;
+-import java.util.LinkedList;
+-import java.util.HashMap;
+-import javax.swing.event.EventListenerList;
+-
+-import main.GUIBuilder;
+-import main.XMLHelper;
+-
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-
+-/**
+- * A ControlledPanel that maintains a group of choices and invokes panel
+- * creation according to the current choices.
+- *
+- * @author korhammer et egger
+- *
+- */
+-public abstract class OptionPanel extends ControlledPanel implements ItemListener {
+-
+-	private static final long serialVersionUID = 88L;
+-
+-	protected LinkedList<String> defaultTrues;
+-	protected EventListenerList listenerList;
+-
+-	protected String[] values;
+-	protected String[] labels;
+-	protected String[] helptexts;
+-
+-	/**
+-	 * The constructor for an OptionPanel.
+-	 *
+-	 * @param element
+-	 *            : The xml element which the OptionPanel is created for.
+-	 * @throws GUIBuildException
+-	 */
+-	public OptionPanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		this(element, parent, true);
+-	}
+-
+-	public OptionPanel(Element element, ControlledPanel parent, boolean doLayout) throws GUIBuildException {
+-		super(element, parent, doLayout);
+-		
+-		String elementdefault = "";
+-
+-		if (element.hasAttribute("default"))
+-			elementdefault = element.getAttribute("default");
+-
+-		listenerList = new EventListenerList();
+-
+-		final Element[] options = XMLHelper.getElementArray(element, "option");
+-		defaultTrues = new LinkedList<String>();
+-
+-		values = new String[options.length];
+-		labels = new String[options.length];
+-		helptexts = new String[options.length];
+-
+-		for (int i=0;i<options.length;i++) {
+-			values[i] = options[i].getAttribute("value");
+-			labels[i] = options[i].getAttribute("label");
+-
+-			if (labels[i] == "")
+-				labels[i] = values[i];
+-
+-			if (elementdefault.equals(values[i]))
+-				defaultTrues.add(values[i]);
+-
+-			if (options[i].hasAttribute("default") && options[i].getAttribute("default").equals("true"))
+-				defaultTrues.add(values[i]);
+-
+-			helptexts[i] = XMLHelper.getChildElementContent(options[i],"help");
+-		}
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String key, String value) {
+-		//System.out.println("Trying to change OptionPanel");
+-		//ControlledPanel child = add("TA2");
+-		//child.set(element);
+-	}
+-
+-
+-	/**
+-	 * Invokes the appropriate build or destruct methods when changes are made
+-	 * to choices.
+-	 *
+-	 * @param arg0
+-	 * @param selectedOption
+-	 */
+-	public void handleItemEvent(ItemEvent arg0, String selectedOption) {
+-		handleItemEvent(arg0, selectedOption, false, null, null, null);
+-	}
+-
+-	public void handleItemEvent(ItemEvent arg0, String selectedOption, boolean doSet, HashMap hm, String setKey, String setValue) {
+-		Element optionElement = XMLHelper.getCertainChildElement(this.element, "option", "label", selectedOption);
+-
+-		if (optionElement == null)
+-			optionElement = XMLHelper.getCertainChildElement(this.element, "option", "value", selectedOption);
+-
+-		//System.out.println("XML of handleItem("+arg0.getItemSelectable().getClass().toString()+"): " + XMLHelper.getString((Node)optionElement));//this.element));
+-
+-		if (arg0.getStateChange() == ItemEvent.SELECTED) {
+-			try {
+-				GUIBuilder.recursiveBuild(optionElement, this, doSet, hm, setKey, setValue);
+-			} catch (final GUIBuildException e) {
+-				// TODO Auto-generated catch block
+-				e.printStackTrace();
+-			}
+-
+-		} else {
+-			try {
+-				GUIBuilder.recursiveDestruct(optionElement, this);
+-			} catch (final GUIBuildException e) {
+-				// TODO Auto-generated catch block
+-				e.printStackTrace();
+-			}
+-		}
+-
+-	}
+-
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/TextfieldPanel.java	(revision 17983)
+@@ -1,129 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import main.GUI;
+-
+-import java.awt.*;
+-import java.awt.event.*;
+-import java.util.HashMap;
+-
+-import javax.swing.JTextField;
+-import javax.swing.JOptionPane;
+-
+-import org.w3c.dom.Element;
+-
+-/**
+- * A panel that contains a textfield.
+- *
+- * @author korhammer et egger
+- *
+- */
+-public class TextfieldPanel extends ControlledPanel implements KeyListener {
+-
+-	private static final long serialVersionUID = 1L;
+-	private String defaultText;
+-
+-	protected JTextField textfield;
+-
+-	/**
+-	 * The constructor for a TextfieldPanel.
+-	 *
+-	 * @param element
+-	 */
+-	public TextfieldPanel(Element element, ControlledPanel parent) {
+-		super(element, parent);
+-		textfield = new JTextField(10);
+-		textfield.setVisible(true);
+-		this.add(textfield, "width 250:100:400, cell 1 0, growx, ay top, gaptop 3");
+-		textfield.addKeyListener(this);
+-
+-		defaultText = "";
+-		if (element.hasAttribute("default")) {
+-			defaultText = element.getAttribute("default");
+-		}
+-		textfield.setText(defaultText);
+-
+-		if (!optional)
+-			textfield.setBackground(GUI.WARNING_BACKGROUND_COLOR);
+-
+-		this.checkBgColor();
+-		textfield.invalidate();
+-	}
+-
+-
+-
+-	@Override
+-	public void close() {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String key, String value) {
+-		//System.out.println("\tI'm changing the label of the TextField with key '" + this.getKey() + "'");
+-		String val = (String)hm.get(hashKey);
+-		if (val != null) textfield.setText(val);
+-		this.checkBgColor();
+-	}
+-
+-	@Override
+-	public String getValue() {
+-		String thetext = textfield.getText();
+-
+-		if (!isOptional() && thetext.equals("")) {
+-			JOptionPane.showMessageDialog(null, "No value was entered for "
+-									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
+-									+ ".\nA value is required. Your .ini-file is probably incorrect.",
+-									"Problem when building .ini file",
+-									JOptionPane.WARNING_MESSAGE);
+-		}
+-
+-		if (thetext.equals(""))
+-			return null;
+-
+-		return thetext;
+-	}
+-
+-	/** Handle the key typed event from the text field. */
+-	public void keyTyped(KeyEvent e) {}
+-
+-	/** Handle the key-pressed event from the text field. */
+-	public void keyPressed(KeyEvent e) {}
+-
+-	/** Handle the key-released event from the text field. */
+-	public void keyReleased(KeyEvent e) {
+-		checkBgColor();
+-	}
+-
+-	public void checkBgColor() {
+-		String text = textfield.getText();
+-		
+-		if (!optional) {
+-			if (text.length() > 0) {
+-				textfield.setBackground(GUI.NORMAL_BACKGROUND_COLOR);
+-			} else {
+-				textfield.setBackground(GUI.WARNING_BACKGROUND_COLOR);
+-			}
+-			textfield.invalidate();
+-		}
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/FramePanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/FramePanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/FramePanel.java	(revision 17983)
+@@ -1,71 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import main.GUIBuilder;
+-import main.XMLHelper;
+-
+-import java.util.HashMap;
+-import javax.swing.JPanel;
+-import javax.swing.border.*;
+-import javax.swing.BorderFactory;
+-
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-import org.w3c.dom.NodeList;
+-import net.miginfocom.swing.MigLayout;
+-
+-public class FramePanel extends ControlledPanel {
+-
+-	private static final long serialVersionUID = 1987664773406118295L;
+-	protected String title = "";
+-
+-	/**
+-	 *
+-	 *
+-	 * @param element
+-	 * @throws GUIBuildException
+-	 */
+-	public FramePanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		super(element, parent, false);
+-		this.setLayout(new MigLayout("wrap 8, top, ins n 5 n n", "[200!][100!][100!][100!][100!][100!][300:400:400]", ""));
+-
+-		if (parent == null)	hierarchy = 1;
+-
+-		title = element.getAttribute("label");
+-
+-		Border mytitledborder = BorderFactory.createTitledBorder(title);
+-		//Border loweredetched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
+-		this.setBorder(mytitledborder);
+-
+-		this.invalidate();
+-	}
+-
+-	@Override
+-	public String getValue() {
+-		return null;
+-	}
+-	
+-	@Override
+-	public void close() {
+-
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/PathPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/PathPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/PathPanel.java	(revision 17983)
+@@ -1,118 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.event.ActionEvent;
+-import java.awt.event.ActionListener;
+-import java.util.HashMap;
+-
+-import javax.swing.JButton;
+-import javax.swing.JFileChooser;
+-import javax.swing.JPanel;
+-
+-import org.w3c.dom.Element;
+-
+-public class PathPanel extends TextfieldPanel implements ActionListener {
+-
+-	/**
+-	 *
+-	 */
+-	private static final long serialVersionUID = 1486664773406118295L;
+-
+-	JButton select_button;
+-
+-	/**
+-	 * Creates a panel with a text field and a file / path chooser button.
+-	 *
+-	 * @param element
+-	 * @throws GUIBuildException
+-	 */
+-	public PathPanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		super(element, parent);
+-
+-		if (element.getAttribute("type").equals("path")) {
+-			select_button = new JButton("Select Path");
+-		} else if (element.getAttribute("type").equals("file")) {
+-			select_button = new JButton("Select File");
+-		} else {
+-			throw new GUIBuildException("PathPanel is not applicable for parameter types other than 'file' and 'path'.");
+-		}
+-
+-		this.remove(textfield);
+-		this.add(textfield, "cell 1 0, growx, span2");
+-
+-		select_button.addActionListener(this);
+-		select_button.setActionCommand("open chooser");
+-		select_button.setVisible(true);
+-		this.add(select_button, "cell 3 0, growx, wrap");
+-
+-	}
+-
+-	@Override
+-	public void actionPerformed(ActionEvent event) {
+-		if (event.getActionCommand().equals("open chooser") && event.getSource() == this.select_button) {
+-			try {
+-				chooseFile();
+-			} catch (final GUIBuildException e) {
+-				// TODO Auto-generated catch block
+-				e.printStackTrace();
+-			}
+-		}
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String key, String value) {
+-		String val = (String)hm.get(hashKey);
+-		if (val != null) textfield.setText(val);
+-		this.checkBgColor();
+-	}
+-
+-	/**
+-	 * Opens the file chooser dialog and writes the path / filepath into the
+-	 * texfield.
+-	 *
+-	 * @throws GUIBuildException
+-	 */
+-	public void chooseFile() throws GUIBuildException {
+-		final JFileChooser filechooser = new JFileChooser(System.getProperty("user.dir"));
+-
+-		if (element.getAttribute("type").equals("path")) {
+-			filechooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+-		} else if (element.getAttribute("type").equals("file")) {
+-			filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
+-		} else {
+-			throw new GUIBuildException("PathPanel is not applicable for parameter types other than 'file' and 'path'.");
+-		}
+-
+-		final int returnVal = filechooser.showOpenDialog(new JPanel());
+-
+-		if (returnVal == JFileChooser.APPROVE_OPTION) {
+-			if (element.getAttribute("type").equals("path")) {
+-				textfield.setText(filechooser.getSelectedFile().getAbsolutePath());
+-			} else {
+-				textfield.setText(filechooser.getSelectedFile().getName());
+-			}
+-
+-			checkBgColor();
+-		}
+-	}
+-
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/IntegerPanel.java	(revision 17983)
+@@ -1,246 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.event.*;
+-import java.util.HashMap;
+-
+-import javax.swing.JButton;
+-import javax.swing.JOptionPane;
+-import javax.swing.SwingConstants;
+-
+-import org.w3c.dom.Element;
+-
+-/**
+- * A panel that maintains a number in an editable textfield,
+- * optionally with a maximum and minimum value.
+- * @author korhammer
+- *
+- */
+-/**
+- * @author korhammer
+- *
+- */
+-public class IntegerPanel extends TextfieldPanel implements ActionListener, FocusListener {
+-	/**
+-	 *
+-	 */
+-	private static final long serialVersionUID = -8959578535487185306L;
+-
+-	private int defaultvalue;
+-	private int maximumvalue;
+-	private int minimumvalue;
+-
+-	private boolean printPlus;
+-
+-	private final JButton down;
+-	private final JButton up;
+-
+-	/**
+-	 * Constructor for a NumberPanel.
+-	 *
+-	 * @param element
+-	 * @throws GUIBuildException
+-	 */
+-	public IntegerPanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		super(element, parent);
+-
+-		setDefaultvalue(0);
+-		minimumvalue = Integer.MIN_VALUE;
+-		maximumvalue = Integer.MAX_VALUE;
+-		printPlus = false;
+-
+-		if (element.getAttribute("type").equals("integer+")) {
+-			setPrintplus(true);
+-		} else {
+-			setPrintplus(false);
+-		}
+-
+-		if (element.hasAttribute("default")) {
+-			setDefaultvalue(element.getAttribute("default"));
+-		}
+-		if (element.hasAttribute("maximum")) {
+-			setMaximumvalue(element.getAttribute("maximum"));
+-		}
+-		if (element.hasAttribute("minimum")) {
+-			setMinimumvalue(element.getAttribute("minimum"));
+-		}
+-
+-		textfield.setColumns(4);
+-		textfield.invalidate();
+-		textfield.setHorizontalAlignment(SwingConstants.RIGHT);
+-
+-		up = new JButton("+");
+-		up.addActionListener(this);
+-		down = new JButton("-");
+-		down.addActionListener(this);
+-		this.add(up, "split 2, growx, ay top");
+-		this.add(down, "growx, ay top");
+-		textfield.addActionListener(this);
+-		textfield.addFocusListener(this);
+-
+-	}
+-
+-	/**
+-	 * Parses a String to an integer. Different from the standard methods as it
+-	 * handles the + sign e.g. in time zones.
+-	 *
+-	 * @param text
+-	 * @return the parsed number
+-	 * @throws NumberFormatException
+-	 */
+-	private static int parse(String text) throws NumberFormatException {
+-
+-		final char first = text.charAt(0);
+-
+-		if (first == '+')
+-			return Integer.parseInt(text.substring(1));
+-		if (first == '-')
+-			return Integer.parseInt(text);
+-		return Integer.parseInt(text);
+-	}
+-
+-	/*
+-	 * (non-Javadoc)
+-	 *
+-	 * @see
+-	 * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+-	 */
+-	@Override
+-	public void actionPerformed(ActionEvent e) {
+-		if (e.getSource() == up) {
+-			manipulateNumber(1);
+-		} else if (e.getSource() == down) {
+-			manipulateNumber(-1);
+-		} else if (e.getSource() == textfield) {
+-			parseTextfield();
+-		}
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String key, String value) {
+-		String val = (String)hm.get(hashKey);
+-		if (val != null) {
+-			try {
+-				Integer.parseInt(val);
+-				textfield.setText(val);
+-			} catch (Exception e) {} //Do nothing if conversion fails
+-		}
+-	}
+-
+-	@Override
+-	public void focusGained(FocusEvent arg0) {
+-
+-	}
+-
+-	@Override
+-	public void focusLost(FocusEvent arg0) {
+-		parseTextfield();
+-	}
+-
+-	/**
+-	 * Manipulates the number in the text field by parsing it, adding the
+-	 * increment and writing it back into the textfield.
+-	 *
+-	 * @param increment
+-	 */
+-	public void manipulateNumber(int increment) {
+-		int number;
+-
+-		try {
+-			number = parseTextfield();
+-		} catch (final NumberFormatException nfe) {
+-			return;
+-		}
+-
+-		if (number + increment <= maximumvalue
+-				&& number + increment >= minimumvalue) {
+-			number += increment;
+-		} else if (number + increment < minimumvalue) {
+-			number = minimumvalue;
+-		} else if (number + increment > maximumvalue) {
+-			number = maximumvalue;
+-		}
+-
+-		printToTextfield(number);
+-	}
+-
+-	/**
+-	 * Calls the parse method on the textfield.
+-	 *
+-	 * @return
+-	 * @throws NumberFormatException
+-	 */
+-	public int parseTextfield() throws NumberFormatException {
+-		try {
+-			return parse(textfield.getText());
+-		} catch (final NumberFormatException nfe) {
+-			JOptionPane.showMessageDialog(null, "The textfield " + getKey()
+-					+ " does not contain a number.");
+-			throw nfe;
+-		}
+-	}
+-
+-	/**
+-	 * Prints a number to the text field optionally with a plus sign.
+-	 *
+-	 * @param number
+-	 */
+-	public void printToTextfield(int number) {
+-		if (this.printPlus && number > 0) {
+-			textfield.setText("+" + number);
+-		} else {
+-			textfield.setText("" + number);
+-		}
+-		checkBgColor();
+-	}
+-
+-	public void setDefaultvalue(int defaultvalue) {
+-		this.defaultvalue = defaultvalue;
+-		this.printToTextfield(defaultvalue);
+-	}
+-
+-	public void setDefaultvalue(String defaultvalue) {
+-		this.defaultvalue = parse(defaultvalue);
+-		this.printToTextfield(this.defaultvalue);
+-	}
+-
+-	public void setMaximumvalue(int maximumvalue) {
+-		this.maximumvalue = maximumvalue;
+-	}
+-
+-	public void setMaximumvalue(String maximumvalue) {
+-		this.maximumvalue = parse(maximumvalue);
+-	}
+-
+-	public void setMinimumvalue(int minimumvalue) {
+-		this.minimumvalue = minimumvalue;
+-	}
+-
+-	public void setMinimumvalue(String minimumvalue) {
+-		this.minimumvalue = parse(minimumvalue);
+-	}
+-
+-	public void setPrintplus(boolean printPlus) {
+-		this.printPlus = printPlus;
+-		printToTextfield(parse(textfield.getText()));
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/AlternativePanel.java	(revision 17983)
+@@ -1,177 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.event.ItemEvent;
+-
+-import javax.swing.JComboBox;
+-import javax.swing.JOptionPane;
+-import java.util.HashMap;
+-import javax.swing.*;
+-import java.awt.*;
+-
+-import main.GUI;
+-
+-import org.w3c.dom.Element;
+-
+-/**
+- * The AlternativePanel contains a dropdown list with alternatives to choose from.
+- *
+- * @author Thomas Egger
+- *
+- */
+-public class AlternativePanel extends OptionPanel {
+-
+-	private static final long serialVersionUID = 4468480774697888798L;
+-	private final JComboBox box;
+-
+-	private String setKey = null, setValue = null;
+-	private boolean doSet = false;
+-	private HashMap setMap;
+-
+-	/**
+-	 * Constructor for the AlternativePanel
+-	 *
+-	 * @param element the <parameter ...> element for which the panel is created.
+-	 * @throws GUIBuildException
+-	 */
+-	public AlternativePanel(Element element, ControlledPanel parent) throws GUIBuildException {
+-		super(element, parent);
+-
+-		box = new JComboBox(labels);
+-		box.insertItemAt("", 0);     //Add an empty label
+-		box.setVisible(true);
+-		box.setSelectedIndex(0);
+-		box.addItemListener(this);
+-
+-		//Issue 263: On OSX the box.setBackground method does not function without this tweak:
+-		if (System.getProperty("os.name").equals("Mac OS X")) 
+-		    box.setRenderer(new ColorCellRenderer(box.getPreferredSize().width));
+-
+-		if (!optional) box.setBackground(GUI.WARNING_BACKGROUND_COLOR);
+-
+-		if (defaultTrues.size() > 1) {
+-			throw new GUIBuildException("Element " + getHashKey() + " has multiple default values");
+-		} else if (defaultTrues.size() == 1) {
+-			box.setSelectedItem(defaultTrues.getFirst());
+-		}
+-
+-		this.add(box, "cell 1 0, growx, ay top, wrap");
+-	}
+-
+-	@Override
+-	public void close() {
+-		this.box.setSelectedIndex(0);
+-	}
+-
+-	@Override
+-	public String getValue() {
+-
+-		if (box.getSelectedIndex() != 0) {
+-			//String selectedString = (String) box.getSelectedItem();
+-			int index = box.getSelectedIndex() - 1;
+-			if (index < 0)
+-				return "";
+-
+-			return values[index];
+-		}
+-
+-		if (!isOptional()) {
+-			JOptionPane.showMessageDialog(null, "No option was selected for "
+-									+ getKey() + " (section '" + getSection().toUpperCase() + "')"
+-									+ ".\nA value is required. Your .ini-file is probably incorrect.",
+-									"Problem when building .ini file",
+-									JOptionPane.WARNING_MESSAGE);
+-		}
+-
+-		return null;
+-	}
+-
+-	@Override
+-	public synchronized void set(HashMap hm, String key, String value) {
+-		doSet = true;
+-		setKey = key;
+-		setValue = value;
+-		setMap = hm;
+-
+-		if (!hm.containsKey(hashKey)) return;
+-		String val = ((String)hm.get(hashKey)).toUpperCase();
+-
+-		//System.out.println("\tAP: Setting AlternativePanel: " + hashKey + " = " + val);
+-
+-		for (int ii=0; ii<values.length; ii++) { //loop through all existant items
+-			if (val.equals(values[ii].toUpperCase())) { //compare to val
+-				this.box.setSelectedIndex(ii+1);
+-				break;
+-			}
+-		}
+-	}
+-
+-	@Override
+-	public synchronized void itemStateChanged(ItemEvent arg0) {
+-		//Deal with help text
+-		help.setText("");
+-
+-		if ((box.getSelectedIndex() > 0) && (helptexts[box.getSelectedIndex()-1] != null)) {
+-			help.setText("<html>" + helptexts[box.getSelectedIndex()-1] + "</html>");
+-		} else {
+-			if (helptext != null) 
+-				help.setText("<html>" + helptext + "</html>");
+-		}
+-
+-		//handle selected Item
+-		final String selectedOption = (String) arg0.getItem();
+-		if (selectedOption == "") {
+-			if (!optional) {
+-				box.setBackground(GUI.WARNING_BACKGROUND_COLOR);
+-			}
+-		} else {
+-			if (!optional) {
+-				box.setBackground(GUI.NORMAL_BACKGROUND_COLOR);
+-			}
+-			//System.out.println("\tDOSET of AlternativePanel: " + doSet);
+-			super.handleItemEvent(arg0, selectedOption, doSet, setMap, setKey, setValue);
+-			doSet = false;
+-			setKey = null;
+-			setMap = null;
+-			setValue = null;
+-		}
+-	}
+-}
+-
+-class ColorCellRenderer implements ListCellRenderer {
+-	protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
+-	private Dimension preferredSize = new Dimension(0, 18);
+-
+-	public ColorCellRenderer(int width) {
+-		width -= 50;
+-
+-		if (width < 100) width = 100; //Default size on OSX
+-	
+-		preferredSize = new Dimension(width, 18);
+-	}
+-
+-	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+-		JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+-		renderer.setPreferredSize(preferredSize);
+-		return renderer;
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java
+===================================================================
+--- ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/gui_elements/DecimalPanel.java	(revision 17983)
+@@ -1,133 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package gui_elements;
+-
+-import java.awt.event.ActionEvent;
+-import java.awt.event.ActionListener;
+-import java.awt.event.FocusEvent;
+-import java.awt.event.FocusListener;
+-import java.util.HashMap;
+-
+-import java.text.DecimalFormat;
+-import java.text.ParseException;
+-import java.text.DecimalFormatSymbols;
+-import javax.swing.JFormattedTextField;
+-
+-import org.w3c.dom.Element;
+-
+-public class DecimalPanel extends TextfieldPanel implements ActionListener, FocusListener{
+-
+-	/**
+-	 *
+-	 */
+-	private static final long serialVersionUID = 1555742510677354674L;
+-	double defaultvalue;
+-	double maximumvalue;
+-	double minimumvalue;
+-
+-	JFormattedTextField textfield;
+-
+-	public DecimalPanel(Element element, ControlledPanel parent) {
+-		super(element, parent);
+-		this.remove(super.textfield);
+-
+-		DecimalFormat format = (DecimalFormat)DecimalFormat.getInstance();
+-		DecimalFormatSymbols custom = new DecimalFormatSymbols();
+-		custom.setDecimalSeparator('.');
+-		format.setDecimalFormatSymbols(custom);
+-		format.setGroupingUsed(false);
+-
+-		textfield = new JFormattedTextField(format);
+-		textfield.addActionListener(this);
+-		textfield.addFocusListener(this);
+-		this.add(textfield,"cell 1 0, growx, ay top, gaptop 3");
+-		textfield.setVisible(true);
+-		this.invalidate();
+-		defaultvalue = 0.0;
+-		maximumvalue = Double.MAX_VALUE;
+-		minimumvalue = Double.MIN_VALUE;
+-
+-
+-		if(element.hasAttribute("minimum")){
+-			minimumvalue = Double.parseDouble(element.getAttribute("minimum"));
+-		}
+-		if(element.hasAttribute("maximum")){
+-			maximumvalue = Double.parseDouble(element.getAttribute("maximum"));
+-		}
+-		if(element.hasAttribute("default")){
+-			defaultvalue = Double.parseDouble(element.getAttribute("default"));
+-		}
+-		setToDefaultValue();
+-	}
+-
+-	private void setToDefaultValue() {
+-		textfield.setValue(new Double(defaultvalue));
+-		this.invalidate();
+-	}
+-
+-	private void checkValue(){
+-		try {
+-			textfield.commitEdit();
+-		} catch (ParseException e) {
+-			// TODO Auto-generated catch block
+-			e.printStackTrace();
+-		}
+-		double currentvalue = ((Number)textfield.getValue()).doubleValue();
+-		if(currentvalue > maximumvalue){
+-			textfield.setValue(new Double(maximumvalue));
+-		}
+-		else if(currentvalue<minimumvalue){
+-			textfield.setValue(new Double(minimumvalue));
+-		}
+-	}
+-
+-	public String getValue(){
+-		return textfield.getValue().toString();
+-	}
+-
+-	@Override
+-	public void set(HashMap hm, String key, String value) {
+-		String val = (String)hm.get(hashKey);
+-		if (val != null) {
+-			try {
+-				Double.parseDouble(val);
+-				textfield.setText(val);
+-			} catch (Exception e) {} //Do nothing if conversion fails
+-		}
+-	}
+-
+-	@Override
+-	public void focusGained(FocusEvent arg0) {
+-		checkValue();
+-
+-	}
+-
+-	@Override
+-	public void focusLost(FocusEvent arg0) {
+-		checkValue();
+-
+-	}
+-
+-	@Override
+-	public void actionPerformed(ActionEvent arg0) {
+-		checkValue();
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/main/PanelNode.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/PanelNode.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/main/PanelNode.java	(revision 17983)
+@@ -1,69 +0,0 @@
+-package main;
+-
+-import java.util.List;
+-import java.util.LinkedList;
+-
+-public class PanelNode {
+-	private String data;
+-	private PanelNode parent;
+-	private LinkedList<PanelNode> children = new LinkedList<PanelNode>();
+-
+-	public PanelNode(String indata) {
+-		data = indata;
+-		parent = null;
+-	}
+-
+-	public PanelNode(PanelNode p) {
+-		data = p.data;
+-		parent = p.parent;
+-		children = new LinkedList<PanelNode>(p.children);
+-	}
+-
+-	public String getData() {
+-		return data;
+-	}
+-
+-	public PanelNode getChild(String data) {
+-		for (PanelNode child : children) {
+-			if (child.data.equals(data))
+-				return child;
+-		}
+-
+-		return null;
+-	}
+-
+-	public PanelNode add(PanelNode c) {
+-		c.parent = this;
+-		children.add(c);
+-
+-		return children.getLast();
+-	}
+-
+-	public PanelNode get(String searchstring) {
+-		if (data.equals(searchstring)) return this;
+-
+-		for (PanelNode child : children) {
+-			PanelNode tmp = child.get(searchstring);
+-			if (tmp != null) return tmp;
+-		}
+-
+-		return null; //Nothing found in subtree
+-	}
+-
+-	public boolean remove(PanelNode tmp) {
+-		return children.remove(tmp);
+-	}
+-
+-	public PanelNode getParent() {
+-		return parent;
+-	}
+-
+-	public void getKeyList(LinkedList<String> keyList) {
+-		if ((data.indexOf('#') == -1) && (data.indexOf('%') == -1))
+-			keyList.add(data);
+-
+-		for (PanelNode child : children) {
+-			child.getKeyList(keyList);
+-		}
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/main/GUIBuilder.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/GUIBuilder.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/main/GUIBuilder.java	(revision 17983)
+@@ -1,391 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package main;
+-
+-import gui_elements.ControlledPanel;
+-import gui_elements.GUIBuildException;
+-
+-import java.io.IOException;
+-
+-import javax.swing.ProgressMonitor;
+-import javax.swing.JFileChooser;
+-import javax.swing.JOptionPane;
+-import javax.swing.JPanel;
+-import javax.swing.filechooser.FileNameExtensionFilter;
+-
+-import java.util.*;
+-
+-import org.w3c.dom.Document;
+-import org.w3c.dom.Element;
+-
+-/**
+- * The main class to build the .ini file creator. Upon construction it reads an
+- * XML file and creates the corresponding GUI. Maintains an ElementControl
+- * object.
+- *
+- * @author korhammer et egger
+- *
+- */
+-public class GUIBuilder {
+-	public static ProgressMonitor monitor;
+-
+-	public static final String xsd = GUIBuilder.class.getClassLoader().getResource("resources/config_schema-0.1.1.xsd").toString();
+-	public static String res_filepath = GUIBuilder.class.getClassLoader().getResource("resources/default_config.xml").toString(); //the default config to start with
+-	public static Document doc;
+-
+-	public static GUI gui;
+-	public static PanelControl panelControl;
+-
+-	public static String application;
+-	public static String currentConfigFile;
+-
+-	public static String saveFilePath = System.getProperty("user.dir");
+-
+-
+-	private static String getFileExtension(final String file_and_path) {
+-		final String file_sep = System.getProperty("file.separator");
+-
+-		// get filename without path
+-		final int fileSepIndex = file_and_path.lastIndexOf(file_sep);
+-		if (fileSepIndex == -1) {
+-			return "";
+-		}
+-		final String filename = file_and_path.substring(fileSepIndex+1); //remove path
+-
+-		// get the extension from the filename
+-		final int extIndex = filename.lastIndexOf(".");
+-		if (extIndex == -1)
+-			return "";
+-
+-		return filename.substring(extIndex+1);
+-	}
+-
+-	/**
+-	 * The main method. Opens the GUI Builder with a menu bar on the side.
+-	 * If an XML filepath is handed over as an argument,
+-	 * the XML file is opened.
+-	 *
+-	 * @param args
+-	 * @throws GUIBuildException
+-	 */
+-	public static void main(String args[]) throws GUIBuildException {
+-
+-		new GUIBuilder();
+-
+-		if ((args.length != 0) && (args[0].length() > 0))
+-			res_filepath = args[0]; //User may provice xml file as first argument
+-
+-		buildGUI(res_filepath);
+-		//gui.hideOpenButton();
+-	}
+-
+-	/**
+-	 * Builds a GUI from the XML-file specified with validation through
+-	 * the specified schema.
+-	 *
+-	 * @param filepath
+-	 * @param schemapath
+-	 * @throws GUIBuildException
+-	 */
+-	public GUIBuilder()	throws GUIBuildException {
+-		if (System.getProperty("mrj.version") != null) {  //detect if running on mac
+-			System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Inishell");
+-			System.setProperty("apple.awt.brushMetalLook", "true");
+-		}
+-		gui = new GUI();
+-	}
+-
+-	public static void setComments(HashMap<String, String> added_comments, HashMap<String, String> comments) {
+-		panelControl.setComments(added_comments, comments);
+-	}
+-
+-	/**
+-	 * Builds the gui for a filepath that can either be handed over as an argument
+-	 * on application start or chosen by using the open button.
+-	 *
+-	 * @param filepath
+-	 * @throws GUIBuildException
+-	 */
+-	public static void buildGUI(String filepath) throws GUIBuildException{
+-		currentConfigFile = filepath;
+-
+-		doc = XMLHelper.readXML(filepath, xsd);
+-		doc = XMLHelper.resolveReferences(doc);
+-
+-		application = doc.getDocumentElement().getAttribute("application");
+-
+-		gui.setApplicationForTitle(application);
+-
+-		panelControl = new PanelControl();
+-
+-		final Element root = doc.getDocumentElement();
+-		recursiveBuild(root, null, false);
+-	}
+-
+-
+-	public static void setValues(final HashMap<String, String> hm, final HashMap<String, String> added_comments, final HashMap<String, String> comments) {
+-		if (hm == null) return;
+-
+-		monitor = new ProgressMonitor(gui, "Loading INI file", "0 out of " + panelControl.order.size() + " sections loaded", 0, panelControl.order.size());
+-		monitor.setMillisToPopup(0);
+-
+-		Thread myrunner = new Thread() {
+-				public void run() {
+-					int progress_counter = 0; //Effectively counts the sections already parsed into the GUI
+-					try {
+-						final int returnval = GUIBuilder.closeFile();
+-						if (returnval == JOptionPane.CANCEL_OPTION) return;
+-						monitor.setProgress(progress_counter);
+-
+-						GUIBuilder.buildGUI(currentConfigFile);
+-					} catch (GUIBuildException e) {
+-						e.printStackTrace();
+-					}
+-
+-					gui.setEnabled(false); //Disable user interaction while the ProgressMonitor is on
+-
+-					HashSet<String> usedKeys = new HashSet<String>(); //save all keys that were used from the HashMap
+-					HashSet<String> unusedKeys = new HashSet<String>(); //save all keys that were used from the HashMap
+-
+-					Iterator<Map.Entry<String, TreeMap<String, ControlledPanel>>> sectionIterator = panelControl.panels.entrySet().iterator();
+-					while (sectionIterator.hasNext()) {
+-						progress_counter++;
+-						monitor.setProgress(progress_counter);
+-						monitor.setNote(progress_counter + " out of " + panelControl.order.size() + " sections loaded");
+-
+-						if (monitor.isCanceled()) { //user cancelled loading
+-							monitor.close();
+-							gui.setEnabled(true);
+-							break; //HACK, should reset the whole environment before breaking
+-						}
+-
+-						Map.Entry<String, TreeMap<String, ControlledPanel>> entry = sectionIterator.next();
+-						TreeMap<String, ControlledPanel> value = entry.getValue();
+-
+-						List<String> sectionKeys = new ArrayList<String>(hm.keySet()); //all keys as defined in the existing ini
+-						String sectionKey = entry.getKey().toUpperCase() + "::"; //The section string
+-						filterList(sectionKey, sectionKeys); //filter keys for current section only (optimization)
+-
+-						LinkedList<ControlledPanel> todos = new LinkedList<ControlledPanel>();
+-						LinkedList<String> keys = new LinkedList<String>();
+-						LinkedList<String> values = new LinkedList<String>();
+-
+-						do {
+-							todos.clear();
+-							keys.clear();
+-							values.clear();
+-
+-							Iterator<Map.Entry<String, ControlledPanel>> keyIterator = value.entrySet().iterator();
+-							while(keyIterator.hasNext()) { //go through all keys of current section
+-								final ControlledPanel mypanel = keyIterator.next().getValue();
+-								//System.out.println("\t" + mypanel.getKey());
+-
+-								String pattern = mypanel.getHashKey();
+-								pattern = pattern.replace("%","[a-zA-Z0-9_]+");
+-								pattern = pattern.replace("#","[1-9]+[0-9]*"); //all integer numbers from 1 to infinity
+-								//System.out.println("Current pattern: " + pattern);
+-
+-								//Loop through all defined keys of this section and compare them with pattern
+-								Iterator<String> keyit = sectionKeys.iterator();
+-								while (keyit.hasNext()) {
+-									final String currkey = keyit.next();
+-									//System.out.println("sectionKeys contains: " + currkey);
+-
+-									if ((!usedKeys.contains(currkey)) && currkey.matches(pattern)) {
+-										//Add mypanel to list of todos
+-										//System.out.println("Adding panel for " + currkey);
+-										todos.add(mypanel);
+-										keys.add(currkey);
+-										values.add(hm.get(currkey));
+-
+-										usedKeys.add(currkey);
+-									}
+-								}
+-							}
+-
+-							for (int jj = 0; jj < todos.size(); jj++) {
+-								//System.out.println("--> SETTING " + keys.get(jj) + "  = " +values.get(jj));
+-								todos.get(jj).set(hm, keys.get(jj), values.get(jj));
+-							}
+-						} while (todos.size() != 0);
+-
+-						if (progress_counter == panelControl.order.size()) gui.setEnabled(true);
+-					}
+-
+-					//Now find out all keys that were not used in the hashmap
+-					for (String key : hm.keySet()) {
+-						if (!usedKeys.contains(key)) {
+-							//System.out.println("Unknown key = " + key);
+-							unusedKeys.add(key);
+-							panelControl.setUnusedKeys(key, hm.get(key));
+-						}
+-					}
+-
+-					setComments(added_comments, comments);
+-				}
+-			};//thread
+-		myrunner.start();
+-	}
+-
+-	private static void filterList(String filter, List<String> list) {
+-		for (Iterator<String> it=list.iterator(); it.hasNext();) {
+-			final String next = it.next();
+-			if (!next.startsWith(filter)) {
+-				it.remove();
+-			}
+-		}
+-	}
+-
+-	public static int closeFile(){
+-		final int returnval = JOptionPane.showConfirmDialog(new JPanel(),
+-				"You will lose all changes made to the current ini-file. " +
+-				"Do you want this?", "Inishell is already open for " + application, JOptionPane.OK_CANCEL_OPTION);
+-
+-
+-
+-		if (returnval == JOptionPane.OK_OPTION) {
+-			gui.closeAllTabs();
+-			gui.rootNode = new PanelNode("");
+-			application = null;
+-			doc = null;
+-			panelControl = null;
+-		}
+-
+-		return returnval;
+-	}
+-
+-
+-	/**
+-	 * Puts the specified panel into the panel control.
+-	 * @param panel
+-	 */
+-	public static void control(ControlledPanel panel) {
+-		final String section = panel.getSection();
+-		panelControl.put(section, panel);
+-	}
+-
+-
+-	/**
+-	 * Recursively traverses all children of the specified element
+-	 * and builds the corresponding panels.
+-	 *
+-	 * @param parentElement
+-	 * @param parentPanel
+-	 * @throws GUIBuildException
+-	 */
+-	public static void recursiveBuild(Element parentElement, ControlledPanel parentPanel, boolean doSet) throws GUIBuildException {
+-		recursiveBuild(parentElement, parentPanel, doSet, null, null, null);
+-	}
+-
+-
+-	public static void recursiveBuild(Element parentElement, ControlledPanel parentPanel, boolean doSet, HashMap hm, String key, String value) throws GUIBuildException {
+-
+-		/* get all child elements for the root */
+-		final String[] tags = {"parameter", "frame"};
+-		final Element[] parameterElements = XMLHelper.getElementArray(parentElement, tags);
+-
+-		for (final Element element : parameterElements) {
+-			final String section = element.getAttribute("section");
+-			ControlledPanel parameterPanel;
+-
+-			if (!panelControl.contains(section, element.getAttribute("key"))) {
+-				//System.out.println("Adding through recursiveBuild: " + element.getAttribute("key"));
+-				parameterPanel = ControlledPanel.createSingleParameterPanel(element, parentPanel);
+-				parameterPanel.setKey(parameterPanel.getKey());
+-
+-				if (!element.getAttribute("template").equals("true")) {
+-					//if (doSet) System.out.println("\tSETTING component key: " + key + "  value: " + value);
+-					if (doSet) parameterPanel.set(hm, parameterPanel.getKey(), value);
+-
+-					gui.addToTab(parameterPanel, section, parentPanel);
+-					control(parameterPanel);
+-				}
+-			} else {
+-				parameterPanel = panelControl.get(section, element.getAttribute("key"));
+-			}
+-
+-			parameterPanel.hold();
+-			recursiveBuild(element, parameterPanel, doSet);
+-		}
+-
+-		gui.validate();
+-	}
+-
+-	/**
+-	 * Recursively destructs child elements of the specified root.
+-	 *
+-	 * @param rootElement
+-	 * @param rootPanel
+-	 * @throws GUIBuildException
+-	 */
+-	public static void recursiveDestruct(Element rootElement, ControlledPanel rootPanel)
+-		throws GUIBuildException {
+-
+-		/* get all child elements for the root */
+-		final Element[] parameterElements = XMLHelper.getElementArray(rootElement, "parameter");
+-
+-		for (final Element element : parameterElements) {
+-			final String section = element.getAttribute("section");
+-			final ControlledPanel parameterPanel = panelControl.get(section, element.getAttribute("key"));
+-			recursiveDestruct(element, parameterPanel);
+-
+-			parameterPanel.release();
+-			parameterPanel.close();
+-
+-			if (!parameterPanel.isNeeded()) {
+-				gui.removeFromTab(parameterPanel, section, rootPanel);
+-			}
+-
+-		}
+-
+-		gui.validate();
+-	}
+-
+-
+-	/**
+-	 * Opens a prompt for the path to save the ini file to. Then prints the ini
+-	 * to the path specified.
+-	 *
+-	 * @throws IOException
+-	 * @throws GUIBuildException
+-	 */
+-	public static void printIOFile() throws IOException, GUIBuildException {
+-		final FileNameExtensionFilter inifilter = new FileNameExtensionFilter(".ini files", "ini");
+-
+-		final JFileChooser filechooser = new JFileChooser(saveFilePath);
+-		filechooser.setFileFilter(inifilter);
+-
+-		final int returnval = filechooser.showSaveDialog(new JPanel());
+-
+-		if (returnval == JFileChooser.APPROVE_OPTION) {
+-			String path = filechooser.getSelectedFile().getAbsolutePath();
+-			final String ext = getFileExtension(path).toLowerCase();
+-			if(!ext.equals("ini")) {
+-				path += ".ini";
+-			}
+-
+-			if (filechooser.getSelectedFile().isDirectory()) return;
+-			saveFilePath = filechooser.getSelectedFile().getParent();
+-
+-			panelControl.printToFile(path);
+-		}
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/main/PanelControl.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/PanelControl.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/main/PanelControl.java	(revision 17983)
+@@ -1,248 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package main;
+-
+-import gui_elements.ControlledPanel;
+-
+-import java.io.File;
+-import java.io.FileWriter;
+-import java.io.IOException;
+-import java.util.HashMap;
+-import java.util.LinkedList;
+-import java.util.Set;
+-import java.util.TreeMap;
+-import java.util.Iterator;
+-
+-/**
+- * Class that maintains all ControlledPanels so that values can be retrieved
+- * from panels, ini-files can be written. And a panel is not multiply created.
+- *
+- * @author korhammer
+- *
+- */
+-public class PanelControl {
+-
+-	LinkedList<String> order;
+-	HashMap<String, TreeMap<String, ControlledPanel>> panels;
+-	HashMap<String, String> comments = null;
+-	HashMap<String, String> added_comments = null;
+-	HashMap<String, HashMap<String, String>> unusedKeys = null;
+-	PanelNode rootNode = null;
+-
+-	/**
+-	 * Constructor for the panel control.
+-	 */
+-	public PanelControl() {
+-		panels = new HashMap<String, TreeMap<String, ControlledPanel>>();
+-		order = new LinkedList<String>();
+-
+-		unusedKeys = new HashMap<String, HashMap<String, String>>();
+-	}
+-
+-	public PanelControl(PanelControl p) {
+-		panels = new HashMap<String, TreeMap<String, ControlledPanel>>(p.panels);
+-		order = new LinkedList<String>(p.order);
+-		if (added_comments != null)
+-			added_comments = new HashMap<String, String>(p.added_comments);
+-
+-		if (comments != null)
+-			comments = new HashMap<String, String>(p.comments);
+-	}
+-
+-	public void setUnusedKeys(String key, String value) {
+-		//Parse key
+-		int offset = key.indexOf("::");
+-		String section = key.substring(0, offset);
+-		String sectionkey = key.substring(offset + 2);
+-
+-		HashMap<String, String> hm = unusedKeys.get(section);
+-		if (hm == null) unusedKeys.put(section, new HashMap<String, String>());
+-
+-		unusedKeys.get(section).put(sectionkey, value);
+-	}
+-
+-	public void setComments(HashMap<String, String> inaddedcomments, HashMap<String, String> incomments) {
+-		this.added_comments = new HashMap<String, String>(inaddedcomments);
+-		this.comments = new HashMap<String, String>(incomments);
+-	}
+-
+-	/**
+-	 * @param section
+-	 * @param key
+-	 * @return true if a panel with such key is maintained in the specified
+-	 *         section
+-	 */
+-	public boolean contains(String section, String key) {
+-		if (!panels.containsKey(section))
+-			return false;
+-
+-		return panels.get(section).containsKey(key);
+-	}
+-
+-	/**
+-	 *
+-	 * @param section
+-	 * @param key
+-	 * @return the panel with the specified section / key pair
+-	 */
+-	public ControlledPanel get(String section, String key) {
+-		return panels.get(section).get(key);
+-	}
+-
+-	/**
+-	 * Prints the ini-file at the specified path.
+-	 *
+-	 * @param path
+-	 */
+-	public void printToFile(String path) {
+-		/* create file */
+-		final File file = new File(path);
+-
+-		try {
+-			final FileWriter writer = new FileWriter(file);
+-
+-			writer.write(this.toString());
+-			writer.close();
+-		} catch (final IOException e) {
+-			// TODO Auto-generated catch block
+-			e.printStackTrace();
+-		}
+-	}
+-
+-	/**
+-	 * Adds the panel to the specified section.
+-	 *
+-	 * @param section
+-	 * @param panel
+-	 */
+-	public void put(String section, ControlledPanel panel) {
+-		final String key = panel.getKey();
+-		if (!panels.containsKey(section)) {
+-			order.add(section);
+-			panels.put(section, new TreeMap<String, ControlledPanel>());
+-		}
+-		panels.get(section).put(key, panel);
+-	}
+-
+-	/**
+-	 * Removes the panel with the specified section and key.
+-	 *
+-	 * @param section
+-	 * @param key
+-	 * @return the panel
+-	 */
+-	public ControlledPanel remove(String section, String key) {
+-		return panels.get(section).remove(key);
+-	}
+-
+-	/**
+-	 * Prints the maintained panels to a string.
+-	 *
+-	 * @return an ini-file-like structure
+-	 */
+-	public void setRootNode(PanelNode inrootNode) {
+-		rootNode = inrootNode;
+-	}
+-
+-	public String extractKey(String instring) {
+-		int offset = instring.indexOf("::");
+-		if (offset == -1) return null;
+-
+-		return instring.substring(offset+2);
+-	}
+-
+-	@Override
+-	public String toString() {
+-		String out = "";
+-
+-		for (final String section : order) {
+-			/* create section */
+-			final String sectionstring = "[" + section.toUpperCase() + "]\n";
+-			String keyvaluestring = "";
+-
+-			/* print section */
+-			LinkedList<String> keys = new LinkedList<String>();
+-			PanelNode sectionNode = rootNode.get(section.toUpperCase());
+-			if (sectionNode != null) sectionNode.getKeyList(keys);
+-
+-			//final Set<String> keys = panels.get(section).keySet();
+-			for (final String hashKey : keys) {
+-				String key = extractKey(hashKey);
+-				if (key == null) continue;
+-
+-				final String value = panels.get(section).get(key).getValue();
+-				if (value != null) {
+-					if ((comments != null) && comments.containsKey(hashKey.toUpperCase())) {
+-						String precomments =  comments.get(hashKey.toUpperCase());
+-						if (!precomments.equals(""))
+-						 	keyvaluestring += precomments;						
+-					}
+-
+-					keyvaluestring += key + "\t=\t" + value;					
+-
+-					if ((added_comments != null) && added_comments.containsKey(hashKey.toUpperCase()))
+-						keyvaluestring += "\t" + added_comments.get(hashKey.toUpperCase());
+-
+-					keyvaluestring += "\n";
+-				}
+-			}
+-
+-			//Add unused keys
+-			HashMap<String, String> extra = unusedKeys.get(section.toUpperCase());
+-			if (extra != null) {
+-				if (!keyvaluestring.equals("")) keyvaluestring += "\n";
+-
+-				for (String extrakey : extra.keySet()) {
+-					String hashKey = section.toUpperCase() + "::" + extrakey.toUpperCase();
+-					if ((comments != null) && comments.containsKey(hashKey)) {
+-						String precomments =  comments.get(hashKey);
+-						if (!precomments.equals(""))
+-						 	keyvaluestring += precomments;						
+-					}
+-				
+-					keyvaluestring += extrakey + "\t=\t" + extra.get(extrakey);
+-
+-					if ((added_comments != null) && added_comments.containsKey(hashKey))
+-					    keyvaluestring += "\t" + added_comments.get(hashKey);
+-
+-					keyvaluestring += "\n";
+-				}
+-			}
+-			
+-			//check if there aren't any comments in that section
+-			String hashKey = section.toUpperCase() + "::";
+-			if ((comments != null) && comments.containsKey(hashKey)) {
+-				String precomments =  comments.get(hashKey);
+-				if (!precomments.equals("")) {
+-					if (precomments.indexOf("\n") == -1) precomments += "\n";
+-					keyvaluestring = precomments + keyvaluestring + "\n";
+-				}
+-			}
+-			
+-			/* add section only if keys / values are printed */
+-			if (!keyvaluestring.equals("")) {
+-				out += sectionstring + keyvaluestring + "\n";
+-			}
+-		}
+-
+-		return out;
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/main/XMLHelper.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/XMLHelper.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/main/XMLHelper.java	(revision 17983)
+@@ -1,525 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package main;
+-
+-import gui_elements.GUIBuildException;
+-
+-import java.io.IOException;
+-import java.util.LinkedList;
+-
+-import javax.xml.parsers.DocumentBuilder;
+-import javax.xml.parsers.DocumentBuilderFactory;
+-import javax.xml.parsers.ParserConfigurationException;
+-import javax.xml.transform.TransformerConfigurationException;
+-import javax.xml.transform.TransformerException;
+-import javax.xml.transform.TransformerFactory;
+-
+-import org.w3c.dom.Document;
+-import org.w3c.dom.Element;
+-import org.w3c.dom.Node;
+-import org.w3c.dom.NodeList;
+-import org.xml.sax.SAXException;
+-
+-//for the XML printing
+-import javax.xml.transform.stream.StreamResult;
+-import javax.xml.transform.*;
+-import javax.xml.transform.dom.*;
+-import java.io.StringWriter;
+-
+-public class XMLHelper {
+-
+-	/**
+-	 * Find the parameter values for which the element should be cloned
+-	 * e.g. for section tags.
+-	 *
+-	 * @param element
+-	 * @param tagName
+-	 * @param attributeName
+-	 * @param parentArgument
+-	 * @return the
+-	 */
+-	public static String[] findApplicableValues(Element element,
+-			String tagName, String attributeName, String parentArgument) {
+-
+-		final String[] argumentsFromElement = getAttributesFromChildren(
+-				element, tagName, attributeName);
+-
+-		/*
+-		 * If no such arguments are specified for the current element but there
+-		 * are for the parent element, take that of the parent.
+-		 */
+-		if (argumentsFromElement.length == 0 && parentArgument != null)
+-			return new String[] { parentArgument };
+-		else if ((argumentsFromElement.length > 0 && parentArgument != null)) {
+-			if (getCertainChildElement(element, tagName, attributeName,
+-					parentArgument) != null)
+-				return new String[] { parentArgument };
+-			else
+-				/*
+-				 * The empty intersection is an empty array so that his case can
+-				 * be handled differently from the null case below.
+-				 */
+-				return new String[0];
+-		}
+-
+-		/*
+-		 * If no arguments are specified for the parent use all element
+-		 * arguments.
+-		 */
+-		else if (argumentsFromElement.length > 0 && parentArgument == null)
+-			return argumentsFromElement;
+-		else if (argumentsFromElement.length == 0 && parentArgument == null)
+-			return null;
+-		return null;
+-	}
+-
+-	/**
+-	 * Get all children of an element that have a certain element tag and
+-	 * extract the values for a certain attribute.
+-	 *
+-	 * @param parent
+-	 *            the parent element
+-	 * @param tag
+-	 *            the element tag
+-	 * @param attribute
+-	 *            the attribute name
+-	 *
+-	 * @return a String array with the attribute values
+-	 */
+-	public static String[] getAttributesFromChildren(Element parent, String tag, String attribute) {
+-		final Element[] elements = getElementArray(parent, tag);
+-
+-		final String[] attributes = new String[elements.length];
+-		for (int i = 0; i < elements.length; i++) {
+-			attributes[i] = elements[i].getAttribute(attribute);
+-		}
+-		return attributes;
+-	}
+-
+-	/**
+-	 * Returns the first child element that has the specified element tag and
+-	 * the value for the specified attribute.
+-	 *
+-	 * @param parent
+-	 * @param tag
+-	 * @param attribute
+-	 * @param value
+-	 * @return the first child element that meets the criteria
+-	 */
+-	public static Element getCertainChildElement(Element parent, String tag,
+-			String attribute, String value) {
+-		final Element[] allElements = getElementArray(parent, tag);
+-		for (final Element element : allElements) {
+-			if (element.hasAttribute(attribute)) {
+-				if (element.getAttribute(attribute).equals(value))
+-					return element;
+-			}
+-		}
+-		return null;
+-	}
+-
+-	/**
+-	 * For the specified element gets the text that is contained in the first
+-	 * child that has a certain element name.
+-	 *
+-	 *
+-	 * @param parent
+-	 *            the parent element
+-	 * @param tag
+-	 *            the element tag for the child
+-	 * @return the text content
+-	 */
+-	public static String getChildElementContent(Element parent, String tag) {
+-		final Element[] elements = getElementArray(parent, tag);
+-		if (elements.length == 0)
+-			return null;
+-
+-		return elements[0].getTextContent();
+-	}
+-
+-
+-
+-	/**
+-	 * @param parent
+-	 * @param tag
+-	 * @return all child elements of the parent with the specified tag
+-	 */
+-	public static Element[] getElementArray(Element parent, String tag) {
+-		if (!parent.hasChildNodes())
+-			return new Element[0];
+-
+-		final NodeList nodeList = parent.getChildNodes();
+-		final LinkedList<Element> elementlist = new LinkedList<Element>();
+-		for (int i = 0; i < nodeList.getLength(); i++) {
+-
+-			final Node element = nodeList.item(i);
+-			if (element.getNodeType() == Node.ELEMENT_NODE && ((Element) element).getTagName().equals(tag)) {
+-				elementlist.add((Element) element);
+-			}
+-		}
+-		final Element[] elements = new Element[elementlist.size()];
+-
+-		return elementlist.toArray(elements);
+-	}
+-
+-	public static Element[] getElementArray(Element parent, String[] tags) {
+-		if (!parent.hasChildNodes())
+-			return new Element[0];
+-
+-		final NodeList nodeList = parent.getChildNodes();
+-		final LinkedList<Element> elementlist = new LinkedList<Element>();
+-		for (int ii = 0; ii < nodeList.getLength(); ii++) {
+-
+-			final Node element = nodeList.item(ii);
+-			if (element.getNodeType() == Node.ELEMENT_NODE) {
+-				//Loop through all possible tags
+-				for (int jj=0; jj<tags.length; jj++) {
+-					if (((Element) element).getTagName().equals(tags[jj])) {
+-						elementlist.add((Element) element);
+-						break;
+-					}
+-				}
+-			}
+-		}
+-
+-		final Element[] elements = new Element[elementlist.size()];
+-		return elementlist.toArray(elements);
+-	}
+-
+-	/**
+-	 * Prints the Document object to the console. as XML.
+-	 *
+-	 * @param doc
+-	 */
+-	public static String printToScreen(Document doc) {
+-
+-		final javax.xml.transform.TransformerFactory tfactory = TransformerFactory
+-				.newInstance();
+-
+-		javax.xml.transform.Transformer xform;
+-		try {
+-			xform = tfactory.newTransformer();
+-
+-			final javax.xml.transform.Source src = new javax.xml.transform.dom.DOMSource(
+-					doc);
+-
+-			final java.io.StringWriter writer = new java.io.StringWriter();
+-			final javax.xml.transform.Result result = new javax.xml.transform.stream.StreamResult(
+-					writer);
+-
+-			xform.transform(src, result);
+-
+-			return writer.toString();
+-
+-		} catch (final TransformerConfigurationException e) {
+-			// TODO Auto-generated catch block
+-			e.printStackTrace();
+-		} catch (final TransformerException e) {
+-			// TODO Auto-generated catch block
+-			e.printStackTrace();
+-		}
+-		return null;
+-	}
+-
+-
+-
+-	/**
+-	 * Reads an XML file and writes it into a Document structure.
+-	 *
+-	 * @param filepath
+-	 * @param xsdpath
+-	 *            the path of the W3 XML schema that the file is based on.
+-	 * @throws GUIBuildException
+-	 */
+-	public static Document readXML(String filepath, String xsdpath)
+-			throws GUIBuildException {
+-
+-		/* read XML file and write it into Document structure */
+-
+-		final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+-		dbf.setIgnoringComments(true);
+-		dbf.setValidating(true);
+-		dbf.setIgnoringElementContentWhitespace(true);
+-
+-		dbf.setAttribute(
+-				"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
+-				"http://www.w3.org/2001/XMLSchema");
+-		dbf.setAttribute(
+-				"http://java.sun.com/xml/jaxp/properties/schemaSource", xsdpath);
+-
+-
+-		DocumentBuilder db;
+-		Document doc;
+-
+-		try {
+-
+-			db = dbf.newDocumentBuilder();
+-			doc = db.parse(filepath);
+-		} catch (final ParserConfigurationException e) {
+-			throw new GUIBuildException(e.getMessage());
+-		} catch (final SAXException e) {
+-			throw new GUIBuildException(e.getMessage());
+-		} catch (final IOException e) {
+-			throw new GUIBuildException(e.getMessage());
+-		}
+-
+-		doc.normalize();
+-		doc.normalizeDocument();
+-
+-		resolveIncludes(doc, xsdpath);
+-		resolveReferences(doc);
+-		recursivelyResolveSections(doc.getDocumentElement(), null);
+-		recursivelyResolveReplaces(doc.getDocumentElement(), null);
+-
+-		return doc;
+-	}
+-
+-	/**
+-	 * This method recursively traverses the document tree and replaces all
+-	 * parameters that contain replace elements with the corresponding number of
+-	 * cloned elements.
+-	 *
+-	 * @param current
+-	 *            the current element
+-	 * @param parentReplace
+-	 *
+-	 */
+-	public static void recursivelyResolveReplaces(Element current,
+-			String parentReplace) {
+-
+-		final String[] replacements = XMLHelper.findApplicableValues(
+-				current, "replace", "name", parentReplace);
+-
+-		/* delete replace children */
+-		final Element[] replaceChildren = XMLHelper.getElementArray(current,
+-				"replace");
+-		for (final Element replace : replaceChildren) {
+-			current.removeChild(replace);
+-		}
+-
+-		if (replacements == null) {
+-			final NodeList childNodes = current.getChildNodes();
+-			final Node[] nodes = new Node[childNodes.getLength()];
+-			for (int i = 0; i < childNodes.getLength(); i++) {
+-				nodes[i] = childNodes.item(i);
+-			}
+-
+-			for (final Node node : nodes) {
+-				if (node.getNodeType() == Node.ELEMENT_NODE) {
+-					XMLHelper.recursivelyResolveReplaces((Element) node,
+-							parentReplace);
+-				}
+-			}
+-		} else if (replacements.length == 0) {
+-			current.getParentNode().removeChild(current);
+-		} else if (replacements != null) {
+-			/* clone element */
+-			for (final String replace : replacements) {
+-				final Element clone = (Element) current.cloneNode(true);
+-				clone.setAttribute("key",
+-						clone.getAttribute("key").replaceAll("%", replace));
+-				clone.setAttribute("replaced", replace);
+-				current.getParentNode().appendChild(clone);
+-
+-				/* Recursion: Do not do recursion on NodeList as it is updated */
+-				final NodeList childNodes = clone.getChildNodes();
+-				final Node[] nodes = new Node[childNodes.getLength()];
+-				for (int i = 0; i < childNodes.getLength(); i++) {
+-					nodes[i] = childNodes.item(i);
+-				}
+-
+-				for (final Node node : nodes) {
+-					if (node.getNodeType() == Node.ELEMENT_NODE) {
+-						XMLHelper.recursivelyResolveReplaces((Element) node,
+-								replace);
+-					}
+-				}
+-
+-			}
+-			current.getParentNode().removeChild(current);
+-		}
+-	}
+-
+-	/**
+-	 * This method recursively traverses the document tree and replaces all
+-	 * parameters that contain section elements with the corresponding number of
+-	 * cloned elements.
+-	 *
+-	 * @param current
+-	 */
+-	public static void recursivelyResolveSections(Element current,
+-			String parentSection) {
+-
+-		final String[] sections = XMLHelper.findApplicableValues(current,
+-				"section", "name", parentSection);
+-
+-
+-		final Element[] sectionChildren = XMLHelper.getElementArray(current,
+-				"section");
+-		for (final Element section : sectionChildren) {
+-			current.removeChild(section);
+-		}
+-
+-		if (sections == null) {
+-			final NodeList childNodes = current.getChildNodes();
+-			final Node[] nodes = new Node[childNodes.getLength()];
+-			for (int i = 0; i < childNodes.getLength(); i++) {
+-				nodes[i] = childNodes.item(i);
+-			}
+-
+-			for (final Node node : nodes) {
+-				if (node.getNodeType() == Node.ELEMENT_NODE) {
+-					XMLHelper.recursivelyResolveSections((Element) node,
+-							parentSection);
+-				}
+-			}
+-		} else if (sections != null) {
+-			/* clone element */
+-			for (final String section : sections) {
+-				final Element clone = (Element) current.cloneNode(true);
+-				clone.setAttribute("section", section);
+-
+-				current.getParentNode().appendChild(clone);
+-
+-				/* Recursion: Do not do recursion on NodeList as it is updated */
+-				final NodeList childNodes = clone.getChildNodes();
+-				final Node[] nodes = new Node[childNodes.getLength()];
+-				for (int i = 0; i < childNodes.getLength(); i++) {
+-					nodes[i] = childNodes.item(i);
+-				}
+-
+-				for (final Node node : nodes) {
+-					if (node.getNodeType() == Node.ELEMENT_NODE) {
+-						XMLHelper.recursivelyResolveSections((Element) node,
+-								section);
+-					}
+-				}
+-
+-			}
+-			current.getParentNode().removeChild(current);
+-		}
+-	}
+-
+-	/**
+-	 * Parses an XML file as specified in the path of an "include" element and
+-	 * replaces the include element with the content of the XML file.
+-	 *
+-	 * @param doc
+-	 */
+-	public static Document resolveIncludes(Document doc, String xsdpath) {
+-		final NodeList include = doc.getElementsByTagName("include");
+-
+-		for (int i = 0; i < include.getLength(); i++) {
+-
+-			final String includePath = ((Element) include.item(i))
+-					.getAttribute("path");
+-
+-			try {
+-				final Document partialDocument = readXML(includePath, xsdpath);
+-
+-				final NodeList children = partialDocument.getChildNodes()
+-						.item(0).getChildNodes();
+-				final Node parent = include.item(i).getParentNode();
+-
+-				for (int j = 0; j < children.getLength(); j++) {
+-					final Node imported = doc
+-							.importNode(children.item(j), true);
+-					parent.appendChild(imported);
+-				}
+-
+-				// parent.replaceChild(fragment, include.item(i));
+-			} catch (final GUIBuildException e) {
+-				// TODO Auto-generated catch block
+-				e.printStackTrace();
+-			}
+-
+-		}
+-
+-		return doc;
+-	}
+-
+-	/**
+-	 * Manipulates the document structure, so that "reference" elements are
+-	 * replaced by the corresponding "parametergroup".
+-	 *
+-	 * @param doc
+-	 * @return
+-	 */
+-	public static Document resolveReferences(Document doc) {
+-
+-		final NodeList references = doc.getElementsByTagName("reference");
+-		final NodeList parametergroups = doc.getElementsByTagName("parametergroup");
+-
+-		while (references.getLength() != 0) {
+-
+-			final Element referenceElement = (Element) references.item(0);
+-
+-			final Element parent = (Element) referenceElement.getParentNode();
+-
+-			parent.removeChild(referenceElement);
+-
+-			for (int i = 0; i < parametergroups.getLength(); i++) {
+-
+-				final Node parametergroupElement = parametergroups.item(i);
+-
+-				if (((Element) parametergroupElement).getAttribute("name")
+-						.equals(referenceElement.getAttribute("name"))) {
+-					final NodeList children = parametergroupElement
+-							.getChildNodes();
+-
+-					for (int j = 0; j < children.getLength(); j++) {
+-						final Node clone = children.item(j).cloneNode(true);
+-						parent.appendChild(clone);
+-					}
+-				}
+-			}
+-		}
+-
+-		while (parametergroups.getLength() != 0) {
+-			parametergroups.item(0).getParentNode()
+-					.removeChild(parametergroups.item(0));
+-		}
+-
+-		return doc;
+-	}
+-
+-
+-	/**
+-	 * @brief  The funciton expects a Node element as argument and transform the XML
+-	 *         (sub)tree starting with the given Node into a string
+-	 * @return A string representing the (sub)tree starting with node
+-	 * @author Thomas Egger
+-	 */
+-	public static String getString(Node node){
+-		String str = "";
+-
+-		try {
+-			Transformer transformer = TransformerFactory.newInstance().newTransformer();
+-			StringWriter buffer = new StringWriter();
+-			transformer.transform(new DOMSource(node), new StreamResult(buffer));
+-			str = buffer.toString();
+-		} catch (Exception ex) {
+-			throw new RuntimeException("Error converting to String", ex);
+-		}
+-
+-		return str;
+-	}
+-}
+Index: ../trunk-jpl/src/java/src/main/GUI.java
+===================================================================
+--- ../trunk-jpl/src/java/src/main/GUI.java	(revision 17982)
++++ ../trunk-jpl/src/java/src/main/GUI.java	(revision 17983)
+@@ -1,548 +0,0 @@
+-/***********************************************************************************/
+-/*  Copyright 2012 WSL Institute for Snow and Avalanche Research    SLF-DAVOS      */
+-/***********************************************************************************/
+-/*	This file is part of INIshell.
+-*
+-*   INIshell 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 3 of the License, or
+-*   (at your option) any later version.
+-*
+-*   INIshell 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 INIshell.  If not, see <http://www.gnu.org/licenses/>.
+-*
+-*/
+-
+-package main;
+-
+-import gui_elements.ControlledPanel;
+-import gui_elements.GUIBuildException;
+-
+-import java.awt.BorderLayout;
+-import java.awt.Color;
+-import java.awt.Component;
+-import java.awt.Container;
+-import java.awt.Desktop;
+-import java.awt.*;
+-import java.awt.event.ActionEvent;
+-import java.awt.event.ActionListener;
+-import java.awt.event.WindowEvent;
+-import java.awt.event.WindowListener;
+-import java.io.IOException;
+-import java.net.URISyntaxException;
+-import java.util.HashMap;
+-import java.util.LinkedList;
+-
+-import javax.swing.BoxLayout;
+-import javax.swing.ImageIcon;
+-import javax.swing.JButton;
+-import javax.swing.JEditorPane;
+-import javax.swing.JFileChooser;
+-import javax.swing.JFrame;
+-import javax.swing.JOptionPane;
+-import javax.swing.JPanel;
+-import javax.swing.JScrollPane;
+-import javax.swing.JTabbedPane;
+-import javax.swing.JToolBar;
+-import javax.swing.event.HyperlinkEvent;
+-import javax.swing.event.HyperlinkListener;
+-import javax.swing.filechooser.FileNameExtensionFilter;
+-import java.io.*;
+-import javax.swing.*;
+-import java.awt.*;
+-import java.awt.event.*;
+-
+-import net.miginfocom.swing.MigLayout;
+-
+-/**
+- * The GUI created by the author.
+- *
+- * @author korhammer et egger
+- *
+- */
+-public class GUI extends JFrame implements WindowListener, ActionListener, HyperlinkListener {
+-
+-	/**
+-	 *
+-	 */
+-	private static final long serialVersionUID = -2428732881181670225L;
+-	public static PanelNode rootNode = null;
+-
+-	private static String title = GUI.class.getPackage().getImplementationTitle() + " " + GUI.class.getPackage().getImplementationVersion();
+-
+-	public static final Color LABEL_COLOR = Color.decode("#000080");
+-	public static Color NORMAL_BACKGROUND_COLOR = Color.decode("#EEEEEE");
+-	public static Color WARNING_BACKGROUND_COLOR = Color.decode("#FF0011");
+-
+-	public static ImageIcon openicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/xml_open.png"));
+-	public static ImageIcon openiniicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/fileopen.png"));
+-	public static ImageIcon exporticon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/filesave.png"));
+-	public static ImageIcon previewicon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/kghostview.png"));
+-	public static ImageIcon reseticon = new ImageIcon(GUI.class.getClassLoader().getResource("resources/icons/reset.png"));
+-
+-	private final JButton createbutton;
+-	private final JButton previewButton;
+-	private final JButton openbutton;
+-	private final JButton openinibutton;
+-	private final JButton resetbutton;
+-
+-	private final JTabbedPane tabpane;
+-	private final JToolBar toolbar;
+-	private HashMap<String,JPanel> tabpanels;
+-
+-	private String configFilePath, iniFilePath;
+-
+-	/*
+-	 * Creates a window with the static components of the GUI, i.e. components
+-	 * that do not depend on the configuration file.
+-	 */
+-	public GUI() throws GUIBuildException {
+-		super(title);
+-
+-		configFilePath = System.getProperty("user.dir");
+-		iniFilePath = System.getProperty("user.dir");
+-
+-		tabpanels = new HashMap<String,JPanel>();
+-
+-		Dimension screenDim = new Dimension(1280, 800);
+-		Dimension maxDim = null;
+-
+-		if (this.getMaximizedBounds() == null) {
+-			Toolkit tk = Toolkit.getDefaultToolkit();
+-			maxDim = tk.getScreenSize();
+-			this.setMaximizedBounds(new Rectangle(0, 0, (int)maxDim.getWidth(), (int)maxDim.getHeight()));
+-		} else {
+-			maxDim = this.getMaximizedBounds().getSize();
+-		}
+-
+-		if (maxDim.height < screenDim.height) {
+-			screenDim.height = maxDim.height;
+-			if (screenDim.height > 100)
+-				screenDim.height -= 25;
+-		}
+-
+-		if (maxDim.width < screenDim.width) {
+-			screenDim.width = maxDim.width;
+-			if (screenDim.width > 100)
+-				screenDim.width -= 25;
+-		}
+-
+-		this.setSize(screenDim);
+-		//this.setExtendedState(MAXIMIZED_BOTH);
+-		this.setVisible(true);
+-		this.setLayout(new BorderLayout());
+-
+-		this.toolbar = new JToolBar();
+-		toolbar.setLayout(new BoxLayout(toolbar, 1));
+-		toolbar.setFloatable(false);
+-		this.setVisible(true);
+-		this.add(toolbar, BorderLayout.WEST);
+-
+-		this.tabpane = new JTabbedPane();
+-		this.add(tabpane);
+-		tabpane.setVisible(true);
+-
+-		this.openbutton = new JButton(openicon);
+-		this.openbutton.setActionCommand("open config");
+-		this.openbutton.setToolTipText("Open XML-configuration");
+-		openbutton.addActionListener(this);
+-		toolbar.add(this.openbutton);
+-
+-		this.openinibutton = new JButton(openiniicon);
+-		this.openinibutton.setActionCommand("open ini");
+-		this.openinibutton.setToolTipText("Open existing INI file");
+-		openinibutton.addActionListener(this);
+-		toolbar.add(this.openinibutton);
+-
+-		this.resetbutton = new JButton(reseticon);
+-		this.resetbutton.setActionCommand("reset");
+-		this.resetbutton.setToolTipText("Reset Interface");
+-		resetbutton.addActionListener(this);
+-		toolbar.add(this.resetbutton);
+-
+-		this.createbutton = new JButton(exporticon);
+-		this.createbutton.setActionCommand("write config");
+-		this.createbutton.setToolTipText("Write to INI-file");
+-		createbutton.addActionListener(this);
+-		toolbar.add(this.createbutton);
+-
+-		this.previewButton = new JButton(previewicon);
+-		this.previewButton.setActionCommand("preview");
+-		this.previewButton.setToolTipText("Preview INI-file");
+-		previewButton.addActionListener(this);
+-		toolbar.add(previewButton);
+-
+-		this.addWindowListener(this);
+-
+-		rootNode = new PanelNode("");
+-	}
+-
+-	/**
+-	 * Writes the application name into the GUI window title bar.
+-	 *
+-	 * @param application
+-	 */
+-	public void setApplicationForTitle(String application){
+-		if(application.equals("")){
+-			this.setTitle(title);
+-		}
+-		else{
+-			this.setTitle(title + " for "+application);
+-		}
+-	}
+-
+-	public void hideOpenButton(){
+-		openbutton.setVisible(false);
+-	}
+-
+-	/**
+-	 * Closes all tabs.
+-	 */
+-	public void closeAllTabs(){
+-		tabpane.removeAll();
+-	}
+-
+-	/**
+-	 * Adds a component to the tab specified and creates the tab if it does not
+-	 * already exist.
+-	 *
+-	 * @param comp
+-	 * @param tabName
+-	 * @throws GUIBuildException
+-	 */
+-	public void addToTab(ControlledPanel comp, String tabName, ControlledPanel parentPanel) throws GUIBuildException {
+-		tabName = Character.toUpperCase(tabName.charAt(0)) + tabName.substring(1).toLowerCase();
+-
+-		String section = ((ControlledPanel)comp).getSection().toUpperCase();
+-		String key = section + "::" + ((ControlledPanel)comp).getKey();//((ControlledPanel)comp).getHashKey();
+-		//System.out.println("\tPanel: " + ((ControlledPanel)comp).getHashKey() + "   Section: " + ((ControlledPanel)comp).getSection());
+-
+-		PanelNode sectionNode = rootNode.getChild(section);
+-		if (sectionNode == null) {
+-			PanelNode tmp = new PanelNode(section);
+-			//System.out.println("\t--Adding section '" + section + "' to tree");
+-			sectionNode = rootNode.add(tmp);
+-		}
+-
+-		if (parentPanel != null) {
+-			//System.out.println("\tLooking for node: " + parentPanel.getHashKey());
+-			sectionNode = sectionNode.get(parentPanel.getSection().toUpperCase() + "::" + parentPanel.getKey());
+-		}
+-
+-		if (sectionNode != null) {
+-			PanelNode keyNode = sectionNode.get(key);
+-			if (keyNode == null) {
+-				PanelNode tmp = new PanelNode(key);
+-				keyNode = sectionNode.add(tmp);
+-				//System.out.println("\t--Adding key '" + key + "' to tree as leaf to " + sectionNode.getData());
+-			}
+-		}
+-
+-		JPanel tab;
+-		if (tabpane.indexOfTab(tabName) == -1) {
+-
+-			tab = new JPanel();
+-			tab.setBackground(Color.white);
+-			tab.setVisible(true);
+-			tab.setLayout(new MigLayout("wrap 1"));
+-
+-			JScrollPane scrollpane = new JScrollPane(tab);
+-			tabpane.add(tabName, scrollpane);
+-			tabpanels.put(tabName, tab);
+-
+-		} else {
+-			tab = tabpanels.get(tabName);
+-		}
+-
+-		if (parentPanel != null && containsPanel(tab, parentPanel)) {
+-			parentPanel.add(comp, "span");
+-		} else {
+-			tab.add(comp);
+-		}
+-
+-		//JViewport jv = ((JScrollPane)tabpane.getComponentAt(tabpane.indexOfTab(tabName))).getViewport();
+-		//jv.setViewPosition(new Point(0,0));
+-
+-		this.validate();
+-	}
+-
+-	public void removeFromTab(ControlledPanel parameterPanel, String section, ControlledPanel parentPanel) {
+-		final String tabTitle = section.substring(0, 1).toUpperCase() + section.substring(1).toLowerCase();
+-		final int index = tabpane.indexOfTab(tabTitle);
+-
+-		final Container container = (Container) tabpane.getComponentAt(index);
+-
+-		//System.out.println("Removing Panel: " + parameterPanel.getHashKey());
+-		PanelNode tmp = rootNode.get(parameterPanel.getSection().toUpperCase() + "::" + parameterPanel.getKey());
+-		tmp.getParent().remove(tmp);
+-
+-		if (parentPanel != null && containsPanel(container, parentPanel)) {
+-			parentPanel.remove(parameterPanel);
+-		} else {
+-			container.remove(parameterPanel);
+-		}
+-
+-		GUIBuilder.panelControl.remove(section, parameterPanel.getKey());
+-
+-		container.repaint();
+-		this.validate();
+-	}
+-
+-	public boolean containsPanel(Container container, JPanel panel) {
+-
+-		for (final Component component : container.getComponents()) {
+-			if (component == panel)
+-				return true;
+-			if (containsPanel((Container) component, panel))
+-				return true;
+-		}
+-		return false;
+-	}
+-
+-	@Override
+-	public void actionPerformed(ActionEvent e) {
+-		if (e.getActionCommand().equals("write config") && GUIBuilder.application!=null ) {
+-			GUIBuilder.panelControl.setRootNode(rootNode);
+-
+-			try {
+-				GUIBuilder.printIOFile();
+-			} catch (final IOException e1) {
+-				// TODO Auto-generated catch block
+-				e1.printStackTrace();
+-			} catch (final GUIBuildException e2) {
+-				// TODO Auto-generated catch block
+-				e2.printStackTrace();
+-			}
+-		} else if (e.getActionCommand().equals("preview") && GUIBuilder.application!=null) {
+-			GUIBuilder.panelControl.setRootNode(rootNode);
+-			previewINIFile();
+-		} else if (e.getActionCommand().equals("reset") && GUIBuilder.application!=null) {
+-			resetGUI();
+-		} else if( (e.getActionCommand().equals("open config"))) {
+-			openFile();
+-		} else if( (e.getActionCommand().equals("open ini"))) {
+-			openINIFile();
+-		}
+-	}
+-
+-	public void resetGUI() {
+-		try {
+-			int returnval = GUIBuilder.closeFile();
+-			if (returnval == JOptionPane.CANCEL_OPTION) return;
+-			GUIBuilder.buildGUI(GUIBuilder.currentConfigFile);
+-		} catch (GUIBuildException e) {
+-			e.printStackTrace();
+-		}
+-	}
+-
+-	public void previewINIFile(){
+-		JFrame frame = new JFrame();
+-		frame.setSize(600,800);
+-		frame.setVisible(true);
+-		//frame.setLayout(new BorderLayout());
+-
+-		JEditorPane pane = new JEditorPane();
+-
+-		pane.setText(GUIBuilder.panelControl.toString());
+-		pane.setVisible(true);
+-		pane.setEditable(false);
+-
+-		JScrollPane scrollPane = new JScrollPane(pane);
+-		scrollPane.setVisible(true);
+-		frame.add(scrollPane);
+-
+-		frame.validate();
+-		frame.repaint();
+-	}
+-
+-	public void openINIFile(){
+-		final FileNameExtensionFilter inifilter = new FileNameExtensionFilter(".ini files", "ini");
+-		final JFileChooser filechooser = new JFileChooser(iniFilePath);
+-		filechooser.setFileFilter(inifilter);
+-		final int returnval = filechooser.showOpenDialog(new JPanel());
+-
+-		HashMap<String, String> hm = new HashMap<String, String>();
+-		HashMap<String, String> comments = new HashMap<String, String>();
+-		HashMap<String, String> added_comments = new HashMap<String, String>();
+-
+-		if (returnval == JFileChooser.APPROVE_OPTION) {
+-			final String path = filechooser.getSelectedFile().toString();
+-			if (filechooser.getSelectedFile().isDirectory()) return;
+-
+-			iniFilePath = filechooser.getSelectedFile().getParent();
+-
+-			System.out.println("Opening INI file: " + path);
+-
+-			try {
+-				BufferedReader br = new BufferedReader(new FileReader(path));
+-				String line;
+-
+-				String section = "GENERAL::";
+-				String clines = "";
+-
+-				while((line = br.readLine()) != null) {
+-					int offset = line.indexOf(";");
+-					int offset2 = line.indexOf("#");
+-
+-					if ((offset2 != -1) && (offset != -1)) {
+-						if (offset2 < offset) offset = offset2;
+-					} else if ((offset2 != -1) && (offset == -1)) {
+-						offset = offset2;
+-					}
+-
+-					String comment = null;
+-				     //System.out.println("CLINES" + clines);
+-					if (offset != -1) {
+-						//System.out.println("COMMENT: " + line.substring(offset));
+-						comment = line.substring(offset);
+-					} else {
+-						//System.out.println("COMMENTLESS");
+-					}
+-
+-					if (-1 != offset) line = line.substring(0, offset);
+-
+-					offset = line.indexOf("#");
+-					if (-1 != offset) line = line.substring(0, offset);
+-
+-					line = line.trim(); //take away ws
+-
+-					if (line.length()>1) {
+-
+-						if (line.charAt(0) == '[') {
+-							offset = line.indexOf("]");
+-							if ((offset == -1) || (offset <= 1)) continue;
+-
+-							if (!clines.equals("")) {
+-								int lbr = clines.indexOf("\n");
+-								clines = clines.substring(0, lbr);
+-								//System.out.println("Adding the precomment: " + clines);
+-								comments.put(section, clines);
+-								clines = "";
+-							}
+-
+-							section = line.substring(1, offset).toUpperCase() + "::";
+-							//System.out.println("New Section: " + section);
+-
+-						} else {
+-							String[] tokens = line.split("=");
+-							if (tokens.length == 2) {
+-								String key = tokens[0].trim();
+-								String value = tokens[1].trim();
+-								if (key.length() > 0) {
+-									hm.put(section + key.toUpperCase(), value);
+-									if (comment != null) added_comments.put(section + key.toUpperCase(), comment);
+-									if (!clines.equals("")) {
+-										//System.out.println("Adding the precomment: " + clines);
+-										comments.put(section + key.toUpperCase(), clines);
+-										clines = "";
+-									}
+-								}
+-							}
+-						}
+-
+-						//System.out.println(line);
+-					} else {
+-						//it was a comment line only, associate it with the next key
+-						if (comment != null) clines += comment;
+-						clines += "\n";
+-					}
+-				}
+-				br.close();
+-
+-				GUIBuilder.setValues(hm, added_comments, comments);
+-			} catch (Exception e) {
+-					// TODO Auto-generated catch block
+-					e.printStackTrace();
+-			}
+-		}
+-	}
+-
+-	public void openFile(){
+-		/* If a configuration is already open, ask for close. */
+-		final FileNameExtensionFilter xmlfilter = new FileNameExtensionFilter(".xml files", "xml");
+-		final JFileChooser filechooser = new JFileChooser(configFilePath);
+-		filechooser.setFileFilter(xmlfilter);
+-		final int returnval = filechooser.showOpenDialog(new JPanel());
+-		if (returnval == JFileChooser.APPROVE_OPTION) {
+-			if(GUIBuilder.application != null){
+-				final int returnval2 = GUIBuilder.closeFile();
+-				if (returnval2 == JOptionPane.CANCEL_OPTION) return;
+-			}
+-
+-			final String path = filechooser.getSelectedFile().toString();
+-			if (filechooser.getSelectedFile().isDirectory()) return;
+-
+-			configFilePath = filechooser.getSelectedFile().getParent();
+-
+-			try {
+-				GUIBuilder.buildGUI(path);
+-			} catch (GUIBuildException e) {
+-				// TODO Auto-generated catch block
+-				e.printStackTrace();
+-			}
+-		}
+-	}
+-
+-	@Override
+-	public void windowActivated(WindowEvent e) {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void windowClosed(WindowEvent e) {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void windowClosing(WindowEvent e) {
+-		System.exit(NORMAL);
+-
+-	}
+-
+-	@Override
+-	public void windowDeactivated(WindowEvent e) {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void windowDeiconified(WindowEvent e) {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void windowIconified(WindowEvent e) {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void windowOpened(WindowEvent e) {
+-		// TODO Auto-generated method stub
+-
+-	}
+-
+-	@Override
+-	public void hyperlinkUpdate(HyperlinkEvent e) {
+-
+-		if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+-		      try {
+-				Desktop.getDesktop().browse(e.getURL().toURI());
+-			} catch (IOException e1) {
+-				// TODO Auto-generated catch block
+-				e1.printStackTrace();
+-			} catch (URISyntaxException e1) {
+-				// TODO Auto-generated catch block
+-				e1.printStackTrace();
+-			}
+-		}
+-	}
+-}
+Index: ../trunk-jpl/src/java/COPYING
+===================================================================
+--- ../trunk-jpl/src/java/COPYING	(revision 17982)
++++ ../trunk-jpl/src/java/COPYING	(revision 17983)
+@@ -1,674 +0,0 @@
+-                    GNU GENERAL PUBLIC LICENSE
+-                       Version 3, 29 June 2007
+-
+- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+- Everyone is permitted to copy and distribute verbatim copies
+- of this license document, but changing it is not allowed.
+-
+-                            Preamble
+-
+-  The GNU General Public License is a free, copyleft license for
+-software and other kinds of works.
+-
+-  The licenses for most software and other practical works are designed
+-to take away your freedom to share and change the works.  By contrast,
+-the GNU General Public License is intended to guarantee your freedom to
+-share and change all versions of a program--to make sure it remains free
+-software for all its users.  We, the Free Software Foundation, use the
+-GNU General Public License for most of our software; it applies also to
+-any other work released this way by its authors.  You can apply it to
+-your programs, too.
+-
+-  When we speak of free software, we are referring to freedom, not
+-price.  Our General Public Licenses are designed to make sure that you
+-have the freedom to distribute copies of free software (and charge for
+-them if you wish), that you receive source code or can get it if you
+-want it, that you can change the software or use pieces of it in new
+-free programs, and that you know you can do these things.
+-
+-  To protect your rights, we need to prevent others from denying you
+-these rights or asking you to surrender the rights.  Therefore, you have
+-certain responsibilities if you distribute copies of the software, or if
+-you modify it: responsibilities to respect the freedom of others.
+-
+-  For example, if you distribute copies of such a program, whether
+-gratis or for a fee, you must pass on to the recipients the same
+-freedoms that you received.  You must make sure that they, too, receive
+-or can get the source code.  And you must show them these terms so they
+-know their rights.
+-
+-  Developers that use the GNU GPL protect your rights with two steps:
+-(1) assert copyright on the software, and (2) offer you this License
+-giving you legal permission to copy, distribute and/or modify it.
+-
+-  For the developers' and authors' protection, the GPL clearly explains
+-that there is no warranty for this free software.  For both users' and
+-authors' sake, the GPL requires that modified versions be marked as
+-changed, so that their problems will not be attributed erroneously to
+-authors of previous versions.
+-
+-  Some devices are designed to deny users access to install or run
+-modified versions of the software inside them, although the manufacturer
+-can do so.  This is fundamentally incompatible with the aim of
+-protecting users' freedom to change the software.  The systematic
+-pattern of such abuse occurs in the area of products for individuals to
+-use, which is precisely where it is most unacceptable.  Therefore, we
+-have designed this version of the GPL to prohibit the practice for those
+-products.  If such problems arise substantially in other domains, we
+-stand ready to extend this provision to those domains in future versions
+-of the GPL, as needed to protect the freedom of users.
+-
+-  Finally, every program is threatened constantly by software patents.
+-States should not allow patents to restrict development and use of
+-software on general-purpose computers, but in those that do, we wish to
+-avoid the special danger that patents applied to a free program could
+-make it effectively proprietary.  To prevent this, the GPL assures that
+-patents cannot be used to render the program non-free.
+-
+-  The precise terms and conditions for copying, distribution and
+-modification follow.
+-
+-                       TERMS AND CONDITIONS
+-
+-  0. Definitions.
+-
+-  "This License" refers to version 3 of the GNU General Public License.
+-
+-  "Copyright" also means copyright-like laws that apply to other kinds of
+-works, such as semiconductor masks.
+-
+-  "The Program" refers to any copyrightable work licensed under this
+-License.  Each licensee is addressed as "you".  "Licensees" and
+-"recipients" may be individuals or organizations.
+-
+-  To "modify" a work means to copy from or adapt all or part of the work
+-in a fashion requiring copyright permission, other than the making of an
+-exact copy.  The resulting work is called a "modified version" of the
+-earlier work or a work "based on" the earlier work.
+-
+-  A "covered work" means either the unmodified Program or a work based
+-on the Program.
+-
+-  To "propagate" a work means to do anything with it that, without
+-permission, would make you directly or secondarily liable for
+-infringement under applicable copyright law, except executing it on a
+-computer or modifying a private copy.  Propagation includes copying,
+-distribution (with or without modification), making available to the
+-public, and in some countries other activities as well.
+-
+-  To "convey" a work means any kind of propagation that enables other
+-parties to make or receive copies.  Mere interaction with a user through
+-a computer network, with no transfer of a copy, is not conveying.
+-
+-  An interactive user interface displays "Appropriate Legal Notices"
+-to the extent that it includes a convenient and prominently visible
+-feature that (1) displays an appropriate copyright notice, and (2)
+-tells the user that there is no warranty for the work (except to the
+-extent that warranties are provided), that licensees may convey the
+-work under this License, and how to view a copy of this License.  If
+-the interface presents a list of user commands or options, such as a
+-menu, a prominent item in the list meets this criterion.
+-
+-  1. Source Code.
+-
+-  The "source code" for a work means the preferred form of the work
+-for making modifications to it.  "Object code" means any non-source
+-form of a work.
+-
+-  A "Standard Interface" means an interface that either is an official
+-standard defined by a recognized standards body, or, in the case of
+-interfaces specified for a particular programming language, one that
+-is widely used among developers working in that language.
+-
+-  The "System Libraries" of an executable work include anything, other
+-than the work as a whole, that (a) is included in the normal form of
+-packaging a Major Component, but which is not part of that Major
+-Component, and (b) serves only to enable use of the work with that
+-Major Component, or to implement a Standard Interface for which an
+-implementation is available to the public in source code form.  A
+-"Major Component", in this context, means a major essential component
+-(kernel, window system, and so on) of the specific operating system
+-(if any) on which the executable work runs, or a compiler used to
+-produce the work, or an object code interpreter used to run it.
+-
+-  The "Corresponding Source" for a work in object code form means all
+-the source code needed to generate, install, and (for an executable
+-work) run the object code and to modify the work, including scripts to
+-control those activities.  However, it does not include the work's
+-System Libraries, or general-purpose tools or generally available free
+-programs which are used unmodified in performing those activities but
+-which are not part of the work.  For example, Corresponding Source
+-includes interface definition files associated with source files for
+-the work, and the source code for shared libraries and dynamically
+-linked subprograms that the work is specifically designed to require,
+-such as by intimate data communication or control flow between those
+-subprograms and other parts of the work.
+-
+-  The Corresponding Source need not include anything that users
+-can regenerate automatically from other parts of the Corresponding
+-Source.
+-
+-  The Corresponding Source for a work in source code form is that
+-same work.
+-
+-  2. Basic Permissions.
+-
+-  All rights granted under this License are granted for the term of
+-copyright on the Program, and are irrevocable provided the stated
+-conditions are met.  This License explicitly affirms your unlimited
+-permission to run the unmodified Program.  The output from running a
+-covered work is covered by this License only if the output, given its
+-content, constitutes a covered work.  This License acknowledges your
+-rights of fair use or other equivalent, as provided by copyright law.
+-
+-  You may make, run and propagate covered works that you do not
+-convey, without conditions so long as your license otherwise remains
+-in force.  You may convey covered works to others for the sole purpose
+-of having them make modifications exclusively for you, or provide you
+-with facilities for running those works, provided that you comply with
+-the terms of this License in conveying all material for which you do
+-not control copyright.  Those thus making or running the covered works
+-for you must do so exclusively on your behalf, under your direction
+-and control, on terms that prohibit them from making any copies of
+-your copyrighted material outside their relationship with you.
+-
+-  Conveying under any other circumstances is permitted solely under
+-the conditions stated below.  Sublicensing is not allowed; section 10
+-makes it unnecessary.
+-
+-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+-
+-  No covered work shall be deemed part of an effective technological
+-measure under any applicable law fulfilling obligations under article
+-11 of the WIPO copyright treaty adopted on 20 December 1996, or
+-similar laws prohibiting or restricting circumvention of such
+-measures.
+-
+-  When you convey a covered work, you waive any legal power to forbid
+-circumvention of technological measures to the extent such circumvention
+-is effected by exercising rights under this License with respect to
+-the covered work, and you disclaim any intention to limit operation or
+-modification of the work as a means of enforcing, against the work's
+-users, your or third parties' legal rights to forbid circumvention of
+-technological measures.
+-
+-  4. Conveying Verbatim Copies.
+-
+-  You may convey verbatim copies of the Program's source code as you
+-receive it, in any medium, provided that you conspicuously and
+-appropriately publish on each copy an appropriate copyright notice;
+-keep intact all notices stating that this License and any
+-non-permissive terms added in accord with section 7 apply to the code;
+-keep intact all notices of the absence of any warranty; and give all
+-recipients a copy of this License along with the Program.
+-
+-  You may charge any price or no price for each copy that you convey,
+-and you may offer support or warranty protection for a fee.
+-
+-  5. Conveying Modified Source Versions.
+-
+-  You may convey a work based on the Program, or the modifications to
+-produce it from the Program, in the form of source code under the
+-terms of section 4, provided that you also meet all of these conditions:
+-
+-    a) The work must carry prominent notices stating that you modified
+-    it, and giving a relevant date.
+-
+-    b) The work must carry prominent notices stating that it is
+-    released under this License and any conditions added under section
+-    7.  This requirement modifies the requirement in section 4 to
+-    "keep intact all notices".
+-
+-    c) You must license the entire work, as a whole, under this
+-    License to anyone who comes into possession of a copy.  This
+-    License will therefore apply, along with any applicable section 7
+-    additional terms, to the whole of the work, and all its parts,
+-    regardless of how they are packaged.  This License gives no
+-    permission to license the work in any other way, but it does not
+-    invalidate such permission if you have separately received it.
+-
+-    d) If the work has interactive user interfaces, each must display
+-    Appropriate Legal Notices; however, if the Program has interactive
+-    interfaces that do not display Appropriate Legal Notices, your
+-    work need not make them do so.
+-
+-  A compilation of a covered work with other separate and independent
+-works, which are not by their nature extensions of the covered work,
+-and which are not combined with it such as to form a larger program,
+-in or on a volume of a storage or distribution medium, is called an
+-"aggregate" if the compilation and its resulting copyright are not
+-used to limit the access or legal rights of the compilation's users
+-beyond what the individual works permit.  Inclusion of a covered work
+-in an aggregate does not cause this License to apply to the other
+-parts of the aggregate.
+-
+-  6. Conveying Non-Source Forms.
+-
+-  You may convey a covered work in object code form under the terms
+-of sections 4 and 5, provided that you also convey the
+-machine-readable Corresponding Source under the terms of this License,
+-in one of these ways:
+-
+-    a) Convey the object code in, or embodied in, a physical product
+-    (including a physical distribution medium), accompanied by the
+-    Corresponding Source fixed on a durable physical medium
+-    customarily used for software interchange.
+-
+-    b) Convey the object code in, or embodied in, a physical product
+-    (including a physical distribution medium), accompanied by a
+-    written offer, valid for at least three years and valid for as
+-    long as you offer spare parts or customer support for that product
+-    model, to give anyone who possesses the object code either (1) a
+-    copy of the Corresponding Source for all the software in the
+-    product that is covered by this License, on a durable physical
+-    medium customarily used for software interchange, for a price no
+-    more than your reasonable cost of physically performing this
+-    conveying of source, or (2) access to copy the
+-    Corresponding Source from a network server at no charge.
+-
+-    c) Convey individual copies of the object code with a copy of the
+-    written offer to provide the Corresponding Source.  This
+-    alternative is allowed only occasionally and noncommercially, and
+-    only if you received the object code with such an offer, in accord
+-    with subsection 6b.
+-
+-    d) Convey the object code by offering access from a designated
+-    place (gratis or for a charge), and offer equivalent access to the
+-    Corresponding Source in the same way through the same place at no
+-    further charge.  You need not require recipients to copy the
+-    Corresponding Source along with the object code.  If the place to
+-    copy the object code is a network server, the Corresponding Source
+-    may be on a different server (operated by you or a third party)
+-    that supports equivalent copying facilities, provided you maintain
+-    clear directions next to the object code saying where to find the
+-    Corresponding Source.  Regardless of what server hosts the
+-    Corresponding Source, you remain obligated to ensure that it is
+-    available for as long as needed to satisfy these requirements.
+-
+-    e) Convey the object code using peer-to-peer transmission, provided
+-    you inform other peers where the object code and Corresponding
+-    Source of the work are being offered to the general public at no
+-    charge under subsection 6d.
+-
+-  A separable portion of the object code, whose source code is excluded
+-from the Corresponding Source as a System Library, need not be
+-included in conveying the object code work.
+-
+-  A "User Product" is either (1) a "consumer product", which means any
+-tangible personal property which is normally used for personal, family,
+-or household purposes, or (2) anything designed or sold for incorporation
+-into a dwelling.  In determining whether a product is a consumer product,
+-doubtful cases shall be resolved in favor of coverage.  For a particular
+-product received by a particular user, "normally used" refers to a
+-typical or common use of that class of product, regardless of the status
+-of the particular user or of the way in which the particular user
+-actually uses, or expects or is expected to use, the product.  A product
+-is a consumer product regardless of whether the product has substantial
+-commercial, industrial or non-consumer uses, unless such uses represent
+-the only significant mode of use of the product.
+-
+-  "Installation Information" for a User Product means any methods,
+-procedures, authorization keys, or other information required to install
+-and execute modified versions of a covered work in that User Product from
+-a modified version of its Corresponding Source.  The information must
+-suffice to ensure that the continued functioning of the modified object
+-code is in no case prevented or interfered with solely because
+-modification has been made.
+-
+-  If you convey an object code work under this section in, or with, or
+-specifically for use in, a User Product, and the conveying occurs as
+-part of a transaction in which the right of possession and use of the
+-User Product is transferred to the recipient in perpetuity or for a
+-fixed term (regardless of how the transaction is characterized), the
+-Corresponding Source conveyed under this section must be accompanied
+-by the Installation Information.  But this requirement does not apply
+-if neither you nor any third party retains the ability to install
+-modified object code on the User Product (for example, the work has
+-been installed in ROM).
+-
+-  The requirement to provide Installation Information does not include a
+-requirement to continue to provide support service, warranty, or updates
+-for a work that has been modified or installed by the recipient, or for
+-the User Product in which it has been modified or installed.  Access to a
+-network may be denied when the modification itself materially and
+-adversely affects the operation of the network or violates the rules and
+-protocols for communication across the network.
+-
+-  Corresponding Source conveyed, and Installation Information provided,
+-in accord with this section must be in a format that is publicly
+-documented (and with an implementation available to the public in
+-source code form), and must require no special password or key for
+-unpacking, reading or copying.
+-
+-  7. Additional Terms.
+-
+-  "Additional permissions" are terms that supplement the terms of this
+-License by making exceptions from one or more of its conditions.
+-Additional permissions that are applicable to the entire Program shall
+-be treated as though they were included in this License, to the extent
+-that they are valid under applicable law.  If additional permissions
+-apply only to part of the Program, that part may be used separately
+-under those permissions, but the entire Program remains governed by
+-this License without regard to the additional permissions.
+-
+-  When you convey a copy of a covered work, you may at your option
+-remove any additional permissions from that copy, or from any part of
+-it.  (Additional permissions may be written to require their own
+-removal in certain cases when you modify the work.)  You may place
+-additional permissions on material, added by you to a covered work,
+-for which you have or can give appropriate copyright permission.
+-
+-  Notwithstanding any other provision of this License, for material you
+-add to a covered work, you may (if authorized by the copyright holders of
+-that material) supplement the terms of this License with terms:
+-
+-    a) Disclaiming warranty or limiting liability differently from the
+-    terms of sections 15 and 16 of this License; or
+-
+-    b) Requiring preservation of specified reasonable legal notices or
+-    author attributions in that material or in the Appropriate Legal
+-    Notices displayed by works containing it; or
+-
+-    c) Prohibiting misrepresentation of the origin of that material, or
+-    requiring that modified versions of such material be marked in
+-    reasonable ways as different from the original version; or
+-
+-    d) Limiting the use for publicity purposes of names of licensors or
+-    authors of the material; or
+-
+-    e) Declining to grant rights under trademark law for use of some
+-    trade names, trademarks, or service marks; or
+-
+-    f) Requiring indemnification of licensors and authors of that
+-    material by anyone who conveys the material (or modified versions of
+-    it) with contractual assumptions of liability to the recipient, for
+-    any liability that these contractual assumptions directly impose on
+-    those licensors and authors.
+-
+-  All other non-permissive additional terms are considered "further
+-restrictions" within the meaning of section 10.  If the Program as you
+-received it, or any part of it, contains a notice stating that it is
+-governed by this License along with a term that is a further
+-restriction, you may remove that term.  If a license document contains
+-a further restriction but permits relicensing or conveying under this
+-License, you may add to a covered work material governed by the terms
+-of that license document, provided that the further restriction does
+-not survive such relicensing or conveying.
+-
+-  If you add terms to a covered work in accord with this section, you
+-must place, in the relevant source files, a statement of the
+-additional terms that apply to those files, or a notice indicating
+-where to find the applicable terms.
+-
+-  Additional terms, permissive or non-permissive, may be stated in the
+-form of a separately written license, or stated as exceptions;
+-the above requirements apply either way.
+-
+-  8. Termination.
+-
+-  You may not propagate or modify a covered work except as expressly
+-provided under this License.  Any attempt otherwise to propagate or
+-modify it is void, and will automatically terminate your rights under
+-this License (including any patent licenses granted under the third
+-paragraph of section 11).
+-
+-  However, if you cease all violation of this License, then your
+-license from a particular copyright holder is reinstated (a)
+-provisionally, unless and until the copyright holder explicitly and
+-finally terminates your license, and (b) permanently, if the copyright
+-holder fails to notify you of the violation by some reasonable means
+-prior to 60 days after the cessation.
+-
+-  Moreover, your license from a particular copyright holder is
+-reinstated permanently if the copyright holder notifies you of the
+-violation by some reasonable means, this is the first time you have
+-received notice of violation of this License (for any work) from that
+-copyright holder, and you cure the violation prior to 30 days after
+-your receipt of the notice.
+-
+-  Termination of your rights under this section does not terminate the
+-licenses of parties who have received copies or rights from you under
+-this License.  If your rights have been terminated and not permanently
+-reinstated, you do not qualify to receive new licenses for the same
+-material under section 10.
+-
+-  9. Acceptance Not Required for Having Copies.
+-
+-  You are not required to accept this License in order to receive or
+-run a copy of the Program.  Ancillary propagation of a covered work
+-occurring solely as a consequence of using peer-to-peer transmission
+-to receive a copy likewise does not require acceptance.  However,
+-nothing other than this License grants you permission to propagate or
+-modify any covered work.  These actions infringe copyright if you do
+-not accept this License.  Therefore, by modifying or propagating a
+-covered work, you indicate your acceptance of this License to do so.
+-
+-  10. Automatic Licensing of Downstream Recipients.
+-
+-  Each time you convey a covered work, the recipient automatically
+-receives a license from the original licensors, to run, modify and
+-propagate that work, subject to this License.  You are not responsible
+-for enforcing compliance by third parties with this License.
+-
+-  An "entity transaction" is a transaction transferring control of an
+-organization, or substantially all assets of one, or subdividing an
+-organization, or merging organizations.  If propagation of a covered
+-work results from an entity transaction, each party to that
+-transaction who receives a copy of the work also receives whatever
+-licenses to the work the party's predecessor in interest had or could
+-give under the previous paragraph, plus a right to possession of the
+-Corresponding Source of the work from the predecessor in interest, if
+-the predecessor has it or can get it with reasonable efforts.
+-
+-  You may not impose any further restrictions on the exercise of the
+-rights granted or affirmed under this License.  For example, you may
+-not impose a license fee, royalty, or other charge for exercise of
+-rights granted under this License, and you may not initiate litigation
+-(including a cross-claim or counterclaim in a lawsuit) alleging that
+-any patent claim is infringed by making, using, selling, offering for
+-sale, or importing the Program or any portion of it.
+-
+-  11. Patents.
+-
+-  A "contributor" is a copyright holder who authorizes use under this
+-License of the Program or a work on which the Program is based.  The
+-work thus licensed is called the contributor's "contributor version".
+-
+-  A contributor's "essential patent claims" are all patent claims
+-owned or controlled by the contributor, whether already acquired or
+-hereafter acquired, that would be infringed by some manner, permitted
+-by this License, of making, using, or selling its contributor version,
+-but do not include claims that would be infringed only as a
+-consequence of further modification of the contributor version.  For
+-purposes of this definition, "control" includes the right to grant
+-patent sublicenses in a manner consistent with the requirements of
+-this License.
+-
+-  Each contributor grants you a non-exclusive, worldwide, royalty-free
+-patent license under the contributor's essential patent claims, to
+-make, use, sell, offer for sale, import and otherwise run, modify and
+-propagate the contents of its contributor version.
+-
+-  In the following three paragraphs, a "patent license" is any express
+-agreement or commitment, however denominated, not to enforce a patent
+-(such as an express permission to practice a patent or covenant not to
+-sue for patent infringement).  To "grant" such a patent license to a
+-party means to make such an agreement or commitment not to enforce a
+-patent against the party.
+-
+-  If you convey a covered work, knowingly relying on a patent license,
+-and the Corresponding Source of the work is not available for anyone
+-to copy, free of charge and under the terms of this License, through a
+-publicly available network server or other readily accessible means,
+-then you must either (1) cause the Corresponding Source to be so
+-available, or (2) arrange to deprive yourself of the benefit of the
+-patent license for this particular work, or (3) arrange, in a manner
+-consistent with the requirements of this License, to extend the patent
+-license to downstream recipients.  "Knowingly relying" means you have
+-actual knowledge that, but for the patent license, your conveying the
+-covered work in a country, or your recipient's use of the covered work
+-in a country, would infringe one or more identifiable patents in that
+-country that you have reason to believe are valid.
+-
+-  If, pursuant to or in connection with a single transaction or
+-arrangement, you convey, or propagate by procuring conveyance of, a
+-covered work, and grant a patent license to some of the parties
+-receiving the covered work authorizing them to use, propagate, modify
+-or convey a specific copy of the covered work, then the patent license
+-you grant is automatically extended to all recipients of the covered
+-work and works based on it.
+-
+-  A patent license is "discriminatory" if it does not include within
+-the scope of its coverage, prohibits the exercise of, or is
+-conditioned on the non-exercise of one or more of the rights that are
+-specifically granted under this License.  You may not convey a covered
+-work if you are a party to an arrangement with a third party that is
+-in the business of distributing software, under which you make payment
+-to the third party based on the extent of your activity of conveying
+-the work, and under which the third party grants, to any of the
+-parties who would receive the covered work from you, a discriminatory
+-patent license (a) in connection with copies of the covered work
+-conveyed by you (or copies made from those copies), or (b) primarily
+-for and in connection with specific products or compilations that
+-contain the covered work, unless you entered into that arrangement,
+-or that patent license was granted, prior to 28 March 2007.
+-
+-  Nothing in this License shall be construed as excluding or limiting
+-any implied license or other defenses to infringement that may
+-otherwise be available to you under applicable patent law.
+-
+-  12. No Surrender of Others' Freedom.
+-
+-  If conditions are imposed on you (whether by court order, agreement or
+-otherwise) that contradict the conditions of this License, they do not
+-excuse you from the conditions of this License.  If you cannot convey a
+-covered work so as to satisfy simultaneously your obligations under this
+-License and any other pertinent obligations, then as a consequence you may
+-not convey it at all.  For example, if you agree to terms that obligate you
+-to collect a royalty for further conveying from those to whom you convey
+-the Program, the only way you could satisfy both those terms and this
+-License would be to refrain entirely from conveying the Program.
+-
+-  13. Use with the GNU Affero General Public License.
+-
+-  Notwithstanding any other provision of this License, you have
+-permission to link or combine any covered work with a work licensed
+-under version 3 of the GNU Affero General Public License into a single
+-combined work, and to convey the resulting work.  The terms of this
+-License will continue to apply to the part which is the covered work,
+-but the special requirements of the GNU Affero General Public License,
+-section 13, concerning interaction through a network will apply to the
+-combination as such.
+-
+-  14. Revised Versions of this License.
+-
+-  The Free Software Foundation may publish revised and/or new versions of
+-the GNU General Public License from time to time.  Such new versions will
+-be similar in spirit to the present version, but may differ in detail to
+-address new problems or concerns.
+-
+-  Each version is given a distinguishing version number.  If the
+-Program specifies that a certain numbered version of the GNU General
+-Public License "or any later version" applies to it, you have the
+-option of following the terms and conditions either of that numbered
+-version or of any later version published by the Free Software
+-Foundation.  If the Program does not specify a version number of the
+-GNU General Public License, you may choose any version ever published
+-by the Free Software Foundation.
+-
+-  If the Program specifies that a proxy can decide which future
+-versions of the GNU General Public License can be used, that proxy's
+-public statement of acceptance of a version permanently authorizes you
+-to choose that version for the Program.
+-
+-  Later license versions may give you additional or different
+-permissions.  However, no additional obligations are imposed on any
+-author or copyright holder as a result of your choosing to follow a
+-later version.
+-
+-  15. Disclaimer of Warranty.
+-
+-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+-
+-  16. Limitation of Liability.
+-
+-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+-SUCH DAMAGES.
+-
+-  17. Interpretation of Sections 15 and 16.
+-
+-  If the disclaimer of warranty and limitation of liability provided
+-above cannot be given local legal effect according to their terms,
+-reviewing courts shall apply local law that most closely approximates
+-an absolute waiver of all civil liability in connection with the
+-Program, unless a warranty or assumption of liability accompanies a
+-copy of the Program in return for a fee.
+-
+-                     END OF TERMS AND CONDITIONS
+-
+-            How to Apply These Terms to Your New Programs
+-
+-  If you develop a new program, and you want it to be of the greatest
+-possible use to the public, the best way to achieve this is to make it
+-free software which everyone can redistribute and change under these terms.
+-
+-  To do so, attach the following notices to the program.  It is safest
+-to attach them to the start of each source file to most effectively
+-state the exclusion of warranty; and each file should have at least
+-the "copyright" line and a pointer to where the full notice is found.
+-
+-    <one line to give the program's name and a brief idea of what it does.>
+-    Copyright (C) <year>  <name of author>
+-
+-    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 3 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, see <http://www.gnu.org/licenses/>.
+-
+-Also add information on how to contact you by electronic and paper mail.
+-
+-  If the program does terminal interaction, make it output a short
+-notice like this when it starts in an interactive mode:
+-
+-    <program>  Copyright (C) <year>  <name of author>
+-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+-    This is free software, and you are welcome to redistribute it
+-    under certain conditions; type `show c' for details.
+-
+-The hypothetical commands `show w' and `show c' should show the appropriate
+-parts of the General Public License.  Of course, your program's commands
+-might be different; for a GUI interface, you would use an "about box".
+-
+-  You should also get your employer (if you work as a programmer) or school,
+-if any, to sign a "copyright disclaimer" for the program, if necessary.
+-For more information on this, and how to apply and follow the GNU GPL, see
+-<http://www.gnu.org/licenses/>.
+-
+-  The GNU General Public License does not permit incorporating your program
+-into proprietary programs.  If your program is a subroutine library, you
+-may consider it more useful to permit linking proprietary applications with
+-the library.  If this is what you want to do, use the GNU Lesser General
+-Public License instead of this License.  But first, please read
+-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+Index: ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp
+===================================================================
+--- ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17982)
++++ ../trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp	(revision 17983)
+@@ -88,221 +88,10 @@
+ }/*}}}*/
+ ElementMatrix* LevelsetAnalysis::CreateKMatrix(Element* element){/*{{{*/
+ 
+-	if(!element->IsOnBase()) return NULL;
+-	Element* basalelement = element->SpawnBasalElement();
+-
+-	/*Intermediaries */
+-	int  dim, domaintype;
+-	int i, row, col;
+-	IssmDouble kappa;
+-	IssmDouble Jdet, dt, D_scalar;
+-	IssmDouble h,hx,hy,hz;
+-	IssmDouble vel, calvingrate;
+-	IssmDouble norm_dlsf;
+-	IssmDouble* xyz_list = NULL;
+-
+-	/*Get problem dimension*/
+-	basalelement->FindParam(&domaintype,DomainTypeEnum);
+-	switch(domaintype){
+-		case Domain2DverticalEnum:   dim = 1; break;
+-		case Domain2DhorizontalEnum: dim = 2; break;
+-		case Domain3DEnum:           dim = 2; break;
+-		default: _error_("mesh "<<EnumToStringx(domaintype)<<" not supported yet");
+-	}
+-
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes    = basalelement->GetNumberOfNodes();
+-
+-	/*Initialize Element vector and other vectors*/
+-	ElementMatrix* Ke       = basalelement->NewElementMatrix();
+-	IssmDouble*    basis    = xNew<IssmDouble>(numnodes);
+-	IssmDouble*    B        = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble*    Bprime   = xNew<IssmDouble>(dim*numnodes);
+-	IssmDouble*    D        = xNew<IssmDouble>(dim*dim);
+-	IssmDouble*    v        = xNew<IssmDouble>(dim);
+-	IssmDouble*    w        = xNew<IssmDouble>(dim);
+-	IssmDouble*    c        = xNew<IssmDouble>(dim);
+-	IssmDouble*    dlsf     = xNew<IssmDouble>(dim);
+-
+-	/*Retrieve all inputs and parameters*/
+-	basalelement->GetVerticesCoordinates(&xyz_list);
+-	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	Input* vx_input=NULL;
+-	Input* vy_input=NULL;
+-	if(domaintype==Domain2DhorizontalEnum){
+-		vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+-		vy_input=basalelement->GetInput(VyEnum); _assert_(vy_input);
+-	}
+-	else{
+-		if(dim==1){
+-			vx_input=basalelement->GetInput(VxEnum); _assert_(vx_input);
+-		}
+-		if(dim==2){
+-			vx_input=basalelement->GetInput(VxAverageEnum); _assert_(vx_input);
+-			vy_input=basalelement->GetInput(VyAverageEnum); _assert_(vy_input);
+-		}
+-	}
+-
+-	Input* lsf_slopex_input  = basalelement->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
+-	Input* lsf_slopey_input  = basalelement->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
+-	Input* calvingrate_input  = basalelement->GetInput(MasstransportCalvingrateEnum);     _assert_(calvingrate_input);
+-	
+-	/* Start  looping on the number of gaussian points: */
+-	Gauss* gauss=basalelement->NewGauss(2);
+-	for(int ig=gauss->begin();ig<gauss->end();ig++){
+-		gauss->GaussPoint(ig);
+-
+-		basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-		D_scalar=gauss->weight*Jdet;
+-
+-		/* Transient */
+-		if(dt!=0.){
+-			basalelement->NodalFunctions(basis,gauss);
+-			TripleMultiply(basis,numnodes,1,0,
+-						&D_scalar,1,1,0,
+-						basis,1,numnodes,0,
+-						&Ke->values[0],1);
+-			D_scalar*=dt;
+-		}
+-
+-		/* Advection */
+-		GetB(B,basalelement,xyz_list,gauss); 
+-		GetBprime(Bprime,basalelement,xyz_list,gauss); 
+-		vx_input->GetInputValue(&v[0],gauss); // in 3D case, add mesh velocity 
+-		vy_input->GetInputValue(&v[1],gauss); 
+-		lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
+-		lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
+-		calvingrate_input->GetInputValue(&calvingrate,gauss);
+-
+-		norm_dlsf=0.;
+-		for(i=0;i<dim;i++) norm_dlsf+=pow(dlsf[i],2);
+-		norm_dlsf=sqrt(norm_dlsf);
+-
+-		if(norm_dlsf>1.e-10)
+-			for(i=0;i<dim;i++) c[i]=calvingrate*dlsf[i]/norm_dlsf;
+-		else
+-			for(i=0;i<dim;i++) c[i]=0.;
+-		
+-		for(i=0;i<dim;i++) w[i]=v[i]-c[i];
+-
+-		for(row=0;row<dim;row++)
+-			for(col=0;col<dim;col++)
+-				if(row==col)
+-					D[row*dim+col]=D_scalar*w[row];
+-				else
+-				   D[row*dim+col]=0.;
+-
+-		TripleMultiply(B,dim,numnodes,1,
+-					D,dim,dim,0,
+-					Bprime,dim,numnodes,0,
+-					&Ke->values[0],1);
+-
+-		/* Stabilization */
+-		int stabilization=2;
+-		vel=0.;
+-		for(i=0;i<dim;i++) vel+=v[i]*v[i];
+-		vel=sqrt(vel)+1.e-14;
+-		switch(stabilization){
+-			case 0:
+-				// no stabilization, do nothing
+-				break;
+-			case 1:
+-				/* Artificial Diffusion */
+-				basalelement->ElementSizes(&hx,&hy,&hz);
+-				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) ); 
+-				kappa=h*vel/2.;
+-				for(row=0;row<dim;row++)
+-					for(col=0;col<dim;col++)
+-					if(row==col)
+-						D[row*dim+col]=D_scalar*kappa;
+-					else
+-						D[row*dim+col]=0.;
+-
+-				TripleMultiply(Bprime,dim,numnodes,1,
+-							D,dim,dim,0,
+-							Bprime,dim,numnodes,0,
+-							&Ke->values[0],1);
+-				break;	
+-			case 2:
+-				/* Streamline Upwinding */
+-				basalelement->ElementSizes(&hx,&hy,&hz);
+-				h=sqrt( pow(hx*v[0]/vel,2) + pow(hy*v[1]/vel,2) );
+-				for(row=0;row<dim;row++) 
+-					for(col=0;col<dim;col++) 
+-						D[row*dim+col] = D_scalar*h/(2.*vel)*v[row]*v[col];
+-
+-				TripleMultiply(Bprime,dim,numnodes,1,
+-							D,dim,dim,0,
+-							Bprime,dim,numnodes,0,
+-							&Ke->values[0],1);
+-				break;
+-			default:
+-				_error_("unknown type of stabilization in LevelsetAnalysis.cpp");
+-		}
+-	}
+-
+-	/*Clean up and return*/
+-	xDelete<IssmDouble>(xyz_list);
+-	xDelete<IssmDouble>(basis);
+-	xDelete<IssmDouble>(B);
+-	xDelete<IssmDouble>(D);
+-	xDelete<IssmDouble>(Bprime);
+-	xDelete<IssmDouble>(v);
+-	xDelete<IssmDouble>(w);
+-	xDelete<IssmDouble>(c);
+-	xDelete<IssmDouble>(dlsf);
+-	delete gauss;
+-	if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+-	return Ke;
++	_error_("not implemented yet");
+ }/*}}}*/
+ ElementVector* LevelsetAnalysis::CreatePVector(Element* element){/*{{{*/
+-	
+-	if(!element->IsOnBase()) return NULL;
+-	Element* basalelement = element->SpawnBasalElement();
+-
+-	/*Intermediaries */
+-	int i, ig, domaintype;
+-	IssmDouble  Jdet,dt;
+-	IssmDouble  lsf;
+-	IssmDouble* xyz_list = NULL;
+-	
+-	/*Fetch number of nodes and dof for this finite element*/
+-	int numnodes = basalelement->GetNumberOfNodes();
+-
+-	/*Initialize Element vector*/
+-	ElementVector* pe = basalelement->NewElementVector();
+-	basalelement->FindParam(&dt,TimesteppingTimeStepEnum);
+-	
+-	if(dt!=0.){
+-		/*Initialize basis vector*/
+-		IssmDouble*    basis = xNew<IssmDouble>(numnodes);
+-
+-		/*Retrieve all inputs and parameters*/
+-		basalelement->GetVerticesCoordinates(&xyz_list);
+-		Input* levelset_input     = basalelement->GetInput(MaskIceLevelsetEnum);                    _assert_(levelset_input);
+-
+-		/* Start  looping on the number of gaussian points: */
+-		Gauss* gauss=basalelement->NewGauss(2);
+-		for(ig=gauss->begin();ig<gauss->end();ig++){
+-			gauss->GaussPoint(ig);
+-
+-			basalelement->JacobianDeterminant(&Jdet,xyz_list,gauss);
+-			basalelement->NodalFunctions(basis,gauss);
+-
+-			/* old function value */
+-			levelset_input->GetInputValue(&lsf,gauss);
+-			for(i=0;i<numnodes;i++) pe->values[i]+=Jdet*gauss->weight*lsf*basis[i];
+-		}
+-
+-		/*Clean up and return*/
+-		xDelete<IssmDouble>(xyz_list);
+-		xDelete<IssmDouble>(basis);
+-		basalelement->FindParam(&domaintype,DomainTypeEnum);
+-		if(domaintype!=Domain2DhorizontalEnum){basalelement->DeleteMaterials(); delete basalelement;};
+-		delete gauss;
+-	}
+-
+-	return pe;
++	_error_("not implemented yet");
+ }/*}}}*/
+ void LevelsetAnalysis::GetSolutionFromInputs(Vector<IssmDouble>* solution,Element* element){/*{{{*/
+ 	_error_("not implemented yet");
+Index: ../trunk-jpl/configure.ac
+===================================================================
+--- ../trunk-jpl/configure.ac	(revision 17982)
++++ ../trunk-jpl/configure.ac	(revision 17983)
+@@ -1,7 +1,7 @@
+ # Process this file with autoconf to produce a configure script.
+ 
+ #AUTOCONF
+-AC_INIT([Ice Sheet System Model (ISSM)],[4.6],[issm@jpl.nasa.gov],[issm],[http://issm.jpl.nasa.gov]) #Initializing configure
++AC_INIT([Ice Sheet System Model (ISSM)],[4.7],[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
+ m4_include([m4/issm_options.m4])
Index: /issm/oecreview/Archive/17802-17983/ISSM-DocReview-17802-17983.tex
===================================================================
--- /issm/oecreview/Archive/17802-17983/ISSM-DocReview-17802-17983.tex	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/ISSM-DocReview-17802-17983.tex	(revision 17986)
@@ -0,0 +1,67 @@
+\documentclass[]{report}   % list options between brackets
+\usepackage{graphicx}              % list packages between braces
+
+% type user-defined commands here
+
+\begin{document}
+
+\title{JPL EXPORT ADMINISTRATION \\ DOCUMENT REVIEW RECORD}   % type title between braces
+\author{Tom Scavo}         % type author(s) between braces
+\date{October 27, 1995}    % type date between braces
+%\maketitle
+
+
+\begin{center}
+\begin{tabular}{ |c|c| }
+\hline
+JPL EXPORT ADMINISTRATION \\
+\textit{ DOCUMENT REVIEW RECORD} \\
+\hline
+\end{tabular}
+\end{center}
+
+\hfill Log \#: \underline{\input{LogNumber}}
+
+\vspace{1cm}
+\noindent (Note: This form and process do not replace the procedures described in JPL Policy relating to review and approval of proposals and contractual 
+documents. This process is intended to document the review and coordination of requests to ascertain the export control ramifications relating to specific 
+documents. Export Administration signature does not convey authority to export or release the "Exporter of Record" from any export laws or regulations.)\\
+
+\noindent \textbf{Program:} \underline{ISSM: Ice Sheet System Model} \\ \\
+\noindent \textbf{Person Requesting or Initiating Export}: \underline{Dr. Eric Larour}\\ \\
+\noindent \textbf{Date Received}: \underline{\input{Date}}\\ \\
+\noindent \textbf{Document Title/Description}: ISSM changes from revision \input{r1} to revision \input{r2} \\ \\
+\noindent \textbf{Release to:} \underline{http://issm.ess.uci.edu/svn/issm/issm/trunk on ISSM svn repository}\\ \\
+\noindent \textbf{JPL Intranet:} \underline{murdo.jpl.nasa.gov/proj/ice/larour/issm-uci/trunk-jpl}\\ \\
+
+\noindent \textbf{Disposition: 6 } 
+Does not contain export-controlled information. May be released/disclosed as requested subject to 
+Company guidelines on protection of proprietary information (if applicable). \\
+
+\noindent \textbf{Comments:}  see table of changes below. \\ \\
+\noindent \textbf{Reviewed by ISSM Export Transfer Liaison:} Dr. Eric Larour \hfill \textbf{Date:} \input{Date} \\ 
+\includegraphics[scale=1]{signature}
+
+\noindent JPL Export Administration Form TBS – June 29, 2011
+
+\begin{center}
+\line(1,0){250}
+\end{center}
+
+\noindent \textbf{Disposition:} \\
+1:	  Public Domain Information (Ref ITAR Section 120.11) \\
+2:	  Qualifies for ITAR Exemption				 \\
+3:	  Covered by Department of State License/Agreement Number					  \\
+4:	  Covered by Department of Commerce validated license or exception				 \\
+5:	  New License Required \\
+6:	  Does not contain export-controlled information.  May be released/disclosed as requested subject
+   to Company guidelines on protection of proprietary information (if applicable). \\
+7:	 Other (specify)   
+\begin{center}
+\line(1,0){250}
+\end{center}
+
+
+\input{log}
+
+\end{document}
Index: /issm/oecreview/Archive/17802-17983/LogNumber.tex
===================================================================
--- /issm/oecreview/Archive/17802-17983/LogNumber.tex	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/LogNumber.tex	(revision 17986)
@@ -0,0 +1,1 @@
+17802-17983
Index: /issm/oecreview/Archive/17802-17983/Makefile
===================================================================
--- /issm/oecreview/Archive/17802-17983/Makefile	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/Makefile	(revision 17986)
@@ -0,0 +1,8 @@
+TARGET=ISSM-DocReview-17802-17983
+
+all: 
+	pdflatex -interaction=errorstopmode -file-line-error -halt-on-error $(TARGET).tex
+	rm -rf *.log *.aux 
+
+clean:
+	rm -rf *.log *.aux
Index: /issm/oecreview/Archive/17802-17983/log.tex
===================================================================
--- /issm/oecreview/Archive/17802-17983/log.tex	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/log.tex	(revision 17986)
@@ -0,0 +1,1239 @@
+\noindent \textbf{Change \#1} with diff file ISSM-17804-17805.diff: \\
+Function name: \\
+D /issm/trunk-jpl/src/java\\
+Export determination: 6. \\
+Rationale: CHG: temp: removing java for sync, putting it back afterwards\\
+\vspace{3em}
+
+\noindent \textbf{Change \#2} with diff file ISSM-17805-17806.diff: \\
+Function name: \\
+M /issm/trunk-jpl A /issm/trunk-jpl/configs/configure.sh (from /issm/trunk/configs/configure.sh:17804) M /issm/trunk-jpl/src\\
+Export determination: 6. \\
+Rationale: merged trunk and trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#3} with diff file ISSM-17807-17808.diff: \\
+Function name: \\
+M /issm/trunk-jpl M /issm/trunk-jpl/src M /issm/trunk-jpl/test\\
+Export determination: 6. \\
+Rationale: Block revision 17806 from being merged into trunk-jpl\\
+\vspace{3em}
+
+\noindent \textbf{Change \#4} with diff file ISSM-17808-17809.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp A /issm/trunk-jpl/src/java A /issm/trunk-jpl/src/java/COPYING A /issm/trunk-jpl/src/java/Changelog\_1.0.0.txt A /issm/trunk-jpl/src/java/License.txt A /issm/trunk-jpl/src/java/MANIFEST.MF A /issm/trunk-jpl/src/java/build A /issm/trunk-jpl/src/java/build/gui\_elements A /issm/trunk-jpl/src/java/build/gui\_elements/AlternativePanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/CheckBoxPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/ColorCellRenderer.class A /issm/trunk-jpl/src/java/build/gui\_elements/CombinedPanel\$1.class A /issm/trunk-jpl/src/java/build/gui\_elements/CombinedPanel\$Type.class A /issm/trunk-jpl/src/java/build/gui\_elements/CombinedPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/ControlledPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/DecimalPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/DuplicatorPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/FramePanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/GUIBuildException.class A /issm/trunk-jpl/src/java/build/gui\_elements/IntegerPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/OptionPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/PathPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/SelectorPanel.class A /issm/trunk-jpl/src/java/build/gui\_elements/TextfieldPanel.class A /issm/trunk-jpl/src/java/build/main A /issm/trunk-jpl/src/java/build/main/GUI.class A /issm/trunk-jpl/src/java/build/main/GUIBuilder\$1.class A /issm/trunk-jpl/src/java/build/main/GUIBuilder.class A /issm/trunk-jpl/src/java/build/main/PanelControl.class A /issm/trunk-jpl/src/java/build/main/PanelNode.class A /issm/trunk-jpl/src/java/build/main/XMLHelper.class A /issm/trunk-jpl/src/java/build/resources A /issm/trunk-jpl/src/java/build/resources/config\_schema-0.1.1.xsd A /issm/trunk-jpl/src/java/build/resources/config\_schema.xsd A /issm/trunk-jpl/src/java/build/resources/default\_config.xml A /issm/trunk-jpl/src/java/build/resources/document-export-4.png A /issm/trunk-jpl/src/java/build/resources/document-open-2.png A /issm/trunk-jpl/src/java/build/resources/document-preview.png A /issm/trunk-jpl/src/java/build/resources/icons A /issm/trunk-jpl/src/java/build/resources/icons/advancedsettings.png A /issm/trunk-jpl/src/java/build/resources/icons/file\_ops.xcf A /issm/trunk-jpl/src/java/build/resources/icons/fileopen.png A /issm/trunk-jpl/src/java/build/resources/icons/filesave.png A /issm/trunk-jpl/src/java/build/resources/icons/filesaveas.png A /issm/trunk-jpl/src/java/build/resources/icons/ini\_open.png A /issm/trunk-jpl/src/java/build/resources/icons/kghostview.png A /issm/trunk-jpl/src/java/build/resources/icons/mydocuments.png A /issm/trunk-jpl/src/java/build/resources/icons/opensettings.png A /issm/trunk-jpl/src/java/build/resources/icons/readme.txt A /issm/trunk-jpl/src/java/build/resources/icons/reset.png A /issm/trunk-jpl/src/java/build/resources/icons/viewmag.png A /issm/trunk-jpl/src/java/build/resources/icons/xml\_open.png A /issm/trunk-jpl/src/java/build.xml A /issm/trunk-jpl/src/java/dist A /issm/trunk-jpl/src/java/dist/inishell.jar A /issm/trunk-jpl/src/java/doc A /issm/trunk-jpl/src/java/doc/examples A /issm/trunk-jpl/src/java/doc/examples/io.ini A /issm/trunk-jpl/src/java/doc/examples/issm.xml A /issm/trunk-jpl/src/java/doc/examples/meteoio\_config.xml A /issm/trunk-jpl/src/java/doc/examples/min\_example.xml A /issm/trunk-jpl/src/java/doc/examples/snowpack\_config.xml A /issm/trunk-jpl/src/java/inishell.sh A /issm/trunk-jpl/src/java/lib A /issm/trunk-jpl/src/java/lib/miglayout-4.0.jar A /issm/trunk-jpl/src/java/src A /issm/trunk-jpl/src/java/src/gui\_elements A /issm/trunk-jpl/src/java/src/gui\_elements/AlternativePanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/CheckBoxPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/CombinedPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/ControlledPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/DecimalPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/DuplicatorPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/FramePanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/GUIBuildException.java A /issm/trunk-jpl/src/java/src/gui\_elements/IntegerPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/OptionPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/PathPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/SelectorPanel.java A /issm/trunk-jpl/src/java/src/gui\_elements/TextfieldPanel.java A /issm/trunk-jpl/src/java/src/main A /issm/trunk-jpl/src/java/src/main/GUI.java A /issm/trunk-jpl/src/java/src/main/GUIBuilder.java A /issm/trunk-jpl/src/java/src/main/PanelControl.java A /issm/trunk-jpl/src/java/src/main/PanelNode.java A /issm/trunk-jpl/src/java/src/main/XMLHelper.java A /issm/trunk-jpl/src/java/src/resources A /issm/trunk-jpl/src/java/src/resources/config\_schema-0.1.1.xsd A /issm/trunk-jpl/src/java/src/resources/config\_schema.xsd A /issm/trunk-jpl/src/java/src/resources/default\_config.xml A /issm/trunk-jpl/src/java/src/resources/document-export-4.png A /issm/trunk-jpl/src/java/src/resources/document-open-2.png A /issm/trunk-jpl/src/java/src/resources/document-preview.png A /issm/trunk-jpl/src/java/src/resources/icons A /issm/trunk-jpl/src/java/src/resources/icons/advancedsettings.png A /issm/trunk-jpl/src/java/src/resources/icons/file\_ops.xcf A /issm/trunk-jpl/src/java/src/resources/icons/fileopen.png A /issm/trunk-jpl/src/java/src/resources/icons/filesave.png A /issm/trunk-jpl/src/java/src/resources/icons/filesaveas.png A /issm/trunk-jpl/src/java/src/resources/icons/ini\_open.png A /issm/trunk-jpl/src/java/src/resources/icons/kghostview.png A /issm/trunk-jpl/src/java/src/resources/icons/mydocuments.png A /issm/trunk-jpl/src/java/src/resources/icons/opensettings.png A /issm/trunk-jpl/src/java/src/resources/icons/readme.txt A /issm/trunk-jpl/src/java/src/resources/icons/reset.png A /issm/trunk-jpl/src/java/src/resources/icons/viewmag.png A /issm/trunk-jpl/src/java/src/resources/icons/xml\_open.png\\
+Export determination: 6. \\
+Rationale: CHG: back to normal\\
+\vspace{3em}
+
+\noindent \textbf{Change \#5} with diff file ISSM-17810-17811.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/extrusion/DepthAverage.m M /issm/trunk-jpl/src/m/extrusion/DepthAverage.py\\
+Export determination: 6. \\
+Rationale: BUG: Should check for Penta\\
+\vspace{3em}
+
+\noindent \textbf{Change \#6} with diff file ISSM-17811-17812.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: collapse accesses 2d mesh fields that no longer exist\\
+\vspace{3em}
+
+\noindent \textbf{Change \#7} with diff file ISSM-17812-17813.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: ADD: Compute Strainrates for Penta and Tria\\
+\vspace{3em}
+
+\noindent \textbf{Change \#8} with diff file ISSM-17813-17814.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test315.m M /issm/trunk-jpl/test/NightlyRun/test315.py M /issm/trunk-jpl/test/NightlyRun/test404.m M /issm/trunk-jpl/test/NightlyRun/test404.py M /issm/trunk-jpl/test/NightlyRun/test427.m M /issm/trunk-jpl/test/NightlyRun/test427.py M /issm/trunk-jpl/test/NightlyRun/test511.m M /issm/trunk-jpl/test/NightlyRun/test511.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#9} with diff file ISSM-17814-17815.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/linux64\_murdo\_ad M /issm/trunk-jpl/jenkins/linux64\_murdo\_ampi\\
+Export determination: 6. \\
+Rationale: BUG: deactivate GIA for AD\\
+\vspace{3em}
+
+\noindent \textbf{Change \#10} with diff file ISSM-17815-17816.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows\\
+Export determination: 6. \\
+Rationale: CHG: disable Gia in windows\\
+\vspace{3em}
+
+\noindent \textbf{Change \#11} with diff file ISSM-17816-17817.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/shared/Elements/Arrhenius.cpp M /issm/trunk-jpl/src/c/solutionsequences/solutionsequence\_newton.cpp\\
+Export determination: 6. \\
+Rationale: BUG: sime bug fixing\\
+\vspace{3em}
+
+\noindent \textbf{Change \#12} with diff file ISSM-17817-17818.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.py\\
+Export determination: 6. \\
+Rationale: CHG: damage model initialization\\
+\vspace{3em}
+
+\noindent \textbf{Change \#13} with diff file ISSM-17818-17819.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/mechanicalproperties.py\\
+Export determination: 6. \\
+Rationale: CHG: adding a print statement to remind user that damage-dependent properties are being calculated\\
+\vspace{3em}
+
+\noindent \textbf{Change \#14} with diff file ISSM-17819-17820.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: BUG: coerce ncols and nrows as ints\\
+\vspace{3em}
+
+\noindent \textbf{Change \#15} with diff file ISSM-17820-17821.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_manager.py M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: CHG: call applyoptions even if data is none\\
+\vspace{3em}
+
+\noindent \textbf{Change \#16} with diff file ISSM-17821-17822.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/latex2html A /issm/trunk-jpl/externalpackages/latex2html/install.sh\\
+Export determination: 6. \\
+Rationale: NEW: added latex2html\\
+\vspace{3em}
+
+\noindent \textbf{Change \#17} with diff file ISSM-17822-17823.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: CHG: added some options to define plot grid\\
+\vspace{3em}
+
+\noindent \textbf{Change \#18} with diff file ISSM-17823-17824.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py M /issm/trunk-jpl/test/NightlyRun/test274.m M /issm/trunk-jpl/test/NightlyRun/test274.py M /issm/trunk-jpl/test/NightlyRun/test285.m M /issm/trunk-jpl/test/NightlyRun/test285.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#19} with diff file ISSM-17824-17825.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Elements/Arrhenius.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed AD compile by removing printf statement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#20} with diff file ISSM-17825-17826.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: initializing some variables\\
+\vspace{3em}
+
+\noindent \textbf{Change \#21} with diff file ISSM-17826-17827.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#22} with diff file ISSM-17827-17828.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: overloaded ComputeStrainRate(), since used by module already\\
+\vspace{3em}
+
+\noindent \textbf{Change \#23} with diff file ISSM-17828-17829.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive3001.nc M /issm/trunk-jpl/test/Archives/Archive3004.nc M /issm/trunk-jpl/test/NightlyRun/test3001.m\\
+Export determination: 6. \\
+Rationale: BUG: fixed AD runs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#24} with diff file ISSM-17829-17830.diff: \\
+Function name: \\
+M /issm/trunk-jpl/jenkins/windows M /issm/trunk-jpl/test/NightlyRun/test804.m M /issm/trunk-jpl/test/NightlyRun/test804.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#25} with diff file ISSM-17830-17831.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive3101.nc M /issm/trunk-jpl/test/Archives/Archive3104.nc M /issm/trunk-jpl/test/NightlyRun/test3001.m M /issm/trunk-jpl/test/NightlyRun/test3001.py M /issm/trunk-jpl/test/NightlyRun/test3101.m M /issm/trunk-jpl/test/NightlyRun/test3101.py\\
+Export determination: 6. \\
+Rationale: CHG: updating AD tests\\
+\vspace{3em}
+
+\noindent \textbf{Change \#26} with diff file ISSM-17831-17832.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp A /issm/trunk-jpl/src/c/analyses/Balancethickness2Analysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/analyses.h M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/cores/AnalysisConfiguration.cpp M /issm/trunk-jpl/src/c/cores/CorePointerFromSolutionEnum.cpp A /issm/trunk-jpl/src/c/cores/balancethickness2\_core.cpp M /issm/trunk-jpl/src/c/cores/cores.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/c/shared/Enum/Synchronize.sh M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/consistency/ismodelselfconsistent.m M /issm/trunk-jpl/src/m/contrib/dassflow/importgmsh.m A /issm/trunk-jpl/src/m/enum/Balancethickness2AnalysisEnum.m A /issm/trunk-jpl/src/m/enum/Balancethickness2SolutionEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MeshVertexonboundaryEnum.m A /issm/trunk-jpl/src/m/enum/SigmaNNEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: added balancethickness2 solution for debugging with Jerome\\
+\vspace{3em}
+
+\noindent \textbf{Change \#27} with diff file ISSM-17832-17833.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/analyses.m4\\
+Export determination: 6. \\
+Rationale: NEW: added balancethickness2 solution for debugging with Jerome\\
+\vspace{3em}
+
+\noindent \textbf{Change \#28} with diff file ISSM-17833-17834.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp\\
+Export determination: 6. \\
+Rationale: BUG: initialize isdamage when copying\\
+\vspace{3em}
+
+\noindent \textbf{Change \#29} with diff file ISSM-17834-17835.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/SectionValues.py\\
+Export determination: 6. \\
+Rationale: CHG: InterpFromMeshToMesh3d now available for python version of SectionValues\\
+\vspace{3em}
+
+\noindent \textbf{Change \#30} with diff file ISSM-17835-17836.diff: \\
+Function name: \\
+D /issm/trunk-jpl/externalpackages/latex2html\\
+Export determination: 6. \\
+Rationale: DEL: not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#31} with diff file ISSM-17836-17837.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/robintemperature.py\\
+Export determination: 6. \\
+Rationale: BUG: forgot return statement\\
+\vspace{3em}
+
+\noindent \textbf{Change \#32} with diff file ISSM-17837-17838.diff: \\
+Function name: \\
+D /issm/trunk-jpl/externalpackages/ssh\\
+Export determination: 6. \\
+Rationale: DEL: not needed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#33} with diff file ISSM-17838-17839.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plot\_overlay.py\\
+Export determination: 6. \\
+Rationale: CHG: minor changes to plot options\\
+\vspace{3em}
+
+\noindent \textbf{Change \#34} with diff file ISSM-17839-17840.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp M /issm/trunk-jpl/src/c/cores/balancethickness2\_core.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/enum/Balancethickness2MisfitEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/NuXEnum.m A /issm/trunk-jpl/src/m/enum/NuYEnum.m A /issm/trunk-jpl/src/m/enum/PotentialEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: added some Enums for balancethickness2\\
+\vspace{3em}
+
+\noindent \textbf{Change \#35} with diff file ISSM-17840-17841.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/extrusion/project2d.py\\
+Export determination: 6. \\
+Rationale: BUG: don't collapse 2D arrays if they have more than once column\\
+\vspace{3em}
+
+\noindent \textbf{Change \#36} with diff file ISSM-17841-17842.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: CHG: extend colormap so that contours fully cover max/min of data\\
+\vspace{3em}
+
+\noindent \textbf{Change \#37} with diff file ISSM-17842-17843.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/classes/IoModel.h M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateNodes.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h\\
+Export determination: 6. \\
+Rationale: NEW: iomodel->faces now has all its vertices\\
+\vspace{3em}
+
+\noindent \textbf{Change \#38} with diff file ISSM-17843-17844.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: compute strain rates on GaussTria, not GaussPenta\\
+\vspace{3em}
+
+\noindent \textbf{Change \#39} with diff file ISSM-17844-17845.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h\\
+Export determination: 6. \\
+Rationale: NEW: use edgeonboundary to figure out whether an edge should be constrained or not\\
+\vspace{3em}
+
+\noindent \textbf{Change \#40} with diff file ISSM-17845-17846.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/dev/issmversion.m\\
+Export determination: 6. \\
+Rationale: CHG: updated copyright date\\
+\vspace{3em}
+
+\noindent \textbf{Change \#41} with diff file ISSM-17846-17847.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateFaces.cpp\\
+Export determination: 6. \\
+Rationale: NEW: Added Tets\\
+\vspace{3em}
+
+\noindent \textbf{Change \#42} with diff file ISSM-17847-17848.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/contrib/bamg/gmsh.m\\
+Export determination: 6. \\
+Rationale: NEW: gmsh to mesh with gmsh\\
+\vspace{3em}
+
+\noindent \textbf{Change \#43} with diff file ISSM-17848-17849.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive1101.nc M /issm/trunk-jpl/test/Archives/Archive1102.nc M /issm/trunk-jpl/test/Archives/Archive1103.nc M /issm/trunk-jpl/test/Archives/Archive1104.nc M /issm/trunk-jpl/test/Archives/Archive1105.nc M /issm/trunk-jpl/test/Archives/Archive1106.nc M /issm/trunk-jpl/test/Archives/Archive1107.nc M /issm/trunk-jpl/test/Archives/Archive1108.nc M /issm/trunk-jpl/test/NightlyRun/test1101.m M /issm/trunk-jpl/test/NightlyRun/test1102.m M /issm/trunk-jpl/test/NightlyRun/test1103.m M /issm/trunk-jpl/test/NightlyRun/test1104.m M /issm/trunk-jpl/test/NightlyRun/test1105.m M /issm/trunk-jpl/test/NightlyRun/test1106.m M /issm/trunk-jpl/test/NightlyRun/test1107.m M /issm/trunk-jpl/test/NightlyRun/test1108.m\\
+Export determination: 6. \\
+Rationale: CHG: trying to reduce weekly runs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#44} with diff file ISSM-17849-17850.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive455.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating P2 results since now interior edges are not constrained anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#45} with diff file ISSM-17850-17851.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/Balancethickness2Analysis.cpp M /issm/trunk-jpl/src/c/analyses/Balancethickness2Analysis.h M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/cores/balancethickness2\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/classes/balancethickness2.m A /issm/trunk-jpl/src/m/enum/BalancethicknessApparentMassbalanceEnum.m A /issm/trunk-jpl/src/m/enum/BalancethicknessNuxEnum.m A /issm/trunk-jpl/src/m/enum/BalancethicknessNuyEnum.m A /issm/trunk-jpl/src/m/enum/BalancethicknessSpcpotentialEnum.m A /issm/trunk-jpl/src/m/enum/BalancethicknessThicknessObsEnum.m A /issm/trunk-jpl/src/m/enum/BalancethicknessVxObsEnum.m A /issm/trunk-jpl/src/m/enum/BalancethicknessVyObsEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/NuXEnum.m D /issm/trunk-jpl/src/m/enum/NuYEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: added new enums for balancethickness2solution\\
+\vspace{3em}
+
+\noindent \textbf{Change \#46} with diff file ISSM-17851-17852.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim\\
+Export determination: 6. \\
+Rationale: CHG: updating hilighting\\
+\vspace{3em}
+
+\noindent \textbf{Change \#47} with diff file ISSM-17852-17853.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateSingleNodeToElementConnectivity.cpp\\
+Export determination: 6. \\
+Rationale: CHG: preparing thermal with tets\\
+\vspace{3em}
+
+\noindent \textbf{Change \#48} with diff file ISSM-17853-17854.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp\\
+Export determination: 6. \\
+Rationale: BUG: tetra edges must be created in the same order as the nodal functions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#49} with diff file ISSM-17854-17855.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp\\
+Export determination: 6. \\
+Rationale: CHG: gauss weights for faces needs to be consistent with reference element\\
+\vspace{3em}
+
+\noindent \textbf{Change \#50} with diff file ISSM-17855-17856.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed NormalBase and NormalTop for flowband models\\
+\vspace{3em}
+
+\noindent \textbf{Change \#51} with diff file ISSM-17856-17857.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/checkplotoptions.py\\
+Export determination: 6. \\
+Rationale: enabled text option for python plots\\
+\vspace{3em}
+
+\noindent \textbf{Change \#52} with diff file ISSM-17857-17858.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#53} with diff file ISSM-17858-17859.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed NR and sigma\_nn with right NormalBase\\
+\vspace{3em}
+
+\noindent \textbf{Change \#54} with diff file ISSM-17859-17860.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed contact condition for FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#55} with diff file ISSM-17860-17861.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added assert in NormalBase and NormalTop\\
+\vspace{3em}
+
+\noindent \textbf{Change \#56} with diff file ISSM-17861-17862.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test322.m M /issm/trunk-jpl/test/NightlyRun/test322.py M /issm/trunk-jpl/test/NightlyRun/test435.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#57} with diff file ISSM-17862-17863.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h A /issm/trunk-jpl/src/c/modules/InputDepthAverageAtBasex A /issm/trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.cpp A /issm/trunk-jpl/src/c/modules/InputDepthAverageAtBasex/InputDepthAverageAtBasex.h A /issm/trunk-jpl/src/c/modules/InputExtrudex A /issm/trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.cpp A /issm/trunk-jpl/src/c/modules/InputExtrudex/InputExtrudex.h M /issm/trunk-jpl/src/c/modules/modules.h\\
+Export determination: 6. \\
+Rationale: NEW: creating new modules to merge cores\\
+\vspace{3em}
+
+\noindent \textbf{Change \#58} with diff file ISSM-17863-17864.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp\\
+Export determination: 6. \\
+Rationale: BUG: last changes for sigmaNN and Contact\\
+\vspace{3em}
+
+\noindent \textbf{Change \#59} with diff file ISSM-17864-17865.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/materials/paterson.py\\
+Export determination: 6. \\
+Rationale: CHG: better handling of input in paterson\\
+\vspace{3em}
+
+\noindent \textbf{Change \#60} with diff file ISSM-17865-17866.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp M /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed tetra gaussian points\\
+\vspace{3em}
+
+\noindent \textbf{Change \#61} with diff file ISSM-17866-17867.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/gauss/GaussTetra.cpp\\
+Export determination: 6. \\
+Rationale: BUG: do not rescale gauss points at base\\
+\vspace{3em}
+
+\noindent \textbf{Change \#62} with diff file ISSM-17867-17868.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/holefiller.py\\
+Export determination: 6. \\
+Rationale: CHG: pass x and y directly; model not otherwise needed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#63} with diff file ISSM-17868-17869.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setmask.py\\
+Export determination: 6. \\
+Rationale: CHG: levelsets should only need to be rank-1 arrays\\
+\vspace{3em}
+
+\noindent \textbf{Change \#64} with diff file ISSM-17869-17870.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py\\
+Export determination: 6. \\
+Rationale: CHG: return axes control after plotting colorbar\\
+\vspace{3em}
+
+\noindent \textbf{Change \#65} with diff file ISSM-17870-17871.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py\\
+Export determination: 6. \\
+Rationale: CHG: starting to work on the rank-1 versus rank-2 issue in python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#66} with diff file ISSM-17871-17872.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#67} with diff file ISSM-17872-17873.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/m1qn3 A /issm/trunk-jpl/externalpackages/m1qn3/Makefile A /issm/trunk-jpl/externalpackages/m1qn3/install.sh\\
+Export determination: 6. \\
+Rationale: NEW: added m1qn3\\
+\vspace{3em}
+
+\noindent \textbf{Change \#68} with diff file ISSM-17873-17874.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/parameterization/setflowequation.py\\
+Export determination: 6. \\
+Rationale: BUG: reshape no longer needed if spc's are rank-1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#69} with diff file ISSM-17874-17875.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h\\
+Export determination: 6. \\
+Rationale: CHG: simplifying velocity and pressure nodal functions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#70} with diff file ISSM-17875-17876.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.h\\
+Export determination: 6. \\
+Rationale: CHG: simplifying reference elements for FS\\
+\vspace{3em}
+
+\noindent \textbf{Change \#71} with diff file ISSM-17876-17877.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetIceShelfBC.py M /issm/trunk-jpl/src/m/boundaryconditions/SetMarineIceSheetBC.py\\
+Export determination: 6. \\
+Rationale: CHG: treat stressbalance spc's as rank-1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#72} with diff file ISSM-17877-17878.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/boundaryconditions/SetIceSheetBC.py\\
+Export determination: 6. \\
+Rationale: BUG: syntax\\
+\vspace{3em}
+
+\noindent \textbf{Change \#73} with diff file ISSM-17878-17879.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test271.py\\
+Export determination: 6. \\
+Rationale: BUG: array indexing problem\\
+\vspace{3em}
+
+\noindent \textbf{Change \#74} with diff file ISSM-17879-17880.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: CHG: fixed array indexing problem, nodes list passed to md.extract should be rank-1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#75} with diff file ISSM-17880-17881.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plot\_manager.py M /issm/trunk-jpl/src/m/plot/plot\_mesh.py\\
+Export determination: 6. \\
+Rationale: CHG: fix for plot\_mesh given new ImageGrid foundation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#76} with diff file ISSM-17881-17882.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/hydrologyshreve.m M /issm/trunk-jpl/src/m/classes/hydrologyshreve.py\\
+Export determination: 6. \\
+Rationale: CHG:reverting hydroshreve from Johnson to LeBrocq\\
+\vspace{3em}
+
+\noindent \textbf{Change \#77} with diff file ISSM-17882-17883.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp\\
+Export determination: 6. \\
+Rationale: CHG:reverting hydroshreve from Johnson to LeBrocq\\
+\vspace{3em}
+
+\noindent \textbf{Change \#78} with diff file ISSM-17883-17884.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/HydrologyshreveCREnum.m D /issm/trunk-jpl/src/m/enum/HydrologyshreveKnEnum.m D /issm/trunk-jpl/src/m/enum/HydrologyshreveNEnum.m D /issm/trunk-jpl/src/m/enum/HydrologyshrevePEnum.m D /issm/trunk-jpl/src/m/enum/HydrologyshreveQEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: removing unused enums\\
+\vspace{3em}
+
+\noindent \textbf{Change \#79} with diff file ISSM-17884-17885.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h\\
+Export determination: 6. \\
+Rationale: BUG: fixed Shreve's new implementation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#80} with diff file ISSM-17885-17886.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/SectionValues.py\\
+Export determination: 6. \\
+Rationale: CHG: removed print statement from debugging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#81} with diff file ISSM-17886-17887.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/BalancethicknessAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/BalancevelocityAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/FreeSurfaceTopAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionBaseAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/L2ProjectionEPLAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeXAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceVerticalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/cores/extrudefrombase\_core.cpp M /issm/trunk-jpl/src/c/modules/InputDepthAverageAtBasex M /issm/trunk-jpl/src/c/modules/InputExtrudex M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/MeshElementonbaseEnum.m D /issm/trunk-jpl/src/m/enum/MeshElementonsurfaceEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: 1. removed elementonbed elementonsurface (everybody should use vertexonX) 2. added sanity check for bednormal and surface normal 3. merging extrudecore and InputExtrude for Penta\\
+\vspace{3em}
+
+\noindent \textbf{Change \#82} with diff file ISSM-17887-17888.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/cores/extrudefrombase\_core.cpp M /issm/trunk-jpl/src/c/cores/hydrology\_core.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: using extrude rather than AddBasalInput\\
+\vspace{3em}
+
+\noindent \textbf{Change \#83} with diff file ISSM-17888-17889.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG: reverting hydro tests to AddBasalInput for now:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#84} with diff file ISSM-17889-17890.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed segmentation fault\\
+\vspace{3em}
+
+\noindent \textbf{Change \#85} with diff file ISSM-17890-17891.diff: \\
+Function name: \\
+D /issm/trunk-jpl/externalpackages/valgrind/README\\
+Export determination: 6. \\
+Rationale: DEL: not needed\\
+\vspace{3em}
+
+\noindent \textbf{Change \#86} with diff file ISSM-17891-17892.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: CHG: default to gaussian kernel for radial interpolation smoothing function\\
+\vspace{3em}
+
+\noindent \textbf{Change \#87} with diff file ISSM-17892-17893.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/interp.py\\
+Export determination: 6. \\
+Rationale: CHG: generalize to allow interpolation onto arbitrary x,y coords\\
+\vspace{3em}
+
+\noindent \textbf{Change \#88} with diff file ISSM-17893-17894.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plotmodel.py M /issm/trunk-jpl/src/m/plot/processdata.py\\
+Export determination: 6. \\
+Rationale: BUG: wrong calculation of data lims when nan's present\\
+\vspace{3em}
+
+\noindent \textbf{Change \#89} with diff file ISSM-17894-17895.diff: \\
+Function name: \\
+D /issm/trunk-jpl/externalpackages/m1qn3/Makefile M /issm/trunk-jpl/externalpackages/m1qn3/install.sh\\
+Export determination: 6. \\
+Rationale: CHG: more self consistent installation script\\
+\vspace{3em}
+
+\noindent \textbf{Change \#90} with diff file ISSM-17895-17896.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/issm\_options.m4 M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/cores/WrapperCorePointerFromSolutionEnum.cpp A /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp M /issm/trunk-jpl/src/c/cores/cores.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/inversion.m M /issm/trunk-jpl/src/m/classes/inversion.py A /issm/trunk-jpl/src/m/classes/m1qn3inversion.m M /issm/trunk-jpl/src/m/classes/taoinversion.m M /issm/trunk-jpl/src/m/contrib/dassflow/importgmsh.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/InversionTaoEnum.m A /issm/trunk-jpl/src/m/enum/InversionTypeEnum.m\\
+Export determination: 6. \\
+Rationale: NEW: preparing m1qn3 inversion\\
+\vspace{3em}
+
+\noindent \textbf{Change \#91} with diff file ISSM-17896-17897.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: making the code a little more flexible\\
+\vspace{3em}
+
+\noindent \textbf{Change \#92} with diff file ISSM-17897-17898.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#93} with diff file ISSM-17898-17899.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/exp/expwrite.py\\
+Export determination: 6. \\
+Rationale: CHG: updated doc for python usage\\
+\vspace{3em}
+
+\noindent \textbf{Change \#94} with diff file ISSM-17899-17900.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp M /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.cpp M /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.h\\
+Export determination: 6. \\
+Rationale: NEW: m1qn3 now workingsvn diff cores/controlm1qn3\_core.cpp\\
+\vspace{3em}
+
+\noindent \textbf{Change \#95} with diff file ISSM-17900-17901.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#96} with diff file ISSM-17901-17902.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/m1qn3/install.sh\\
+Export determination: 6. \\
+Rationale: CHG: enable compilation with ifort when possible\\
+\vspace{3em}
+
+\noindent \textbf{Change \#97} with diff file ISSM-17902-17903.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: minor compilation warning on pfe\\
+\vspace{3em}
+
+\noindent \textbf{Change \#98} with diff file ISSM-17903-17904.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/analyticaldamage.py M /issm/trunk-jpl/src/m/mech/thomasparams.py\\
+Export determination: 6. \\
+Rationale: BUG: a couple minor fixes for damage calcs\\
+\vspace{3em}
+
+\noindent \textbf{Change \#99} with diff file ISSM-17904-17905.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/m1qn3inversion.m M /issm/trunk-jpl/src/m/classes/taoinversion.m\\
+Export determination: 6. \\
+Rationale: BUG: make a copy before marshalling responses\\
+\vspace{3em}
+
+\noindent \textbf{Change \#100} with diff file ISSM-17905-17906.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp\\
+Export determination: 6. \\
+Rationale: CHG: added constraints on m1qn3 inversion\\
+\vspace{3em}
+
+\noindent \textbf{Change \#101} with diff file ISSM-17906-17907.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/inversion.py A /issm/trunk-jpl/src/m/classes/m1qn3inversion.py\\
+Export determination: 6. \\
+Rationale: NEW: python version of m1qn3 inversion class\\
+\vspace{3em}
+
+\noindent \textbf{Change \#102} with diff file ISSM-17907-17908.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/analyses/Analysis.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/classes/FemModel.h M /issm/trunk-jpl/src/c/cores/control\_core.cpp M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp M /issm/trunk-jpl/src/c/cores/controltao\_core.cpp M /issm/trunk-jpl/src/c/cores/cores.h D /issm/trunk-jpl/src/c/cores/objectivefunction.cpp M /issm/trunk-jpl/src/c/shared/Numerics/BrentSearch.cpp D /issm/trunk-jpl/src/c/shared/Numerics/OptArgs.h D /issm/trunk-jpl/src/c/shared/Numerics/OptimalSearch.cpp M /issm/trunk-jpl/src/c/shared/Numerics/numerics.h\\
+Export determination: 6. \\
+Rationale: CHG: simplifying inversions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#103} with diff file ISSM-17908-17909.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/m1qn3inversion.m M /issm/trunk-jpl/src/m/classes/matdamageice.m\\
+Export determination: 6. \\
+Rationale: CHG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#104} with diff file ISSM-17909-17910.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/m1qn3inversion.m M /issm/trunk-jpl/src/m/classes/m1qn3inversion.py\\
+Export determination: 6. \\
+Rationale: CHG: added dxmin and epsrel as options\\
+\vspace{3em}
+
+\noindent \textbf{Change \#105} with diff file ISSM-17910-17911.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/InversionDxminEnum.m A /issm/trunk-jpl/src/m/enum/InversionEpsrelEnum.m M /issm/trunk-jpl/src/wrappers/IssmConfig/IssmConfig.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added some enums necessary for m1qn3\\
+\vspace{3em}
+
+\noindent \textbf{Change \#106} with diff file ISSM-17911-17912.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp\\
+Export determination: 6. \\
+Rationale: NEW: Dxmin and Epsrel are now parameters\\
+\vspace{3em}
+
+\noindent \textbf{Change \#107} with diff file ISSM-17912-17913.diff: \\
+Function name: \\
+M /issm/trunk-jpl/scripts/GenerateReferences.sh D /issm/trunk-jpl/scripts/cloc-1.55.pl A /issm/trunk-jpl/scripts/cloc-1.60.pl M /issm/trunk-jpl/scripts/cloc2html.py M /issm/trunk-jpl/scripts/getloc.sh M /issm/trunk-jpl/src/dox/issm.dox\\
+Export determination: 6. \\
+Rationale: BUG: fixing number of lines of code in fortran 77\\
+\vspace{3em}
+
+\noindent \textbf{Change \#108} with diff file ISSM-17913-17914.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/m1qn3inversion.py\\
+Export determination: 6. \\
+Rationale: BUG: a couple minor fixes for python version\\
+\vspace{3em}
+
+\noindent \textbf{Change \#109} with diff file ISSM-17914-17915.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/vim/addons/vim/syntax/c.vim M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/InversionAlgorithmEnum.m A /issm/trunk-jpl/src/m/enum/InversionFatolEnum.m A /issm/trunk-jpl/src/m/enum/InversionFgtolEnum.m A /issm/trunk-jpl/src/m/enum/InversionGatolEnum.m A /issm/trunk-jpl/src/m/enum/InversionGgtolEnum.m A /issm/trunk-jpl/src/m/enum/InversionGttolEnum.m A /issm/trunk-jpl/src/m/enum/InversionMaxiterEnum.m A /issm/trunk-jpl/src/m/enum/InversionMaxstepsEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: added some enums for tao and m1qn3\\
+\vspace{3em}
+
+\noindent \textbf{Change \#110} with diff file ISSM-17915-17916.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py\\
+Export determination: 6. \\
+Rationale: CHG: pass color norm for element plot\\
+\vspace{3em}
+
+\noindent \textbf{Change \#111} with diff file ISSM-17916-17917.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test211.m M /issm/trunk-jpl/test/NightlyRun/test211.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#112} with diff file ISSM-17917-17918.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test404.m M /issm/trunk-jpl/test/NightlyRun/test404.py M /issm/trunk-jpl/test/NightlyRun/test703.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#113} with diff file ISSM-17918-17919.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp M /issm/trunk-jpl/src/c/cores/controltao\_core.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/m1qn3inversion.m M /issm/trunk-jpl/src/m/classes/m1qn3inversion.py M /issm/trunk-jpl/src/m/classes/taoinversion.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py D /issm/trunk-jpl/src/m/enum/InversionEpsrelEnum.m D /issm/trunk-jpl/src/m/enum/InversionFgtolEnum.m A /issm/trunk-jpl/src/m/enum/InversionFrtolEnum.m D /issm/trunk-jpl/src/m/enum/InversionGgtolEnum.m A /issm/trunk-jpl/src/m/enum/InversionGrtolEnum.m\\
+Export determination: 6. \\
+Rationale: CHG: added some options to TAO and M1QN3 inversions\\
+\vspace{3em}
+
+\noindent \textbf{Change \#114} with diff file ISSM-17919-17920.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/applyoptions.py M /issm/trunk-jpl/src/m/plot/plotmodel.py\\
+Export determination: 6. \\
+Rationale: CHG: add option to easily turn tick labels off\\
+\vspace{3em}
+
+\noindent \textbf{Change \#115} with diff file ISSM-17920-17921.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/inversion.m M /issm/trunk-jpl/src/m/classes/m1qn3inversion.m M /issm/trunk-jpl/src/m/classes/taoinversion.m\\
+Export determination: 6. \\
+Rationale: CHG: better conversions between classes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#116} with diff file ISSM-17921-17922.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/averaging.py\\
+Export determination: 6. \\
+Rationale: BUG: matrix needs to be in csc format for averaging\\
+\vspace{3em}
+
+\noindent \textbf{Change \#117} with diff file ISSM-17922-17923.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/averaging.py\\
+Export determination: 6. \\
+Rationale: BUG: coerce matrix to csc for each iteration\\
+\vspace{3em}
+
+\noindent \textbf{Change \#118} with diff file ISSM-17923-17924.diff: \\
+Function name: \\
+D /issm/trunk-jpl/scripts/Update.sh D /issm/trunk-jpl/scripts/archive.sh D /issm/trunk-jpl/scripts/sync.sh\\
+Export determination: 6. \\
+Rationale: CHG: removed some old scripts not needed anymore\\
+\vspace{3em}
+
+\noindent \textbf{Change \#119} with diff file ISSM-17924-17925.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/LsfReinitializationAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/SmoothedSurfaceSlopeYAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/IoModel.cpp M /issm/trunk-jpl/src/c/classes/Loads/Riftfront.cpp M /issm/trunk-jpl/src/c/classes/Massfluxatgate.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/kriging/Observations.cpp M /issm/trunk-jpl/src/c/cores/controlm1qn3\_core.cpp M /issm/trunk-jpl/src/c/cores/masstransport\_core.cpp M /issm/trunk-jpl/src/c/cores/steadystate\_core.cpp M /issm/trunk-jpl/src/c/cores/transient\_core.cpp M /issm/trunk-jpl/src/c/modules/IoModelToConstraintsx/IoModelToConstraintsx.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateEdges.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateParameters.cpp M /issm/trunk-jpl/src/c/toolkits/issm/IssmMpiSparseMat.h M /issm/trunk-jpl/src/c/toolkits/mumps/MumpsSolve.cpp\\
+Export determination: 6. \\
+Rationale: CHG: some CPPcheck errors\\
+\vspace{3em}
+
+\noindent \textbf{Change \#120} with diff file ISSM-17925-17926.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceSIAAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h\\
+Export determination: 6. \\
+Rationale: CHG: mergind GetXCoord Y and Z\\
+\vspace{3em}
+
+\noindent \textbf{Change \#121} with diff file ISSM-17926-17927.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/SegRef.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/Materials/Material.h M /issm/trunk-jpl/src/c/classes/Materials/Matice.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matice.h M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.h D /issm/trunk-jpl/src/c/modules/ComputeBasalStressx D /issm/trunk-jpl/src/c/modules/ComputeStrainRatex D /issm/trunk-jpl/src/c/modules/Reducevectorgtosx M /issm/trunk-jpl/src/c/modules/modules.h\\
+Export determination: 6. \\
+Rationale: DEL: cleaning up unused functions according to cppcheck\\
+\vspace{3em}
+
+\noindent \textbf{Change \#122} with diff file ISSM-17927-17928.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test322.m M /issm/trunk-jpl/test/NightlyRun/test322.py M /issm/trunk-jpl/test/NightlyRun/test513.m M /issm/trunk-jpl/test/NightlyRun/test513.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxed some tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#123} with diff file ISSM-17928-17929.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/friction.m M /issm/trunk-jpl/src/m/classes/friction.py\\
+Export determination: 6. \\
+Rationale: CHG: better description of friction parameters\\
+\vspace{3em}
+
+\noindent \textbf{Change \#124} with diff file ISSM-17929-17930.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp\\
+Export determination: 6. \\
+Rationale: CHG: corrected description of friction coefficient calculation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#125} with diff file ISSM-17930-17931.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test220.m M /issm/trunk-jpl/test/NightlyRun/test220.py\\
+Export determination: 6. \\
+Rationale: CHG: relaxing toerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#126} with diff file ISSM-17931-17932.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/balancethickness.m M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/debug.m M /issm/trunk-jpl/src/m/classes/flowequation.m M /issm/trunk-jpl/src/m/classes/geometry.m M /issm/trunk-jpl/src/m/classes/gia.m M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/inversion.m M /issm/trunk-jpl/src/m/classes/masstransport.m M /issm/trunk-jpl/src/m/classes/matice.m M /issm/trunk-jpl/src/m/classes/mesh2d.m M /issm/trunk-jpl/src/m/classes/mesh2dvertical.m M /issm/trunk-jpl/src/m/classes/mesh3dprisms.m M /issm/trunk-jpl/src/m/classes/mesh3dtetras.m M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/settings.m M /issm/trunk-jpl/src/m/classes/stressbalance.m M /issm/trunk-jpl/src/m/classes/thermal.m M /issm/trunk-jpl/src/m/classes/timestepping.m M /issm/trunk-jpl/src/m/classes/transient.m\\
+Export determination: 6. \\
+Rationale: New version of gui renderer including dropboxes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#127} with diff file ISSM-17932-17933.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m\\
+Export determination: 6. \\
+Rationale: BUG: do not comment out toolkits\\
+\vspace{3em}
+
+\noindent \textbf{Change \#128} with diff file ISSM-17933-17934.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/Makefile.am A /issm/trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.cpp A /issm/trunk-jpl/src/c/analyses/AdjointBalancethickness2Analysis.h M /issm/trunk-jpl/src/c/analyses/EnumToAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/analyses.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/cores/AdjointCorePointerFromSolutionEnum.cpp A /issm/trunk-jpl/src/c/cores/adjointbalancethickness2\_core.cpp M /issm/trunk-jpl/src/c/cores/cores.h M /issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp A /issm/trunk-jpl/src/m/enum/AdjointBalancethickness2AnalysisEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: preparing adjoint for irrotational flow\\
+\vspace{3em}
+
+\noindent \textbf{Change \#129} with diff file ISSM-17934-17935.diff: \\
+Function name: \\
+M /issm/trunk-jpl/m4/analyses.m4\\
+Export determination: 6. \\
+Rationale: NEW: added new analysis\\
+\vspace{3em}
+
+\noindent \textbf{Change \#130} with diff file ISSM-17935-17936.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: temperature is back to P1\\
+\vspace{3em}
+
+\noindent \textbf{Change \#131} with diff file ISSM-17936-17937.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp\\
+Export determination: 6. \\
+Rationale: BUG: simplifying the way control inputs are created\\
+\vspace{3em}
+
+\noindent \textbf{Change \#132} with diff file ISSM-17937-17938.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: minor\\
+\vspace{3em}
+
+\noindent \textbf{Change \#133} with diff file ISSM-17938-17939.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp\\
+Export determination: 6. \\
+Rationale: CHG: return zero friction if velocity magnitude is calculated as zero instead of raising error, useful for Weertman sliding law\\
+\vspace{3em}
+
+\noindent \textbf{Change \#134} with diff file ISSM-17939-17940.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/groundingline.py\\
+Export determination: 6. \\
+Rationale: CHG: updated display for groundingline classes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#135} with diff file ISSM-17940-17941.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: only depth-average damage if damgae is being used\\
+\vspace{3em}
+
+\noindent \textbf{Change \#136} with diff file ISSM-17941-17942.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/groundingline.m M /issm/trunk-jpl/src/m/classes/groundingline.py M /issm/trunk-jpl/src/m/classes/model.m A /issm/trunk-jpl/src/m/enum/AggressiveMigrationEnum.m D /issm/trunk-jpl/src/m/enum/AgressiveMigrationEnum.m M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py\\
+Export determination: 6. \\
+Rationale: CHG: fixed spelling: Agressive->Aggressive\\
+\vspace{3em}
+
+\noindent \textbf{Change \#137} with diff file ISSM-17942-17943.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/IdToName.m M /issm/trunk-jpl/test/NightlyRun/IdToName.py M /issm/trunk-jpl/test/NightlyRun/test423.m M /issm/trunk-jpl/test/NightlyRun/test423.py M /issm/trunk-jpl/test/NightlyRun/test424.m M /issm/trunk-jpl/test/NightlyRun/test424.py M /issm/trunk-jpl/test/NightlyRun/test426.m M /issm/trunk-jpl/test/NightlyRun/test426.py M /issm/trunk-jpl/test/NightlyRun/test433.m M /issm/trunk-jpl/test/NightlyRun/test433.py M /issm/trunk-jpl/test/Par/RoundSheetShelf.py\\
+Export determination: 6. \\
+Rationale: CHG: updated spelling for NR\\
+\vspace{3em}
+
+\noindent \textbf{Change \#138} with diff file ISSM-17943-17944.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp M /issm/trunk-jpl/src/c/classes/Loads/Friction.h\\
+Export determination: 6. \\
+Rationale: CHG: simplifying friction coefficient call\\
+\vspace{3em}
+
+\noindent \textbf{Change \#139} with diff file ISSM-17944-17945.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: compute basal melt rate using ice density, and use relationship (1 - w)*rho\_mixture = rho\_ice\\
+\vspace{3em}
+
+\noindent \textbf{Change \#140} with diff file ISSM-17945-17946.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/solve/WriteData.m M /issm/trunk-jpl/src/m/solve/WriteData.py\\
+Export determination: 6. \\
+Rationale: CHG: make sure writedata uses the Enum if provided\\
+\vspace{3em}
+
+\noindent \textbf{Change \#141} with diff file ISSM-17946-17947.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyShreveAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MasstransportAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp M /issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/matdamageice.m M /issm/trunk-jpl/src/m/classes/matdamageice.py M /issm/trunk-jpl/src/m/classes/matice.m M /issm/trunk-jpl/src/m/classes/matice.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/MaterialsRhoSeawaterEnum.m D /issm/trunk-jpl/src/m/enum/MaterialsRhoWaterEnum.m M /issm/trunk-jpl/src/m/qmu/setupdesign/IsScaled.m\\
+Export determination: 6. \\
+Rationale: CHG: renaming RhoWaterEnum RhoSeawaterEnum:\\
+\vspace{3em}
+
+\noindent \textbf{Change \#142} with diff file ISSM-17947-17948.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive327.nc\\
+Export determination: 6. \\
+Rationale: CHG: update archive 327\\
+\vspace{3em}
+
+\noindent \textbf{Change \#143} with diff file ISSM-17948-17949.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/matdamageice.py\\
+Export determination: 6. \\
+Rationale: BUG: added include of Enum\\
+\vspace{3em}
+
+\noindent \textbf{Change \#144} with diff file ISSM-17949-17950.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: ADD: shelf dampening force for basal melting\\
+\vspace{3em}
+
+\noindent \textbf{Change \#145} with diff file ISSM-17950-17951.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: CHG:Getting rid of the storing coeficient in transfer term\\
+\vspace{3em}
+
+\noindent \textbf{Change \#146} with diff file ISSM-17951-17952.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/damage.m M /issm/trunk-jpl/src/m/classes/damage.py\\
+Export determination: 6. \\
+Rationale: CHG: initial value of isdamage = 0\\
+\vspace{3em}
+
+\noindent \textbf{Change \#147} with diff file ISSM-17952-17953.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Loads/Friction.cpp M /issm/trunk-jpl/src/c/classes/Loads/Friction.h M /issm/trunk-jpl/src/c/shared/Enum/EnumDefinitions.h M /issm/trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp M /issm/trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp M /issm/trunk-jpl/src/m/classes/friction.m M /issm/trunk-jpl/src/m/classes/friction.py A /issm/trunk-jpl/src/m/classes/frictionweertman.m A /issm/trunk-jpl/src/m/classes/frictionweertman.py M /issm/trunk-jpl/src/m/enum/EnumDefinitions.py A /issm/trunk-jpl/src/m/enum/FrictionCEnum.m A /issm/trunk-jpl/src/m/enum/FrictionLawEnum.m A /issm/trunk-jpl/src/m/enum/FrictionMEnum.m M /issm/trunk-jpl/src/m/plot/plot\_overlay.py\\
+Export determination: 6. \\
+Rationale: CHG: added frictionweertman class for Weertman sliding law\\
+\vspace{3em}
+
+\noindent \textbf{Change \#148} with diff file ISSM-17953-17954.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_unit.py M /issm/trunk-jpl/src/m/plot/processdata.py\\
+Export determination: 6. \\
+Rationale: CHG: better handling of clim when nan's are present or when data is constant, so that color norm is better suited for plotting in python\\
+\vspace{3em}
+
+\noindent \textbf{Change \#149} with diff file ISSM-17954-17955.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_manager.py\\
+Export determination: 6. \\
+Rationale: CHG: added a try/except for importing osgeo/gdal since basic python plots can work without it (only impacts overlay plots\\
+\vspace{3em}
+
+\noindent \textbf{Change \#150} with diff file ISSM-17955-17956.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/plot/plot\_mesh.py\\
+Export determination: 6. \\
+Rationale: CHG: turn on ticklabels by default for mesh plot\\
+\vspace{3em}
+
+\noindent \textbf{Change \#151} with diff file ISSM-17956-17957.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/MeltingAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: forgot to retrieve frictionlaw\\
+\vspace{3em}
+
+\noindent \textbf{Change \#152} with diff file ISSM-17957-17958.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp M /issm/trunk-jpl/test/Archives/Archive703.nc\\
+Export determination: 6. \\
+Rationale: BUG: fixed FS flowand when meltrate = NaN\\
+\vspace{3em}
+
+\noindent \textbf{Change \#153} with diff file ISSM-17958-17959.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/interp/SectionValues.py\\
+Export determination: 6. \\
+Rationale: BUG: fixed python SectionValues for 2D meshes\\
+\vspace{3em}
+
+\noindent \textbf{Change \#154} with diff file ISSM-17959-17960.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/model.m M /issm/trunk-jpl/src/m/classes/model.py\\
+Export determination: 6. \\
+Rationale: BUG: fixing problems in model collapse\\
+\vspace{3em}
+
+\noindent \textbf{Change \#155} with diff file ISSM-17960-17961.diff: \\
+Function name: \\
+A /issm/trunk-jpl/externalpackages/petsc/install-3.4-hpc.sh\\
+Export determination: 6. \\
+Rationale: NEW: added installation script for hpc\\
+\vspace{3em}
+
+\noindent \textbf{Change \#156} with diff file ISSM-17961-17962.diff: \\
+Function name: \\
+A /issm/trunk-jpl/src/m/materials/DepthAvgTempCond.m A /issm/trunk-jpl/src/m/materials/DepthAvgTempCond.py\\
+Export determination: 6. \\
+Rationale: CHG: conductive profile on an ice sheet, thermal computation.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#157} with diff file ISSM-17962-17963.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp M /issm/trunk-jpl/src/c/classes/Elements/ElementHook.cpp M /issm/trunk-jpl/src/c/classes/Elements/Elements.cpp M /issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/SegRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tetra.cpp M /issm/trunk-jpl/src/c/classes/Elements/TetraRef.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/TriaRef.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removed FUNCTION\\
+\vspace{3em}
+
+\noindent \textbf{Change \#158} with diff file ISSM-17963-17964.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/materials/DepthAvgTempCond.py\\
+Export determination: 6. \\
+Rationale: CHG: issues with shape of vectors.\\
+\vspace{3em}
+
+\noindent \textbf{Change \#159} with diff file ISSM-17964-17965.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp\\
+Export determination: 6. \\
+Rationale: CHG: change in transfer computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#160} with diff file ISSM-17965-17966.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/mech/analyticaldamage.py\\
+Export determination: 6. \\
+Rationale: CHG: plotmodel should not be needed here\\
+\vspace{3em}
+
+\noindent \textbf{Change \#161} with diff file ISSM-17966-17967.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/verbose.py\\
+Export determination: 6. \\
+Rationale: CHG: leftover from matlab;\\
+\vspace{3em}
+
+\noindent \textbf{Change \#162} with diff file ISSM-17967-17968.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: CHG: removed FUNCTION\\
+\vspace{3em}
+
+\noindent \textbf{Change \#163} with diff file ISSM-17968-17969.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/m/classes/m1qn3inversion.m\\
+Export determination: 6. \\
+Rationale: CHG: Don't check vy field if domaintype is 2dvertical\\
+\vspace{3em}
+
+\noindent \textbf{Change \#164} with diff file ISSM-17969-17970.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp M /issm/trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.h\\
+Export determination: 6. \\
+Rationale: CHG: preparing inversions of flowband models with Hongju\\
+\vspace{3em}
+
+\noindent \textbf{Change \#165} with diff file ISSM-17970-17971.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive213.nc M /issm/trunk-jpl/test/Archives/Archive215.nc M /issm/trunk-jpl/test/Archives/Archive511.nc\\
+Export determination: 6. \\
+Rationale: CHG: updated archive because we do not use the same order of integration for surface velocity misfit\\
+\vspace{3em}
+
+\noindent \textbf{Change \#166} with diff file ISSM-17971-17972.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/AdjointHorizAnalysis.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/cores/adjointstressbalance\_core.cpp\\
+Export determination: 6. \\
+Rationale: NEW: inversions for FS blowbands\\
+\vspace{3em}
+
+\noindent \textbf{Change \#167} with diff file ISSM-17972-17973.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Seg.cpp M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp M /issm/trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.h M /issm/trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp\\
+Export determination: 6. \\
+Rationale: NEW: added DragCoefficientAbsGradientx in module\\
+\vspace{3em}
+
+\noindent \textbf{Change \#168} with diff file ISSM-17973-17974.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/Archives/Archive213.nc M /issm/trunk-jpl/test/Archives/Archive215.nc M /issm/trunk-jpl/test/Archives/Archive415.nc M /issm/trunk-jpl/test/Archives/Archive511.nc M /issm/trunk-jpl/test/Archives/Archive512.nc M /issm/trunk-jpl/test/Archives/Archive513.nc\\
+Export determination: 6. \\
+Rationale: CHG: updating archives because we are using a better way to compute misfits\\
+\vspace{3em}
+
+\noindent \textbf{Change \#169} with diff file ISSM-17974-17975.diff: \\
+Function name: \\
+M /issm/trunk-jpl/test/NightlyRun/test703.m\\
+Export determination: 6. \\
+Rationale: CHG: relaxed tolerances\\
+\vspace{3em}
+
+\noindent \textbf{Change \#170} with diff file ISSM-17975-17976.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp M /issm/trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.h M /issm/trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp M /issm/trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.h\\
+Export determination: 6. \\
+Rationale: CHG: moving misfits to modules\\
+\vspace{3em}
+
+\noindent \textbf{Change \#171} with diff file ISSM-17976-17977.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.h M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp M /issm/trunk-jpl/src/c/classes/Elements/Penta.h M /issm/trunk-jpl/src/c/classes/Elements/Seg.h M /issm/trunk-jpl/src/c/classes/Elements/Tetra.h M /issm/trunk-jpl/src/c/classes/Elements/Tria.cpp M /issm/trunk-jpl/src/c/classes/Elements/Tria.h M /issm/trunk-jpl/src/c/classes/FemModel.cpp M /issm/trunk-jpl/src/c/modules/DragCoefficientAbsGradientx/DragCoefficientAbsGradientx.cpp M /issm/trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.cpp M /issm/trunk-jpl/src/c/modules/RheologyBbarAbsGradientx/RheologyBbarAbsGradientx.h M /issm/trunk-jpl/src/c/modules/SurfaceAbsVelMisfitx/SurfaceAbsVelMisfitx.cpp M /issm/trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.cpp M /issm/trunk-jpl/src/c/modules/SurfaceAverageVelMisfitx/SurfaceAverageVelMisfitx.h M /issm/trunk-jpl/src/c/modules/SurfaceLogVelMisfitx/SurfaceLogVelMisfitx.cpp M /issm/trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.cpp M /issm/trunk-jpl/src/c/modules/SurfaceLogVxVyMisfitx/SurfaceLogVxVyMisfitx.h M /issm/trunk-jpl/src/c/modules/SurfaceRelVelMisfitx/SurfaceRelVelMisfitx.cpp M /issm/trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.cpp M /issm/trunk-jpl/src/c/modules/ThicknessAbsMisfitx/ThicknessAbsMisfitx.h M /issm/trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.cpp M /issm/trunk-jpl/src/c/modules/ThicknessAcrossGradientx/ThicknessAcrossGradientx.h M /issm/trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.cpp M /issm/trunk-jpl/src/c/modules/ThicknessAlongGradientx/ThicknessAlongGradientx.h\\
+Export determination: 6. \\
+Rationale: CHG: pushing misfits away from elements\\
+\vspace{3em}
+
+\noindent \textbf{Change \#172} with diff file ISSM-17977-17978.diff: \\
+Function name: \\
+M /issm/trunk-jpl/externalpackages/valgrind/issm.supp\\
+Export determination: 6. \\
+Rationale: CHG: updateing suppression list\\
+\vspace{3em}
+
+\noindent \textbf{Change \#173} with diff file ISSM-17978-17979.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Element.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed some memory leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#174} with diff file ISSM-17979-17980.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG:Fixing effective pressure computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#175} with diff file ISSM-17980-17981.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG:Fixing effective pressure computation\\
+\vspace{3em}
+
+\noindent \textbf{Change \#176} with diff file ISSM-17981-17982.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed some memory leaks\\
+\vspace{3em}
+
+\noindent \textbf{Change \#177} with diff file ISSM-17982-17983.diff: \\
+Function name: \\
+M /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp\\
+Export determination: 6. \\
+Rationale: BUG: fixed memory leak and clean up extrusion\\
+\vspace{3em}
+
Index: /issm/oecreview/Archive/17802-17983/r1.tex
===================================================================
--- /issm/oecreview/Archive/17802-17983/r1.tex	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/r1.tex	(revision 17986)
@@ -0,0 +1,1 @@
+17802
Index: /issm/oecreview/Archive/17802-17983/r2.tex
===================================================================
--- /issm/oecreview/Archive/17802-17983/r2.tex	(revision 17986)
+++ /issm/oecreview/Archive/17802-17983/r2.tex	(revision 17986)
@@ -0,0 +1,1 @@
+17983
