Index: /issm/trunk-jpl/src/c/Container/Constraints.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Constraints.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Constraints.h	(revision 14975)
@@ -4,11 +4,4 @@
 /*forward declarations */
 #include "./DataSet.h"
-class Materials;
-class Parameters;
-class Elements;
-class Vertices;
-class Loads;
-class Nodes;
-class Inputs;
 
 #include "../shared/Enum/Enum.h"
Index: /issm/trunk-jpl/src/c/Container/DataSet.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/DataSet.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/DataSet.h	(revision 14975)
@@ -9,13 +9,5 @@
 /*forward declarations */
 class Object;
-class Elements;
-class Loads;
-class Nodes;
-class Vertices;
-class Materials;
-class Parameters;
-class Patch;
 class Results;
-class Patch;
 
 /*! \brief Declaration of DataSet class
Index: /issm/trunk-jpl/src/c/Container/Elements.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Elements.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Elements.cpp	(revision 14975)
@@ -12,4 +12,5 @@
 
 #include "./Elements.h"
+#include "./Results.h"
 #include "./Parameters.h"
 #include "../classes/classes.h"
Index: /issm/trunk-jpl/src/c/Container/Elements.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Elements.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Elements.h	(revision 14975)
@@ -6,9 +6,8 @@
 class Materials;
 class Parameters;
-class Elements;
 class Vertices;
 class Loads;
 class Nodes;
-class Inputs;
+class Patch;
 
 /*! \brief Declaration of Elements class 
Index: /issm/trunk-jpl/src/c/Container/Inputs.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Inputs.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Inputs.cpp	(revision 14975)
@@ -426,2 +426,55 @@
 }
 /*}}}*/
+
+/*Methods relating to inputs: */
+void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){ /*{{{*/
+ 
+	/*figure out convergence at the input level. 
+	  We are given a list of inputs, new and old, and a criterion, and using the
+	  inputs, we return the value of the criterion test, which will be used at the
+	  solution level to determine convergence.
+	  */ 
+
+	int i,j;
+
+	/*output: */
+	IssmDouble eps;
+
+	/*intermediary: */
+	IssmDouble *newvalues     = NULL;
+	IssmDouble *oldvalues     = NULL;
+	int     num_values;
+	IssmDouble  ndu        = 0;
+	IssmDouble  nu         = 0;
+
+	if(criterion_enum==RelativeEnum){
+
+		/*conpute ndu/du (where u could be velocity, pressure, temperature, etc ...): */
+		for(i=0;i<num_inputs;i++){
+
+			/*in debugging mode, check that the inputs are of the same type*/
+			_assert_(new_inputs[i]->ObjectEnum()==old_inputs[i]->ObjectEnum());
+
+			/*Get pointers*/
+			new_inputs[i]->GetValuesPtr(&newvalues,&num_values);
+			old_inputs[i]->GetValuesPtr(&oldvalues,&num_values);
+			for(j=0;j<num_values;j++){
+				ndu+=pow(newvalues[j]-oldvalues[j],2);
+				nu+=pow(oldvalues[j],2);
+			}
+		}
+
+		/*take square root: */
+		ndu=sqrt(ndu);
+		nu=sqrt(nu);
+
+		/*now, compute eps: */
+		if(reCast<bool>(nu))eps=ndu/nu;
+		else eps=0;
+	}
+	else _error_("convergence criterion " << EnumToStringx(criterion_enum) << " not supported yet!");
+
+	/*Assign output pointers:*/
+	*peps=eps;
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/Container/Inputs.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Inputs.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Inputs.h	(revision 14975)
@@ -5,4 +5,5 @@
 class Parameters;
 class Input;
+
 #include "./DataSet.h"
 #include "../shared/Numerics/types.h"
@@ -42,3 +43,6 @@
 };
 
+/*Methods relating to inputs: */
+void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum);
+
 #endif //ifndef _INPUTS_H_
Index: /issm/trunk-jpl/src/c/Container/Loads.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Loads.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Loads.cpp	(revision 14975)
@@ -16,5 +16,5 @@
 #include <iostream>
 
-#include "./DataSet.h"
+#include "./Loads.h"
 #include "../shared/shared.h"
 #include "../shared/Enum/Enum.h"
Index: /issm/trunk-jpl/src/c/Container/Loads.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Loads.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Loads.h	(revision 14975)
@@ -3,12 +3,10 @@
 
 /*forward declarations */
+#include "./DataSet.h"
 class Materials;
 class Parameters;
 class Elements;
 class Vertices;
-class Loads;
 class Nodes;
-class DataSet;
-class Inputs;
 
 /*!\brief Declaration of Loads class.
Index: /issm/trunk-jpl/src/c/Container/Materials.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Materials.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Materials.h	(revision 14975)
@@ -9,5 +9,4 @@
 class Loads;
 class Nodes;
-class Inputs;
 
 /*! \brief Declaration of Materials class.
Index: /issm/trunk-jpl/src/c/Container/Nodes.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Nodes.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Nodes.h	(revision 14975)
@@ -3,4 +3,11 @@
 
 #include "./DataSet.h"
+class Parameters;
+class Elements;
+class Vertices;
+class Loads;
+class Nodes;
+class Materials;
+
 
 /*!\brief Declaration of Nodes class.
Index: /issm/trunk-jpl/src/c/Container/Options.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 14975)
@@ -16,4 +16,5 @@
 
 #include "./DataSet.h"
+#include "./Options.h"
 #include "../shared/shared.h"
 #include "../shared/io/io.h"
Index: /issm/trunk-jpl/src/c/Container/Parameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Parameters.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Parameters.cpp	(revision 14975)
@@ -16,5 +16,5 @@
 #include <iostream>
 
-#include "./DataSet.h"
+#include "./Parameters.h"
 #include "../shared/shared.h"
 #include "../shared/Enum/Enum.h"
@@ -490,2 +490,102 @@
 }
 /*}}}*/
+
+/*Methods relating to parameters: */
+char* OptionsFromAnalysis(Parameters* parameters,int analysis_type){ /*{{{*/
+
+	/* figure out ISSM options for current analysis, return a string. */ 
+
+	/*output: */
+	char*   outstring=NULL;
+
+	/*intermediary: */
+	int          dummy;
+	IssmDouble  *analyses    = NULL;
+	char       **strings     = NULL;
+	char        *string      = NULL;
+	int          numanalyses;
+	int          found       = -1;
+	int          i;
+
+	numanalyses=0;
+	parameters->FindParam(&strings,&numanalyses,ToolkitsOptionsStringsEnum);
+
+	parameters->FindParam(&analyses,&dummy,ToolkitsOptionsAnalysesEnum);
+
+	if(numanalyses==0)return NULL; //we did not find petsc options, don't bother.
+
+	/*ok, go through analyses and figure out if it corresponds to our analysis_type: */
+	for(i=0;i<numanalyses;i++){
+		if(analyses[i]==analysis_type){
+			found=i;
+			break;
+		}
+	}
+	if(found==-1){
+		/*still haven't found a list of petsc options, go find the default one, for analysis type NoneAnalysisEnum: */
+		for(i=0;i<numanalyses;i++){
+			if(analyses[i]==DefaultAnalysisEnum){
+				found=i;
+				break;
+			}
+		}
+	}
+	if (found==-1){
+		_error_("could find neither a default analysis nor analysis " << EnumToStringx(analysis_type));
+	}
+
+	/*ok, grab the option string: */
+	outstring=xNew<char>(strlen(strings[found])+1);
+	strcpy(outstring,strings[found]);
+
+	/*Free ressources*/
+	xDelete<IssmDouble>(analyses);
+	for(i=0;i<numanalyses;i++){
+		string=strings[i];
+		xDelete<char>(string);
+	}
+	xDelete<char*>(strings);
+	return outstring;
+} 
+/*}}}*/
+void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type){ /*{{{*/
+
+	/*!\file:  ToolkitsOptionsFromAnalysis.cpp
+	 * \brief: for each analysis, setup the issmoptions string. 
+	 * This is mainly for the case where we run our toolkits using petsc. In this case, we need to 
+	 * plug our toolkits options directly into the petsc options database. This is the case for each analysis type 
+	 * and parameters
+	 */ 
+
+
+	char* options=NULL;
+
+	/*Recover first the options string for this analysis: */
+	options=OptionsFromAnalysis(parameters,analysis_type);
+
+	/*Initialize our Toolkit Options: */
+	ToolkitOptions::Init(options);
+
+	#ifdef _HAVE_PETSC_
+		/*In case we are using PETSC, we do not rely on issmoptions. Instead, we dump issmoptions into the Petsc 
+		 * options database: */
+
+		#if _PETSC_MAJOR_ == 2 
+		PetscOptionsDestroy();
+		PetscOptionsCreate();
+		//PetscOptionsCheckInitial_Private();
+		//PetscOptionsCheckInitial_Components();
+		PetscOptionsSetFromOptions();
+		PetscOptionsInsertMultipleString(options); //our patch
+		#else
+		PetscOptionsSetFromOptions();
+		PetscOptionsClear();
+		//PetscOptionsSetFromOptions();
+		PetscOptionsInsertMultipleString(options); //our patch
+		#endif
+
+	#endif
+
+	xDelete<char>(options);
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/Container/Parameters.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Parameters.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Parameters.h	(revision 14975)
@@ -6,11 +6,4 @@
 template <class doublematrix> class Matrix;
 template <class doubletype> class Vector;
-class Materials;
-class Parameters;
-class Elements;
-class Vertices;
-class Loads;
-class Nodes;
-class Inputs;
 #include "./DataSet.h"
 #include "../shared/Numerics/types.h"
@@ -65,3 +58,8 @@
 };
 
+/*Methods relating to parameters: */
+char       *OptionsFromAnalysis(Parameters *parameters,int analysis_type);
+void        ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type);
+
+
 #endif //ifndef _PARAMETERS_H_
Index: /issm/trunk-jpl/src/c/Container/Results.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Results.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Results.h	(revision 14975)
@@ -5,11 +5,5 @@
 
 /*forward declarations */
-class Materials;
 class Parameters;
-class Elements;
-class Vertices;
-class Loads;
-class Nodes;
-class Inputs;
 
 /*!\brief Declaration of Results class.
Index: /issm/trunk-jpl/src/c/Container/Vertices.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Vertices.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Vertices.cpp	(revision 14975)
@@ -16,5 +16,5 @@
 #include <iostream>
 
-#include "./DataSet.h"
+#include "./Vertices.h"
 #include "../shared/shared.h"
 #include "../shared/Enum/Enum.h"
Index: /issm/trunk-jpl/src/c/Container/Vertices.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Vertices.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/Container/Vertices.h	(revision 14975)
@@ -3,11 +3,6 @@
 
 /*forward declarations */
-class Materials;
-class Elements;
-class Vertices;
-class Loads;
-class Nodes;
-class DataSet;
-class Inputs;
+#include "./DataSet.h"
+#include "../shared/Numerics/types.h"
 
 /*!\brief Declaration of Vertices class.
Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 14974)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 14975)
@@ -200,5 +200,4 @@
 					./shared/Numerics/Verbosity.h\
 					./shared/Numerics/Verbosity.cpp\
-					./shared/Numerics/IsInputConverged.cpp\
 					./shared/Numerics/GaussPoints.h\
 					./shared/Numerics/GaussPoints.cpp\
@@ -210,6 +209,4 @@
 					./shared/Numerics/XZvectorsToCoordinateSystem.cpp\
 					./shared/Numerics/UnitConversion.cpp\
-					./shared/Numerics/OptionsFromAnalysis.cpp\
-					./shared/Numerics/ToolkitsOptionsFromAnalysis.cpp\
 					./shared/Exceptions/exceptions.h\
 					./shared/Exceptions/Exceptions.cpp\
Index: /issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 14975)
@@ -18,4 +18,5 @@
 #include "../shared/io/io.h"
 #include "../Container/Parameters.h"
+#include "../Container/Elements.h"
 #include "../shared/shared.h"
 
Index: /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/kriging/ExponentialVariogram.cpp	(revision 14975)
@@ -12,6 +12,6 @@
 #include <string.h>
 #include "../objects/objects.h"
-#include "../../shared/Enum/Enum.h"
 #include "../../shared/shared.h"
+#include "../../Container/Container.h"
 
 /*ExponentialVariogram constructors and destructor*/
Index: /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/kriging/GaussianVariogram.cpp	(revision 14975)
@@ -12,6 +12,6 @@
 #include <string.h>
 #include "../objects/objects.h"
-#include "../../shared/Enum/Enum.h"
 #include "../../shared/shared.h"
+#include "../../Container/Container.h"
 
 /*GaussianVariogram constructors and destructor*/
Index: /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/kriging/PowerVariogram.cpp	(revision 14975)
@@ -12,6 +12,6 @@
 #include <string.h>
 #include "../objects/objects.h"
-#include "../../shared/Enum/Enum.h"
 #include "../../shared/shared.h"
+#include "../../Container/Container.h"
 
 /*PowerVariogram constructors and destructor*/
Index: /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/kriging/SphericalVariogram.cpp	(revision 14975)
@@ -12,6 +12,6 @@
 #include <string.h>
 #include "../objects/objects.h"
-#include "../../shared/Enum/Enum.h"
 #include "../../shared/shared.h"
+#include "../../Container/Container.h"
 
 /*SphericalVariogram constructors and destructor*/
Index: /issm/trunk-jpl/src/c/classes/objects/DependentObject.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/DependentObject.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/DependentObject.h	(revision 14975)
@@ -11,10 +11,4 @@
 /*}}}*/
 
-class Elements;
-class Nodes;
-class Vertices;
-class Loads;
-class Materials;
-class Parameters;
 class FemModel;
 
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/ElementResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/ElementResult.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/ElementResult.h	(revision 14975)
@@ -9,4 +9,5 @@
 /*{{{*/
 #include "../Object.h"
+class Patch;
 /*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp	(revision 14975)
@@ -16,4 +16,6 @@
 #include "../../../shared/Enum/Enum.h"
 #include "../../../shared/shared.h"
+#include "../../../Container/Inputs.h"
+#include "../../../Container/Parameters.h"
 /*}}}*/	
 
@@ -218,8 +220,8 @@
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
 	 * datasets, using internal ids and offsets hidden in hooks: */
-	hnodes->configure(nodesin);
-	hvertices->configure(verticesin);
-	helement->configure(elementsin);
-	hmatpar->configure(materialsin);
+	hnodes->configure((DataSet*)nodesin);
+	hvertices->configure((DataSet*)verticesin);
+	helement->configure((DataSet*)elementsin);
+	hmatpar->configure((DataSet*)materialsin);
 
 	/*Initialize hooked fields*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h	(revision 14975)
@@ -17,4 +17,5 @@
 class IoModel;
 class ElementVector;
+class Vertex;
 /*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h	(revision 14975)
@@ -10,12 +10,17 @@
 /*Headers:*/
 /*{{{*/
-class Object;
+class Node;
 template <class doublematrix> class Matrix;
 template <class doubletype> class Vector;
+class Elements;
+class Loads;
+class Nodes;
+class Vertices;
+class Materials;
+class Parameters;
 
 #include "../Object.h"
 #include "../../Update.h"
-#include "../../../toolkits/toolkits.h"
-#include "../../../Container/Container.h"
+
 /*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp	(revision 14975)
@@ -16,4 +16,6 @@
 #include "../../../shared/shared.h"
 #include "../../classes.h"
+#include "../../../Container/Inputs.h"
+#include "../../../Container/Parameters.h"
 /*}}}*/	
 
@@ -238,7 +240,7 @@
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
 	 * datasets, using internal ids and offsets hidden in hooks: */
-	hnodes->configure(nodesin);
-	hvertices->configure(verticesin);
-	helement->configure(elementsin);
+	hnodes->configure((DataSet*)nodesin);
+	hvertices->configure((DataSet*)verticesin);
+	helement->configure((DataSet*)elementsin);
 
 	/*Initialize hooked fields*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp	(revision 14975)
@@ -16,4 +16,5 @@
 #include "../../../shared/Enum/Enum.h"
 #include "../../../shared/shared.h"
+#include "../../../Container/Parameters.h"
 /*}}}*/
 
@@ -111,5 +112,5 @@
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
 	 * datasets, using internal ids and offsets hidden in hooks: */
-	hnodes->configure(nodesin);
+	hnodes->configure((DataSet*)nodesin);
 
 	/*Initialize hooked fields*/
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp	(revision 14975)
@@ -14,4 +14,6 @@
 #include "../../../shared/Enum/Enum.h"
 #include "../../../shared/shared.h"
+#include "../../../Container/Inputs.h"
+#include "../../../Container/Parameters.h"
 
 /*Matdamageice constructors and destructor*/
@@ -112,5 +114,5 @@
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
 	 * datasets, using internal ids and offsets hidden in hooks: */
-	helement->configure(elementsin);
+	helement->configure((DataSet*)elementsin);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.cpp	(revision 14975)
@@ -14,4 +14,6 @@
 #include "../../../shared/Enum/Enum.h"
 #include "../../../shared/shared.h"
+#include "../../../Container/Inputs.h"
+#include "../../../Container/Parameters.h"
 
 /*Matice constructors and destructor*/
@@ -112,5 +114,5 @@
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
 	 * datasets, using internal ids and offsets hidden in hooks: */
-	helement->configure(elementsin);
+	helement->configure((DataSet*)elementsin);
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Options/GenericOption.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/GenericOption.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Options/GenericOption.h	(revision 14975)
@@ -17,6 +17,5 @@
 #include "../../../shared/Exceptions/exceptions.h"
 #include "../../../shared/MemOps/MemOps.h"
-#include "../../../shared/io/io.h"
-#include "../../../shared/Enum/Enum.h"
+#include "../../../shared/shared.h"
 #include "./OptionUtilities.h"
 
Index: /issm/trunk-jpl/src/c/classes/objects/Vertex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Vertex.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/classes/objects/Vertex.cpp	(revision 14975)
@@ -12,6 +12,6 @@
 #include <string.h>
 #include "../classes.h"
-#include "../../shared/Enum/Enum.h"
 #include "../../shared/shared.h"
+#include "../../Container/Parameters.h"
 /*}}}*/
 
Index: /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh2dx/InterpFromMeshToMesh2dx.cpp	(revision 14975)
@@ -7,4 +7,5 @@
 #include "../../toolkits/toolkits.h"
 #include "../../classes/objects/objects.h"
+#include "../../Container/Container.h"
 
 using namespace bamg;
Index: /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h	(revision 14975)
@@ -8,4 +8,6 @@
 
 #include "../../classes/objects/objects.h"
+#include "../../Container/Parameters.h"
+#include "../../Container/Nodes.h"
 
 /* local prototypes: */
Index: /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h	(revision 14975)
@@ -8,4 +8,5 @@
 
 #include "../../classes/objects/objects.h"
+#include "../../Container/Container.h"
 
 /* local prototypes: */
Index: /issm/trunk-jpl/src/c/shared/Elements/Arrhenius.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Elements/Arrhenius.cpp	(revision 14974)
+++ /issm/trunk-jpl/src/c/shared/Elements/Arrhenius.cpp	(revision 14975)
@@ -4,5 +4,5 @@
 
 #include <math.h>
-#include "./elements.h"
+#include "../Numerics/types.h"
 #include "../Exceptions/exceptions.h"
 
Index: /issm/trunk-jpl/src/c/shared/Elements/elements.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Elements/elements.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/shared/Elements/elements.h	(revision 14975)
@@ -7,8 +7,4 @@
 
 #include "../Numerics/types.h"
-class ElementMatrix;
-class ElementVector;
-class Vertex;
-class Node;
 
 IssmDouble Paterson(IssmDouble temperature);
Index: sm/trunk-jpl/src/c/shared/Numerics/IsInputConverged.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/IsInputConverged.cpp	(revision 14974)
+++ 	(revision )
@@ -1,59 +1,0 @@
-/*!\file:  IsInputConverged.cpp
- * \brief: figure out convergence at the input level. 
- * We are given a list of inputs, new and old, and a criterion, and using the inputs, we 
- * return the value of the criterion test, which will be used at the solution level 
- * to determine convergence.
- */ 
-
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include "../../classes/objects/objects.h"
-
-void IsInputConverged(IssmDouble* peps, Input** new_inputs,Input** old_inputs,int num_inputs,int criterion_enum){
-
-	int i,j;
-
-	/*output: */
-	IssmDouble eps;
-
-	/*intermediary: */
-	IssmDouble *newvalues     = NULL;
-	IssmDouble *oldvalues     = NULL;
-	int     num_values;
-	IssmDouble  ndu        = 0;
-	IssmDouble  nu         = 0;
-
-	if(criterion_enum==RelativeEnum){
-
-		/*conpute ndu/du (where u could be velocity, pressure, temperature, etc ...): */
-		for(i=0;i<num_inputs;i++){
-
-			/*in debugging mode, check that the inputs are of the same type*/
-			_assert_(new_inputs[i]->ObjectEnum()==old_inputs[i]->ObjectEnum());
-
-			/*Get pointers*/
-			new_inputs[i]->GetValuesPtr(&newvalues,&num_values);
-			old_inputs[i]->GetValuesPtr(&oldvalues,&num_values);
-			for(j=0;j<num_values;j++){
-				ndu+=pow(newvalues[j]-oldvalues[j],2);
-				nu+=pow(oldvalues[j],2);
-			}
-		}
-
-		/*take square root: */
-		ndu=sqrt(ndu);
-		nu=sqrt(nu);
-
-		/*now, compute eps: */
-		if(reCast<bool>(nu))eps=ndu/nu;
-		else eps=0;
-	}
-	else _error_("convergence criterion " << EnumToStringx(criterion_enum) << " not supported yet!");
-
-	/*Assign output pointers:*/
-	*peps=eps;
-}
Index: sm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/OptionsFromAnalysis.cpp	(revision 14974)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*!\file:  OptionsFromAnalysis.cpp
- * \brief: figure out ISSM options for current analysis, return a string.
- */ 
-
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <cstring>
-
-#include "../../classes/objects/objects.h"
-#include "../../Container/Parameters.h"
-#include "../../shared/Enum/Enum.h"
-
-char* OptionsFromAnalysis(Parameters* parameters,int analysis_type){
-
-	/*output: */
-	char*   outstring=NULL;
-
-	/*intermediary: */
-	int          dummy;
-	IssmDouble  *analyses    = NULL;
-	char       **strings     = NULL;
-	char        *string      = NULL;
-	int          numanalyses;
-	int          found       = -1;
-	int          i;
-
-	numanalyses=0;
-	parameters->FindParam(&strings,&numanalyses,ToolkitsOptionsStringsEnum);
-
-	parameters->FindParam(&analyses,&dummy,ToolkitsOptionsAnalysesEnum);
-
-	if(numanalyses==0)return NULL; //we did not find petsc options, don't bother.
-
-	/*ok, go through analyses and figure out if it corresponds to our analysis_type: */
-	for(i=0;i<numanalyses;i++){
-		if(analyses[i]==analysis_type){
-			found=i;
-			break;
-		}
-	}
-	if(found==-1){
-		/*still haven't found a list of petsc options, go find the default one, for analysis type NoneAnalysisEnum: */
-		for(i=0;i<numanalyses;i++){
-			if(analyses[i]==DefaultAnalysisEnum){
-				found=i;
-				break;
-			}
-		}
-	}
-	if (found==-1){
-		_error_("could find neither a default analysis nor analysis " << EnumToStringx(analysis_type));
-	}
-
-	/*ok, grab the option string: */
-	outstring=xNew<char>(strlen(strings[found])+1);
-	strcpy(outstring,strings[found]);
-
-	/*Free ressources*/
-	xDelete<IssmDouble>(analyses);
-	for(i=0;i<numanalyses;i++){
-		string=strings[i];
-		xDelete<char>(string);
-	}
-	xDelete<char*>(strings);
-	return outstring;
-}
Index: sm/trunk-jpl/src/c/shared/Numerics/ToolkitsOptionsFromAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/ToolkitsOptionsFromAnalysis.cpp	(revision 14974)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*!\file:  ToolkitsOptionsFromAnalysis.cpp
- * \brief: for each analysis, setup the issmoptions string. 
- * This is mainly for the case where we run our toolkits using petsc. In this case, we need to 
- * plug our toolkits options directly into the petsc options database. This is the case for each analysis type 
- * and parameters
- */ 
-
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include "../../classes/classes.h"
-#include "../../Container/Parameters.h"
-#include "../../toolkits/toolkits.h"
-
-void ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type){
-
-	char* options=NULL;
-
-	/*Recover first the options string for this analysis: */
-	options=OptionsFromAnalysis(parameters,analysis_type);
-
-	/*Initialize our Toolkit Options: */
-	ToolkitOptions::Init(options);
-
-	#ifdef _HAVE_PETSC_
-		/*In case we are using PETSC, we do not rely on issmoptions. Instead, we dump issmoptions into the Petsc 
-		 * options database: */
-
-		#if _PETSC_MAJOR_ == 2 
-		PetscOptionsDestroy();
-		PetscOptionsCreate();
-		//PetscOptionsCheckInitial_Private();
-		//PetscOptionsCheckInitial_Components();
-		PetscOptionsSetFromOptions();
-		PetscOptionsInsertMultipleString(options); //our patch
-		#else
-		PetscOptionsSetFromOptions();
-		PetscOptionsClear();
-		//PetscOptionsSetFromOptions();
-		PetscOptionsInsertMultipleString(options); //our patch
-		#endif
-
-	#endif
-
-	xDelete<char>(options);
-}
Index: /issm/trunk-jpl/src/c/shared/Numerics/numerics.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/shared/Numerics/numerics.h	(revision 14975)
@@ -11,4 +11,5 @@
 #include "./recast.h"
 #include "./types.h"
+#include "./constants.h"
 
 class Input;
@@ -26,11 +27,8 @@
 void        OptimalSearch(IssmDouble *psearch_scalar,IssmDouble*pJ,OptPars*optpars,IssmDouble (*f)(IssmDouble,OptArgs*), OptArgs*optargs);
 void        cross(IssmDouble *result,IssmDouble*vector1,IssmDouble*vector2);
-void        IsInputConverged(IssmDouble *peps, Input**new_inputs,Input**old_inputs,int num_inputs,int criterion_enum);
 void        UnitConversion(IssmDouble *values, int numvalues,int direction_enum, int type_enum);
 IssmDouble  UnitConversion(IssmDouble value, int direction_enum, int type_enum);
-char       *OptionsFromAnalysis(Parameters *parameters,int analysis_type);
 void        XZvectorsToCoordinateSystem(IssmDouble *T,IssmDouble*xzvectors);
 int         cubic(IssmDouble a, IssmDouble b, IssmDouble c, IssmDouble d, double X[3], int *num);
-void        ToolkitsOptionsFromAnalysis(Parameters* parameters,int analysis_type);
 
 #endif //ifndef _NUMERICS_H_
Index: /issm/trunk-jpl/src/c/shared/Numerics/recast.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/recast.h	(revision 14974)
+++ /issm/trunk-jpl/src/c/shared/Numerics/recast.h	(revision 14975)
@@ -17,6 +17,5 @@
 #if !defined(_HAVE_ADOLC_) || defined(_WRAPPERS_)
 
-template<class To, class From>
-To reCast(const From& from) {
+template<class To, class From> To reCast(const From& from) {
     return (To)from;
 }
@@ -25,11 +24,9 @@
 #include "./types.h"
 
-template<class To, class From>
-struct ForPartialSpecialization {
+template<class To, class From> struct ForPartialSpecialization {
     static  To reCast(const From& from ) { return (To) from;}
 };
 
-template<class To, class From>
-To reCast(const From& from) {
+template<class To, class From> To reCast(const From& from) {
     return ForPartialSpecialization<To,From>::reCast(from);
 }
@@ -37,6 +34,5 @@
  * partial specialization
  */
-template<class To>
-struct ForPartialSpecialization<To,adouble> {
+template<class To> struct ForPartialSpecialization<To,adouble> {
     static  To reCast(const adouble& from ) { return (To) (from.getValue());}
 };
