Index: /issm/trunk-jpl/src/c/Container/Elements.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Elements.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/Container/Elements.cpp	(revision 13216)
@@ -175,5 +175,5 @@
 	IssmDouble *resultstimes = NULL;
 	IssmDouble *vector_serial= NULL;
-	Vector*     vector       = NULL;
+	Vector<IssmDouble>*     vector       = NULL;
 	bool   io_gather;
 	bool   results_as_patches;
@@ -233,5 +233,5 @@
 			else if(resultssizes[i]==P0Enum) vectorsize=numberofelements;
 			else _error_("Unkown result size: " << EnumToStringx(resultssizes[i]));
-			vector=new Vector(vectorsize);
+			vector=new Vector<IssmDouble>(vectorsize);
 
 			for(int j=0;j<this->Size();j++){
Index: /issm/trunk-jpl/src/c/Container/Observations.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Observations.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/Container/Observations.cpp	(revision 13216)
@@ -19,4 +19,6 @@
 #include "./Observations.h"
 #include "../shared/shared.h"
+#include "../Container/Container.h"
+#include "../classes/classes.h"
 #include "../include/include.h"
 #include "../modules/modules.h"
Index: /issm/trunk-jpl/src/c/Container/Observations.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Observations.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/Container/Observations.h	(revision 13216)
@@ -7,4 +7,5 @@
 
 #include "../include/include.h"
+#include "../classes/objects/Options/GenericOption.h"
 
 class Quadtree;
Index: /issm/trunk-jpl/src/c/Container/Options.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/Container/Options.cpp	(revision 13216)
@@ -19,4 +19,5 @@
 #include "../io/io.h"
 #include "../include/include.h"
+#include "../classes/classes.h"
 #include "../shared/shared.h"
 #include "../EnumDefinitions/EnumDefinitions.h"
@@ -40,4 +41,6 @@
 int  Options::AddOption(Option* in_option){
 
+	char* name=NULL;
+	
 	vector<Object*>::iterator object;
 	Option* option=NULL;
@@ -47,8 +50,10 @@
 
 	/*Also, check the option name*/
-	if(!in_option->name) _error_("input option has an empty name");
-	if(strchr(in_option->name,'.')) _error_("Option \"" << in_option->name << "\" has a protected character \".\"");
-	if(strchr(in_option->name,'[')) _error_("Option \"" << in_option->name << "\" has a protected character \"[\"");
-	if(strchr(in_option->name,']')) _error_("Option \"" << in_option->name << "\" has a protected character \"]\"");
+	name=in_option->Name();
+
+	if(!name) _error_("input option has an empty name");
+	if(strchr(name,'.')) _error_("Option \"" << name << "\" has a protected character \".\"");
+	if(strchr(name,'[')) _error_("Option \"" << name << "\" has a protected character \"[\"");
+	if(strchr(name,']')) _error_("Option \"" << name << "\" has a protected character \"]\"");
 
 	/*Finally, check that no option of the same name already exists in the dataset*/
@@ -56,6 +61,6 @@
 
 		option=(Option*)(*object); 
-		if (!strcmp(option->name,in_option->name)){
-			_error_("Options \"" << in_option->name << "\" found multiple times");
+		if (!strcmp(option->Name(),name)){
+			_error_("Options \"" << name << "\" found multiple times");
 			break;
 		}
@@ -66,230 +71,4 @@
 
 	return 1;
-}
-/*}}}*/
-/*FUNCTION Options::Get(int* pvalue, char* name){{{*/
-void Options::Get(int* pvalue,const char* name){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, no default provided*/
-	else{
-		_error_("option of name \"" << name << "\" not found, and no default value has been provided");
-	}
-}
-/*}}}*/
-/*FUNCTION Options::Get(int* pvalue, char* name,int default_value){{{*/
-void Options::Get(int* pvalue,const char* name,int default_value){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, a default is provided here*/
-	else{
-		*pvalue=default_value;
-	}
-}
-/*}}}*/
-/*FUNCTION Options::Get(IssmDouble* pvalue, char* name){{{*/
-void Options::Get(IssmDouble* pvalue,const char* name){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, no default provided*/
-	else{
-		_error_("option of name \"" << name << "\" not found, and no default value has been provided");
-	}
-}
-/*}}}*/
-/*FUNCTION Options::Get(IssmDouble* pvalue, char* name,IssmDouble default_value){{{*/
-void Options::Get(IssmDouble* pvalue,const char* name,IssmDouble default_value){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, a default is provided here*/
-	else{
-		*pvalue=default_value;
-	}
-}
-/*}}}*/
-/*FUNCTION Options::Get(bool* pvalue, char* name){{{*/
-void Options::Get(bool* pvalue,const char* name){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, no default provided*/
-	else{
-		_error_("option of name \"" << name << "\" not found, and no default value has been provided");
-	}
-}
-/*}}}*/
-/*FUNCTION Options::Get(bool* pvalue, char* name,bool default_value){{{*/
-void Options::Get(bool* pvalue,const char* name,bool default_value){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, a default is provided here*/
-	else{
-		*pvalue=default_value;
-	}
-}
-/*}}}*/
-/*FUNCTION Options::Get(char** pvalue, char* name){{{*/
-void Options::Get(char** pvalue,const char* name){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-	char* outstring=NULL;
-	int   stringsize;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, no default provided*/
-	else{
-		_error_("option of name \"" << name << "\" not found, and no default value has been provided");
-	}
-
-}
-/*}}}*/
-/*FUNCTION Options::Get(char** pvalue, char* name,char* default_value){{{*/
-void Options::Get(char** pvalue,const char* name,const char* default_value){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-	char* outstring=NULL;
-	int   stringsize;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue);
-	}
-	/*Else, the Option does not exist, a default is provided here*/
-	else{
-		stringsize=strlen(default_value)+1;
-		outstring=xNew<char>(stringsize);
-		xMemCpy<char>(outstring,default_value,stringsize);
-		*pvalue=outstring;
-	}
-
-}
-/*}}}*/
-/*FUNCTION Options::Get(char*** ppvalue,int* numel,char* name){{{*/
-void Options::Get(char*** ppvalue,int* numel,const char* name){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-	Option* option2=NULL;
-	Options* options=NULL;
-	int   i;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		/*If the object is a Cell, copy the strings from its options dataset*/ 
-		if(option->ObjectEnum()==OptionCellEnum){
-			if (option->NumEl()) {
-				*ppvalue=xNew<char*>(option->NumEl());
-				if (numel) *numel=option->NumEl();
-				option->Get(&options);
-				for (i=0; i<option->NumEl(); i++) {
-					option2=((Option *)options->GetObjectByOffset(i));
-					if(option2->ObjectEnum()==OptionCharEnum)
-						option2->Get(&((*ppvalue)[i]));
-					else
-						((*ppvalue)[i])=NULL;
-				}
-			}
-		}
-		/*If the object is a Char, copy the strings from its concatenation*/ 
-		else if(option->ObjectEnum()==OptionCharEnum){
-			option->Get(ppvalue,numel);
-		}
-		/*Else: not supported*/
-		else{
-			_error_("Cannot recover field \"" << name << "\" for an option of type " << EnumToStringx(option->ObjectEnum()));
-		}
-	}
-	/*Else, the Option does not exist, no default provided*/
-	else{
-		*ppvalue=NULL;
-		if (numel) *numel=0;
-	}
-
-}
-/*}}}*/
-/*FUNCTION Options::Get(IssmDouble** pvalue,int* numel,const char* name){{{*/
-void Options::Get(IssmDouble** pvalue,int* numel,const char* name){
-
-	vector<Object*>::iterator object;
-	Option* option=NULL;
-
-	/*Get option*/
-	option=GetOption(name);
-
-	/*If the pointer is not NULL, the option has been found*/
-	if(option){
-		option->Get(pvalue,numel);
-	}
-	/*Else, the Option does not exist, no default provided*/
-	else{
-		_error_("option of name \"" << name << "\" not found, and no default value has been provided");
-	}
 }
 /*}}}*/
@@ -304,8 +83,8 @@
 
 		option=(Option*)(*object); 
-		if (!strncmp(name,option->name,strlen(option->name))){
+		if (!strncmp(name,option->Name(),strlen(option->Name()))){
 
 			/*OK, now do we have a complete name? If not, it is a cell or a structure, we need to go further*/
-			if(!strcmp(name,option->name)){
+			if(!strcmp(name,option->Name())){
 				return option;
 			}
@@ -313,11 +92,13 @@
 				/*If the object is a Cell, recursive call to its options*/ 
 				if(option->ObjectEnum()==OptionCellEnum){
-					return ((OptionCell*)option)->values->GetOption(name);
+					GenericOption<Options*>* celloption=(GenericOption<Options*>*)option;
+					return celloption->value->GetOption(name);
 				}
 				/*If the object is a Struct loop over its size and recursive call*/
 				else if(option->ObjectEnum()==OptionStructEnum){
-					for(int i=0;i<option->numel;i++){
-						_assert_(((OptionStruct*)option)->values[i]);
-						return ((OptionStruct*)option)->values[i]->GetOption(name);
+					for(int i=0;i<option->NumEl();i++){
+						GenericOption<Options**>* structoption=(GenericOption<Options**>*)option;
+						_assert_(structoption->value[i]);
+						return structoption->value[i]->GetOption(name);
 					}
 				}
Index: /issm/trunk-jpl/src/c/Container/Options.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Options.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/Container/Options.h	(revision 13216)
@@ -5,4 +5,6 @@
 #ifndef _CONTAINER_OPTIONS_H_
 #define _CONTAINER_OPTIONS_H_
+
+#include "../classes/objects/Options/GenericOption.h"
 
 /*forward declarations */
@@ -20,14 +22,79 @@
 		int  AddOption(Option* in_oobject);
 		Option* GetOption(const char* name);
-		void Get(IssmDouble*  pvalue,const char* name);
-		void Get(IssmDouble*  pvalue,const char* name,IssmDouble default_value);
-		void Get(int*  pvalue,const char* name);
-		void Get(int*  pvalue,const char* name,int default_value);
-		void Get(bool*    pvalue,const char* name);
-		void Get(bool*    pvalue,const char* name,bool default_value);
-		void Get(char**   pvalue,const char* name);
-		void Get(char**   pvalue,const char* name,const char* default_value);
-		void Get(char***  pvalue,int* numel,const char* name);
-		void Get(IssmDouble** pvalue,int* numel,const char* name);
+		
+		
+		template <class OptionType> void Get(OptionType* pvalue,const char* name){ /*{{{*/
+
+			vector<Object*>::iterator object;
+			GenericOption<OptionType>* genericoption=NULL;
+
+			/*Get option*/
+			genericoption=(GenericOption<OptionType>*)GetOption(name);
+
+			/*If the pointer is not NULL, the option has been found*/
+			if(genericoption){
+				genericoption->Get(pvalue);
+			}
+			/*Else, the Option does not exist, no default provided*/
+			else{
+				_error_("option of name \"" << name << "\" not found, and no default value has been provided");
+			}
+		}
+		/*}}}*/
+		template <class OptionType> void Get(OptionType* pvalue,int* pnumel, const char* name){ /*{{{*/
+
+			vector<Object*>::iterator object;
+			GenericOption<OptionType>* genericoption=NULL;
+
+			/*Get option*/
+			genericoption=(GenericOption<OptionType>*)GetOption(name);
+
+			/*If the pointer is not NULL, the option has been found*/
+			if(genericoption){
+				genericoption->Get(pvalue);
+				*pnumel=genericoption->NumEl();
+			}
+			/*Else, the Option does not exist, no default provided*/
+			else{
+				_error_("option of name \"" << name << "\" not found, and no default value has been provided");
+			}
+		}
+		/*}}}*/
+		template <class OptionType> void Get(OptionType* pvalue,const char* name,OptionType default_value){ /*{{{*/
+
+			vector<Object*>::iterator object;
+			GenericOption<OptionType>* genericoption=NULL;
+
+			/*Get option*/
+			genericoption=(GenericOption<OptionType>*)GetOption(name);
+
+			/*If the pointer is not NULL, the option has been found*/
+			if(genericoption){
+				genericoption->Get(pvalue);
+			}
+			else{
+				*pvalue=default_value;
+			}
+		}
+		/*}}}*/
+		template <class OptionType> void Get(OptionType* pvalue,int* pnumel, const char* name,OptionType default_value){ /*{{{*/
+
+			vector<Object*>::iterator object;
+			GenericOption<OptionType>* genericoption=NULL;
+
+			/*Get option*/
+			genericoption=(GenericOption<OptionType>*)GetOption(name);
+
+			/*If the pointer is not NULL, the option has been found*/
+			if(genericoption){
+				genericoption->Get(pvalue);
+				*pnumel=genericoption->NumEl();
+			}
+			else{
+				*pvalue=default_value;
+			}
+		}
+		/*}}}*/
+
 };
 
Index: /issm/trunk-jpl/src/c/Container/Parameters.cpp
===================================================================
--- /issm/trunk-jpl/src/c/Container/Parameters.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/Container/Parameters.cpp	(revision 13216)
@@ -244,6 +244,6 @@
 }
 /*}}}*/
-/*FUNCTION Parameters::FindParam(Vector** pvec,int enum_type){{{*/
-void Parameters::FindParam(Vector** pvec,int enum_type){ _assert_(this);
+/*FUNCTION Parameters::FindParam(Vector<IssmDouble>** pvec,int enum_type){{{*/
+void Parameters::FindParam(Vector<IssmDouble>** pvec,int enum_type){ _assert_(this);
 	
 	vector<Object*>::iterator object;
@@ -262,6 +262,6 @@
 }
 /*}}}*/
-/*FUNCTION Parameters::FindParam(Matrix** pmat,int enum_type){{{*/
-void Parameters::FindParam(Matrix** pmat,int enum_type){ _assert_(this);
+/*FUNCTION Parameters::FindParam(Matrix<IssmDouble>** pmat,int enum_type){{{*/
+void Parameters::FindParam(Matrix<IssmDouble>** pmat,int enum_type){ _assert_(this);
 	
 	vector<Object*>::iterator object;
@@ -406,6 +406,6 @@
 }
 /*}}}*/
-/*FUNCTION Parameters::SetParam(Vector* vector,int enum_type);{{{*/
-void   Parameters::SetParam(Vector* vector,int enum_type){
+/*FUNCTION Parameters::SetParam(Vector<IssmDouble>* vector,int enum_type);{{{*/
+void   Parameters::SetParam(Vector<IssmDouble>* vector,int enum_type){
 
 	Param* param=NULL;
@@ -418,6 +418,6 @@
 }
 /*}}}*/
-/*FUNCTION Parameters::SetParam(Matrix* matrix,int enum_type);{{{*/
-void   Parameters::SetParam(Matrix* matrix,int enum_type){
+/*FUNCTION Parameters::SetParam(Matrix<IssmDouble>* matrix,int enum_type);{{{*/
+void   Parameters::SetParam(Matrix<IssmDouble>* matrix,int enum_type){
 
 	Param* param=NULL;
Index: /issm/trunk-jpl/src/c/Container/Parameters.h
===================================================================
--- /issm/trunk-jpl/src/c/Container/Parameters.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/Container/Parameters.h	(revision 13216)
@@ -8,6 +8,6 @@
 
 /*forward declarations */
-class Matrix;
-class Vector;
+template <class doublematrix> class Matrix;
+template <class doubletype> class Vector;
 class Materials;
 class Parameters;
@@ -41,6 +41,6 @@
 		void  FindParam(IssmDouble** pIssmDoublearray,int* pM,int* pN,int enum_type);
 		void  FindParam(IssmDouble*** parray,int* pM, int** pmdims_array,int** pndims_array,int enum_type);
-		void  FindParam(Vector** pvec,int enum_type);
-		void  FindParam(Matrix** pmat,int enum_type);
+		void  FindParam(Vector<IssmDouble>** pvec,int enum_type);
+		void  FindParam(Matrix<IssmDouble>** pmat,int enum_type);
 		void  FindParam(FILE** pfid,int enum_type);
 		
@@ -54,6 +54,6 @@
 		void  SetParam(int* intarray,int M,int enum_type);
 		void  SetParam(int* intarray,int M,int N,int enum_type);
-		void  SetParam(Vector* vec,int enum_type);
-		void  SetParam(Matrix* mat,int enum_type);
+		void  SetParam(Vector<IssmDouble>* vec,int enum_type);
+		void  SetParam(Matrix<IssmDouble>* mat,int enum_type);
 		void  SetParam(FILE* fid,int enum_type);
 		void  UnitConversion(int direction_enum);
Index: /issm/trunk-jpl/src/c/Makefile.am
===================================================================
--- /issm/trunk-jpl/src/c/Makefile.am	(revision 13215)
+++ /issm/trunk-jpl/src/c/Makefile.am	(revision 13216)
@@ -132,7 +132,5 @@
 					./classes/matrix/ElementVector.cpp\
 					./classes/matrix/Matrix.h\
-					./classes/matrix/Matrix.cpp\
 					./classes/matrix/Vector.h\
-					./classes/matrix/Vector.cpp\
 					./classes/objects/Params/Param.h\
 					./classes/objects/Params/GenericParam.h\
@@ -237,7 +235,5 @@
 					./toolkits/issm/issmtoolkit.h\
 					./toolkits/issm/SeqVec.h\
-					./toolkits/issm/SeqVec.cpp\
 					./toolkits/issm/SeqMat.h\
-					./toolkits/issm/SeqMat.cpp\
 					./toolkits/triangle/triangleincludes.h\
 					./toolkitsenums.h\
@@ -360,18 +356,8 @@
 					./solvers/solver_nonlinear.cpp\
 					./solvers/solver_newton.cpp\
-					./classes/objects/Options/Option.cpp\
 					./classes/objects/Options/Option.h\
-					./classes/objects/Options/OptionDouble.cpp\
-					./classes/objects/Options/OptionDouble.h\
-					./classes/objects/Options/OptionChar.cpp\
-					./classes/objects/Options/OptionChar.h\
+					./classes/objects/Options/GenericOption.h\
 					./classes/objects/Options/OptionUtilities.cpp\
-					./classes/objects/Options/OptionUtilities.h\
-					./classes/objects/Options/OptionLogical.cpp\
-					./classes/objects/Options/OptionLogical.h\
-					./classes/objects/Options/OptionStruct.cpp\
-					./classes/objects/Options/OptionStruct.h\
-					./classes/objects/Options/OptionCell.cpp\
-					./classes/objects/Options/OptionCell.h
+					./classes/objects/Options/OptionUtilities.h
 
 #}}}
Index: /issm/trunk-jpl/src/c/classes/IoModel.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/IoModel.cpp	(revision 13216)
@@ -879,5 +879,4 @@
 	/*output: */
 	int     code;
-	Option *option      = NULL;
 	char   *name        = NULL;
 
@@ -889,32 +888,35 @@
 	switch(code){
 		case 3: {//IssmDouble
-			  IssmDouble *value = NULL;
-			  value=xNew<IssmDouble>(1);
-			  FetchData(value,index+1);
-			  option = new OptionDouble();
-			  ((OptionDouble*)option)->values = value;
-			  option->name  = name;
-			  option->numel = 1;
-			  option->ndims = 1;
-			  option->size  = NULL;
-			  break;
-			  }
+					GenericOption<IssmDouble*>* option;
+					IssmDouble *value = NULL;
+					value=xNew<IssmDouble>(1);
+					FetchData(value,index+1);
+					option = new GenericOption<IssmDouble*>();
+					option->value = value;
+					option->name  = name;
+					option->numel = 1;
+					option->ndims = 1;
+					option->size  = NULL;
+					/*Assign output pointers: */
+					*poption=option;
+					break;
+				}
 		case 4: {//char
-			  char* value = NULL;
-			  FetchData(&value,index+1);
-			  option = new OptionChar();
-			  ((OptionChar*)option)->values = value;
-			  option->name  = name;
-			  option->numel = 1;
-			  option->ndims = 1;
-			  option->size  = NULL;
-			  break;
-			  }
+					GenericOption<char*>* option;
+					char* value = NULL;
+					FetchData(&value,index+1);
+					option = new GenericOption<char*>();
+					option->value = value;
+					option->name  = name;
+					option->numel = 1;
+					option->ndims = 1;
+					option->size  = NULL;
+					*poption=option;
+					break;
+				}
 		default:
 			  _error_("Option of format " << code << " not supported yet");
 	}
 
-	/*Assign output pointers: */
-	*poption=option;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.cpp	(revision 13216)
@@ -245,6 +245,6 @@
 
 /*ElementMatrix specific routines: */
-/*FUNCTION ElementMatrix::AddToGlobal(Matrix* Kff, Matrix* Kfs){{{*/
-void ElementMatrix::AddToGlobal(Matrix* Kff, Matrix* Kfs){
+/*FUNCTION ElementMatrix::AddToGlobal(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){{{*/
+void ElementMatrix::AddToGlobal(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
 
 	int i,j;
@@ -300,6 +300,6 @@
 }
 /*}}}*/
-/*FUNCTION ElementMatrix::AddToGlobal(Matrix* Jff){{{*/
-void ElementMatrix::AddToGlobal(Matrix* Jff){
+/*FUNCTION ElementMatrix::AddToGlobal(Matrix<IssmDouble>* Jff){{{*/
+void ElementMatrix::AddToGlobal(Matrix<IssmDouble>* Jff){
 
 	int i,j;
Index: /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/matrix/ElementMatrix.h	(revision 13216)
@@ -15,5 +15,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 class Node;
-class Matrix;
+template <class doublematrix> class Matrix;
 class Parameters;
 /*}}}*/
@@ -60,6 +60,6 @@
 		/*}}}*/
 		/*ElementMatrix specific routines {{{*/
-		void AddToGlobal(Matrix* Kff, Matrix* Kfs);
-		void AddToGlobal(Matrix* Jff);
+		void AddToGlobal(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+		void AddToGlobal(Matrix<IssmDouble>* Jff);
 		void Echo(void);
 		void CheckConsistency(void);
Index: /issm/trunk-jpl/src/c/classes/matrix/ElementVector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/ElementVector.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/matrix/ElementVector.cpp	(revision 13216)
@@ -160,6 +160,6 @@
 
 /*ElementVector specific routines: */
-/*FUNCTION ElementVector::AddToGlobal(Vector* pf){{{*/
-void ElementVector::AddToGlobal(Vector* pf){
+/*FUNCTION ElementVector::AddToGlobal(Vector<IssmDouble>* pf){{{*/
+void ElementVector::AddToGlobal(Vector<IssmDouble>* pf){
 
 	int i;
@@ -184,6 +184,6 @@
 }
 /*}}}*/
-/*FUNCTION ElementVector::InsertIntoGlobal(Vector* pf){{{*/
-void ElementVector::InsertIntoGlobal(Vector* pf){
+/*FUNCTION ElementVector::InsertIntoGlobal(Vector<IssmDouble>* pf){{{*/
+void ElementVector::InsertIntoGlobal(Vector<IssmDouble>* pf){
 
 	int i;
Index: /issm/trunk-jpl/src/c/classes/matrix/ElementVector.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/ElementVector.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/matrix/ElementVector.h	(revision 13216)
@@ -15,5 +15,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 class Node;
-class Vector;
+template <class doubletype> class Vector;
 class Parameters;
 /*}}}*/
@@ -42,6 +42,6 @@
 		/*}}}*/
 		/*ElementVector specific routines {{{*/
-		void AddToGlobal(Vector* pf);
-		void InsertIntoGlobal(Vector* pf);
+		void AddToGlobal(Vector<IssmDouble>* pf);
+		void InsertIntoGlobal(Vector<IssmDouble>* pf);
 		void Echo(void);
 		void CheckConsistency(void);
Index: sm/trunk-jpl/src/c/classes/matrix/Matrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/Matrix.cpp	(revision 13215)
+++ 	(revision )
@@ -1,314 +1,0 @@
-/*!\file Matrix.cpp
- * \brief: implementation of the Matrix object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../classes.h"
-#include "../../shared/shared.h"
-#include "../../Container/Container.h"
-#include "../../include/include.h"
-#include "../../toolkits/toolkits.h"
-#include "./Matrix.h"
-	
-/*}}}*/
-
-/*Matrix constructors and destructor*/
-/*FUNCTION Matrix::Matrix(){{{*/
-Matrix::Matrix(){
-
-	#ifdef _HAVE_PETSC_
-	pmatrix=NULL;
-	#endif
-	smatrix=NULL;
-
-	type=PetscMatType; //default
-	#ifndef _HAVE_PETSC_
-	type=SeqMatType;
-	#endif
-	
-}
-/*}}}*/
-/*FUNCTION Matrix::Matrix(int M,int N,int type){{{*/
-Matrix::Matrix(int M,int N,int in_type){
-
-	#ifdef _HAVE_PETSC_
-	pmatrix=NULL;
-	#endif
-	smatrix=NULL;
-	type=in_type;
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix=new PetscMat(M,N);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix=new SeqMat(M,N);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Matrix::Matrix(int M,int N,IssmDouble sparsity,int type){{{*/
-Matrix::Matrix(int M,int N,IssmDouble sparsity,int in_type){
-
-	#ifdef _HAVE_PETSC_
-	pmatrix=NULL;
-	#endif
-	smatrix=NULL;
-	type=in_type;
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix=new PetscMat(M,N,sparsity);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix=new SeqMat(M,N,sparsity);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-}
-/*}}}*/
-/*FUNCTION Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity,int type){{{*/
-Matrix::Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity,int in_type){
-
-	#ifdef _HAVE_PETSC_
-	pmatrix=NULL;
-	#endif
-	smatrix=NULL;
-	type=in_type;
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix=new PetscMat(serial_mat,M,N,sparsity);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix=new SeqMat(serial_mat,M,N,sparsity);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-	
-}
-/*}}}*/
-/*FUNCTION Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode,int type){{{*/
-Matrix::Matrix(int M,int N,int connectivity,int numberofdofspernode,int in_type){
-
-	#ifdef _HAVE_PETSC_
-	pmatrix=NULL;
-	#endif
-	smatrix=NULL;
-	type=in_type;
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix=new PetscMat(M,N,connectivity,numberofdofspernode);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix=new SeqMat(M,N,connectivity,numberofdofspernode);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-	
-}
-/*}}}*/
-/*FUNCTION Matrix::~Matrix(){{{*/
-Matrix::~Matrix(){
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		delete this->pmatrix;
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqMatType){
-		delete this->smatrix;
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-
-/*Matrix specific routines: */
-/*FUNCTION Matrix::Echo{{{*/
-void Matrix::Echo(void){
-	_assert_(this);
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix->Echo();
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix->Echo();
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Matrix::Assemble{{{*/
-void Matrix::Assemble(void){
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix->Assemble();
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix->Assemble();
-	}
-	else{
-		_error_("Matrix type: " << type << " not supported yet!");
-	}
-}
-/*}}}*/
-/*FUNCTION Matrix::Norm{{{*/
-IssmDouble Matrix::Norm(NormMode norm_type){
-	
-	IssmDouble norm=0;
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		norm=this->pmatrix->Norm(norm_type);
-		#endif
-	}
-	else if(type==SeqMatType){
-		norm=this->smatrix->Norm(norm_type);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-
-	return norm;
-}
-/*}}}*/
-/*FUNCTION Matrix::GetSize{{{*/
-void Matrix::GetSize(int* pM,int* pN){
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix->GetSize(pM,pN);
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix->GetSize(pM,pN);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-	
-}
-/*}}}*/
-/*FUNCTION Matrix::GetLocalSize{{{*/
-void Matrix::GetLocalSize(int* pM,int* pN){
-	
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix->GetLocalSize(pM,pN);
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix->GetLocalSize(pM,pN);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Matrix::MatMult{{{*/
-void Matrix::MatMult(Vector* X,Vector* AX){
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix->MatMult(X->pvector,AX->pvector);
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix->MatMult(X->svector,AX->svector);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Matrix::Duplicate{{{*/
-Matrix* Matrix::Duplicate(void){
-
-	Matrix* output=NULL;
-
-	output=new Matrix();
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		output->pmatrix=this->pmatrix->Duplicate();
-		#endif
-	}
-	else if(type==SeqMatType){
-		output->smatrix=this->smatrix->Duplicate();
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-	
-	return output;
-}
-/*}}}*/
-/*FUNCTION Matrix::ToSerial{{{*/
-IssmDouble* Matrix::ToSerial(void){
-
-	IssmDouble* output=NULL;
-	
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		output=this->pmatrix->ToSerial();
-		#endif
-	}
-	else if(type==SeqMatType){
-		output=this->smatrix->ToSerial();
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-
-
-	return output;
-}
-/*}}}*/
-/*FUNCTION Matrix::SetValues{{{*/
-void Matrix::SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){
-		
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix->SetValues(m,idxm,n,idxn,values,mode);
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix->SetValues(m,idxm,n,idxn,values,mode);
-	}
-	else _error_("Matrix type: " << type << " not supported yet!");
-}
-/*}}}*/
-/*FUNCTION Matrix::Convert{{{*/
-void Matrix::Convert(MatrixType newtype){
-
-	if(type==PetscMatType){
-		#ifdef _HAVE_PETSC_
-		this->pmatrix->Convert(newtype);
-		#endif
-	}
-	else if(type==SeqMatType){
-		this->smatrix->Convert(newtype);
-	}
-	else{
-		_error_("Matrix type: " << type << " not supported yet!");
-	}
-
-}
-/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/matrix/Matrix.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/Matrix.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/matrix/Matrix.h	(revision 13216)
@@ -17,7 +17,10 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 /*}}}*/
-class Vector;
-enum matrixtype{PetscMatType, SeqMatType};
-
+
+enum matrixtype { PetscMatType, SeqMatType };
+
+template <class doubletype> class Vector;
+
+template <class doubletype> 
 class Matrix{
 
@@ -27,33 +30,314 @@
 		PetscMat *pmatrix;
 		#endif
-		SeqMat   *smatrix;
+		SeqMat<doubletype>   *smatrix;
 		int       type;
 
-		/*Matrix constructors, destructors {{{*/
-		Matrix();
-		#ifdef _HAVE_PETSC_
-		Matrix(int M,int N,int type=PetscMatType);
-		Matrix(int M,int N,IssmDouble sparsity,int type=PetscMatType);
-		Matrix(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity,int type=PetscMatType);
-		Matrix(int M,int N,int connectivity,int numberofdofspernode,int type=PetscMatType);
+		/*Matrix constructors, destructors*/
+		/*FUNCTION Matrix(){{{*/
+		Matrix(){
+
+			#ifdef _HAVE_PETSC_
+			pmatrix=NULL;
+			#endif
+			smatrix=NULL;
+
+			type=PetscMatType; //default
+			#ifndef _HAVE_PETSC_
+			type=SeqMatType;
+			#endif
+
+		}
+		/*}}}*/
+		/*FUNCTION Matrix(int M,int N,int in_type){{{*/
+		#ifdef _HAVE_PETSC_
+		Matrix(int M,int N,int in_type=PetscMatType){
 		#else
-		Matrix(int M,int N,int type=SeqMatType);
-		Matrix(int M,int N,IssmDouble sparsity,int type=SeqMatType);
-		Matrix(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity,int type=SeqMatType);
-		Matrix(int M,int N,int connectivity,int numberofdofspernode,int type=SeqMatType);
-		#endif
-		~Matrix();
-		/*}}}*/
-		/*Matrix specific routines {{{*/
-		void        Echo(void);
-		void        Assemble(void);
-		IssmDouble  Norm(NormMode norm_type);
-		void        GetSize(int *pM,int*pN);
-		void        GetLocalSize(int *pM,int*pN);
-		void        MatMult(Vector *X,Vector*AX);
-		Matrix     *Duplicate(void);
-		IssmDouble *ToSerial(void);
-		void        SetValues(int m,int *idxm,int n,int*idxn,IssmDouble*values,InsMode mode);
-		void        Convert(MatrixType newtype);
+		Matrix(int M,int N,int in_type=SeqMatType){
+		#endif
+
+			#ifdef _HAVE_PETSC_
+			pmatrix=NULL;
+			#endif
+			smatrix=NULL;
+			type=in_type;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix=new PetscMat(M,N);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix=new SeqMat<doubletype>(M,N);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Matrix(int M,int N,IssmDouble sparsity,int in_type){{{*/
+		#ifdef _HAVE_PETSC_
+		Matrix(int M,int N,IssmDouble sparsity,int in_type=PetscMatType){
+		#else
+		Matrix(int M,int N,IssmDouble sparsity,int in_type=SeqMatType){
+		#endif
+
+			#ifdef _HAVE_PETSC_
+			pmatrix=NULL;
+			#endif
+
+			smatrix=NULL;
+			type=in_type;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix=new PetscMat(M,N,sparsity);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix=new SeqMat<doubletype>(M,N,sparsity);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+		}
+		/*}}}*/
+		/*FUNCTION Matrix(IssmDouble* serial_mat, int M,int N,IssmDouble sparsity,int in_type){{{*/
+		#ifdef _HAVE_PETSC_
+		Matrix(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity,int in_type=PetscMatType){
+		#else
+		Matrix(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity,int in_type=SeqMatType){
+		#endif
+
+			#ifdef _HAVE_PETSC_
+			pmatrix=NULL;
+			#endif
+			smatrix=NULL;
+			type=in_type;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix=new PetscMat(serial_mat,M,N,sparsity);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix=new SeqMat<doubletype>(serial_mat,M,N,sparsity);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Matrix(int M,int N,int connectivity,int numberofdofspernode,int in_type){{{*/
+		#ifdef _HAVE_PETSC_
+		Matrix(int M,int N,int connectivity,int numberofdofspernode,int in_type=PetscMatType){
+		#else
+		Matrix(int M,int N,int connectivity,int numberofdofspernode,int in_type=SeqMatType){
+		#endif
+
+			#ifdef _HAVE_PETSC_
+			pmatrix=NULL;
+			#endif
+			smatrix=NULL;
+			type=in_type;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix=new PetscMat(M,N,connectivity,numberofdofspernode);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix=new SeqMat<doubletype>(M,N,connectivity,numberofdofspernode);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION ~Matrix(){{{*/
+		~Matrix(){
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				delete this->pmatrix;
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqMatType){
+				delete this->smatrix;
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+
+		/*Matrix specific routines:*/
+		/*FUNCTION Echo{{{*/
+		void Echo(void){
+			_assert_(this);
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix->Echo();
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix->Echo();
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Assemble{{{*/
+		void Assemble(void){
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix->Assemble();
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix->Assemble();
+			}
+			else{
+				_error_("Matrix type: " << type << " not supported yet!");
+			}
+		}
+		/*}}}*/
+		/*FUNCTION Norm{{{*/
+		IssmDouble Norm(NormMode norm_type){
+
+			IssmDouble norm=0;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				norm=this->pmatrix->Norm(norm_type);
+				#endif
+			}
+			else if(type==SeqMatType){
+				norm=this->smatrix->Norm(norm_type);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+			return norm;
+		}
+		/*}}}*/
+		/*FUNCTION GetSize{{{*/
+		void GetSize(int* pM,int* pN){
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix->GetSize(pM,pN);
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix->GetSize(pM,pN);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION GetLocalSize{{{*/
+		void GetLocalSize(int* pM,int* pN){
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix->GetLocalSize(pM,pN);
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix->GetLocalSize(pM,pN);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION MatMult{{{*/
+		void MatMult(Vector<doubletype>* X,Vector<doubletype>* AX){
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix->MatMult(X->pvector,AX->pvector);
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix->MatMult(X->svector,AX->svector);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Duplicate{{{*/
+		Matrix* Duplicate(void){
+
+			Matrix* output=NULL;
+
+			output=new Matrix();
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				output->pmatrix=this->pmatrix->Duplicate();
+				#endif
+			}
+			else if(type==SeqMatType){
+				output->smatrix=this->smatrix->Duplicate();
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+			return output;
+		}
+		/*}}}*/
+		/*FUNCTION ToSerial{{{*/
+		doubletype* ToSerial(void){
+
+			doubletype* output=NULL;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				output=this->pmatrix->ToSerial();
+				#endif
+			}
+			else if(type==SeqMatType){
+				output=this->smatrix->ToSerial();
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+
+			return output;
+		}
+		/*}}}*/
+		/*FUNCTION SetValues{{{*/
+		void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode){
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix->SetValues(m,idxm,n,idxn,values,mode);
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix->SetValues(m,idxm,n,idxn,values,mode);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+		}
+		/*}}}*/
+		/*FUNCTION Convert{{{*/
+		void Convert(MatrixType newtype){
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix->Convert(newtype);
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix->Convert(newtype);
+			}
+			else{
+				_error_("Matrix type: " << type << " not supported yet!");
+			}
+
+		}
 		/*}}}*/
 };
Index: sm/trunk-jpl/src/c/classes/matrix/Vector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/Vector.cpp	(revision 13215)
+++ 	(revision )
@@ -1,447 +1,0 @@
-/*!\file Vector.cpp
- * \brief: implementation of the Vector object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../classes.h"
-#include "../../shared/shared.h"
-#include "../../Container/Container.h"
-#include "../../include/include.h"
-#include "../../toolkits/toolkits.h"
-#include "./Vector.h"
-/*}}}*/
-
-/*Vector constructors and destructor*/
-/*FUNCTION Vector::Vector(){{{*/
-Vector::Vector(){
-
-	#ifdef _HAVE_PETSC_
-	this->pvector=NULL;
-	#endif
-	this->svector=NULL;
-	
-	type=PetscVecType; //default
-	#ifndef _HAVE_PETSC_
-	type=SeqVecType;
-	#endif
-
-}
-/*}}}*/
-/*FUNCTION Vector::Vector(int M,bool fromlocalsize,int type){{{*/
-Vector::Vector(int M,bool fromlocalsize,int in_type){
-	
-	#ifdef _HAVE_PETSC_
-	pvector=NULL;
-	#endif
-	svector=NULL;
-	type=in_type;
-
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector=new PetscVec(M,fromlocalsize);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector=new SeqVec(M,fromlocalsize);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-#ifdef _HAVE_PETSC_
-/*FUNCTION Vector::Vector(Vec petsc_vector){{{*/
-Vector::Vector(Vec petsc_vector){
-
-	this->type=PetscVecType;
-	this->svector=NULL;
-	this->pvector=new PetscVec(petsc_vector);
-
-}
-/*}}}*/
-#endif
-/*FUNCTION Vector::Vector(IssmDouble* serial_vec,int M,int type){{{*/
-Vector::Vector(IssmDouble* serial_vec,int M,int in_type){
-
-	#ifdef _HAVE_PETSC_
-	pvector=NULL;
-	#endif
-
-	svector=NULL;
-	type=in_type;
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector=new PetscVec(serial_vec,M);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector=new SeqVec(serial_vec,M);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::~Vector(){{{*/
-Vector::~Vector(){
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		delete this->pvector;
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		delete this->svector;
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-}
-/*}}}*/
-
-/*Vector specific routines: */
-/*FUNCTION Vector::Echo{{{*/
-void Vector::Echo(void){
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->Echo();
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->Echo();
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::Assemble{{{*/
-void Vector::Assemble(void){
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->Assemble();
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->Assemble();
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::SetValues{{{*/
-void Vector::SetValues(int ssize, int* list, IssmDouble* values, InsMode mode){
-		
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->SetValues(ssize,list,values,mode);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->SetValues(ssize,list,values,mode);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-		
-
-}
-/*}}}*/
-/*FUNCTION Vector::SetValue{{{*/
-void Vector::SetValue(int dof, IssmDouble value, InsMode mode){
-	
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->SetValue(dof,value,mode);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->SetValue(dof,value,mode);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::GetValue{{{*/
-void Vector::GetValue(IssmDouble* pvalue,int dof){
-		
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->GetValue(pvalue,dof);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->GetValue(pvalue,dof);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::GetSize{{{*/
-void Vector::GetSize(int* pM){
-	
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->GetSize(pM);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->GetSize(pM);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::IsEmpty{{{*/
-bool Vector::IsEmpty(void){
-
-	int M;
-
-	this->GetSize(&M);
-
-	if(M==0) 
-	 return true;
-	else
-	 return false;
-}
-/*}}}*/
-/*FUNCTION Vector::GetLocalSize{{{*/
-void Vector::GetLocalSize(int* pM){
-		
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->GetLocalSize(pM);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->GetLocalSize(pM);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::Duplicate{{{*/
-Vector* Vector::Duplicate(void){
-	
-	Vector* output=NULL;
-
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		output=new Vector();
-		output->pvector=this->pvector->Duplicate();
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		output=new Vector();
-		output->svector=this->svector->Duplicate();
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-	return output;
-
-}
-/*}}}*/
-/*FUNCTION Vector::Set{{{*/
-void Vector::Set(IssmDouble value){
-	
-	
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->Set(value);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->Set(value);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::AXPY{{{*/
-void Vector::AXPY(Vector* X, IssmDouble a){
-	
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->AXPY(X->pvector,a);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->AXPY(X->svector,a);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::AYPX{{{*/
-void Vector::AYPX(Vector* X, IssmDouble a){
-	
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->AYPX(X->pvector,a);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->AYPX(X->svector,a);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-
-}
-/*}}}*/
-/*FUNCTION Vector::ToMPISerial{{{*/
-IssmDouble* Vector::ToMPISerial(void){
-
-	IssmDouble* vec_serial=NULL;
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		vec_serial=this->pvector->ToMPISerial();
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		vec_serial=this->svector->ToMPISerial();
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-	return vec_serial;
-
-}
-/*}}}*/
-/*FUNCTION Vector::Copy{{{*/
-void Vector::Copy(Vector* to){
-
-	
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->Copy(to->pvector);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->Copy(to->svector);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-
-}
-/*}}}*/
-/*FUNCTION Vector::Norm{{{*/
-IssmDouble Vector::Norm(NormMode norm_type){
-	
-	IssmDouble norm=0;
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		norm=this->pvector->Norm(norm_type);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		norm=this->svector->Norm(norm_type);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-	return norm;
-}
-/*}}}*/
-/*FUNCTION Vector::Scale{{{*/
-void Vector::Scale(IssmDouble scale_factor){
-	
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->Scale(scale_factor);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->Scale(scale_factor);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
-/*FUNCTION Vector::Dot{{{*/
-IssmDouble Vector::Dot(Vector* vector){
-
-	IssmDouble dot;
-	
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		dot=this->pvector->Dot(vector->pvector);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		dot=this->svector->Dot(vector->svector);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-	return dot;
-}
-/*}}}*/
-/*FUNCTION Vector::PointwiseDivide{{{*/
-void Vector::PointwiseDivide(Vector* x,Vector* y){
-
-
-	if(type==PetscVecType){
-		#ifdef _HAVE_PETSC_
-		this->pvector->PointwiseDivide(x->pvector,y->pvector);
-		#else
-		_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
-		#endif
-	}
-	else if(type==SeqVecType){
-		this->svector->PointwiseDivide(x->svector,y->svector);
-	}
-	else _error_("Vector type: " << type << " not supported yet!");
-
-}
-/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/matrix/Vector.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/Vector.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/matrix/Vector.h	(revision 13216)
@@ -21,4 +21,5 @@
 enum vectortype { PetscVecType, SeqVecType };
 
+template <class doubletype> 
 class Vector{
 
@@ -28,43 +29,441 @@
 		PetscVec* pvector;
 		#endif
-		SeqVec* svector; 
+		SeqVec<doubletype>* svector; 
 		int     type;
 	
 
-		/*Vector constructors, destructors {{{*/
-		Vector();
+		/*Vector constructors, destructors */
+		/*FUNCTION Vector(){{{*/
+		Vector(){
+
+			#ifdef _HAVE_PETSC_
+			this->pvector=NULL;
+			#endif
+			this->svector=NULL;
+
+			type=PetscVecType; //default
+			#ifndef _HAVE_PETSC_
+			type=SeqVecType;
+			#endif
+
+		}
+		/*}}}*/
+		/*FUNCTION Vector(int M,bool fromlocalsize,int in_type){{{*/
 		#ifdef _HAVE_PETSC_
-		Vector(Vec petsc_vector);
-		Vector(int M,bool fromlocalsize=false,int type=PetscVecType);
-		Vector(IssmDouble* serial_vec,int pM,int type=PetscVecType);
+		Vector(int M,bool fromlocalsize=false,int in_type=PetscVecType){
 		#else
-		Vector(int M,bool fromlocalsize=false,int type=SeqVecType);
-		Vector(IssmDouble* serial_vec,int pM,int type=SeqVecType);
+		Vector(int M,bool fromlocalsize=false,int in_type=SeqVecType){
 		#endif
 
-		~Vector();
-		/*}}}*/
-		/*Vector specific routines {{{*/
-		void    Echo(void);
-		void    AXPY(Vector *X, IssmDouble a);
-		void    AYPX(Vector *X, IssmDouble a);
-		void    Assemble(void);
-		void    Copy(Vector *to);
-		IssmDouble  Dot(Vector *vector);
-		Vector *Duplicate(void);
-		void    GetValue(IssmDouble *pvalue, int dof);
-		void    GetSize(int *pM);
-		void    GetLocalSize(int *pM);
-		bool    IsEmpty(void);
-		IssmDouble  Norm(NormMode norm_type);
-		void    PointwiseDivide(Vector  *x,Vector*y);
-		void    Scale(IssmDouble scale_factor);
-		void    Set(IssmDouble value);
-		void    SetValues(int ssize, int *list, IssmDouble*values, InsMode mode);
-		void    SetValue(int dof, IssmDouble value, InsMode mode);
-		IssmDouble *ToMPISerial(void);
+			#ifdef _HAVE_PETSC_
+			pvector=NULL;
+			#endif
+			svector=NULL;
+			type=in_type;
+
+
+			if(type==PetscVecType){
+			#ifdef _HAVE_PETSC_
+				this->pvector=new PetscVec(M,fromlocalsize);
+			 #else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+			 #endif
+			}
+			else if(type==SeqVecType){
+				this->svector=new SeqVec<doubletype>(M,fromlocalsize);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Vector(doubletype* serial_vec,int M,int in_type){{{*/
+		#ifdef _HAVE_PETSC_
+		Vector(doubletype* serial_vec,int M,int in_type=PetscVecType){
+		#else
+		Vector(doubletype* serial_vec,int M,int in_type=SeqVecType){
+		#endif
+
+			#ifdef _HAVE_PETSC_
+			pvector=NULL;
+			#endif
+
+			svector=NULL;
+			type=in_type;
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector=new PetscVec(serial_vec,M);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector=new SeqVec<doubletype>(serial_vec,M);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION ~Vector(){{{*/
+		~Vector(){
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				delete this->pvector;
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				delete this->svector;
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+		}
+		/*}}}*/
+		#ifdef _HAVE_PETSC_
+		/*FUNCTION Vector(Vec petsc_vector){{{*/
+		Vector(Vec petsc_vector){
+
+			this->type=PetscVecType;
+			this->svector=NULL;
+			this->pvector=new PetscVec(petsc_vector);
+
+		}
+		/*}}}*/
+		#endif
+
+		/*Vector specific routines*/
+		/*FUNCTION Echo{{{*/
+		void Echo(void){
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->Echo();
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->Echo();
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Assemble{{{*/
+		void Assemble(void){
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->Assemble();
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->Assemble();
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION SetValues{{{*/
+		void SetValues(int ssize, int* list, doubletype* values, InsMode mode){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->SetValues(ssize,list,values,mode);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->SetValues(ssize,list,values,mode);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+
+
+		}
+		/*}}}*/
+		/*FUNCTION SetValue{{{*/
+		void SetValue(int dof, doubletype value, InsMode mode){
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->SetValue(dof,value,mode);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->SetValue(dof,value,mode);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION GetValue{{{*/
+		void GetValue(doubletype* pvalue,int dof){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->GetValue(pvalue,dof);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->GetValue(pvalue,dof);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION GetSize{{{*/
+		void GetSize(int* pM){
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->GetSize(pM);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->GetSize(pM);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION IsEmpty{{{*/
+		bool IsEmpty(void){
+
+			int M;
+
+			this->GetSize(&M);
+
+			if(M==0) 
+				return true;
+			else
+				return false;
+		}
+		/*}}}*/
+		/*FUNCTION GetLocalSize{{{*/
+		void GetLocalSize(int* pM){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->GetLocalSize(pM);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->GetLocalSize(pM);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Duplicate{{{*/
+		Vector* Duplicate(void){
+
+			Vector* output=NULL;
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				output=new Vector();
+				output->pvector=this->pvector->Duplicate();
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				output=new Vector();
+				output->svector=this->svector->Duplicate();
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+			return output;
+
+		}
+		/*}}}*/
+		/*FUNCTION Set{{{*/
+		void Set(doubletype value){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->Set(value);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->Set(value);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION AXPY{{{*/
+		void AXPY(Vector* X, doubletype a){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->AXPY(X->pvector,a);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->AXPY(X->svector,a);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION AYPX{{{*/
+		void AYPX(Vector* X, doubletype a){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->AYPX(X->pvector,a);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->AYPX(X->svector,a);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+
+		}
+		/*}}}*/
+		/*FUNCTION ToMPISerial{{{*/
+		doubletype* ToMPISerial(void){
+
+			doubletype* vec_serial=NULL;
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				vec_serial=this->pvector->ToMPISerial();
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				vec_serial=this->svector->ToMPISerial();
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+			return vec_serial;
+
+		}
+		/*}}}*/
+		/*FUNCTION Copy{{{*/
+		void Copy(Vector* to){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->Copy(to->pvector);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->Copy(to->svector);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+
+		}
+		/*}}}*/
+		/*FUNCTION Norm{{{*/
+		doubletype Norm(NormMode norm_type){
+
+			doubletype norm=0;
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				norm=this->pvector->Norm(norm_type);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				norm=this->svector->Norm(norm_type);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+			return norm;
+		}
+		/*}}}*/
+		/*FUNCTION Scale{{{*/
+		void Scale(doubletype scale_factor){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->Scale(scale_factor);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->Scale(scale_factor);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
+		/*FUNCTION Dot{{{*/
+		doubletype Dot(Vector* vector){
+
+			doubletype dot;
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				dot=this->pvector->Dot(vector->pvector);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				dot=this->svector->Dot(vector->svector);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+			return dot;
+		}
+		/*}}}*/
+		/*FUNCTION PointwiseDivide{{{*/
+		void PointwiseDivide(Vector* x,Vector* y){
+
+
+			if(type==PetscVecType){
+				#ifdef _HAVE_PETSC_
+				this->pvector->PointwiseDivide(x->pvector,y->pvector);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqVecType){
+				this->svector->PointwiseDivide(x->svector,y->svector);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
 		/*}}}*/
 };
-
-
 #endif //#ifndef _VECTOR_H_
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/BoolElementResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/BoolElementResult.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/BoolElementResult.cpp	(revision 13216)
@@ -126,10 +126,10 @@
 /*}}}*/
 /*FUNCTION BoolElementResult::GetVectorFromResults{{{*/
-void BoolElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){
+void BoolElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){
 
 	_error_("cannot return vector on vertices");
 } /*}}}*/
 /*FUNCTION BoolElementResult::GetElementVectorFromResults{{{*/
-void BoolElementResult::GetElementVectorFromResults(Vector* vector,int dof){
+void BoolElementResult::GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof){
 
 	vector->SetValue(dof,value,INS_VAL);
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/BoolElementResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/BoolElementResult.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/BoolElementResult.h	(revision 13216)
@@ -48,6 +48,6 @@
 		/*BoolElementResult management: {{{*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs);
-		void GetElementVectorFromResults(Vector* vector,int dof);
+		void GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs);
+		void GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof);
 		/*}}}*/
 };
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/DoubleElementResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/DoubleElementResult.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/DoubleElementResult.cpp	(revision 13216)
@@ -127,10 +127,10 @@
 /*}}}*/
 /*FUNCTION DoubleElementResult::GetVectorFromResults{{{1*/
-void DoubleElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){
+void DoubleElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){
 
 	_error_("cannot return vector on vertices");
 } /*}}}*/
 /*FUNCTION DoubleElementResult::GetElementVectorFromResults{{{1*/
-void DoubleElementResult::GetElementVectorFromResults(Vector* vector,int dof){
+void DoubleElementResult::GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof){
 
 	vector->SetValue(dof,value,INS_VAL);
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/DoubleElementResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/DoubleElementResult.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/DoubleElementResult.h	(revision 13216)
@@ -48,6 +48,6 @@
 		/*DoubleElementResult management: {{{*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs);
-		void GetElementVectorFromResults(Vector* vector,int dof);
+		void GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs);
+		void GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof);
 		/*}}}*/
 };
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/ElementResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/ElementResult.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/ElementResult.h	(revision 13216)
@@ -25,6 +25,6 @@
 		virtual void    PatchFill(int row, Patch* patch)=0;
 		virtual int     InstanceEnum()=0;
-		virtual void    GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdof)=0;
-		virtual void    GetElementVectorFromResults(Vector* vector,int dof)=0;
+		virtual void    GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdof)=0;
+		virtual void    GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof)=0;
 
 };
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/PentaP1ElementResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/PentaP1ElementResult.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/PentaP1ElementResult.cpp	(revision 13216)
@@ -138,5 +138,5 @@
 /*}}}*/
 /*FUNCTION PentaP1ElementResult::GetVectorFromResults{{{*/
-void PentaP1ElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){
+void PentaP1ElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){
 
 	IssmDouble data[6];
@@ -148,5 +148,5 @@
 } /*}}}*/
 /*FUNCTION PentaP1ElementResult::GetElementVectorFromResults{{{*/
-void PentaP1ElementResult::GetElementVectorFromResults(Vector* vector,int dof){
+void PentaP1ElementResult::GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof){
 
 	_error_("Result " << EnumToStringx(enum_type) << " is a PentaP1ElementResult and should not write vector of size numberofelemenrs");
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/PentaP1ElementResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/PentaP1ElementResult.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/PentaP1ElementResult.h	(revision 13216)
@@ -47,6 +47,6 @@
 		/*PentaP1ElementResult management: {{{*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs);
-		void GetElementVectorFromResults(Vector* vector,int dof);
+		void GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs);
+		void GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof);
 		/*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/TriaP1ElementResult.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/TriaP1ElementResult.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/TriaP1ElementResult.cpp	(revision 13216)
@@ -126,5 +126,5 @@
 /*}}}*/
 /*FUNCTION TriaP1ElementResult::GetVectorFromResults{{{*/
-void TriaP1ElementResult::GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs){
+void TriaP1ElementResult::GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs){
 
 	IssmDouble data[3];
@@ -136,5 +136,5 @@
 } /*}}}*/
 /*FUNCTION TriaP1ElementResult::GetElementVectorFromResults{{{*/
-void TriaP1ElementResult::GetElementVectorFromResults(Vector* vector,int dof){
+void TriaP1ElementResult::GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof){
 	_error_("Result " << EnumToStringx(enum_type) << " is a TriaP1ElementResult and should not write vector of size numberofelemenrs");
 } /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/ElementResults/TriaP1ElementResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ElementResults/TriaP1ElementResult.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ElementResults/TriaP1ElementResult.h	(revision 13216)
@@ -46,6 +46,6 @@
 		/*TriaP1ElementResult management: {{{*/
 		int   InstanceEnum();
-		void GetVectorFromResults(Vector* vector,int* doflist,int* connectivitylist,int numdofs);
-		void GetElementVectorFromResults(Vector* vector,int dof);
+		void GetVectorFromResults(Vector<IssmDouble>* vector,int* doflist,int* connectivitylist,int numdofs);
+		void GetElementVectorFromResults(Vector<IssmDouble>* vector,int dof);
 		/*}}}*/
 
Index: /issm/trunk-jpl/src/c/classes/objects/Elements/Element.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Elements/Element.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Elements/Element.h	(revision 13216)
@@ -16,6 +16,6 @@
 class Parameters;
 class Patch;
-class Matrix;
-class Vector;
+template <class doublematrix> class Matrix;
+template <class doubletype> class Vector;
 
 #include "../../../toolkits/toolkits.h"
@@ -30,8 +30,8 @@
 		virtual void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
 		virtual void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters)=0;
-		virtual void   CreateKMatrix(Matrix* Kff, Matrix*  Kfs,Vector* df)=0;
-		virtual void   CreatePVector(Vector* pf)=0;
-		virtual void   CreateJacobianMatrix(Matrix* Jff)=0;
-		virtual void   GetSolutionFromInputs(Vector* solution)=0;
+		virtual void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>*  Kfs,Vector<IssmDouble>* df)=0;
+		virtual void   CreatePVector(Vector<IssmDouble>* pf)=0;
+		virtual void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+		virtual void   GetSolutionFromInputs(Vector<IssmDouble>* solution)=0;
 		virtual int    GetNodeIndex(Node* node)=0;
 		virtual int    Sid()=0;
@@ -46,6 +46,6 @@
 		virtual IssmDouble SurfaceArea(void)=0;
 		virtual void   InputDepthAverageAtBase(int enum_type,int average_enum_type,int object_enum)=0;
-		virtual void   ComputeBasalStress(Vector* sigma_b)=0;
-		virtual void   ComputeStrainRate(Vector* eps)=0;
+		virtual void   ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0;
+		virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
 		virtual void   PatchSize(int* pnumrows, int* pnumvertices,int* pnumnodes)=0;
 		virtual void   PatchFill(int* pcount, Patch* patch)=0;
@@ -62,19 +62,19 @@
 		virtual int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units)=0;
 		virtual void   InputScale(int enum_type,IssmDouble scale_factor)=0;
-		virtual void   GetVectorFromInputs(Vector* vector, int name_enum)=0;
-		virtual void   GetVectorFromResults(Vector* vector,int id,int enum_in,int interp)=0;
+		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum)=0;
+		virtual void   GetVectorFromResults(Vector<IssmDouble>* vector,int id,int enum_in,int interp)=0;
 		virtual void   InputArtificialNoise(int enum_type,IssmDouble min,IssmDouble max)=0;
 		virtual bool   InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums)=0;
-		virtual void   AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
+		virtual void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part)=0;
 		virtual int*   GetHorizontalNeighboorSids(void)=0;
 		virtual IssmDouble TimeAdapt()=0;
 		virtual void   MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding)=0;
-		virtual void   PotentialSheetUngrounding(Vector* potential_sheet_ungrounding)=0;
+		virtual void   PotentialSheetUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding)=0;
 		virtual void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm)=0;
 		virtual void   Delta18oParameterization(void)=0;
 		virtual void   SmbGradients()=0;
-		virtual int    UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf)=0;
+		virtual int    UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf)=0;
 		virtual void   ResetCoordinateSystem()=0;
-		virtual void   SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius)=0;
+		virtual void   SmearFunction(Vector<IssmDouble>* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius)=0;
 
 		#ifdef _HAVE_RESPONSES_
@@ -97,5 +97,5 @@
 
 		#ifdef _HAVE_CONTROL_
-		virtual void   Gradj(Vector* gradient,int control_type,int control_index)=0;
+		virtual void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index)=0;
 		virtual IssmDouble ThicknessAbsMisfit(bool process_units  ,int weight_index)=0;
 		virtual IssmDouble SurfaceAbsVelMisfit(bool process_units ,int weight_index)=0;
@@ -109,8 +109,8 @@
 		virtual IssmDouble RheologyBbarAbsGradient(bool process_units,int weight_index)=0;
 		virtual IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index)=0;
-		virtual void   ControlInputGetGradient(Vector* gradient,int enum_type,int control_index)=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;
-		virtual void   GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data)=0;
+		virtual void   GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data)=0;
 		virtual void   SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index)=0;
 		virtual void   InputControlUpdate(IssmDouble scalar,bool save_parameter)=0;
Index: /issm/trunk-jpl/src/c/classes/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Elements/Penta.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Elements/Penta.cpp	(revision 13216)
@@ -145,5 +145,5 @@
 /*Other*/
 /*FUNCTION Penta::AverageOntoPartition {{{*/
-void  Penta::AverageOntoPartition(Vector* partition_contributions,Vector* 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!");
 }
@@ -226,5 +226,5 @@
 /*}}}*/
 /*FUNCTION Penta::ComputeBasalStress {{{*/
-void  Penta::ComputeBasalStress(Vector* sigma_b){
+void  Penta::ComputeBasalStress(Vector<IssmDouble>* sigma_b){
 
 	int         i,j,ig;
@@ -316,5 +316,5 @@
 /*}}}*/
 /*FUNCTION Penta::ComputeStrainRate {{{*/
-void  Penta::ComputeStrainRate(Vector* eps){
+void  Penta::ComputeStrainRate(Vector<IssmDouble>* eps){
 
 	_error_("Not implemented yet");
@@ -410,5 +410,5 @@
 /*}}}*/
 /*FUNCTION Penta::CreateKMatrix {{{*/
-void  Penta::CreateKMatrix(Matrix* Kff, Matrix* Kfs,Vector* df){
+void  Penta::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df){
 
 	/*retrieve parameters: */
@@ -514,5 +514,5 @@
 /*}}}*/
 /*FUNCTION Penta::CreatePVector {{{*/
-void  Penta::CreatePVector(Vector* pf){
+void  Penta::CreatePVector(Vector<IssmDouble>* pf){
 
 	/*retrive parameters: */
@@ -616,5 +616,5 @@
 /*}}}*/
 /*FUNCTION Penta::CreateJacobianMatrix{{{*/
-void  Penta::CreateJacobianMatrix(Matrix* Jff){
+void  Penta::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
 
 	/*retrieve parameters: */
@@ -1006,5 +1006,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetSolutionFromInputs{{{*/
-void  Penta::GetSolutionFromInputs(Vector* solution){
+void  Penta::GetSolutionFromInputs(Vector<IssmDouble>* solution){
 
 	int analysis_type;
@@ -1133,5 +1133,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetVectorFromInputs{{{*/
-void  Penta::GetVectorFromInputs(Vector* vector,int input_enum){
+void  Penta::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
 
 	int doflist1[NUMVERTICES];
@@ -1152,5 +1152,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetVectorFromResults{{{*/
-void  Penta::GetVectorFromResults(Vector* vector,int offset,int enum_in,int interp){
+void  Penta::GetVectorFromResults(Vector<IssmDouble>* vector,int offset,int enum_in,int interp){
 
 	/*Get result*/
@@ -2390,5 +2390,5 @@
 /*}}}*/
 /*FUNCTION Penta::PotentialSheetUngrounding{{{*/
-void  Penta::PotentialSheetUngrounding(Vector* potential_sheet_ungrounding){
+void  Penta::PotentialSheetUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){
 
 	int     i;
@@ -2965,5 +2965,5 @@
 /*}}}*/
 /*FUNCTION Penta::UpdatePotentialSheetUngrounding{{{*/
-int Penta::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
+int Penta::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
 
 	int i;
@@ -3033,5 +3033,5 @@
 /*}}}*/
 /*FUNCTION Penta::SmearFunction {{{*/
-void  Penta::SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){
+void  Penta::SmearFunction(Vector<IssmDouble>* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){
 	_error_("not implemented yet");
 }
@@ -4247,5 +4247,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetSolutionFromInputsThermal{{{*/
-void  Penta::GetSolutionFromInputsThermal(Vector* solution){
+void  Penta::GetSolutionFromInputsThermal(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF1*NUMVERTICES;
@@ -4278,5 +4278,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetSolutionFromInputsEnthalpy{{{*/
-void  Penta::GetSolutionFromInputsEnthalpy(Vector* solution){
+void  Penta::GetSolutionFromInputsEnthalpy(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF1*NUMVERTICES;
@@ -4461,5 +4461,5 @@
 #ifdef _HAVE_CONTROL_
 /*FUNCTION Penta::ControlInputGetGradient{{{*/
-void Penta::ControlInputGetGradient(Vector* gradient,int enum_type,int control_index){
+void Penta::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){
 
 	int doflist1[NUMVERTICES];
@@ -4808,5 +4808,5 @@
 /*}}}*/
 /*FUNCTION Penta::Gradj {{{*/
-void  Penta::Gradj(Vector* 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)*/
 
@@ -4899,5 +4899,5 @@
 /*}}}*/
 /*FUNCTION Penta::GradjDragMacAyeal {{{*/
-void  Penta::GradjDragMacAyeal(Vector* gradient,int control_index){
+void  Penta::GradjDragMacAyeal(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Gradient is 0 if on shelf or not on bed*/
@@ -4911,5 +4911,5 @@
 } /*}}}*/
 /*FUNCTION Penta::GradjDragPattyn {{{*/
-void  Penta::GradjDragPattyn(Vector* gradient,int control_index){
+void  Penta::GradjDragPattyn(Vector<IssmDouble>* gradient,int control_index){
 
 	int        i,j,ig;
@@ -4982,5 +4982,5 @@
 /*}}}*/
 /*FUNCTION Penta::GradjDragStokes {{{*/
-void  Penta::GradjDragStokes(Vector* gradient,int control_index){
+void  Penta::GradjDragStokes(Vector<IssmDouble>* gradient,int control_index){
 
 	int        i,j,ig;
@@ -5074,5 +5074,5 @@
 /*}}}*/
 /*FUNCTION Penta::GradjBbarMacAyeal {{{*/
-void  Penta::GradjBbarMacAyeal(Vector* gradient,int control_index){
+void  Penta::GradjBbarMacAyeal(Vector<IssmDouble>* gradient,int control_index){
 
 	/*This element should be collapsed into a tria element at its base*/
@@ -5092,5 +5092,5 @@
 } /*}}}*/
 /*FUNCTION Penta::GradjBbarPattyn {{{*/
-void  Penta::GradjBbarPattyn(Vector* gradient,int control_index){
+void  Penta::GradjBbarPattyn(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Gradient is computed on bed only (Bbar)*/
@@ -5109,5 +5109,5 @@
 } /*}}}*/
 /*FUNCTION Penta::GradjBbarStokes {{{*/
-void  Penta::GradjBbarStokes(Vector* gradient,int control_index){
+void  Penta::GradjBbarStokes(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Gradient is computed on bed only (Bbar)*/
@@ -5492,5 +5492,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetVectorFromControlInputs{{{*/
-void  Penta::GetVectorFromControlInputs(Vector* 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 doflist1[NUMVERTICES];
@@ -8075,5 +8075,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticHoriz{{{*/
-void  Penta::GetSolutionFromInputsDiagnosticHoriz(Vector* solution){
+void  Penta::GetSolutionFromInputsDiagnosticHoriz(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF2*NUMVERTICES;
@@ -8117,5 +8117,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticHutter{{{*/
-void  Penta::GetSolutionFromInputsDiagnosticHutter(Vector* solution){
+void  Penta::GetSolutionFromInputsDiagnosticHutter(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF2*NUMVERTICES;
@@ -8153,5 +8153,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticVert{{{*/
-void  Penta::GetSolutionFromInputsDiagnosticVert(Vector* solution){
+void  Penta::GetSolutionFromInputsDiagnosticVert(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF1*NUMVERTICES;
@@ -8186,5 +8186,5 @@
 /*}}}*/
 /*FUNCTION Penta::GetSolutionFromInputsDiagnosticStokes{{{*/
-void  Penta::GetSolutionFromInputsDiagnosticStokes(Vector* solution){
+void  Penta::GetSolutionFromInputsDiagnosticStokes(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF4*NUMVERTICES;
Index: /issm/trunk-jpl/src/c/classes/objects/Elements/Penta.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Elements/Penta.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Elements/Penta.h	(revision 13216)
@@ -74,21 +74,21 @@
 		/*}}}*/
 		/*Element virtual functions definitions: {{{*/
-		void   AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+		void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
 		void   BasalFrictionCreateInput(void);
-		void   ComputeBasalStress(Vector* sigma_b);
-		void   ComputeStrainRate(Vector* eps);
+		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+		void   ComputeStrainRate(Vector<IssmDouble>* eps);
 		void   ComputeStressTensor();
 		void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
-		void   CreateKMatrix(Matrix* Kff, Matrix* Kfs,Vector* df);
-		void   CreatePVector(Vector* pf);
-		void   CreateJacobianMatrix(Matrix* Jff);
+		void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df);
+		void   CreatePVector(Vector<IssmDouble>* pf);
+		void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
 		void   Delta18oParameterization(void);
 		void   DeleteResults(void);
 		int    GetNodeIndex(Node* node);
-		void   GetSolutionFromInputs(Vector* solution);
+		void   GetSolutionFromInputs(Vector<IssmDouble>* solution);
 		IssmDouble GetZcoord(GaussPenta* gauss);
-		void   GetVectorFromInputs(Vector* vector,int name_enum);
-		void   GetVectorFromResults(Vector* vector,int offset,int name_enum,int interp);
+		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int name_enum);
+		void   GetVectorFromResults(Vector<IssmDouble>* vector,int offset,int name_enum,int interp);
 		
 		int    Sid();
@@ -103,5 +103,5 @@
 		void   InputToResult(int enum_type,int step,IssmDouble time);
 		void   MigrateGroundingLine(IssmDouble* old_floating_ice,IssmDouble* sheet_ungrounding);
-		void   PotentialSheetUngrounding(Vector* potential_sheet_ungrounding);
+		void   PotentialSheetUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
 		void   RequestedOutput(int output_enum,int step,IssmDouble time);
 		void   ListResultsInfo(int** results_enums,int** results_size,IssmDouble** results_times,int** results_steps,int* num_results);
@@ -114,10 +114,10 @@
 		IssmDouble SurfaceArea(void);
 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
-		int    UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
+		int    UpdatePotentialSheetUngrounding(IssmDouble* potential_sheet_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units);
 		IssmDouble TimeAdapt();
 		int*   GetHorizontalNeighboorSids(void);
 		void   ViscousHeatingCreateInput(void);
-		void   SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius);
+		void   SmearFunction(Vector<IssmDouble>* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius);
 
 		 #ifdef _HAVE_RESPONSES_
@@ -142,14 +142,14 @@
 		IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index);
 		void   GradientIndexing(int* indexing,int control_index);
-		void   Gradj(Vector* gradient,int control_type,int control_index);
-		void   GradjDragMacAyeal(Vector* gradient,int control_index);
-		void   GradjDragPattyn(Vector* gradient,int control_index);
-		void   GradjDragStokes(Vector* gradient,int control_index);
-		void   GradjBbarMacAyeal(Vector* gradient,int control_index);
-		void   GradjBbarPattyn(Vector* gradient,int control_index);
-		void   GradjBbarStokes(Vector* gradient,int control_index);
-		void   GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data);
+		void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index);
+		void   GradjDragMacAyeal(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjDragPattyn(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjDragStokes(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjBbarMacAyeal(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjBbarPattyn(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjBbarStokes(Vector<IssmDouble>* gradient,int control_index);
+		void   GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data);
 		void   SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index);
-		void   ControlInputGetGradient(Vector* gradient,int enum_type,int control_index);
+		void   ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index);
 		void   ControlInputScaleGradient(int enum_type,IssmDouble scale);
 		void   ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
@@ -183,5 +183,5 @@
 		void    GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
 		void	  GetPhi(IssmDouble* phi, IssmDouble*  epsilon, IssmDouble viscosity);
-		void	  GetSolutionFromInputsEnthalpy(Vector* solutiong);
+		void	  GetSolutionFromInputsEnthalpy(Vector<IssmDouble>* solutiong);
 		IssmDouble  GetStabilizationParameter(IssmDouble u, IssmDouble v, IssmDouble w, IssmDouble diameter, IssmDouble kappa);
 		void    GetStrainRate3dPattyn(IssmDouble* epsilon,IssmDouble* xyz_list, GaussPenta* gauss, Input* vx_input, Input* vy_input);
@@ -254,8 +254,8 @@
 		void           InputUpdateFromSolutionDiagnosticVert( IssmDouble* solutiong);
 		void           InputUpdateFromSolutionDiagnosticStokes( IssmDouble* solutiong);
-		void	         GetSolutionFromInputsDiagnosticHoriz(Vector* solutiong);
-		void	         GetSolutionFromInputsDiagnosticHutter(Vector* solutiong);
-		void	         GetSolutionFromInputsDiagnosticStokes(Vector* solutiong);
-		void	         GetSolutionFromInputsDiagnosticVert(Vector* solutiong);
+		void	         GetSolutionFromInputsDiagnosticHoriz(Vector<IssmDouble>* solutiong);
+		void	         GetSolutionFromInputsDiagnosticHutter(Vector<IssmDouble>* solutiong);
+		void	         GetSolutionFromInputsDiagnosticStokes(Vector<IssmDouble>* solutiong);
+		void	         GetSolutionFromInputsDiagnosticVert(Vector<IssmDouble>* solutiong);
 		ElementVector* CreatePVectorCouplingMacAyealStokes(void);
 		ElementVector* CreatePVectorCouplingMacAyealStokesViscous(void);
@@ -313,5 +313,5 @@
 		ElementVector* CreatePVectorThermalShelf(void);
 		ElementVector* CreatePVectorThermalSheet(void);
-		void	       GetSolutionFromInputsThermal(Vector* solutiong);
+		void	       GetSolutionFromInputsThermal(Vector<IssmDouble>* solutiong);
 		void           InputUpdateFromSolutionThermal( IssmDouble* solutiong);
 		void           InputUpdateFromSolutionEnthalpy( IssmDouble* solutiong);
Index: /issm/trunk-jpl/src/c/classes/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Elements/Tria.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Elements/Tria.cpp	(revision 13216)
@@ -125,5 +125,5 @@
 /*Other*/
 /*FUNCTION Tria::AverageOntoPartition {{{*/
-void  Tria::AverageOntoPartition(Vector* partition_contributions,Vector* 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;
@@ -165,5 +165,5 @@
 /*}}}*/
 /*FUNCTION Tria::CreateKMatrix {{{*/
-void  Tria::CreateKMatrix(Matrix* Kff, Matrix* Kfs,Vector* df){
+void  Tria::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df){
 
 	/*retreive parameters: */
@@ -517,5 +517,5 @@
 /*}}}*/
 /*FUNCTION Tria::CreatePVector {{{*/
-void  Tria::CreatePVector(Vector* pf){
+void  Tria::CreatePVector(Vector<IssmDouble>* pf){
 
 	/*retrive parameters: */
@@ -740,5 +740,5 @@
 /*}}}*/
 /*FUNCTION Tria::CreateJacobianMatrix{{{*/
-void  Tria::CreateJacobianMatrix(Matrix* Jff){
+void  Tria::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
 
 	/*retrieve parameters: */
@@ -773,10 +773,10 @@
 /*}}}*/
 /*FUNCTION Tria::ComputeBasalStress {{{*/
-void  Tria::ComputeBasalStress(Vector* eps){
+void  Tria::ComputeBasalStress(Vector<IssmDouble>* eps){
 	_error_("Not Implemented yet");
 }
 /*}}}*/
 /*FUNCTION Tria::ComputeStrainRate {{{*/
-void  Tria::ComputeStrainRate(Vector* eps){
+void  Tria::ComputeStrainRate(Vector<IssmDouble>* eps){
 	_error_("Not Implemented yet");
 }
@@ -1191,5 +1191,5 @@
 /*}}}*/
 /*FUNCTION Tria::GetSolutionFromInputs{{{*/
-void  Tria::GetSolutionFromInputs(Vector* solution){
+void  Tria::GetSolutionFromInputs(Vector<IssmDouble>* solution){
 
 	/*retrive parameters: */
@@ -1241,5 +1241,5 @@
 /*}}}*/
 /*FUNCTION Tria::GetVectorFromInputs{{{*/
-void  Tria::GetVectorFromInputs(Vector* vector,int input_enum){
+void  Tria::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
 
 	int doflist1[NUMVERTICES];
@@ -1260,5 +1260,5 @@
 /*}}}*/
 /*FUNCTION Tria::GetVectorFromResults{{{*/
-void  Tria::GetVectorFromResults(Vector* vector,int offset,int enum_in,int interp){
+void  Tria::GetVectorFromResults(Vector<IssmDouble>* vector,int offset,int enum_in,int interp){
 
 	/*Get result*/
@@ -2131,5 +2131,5 @@
 /*}}}*/
 /*FUNCTION Tria::PotentialSheetUngrounding{{{*/
-void  Tria::PotentialSheetUngrounding(Vector* potential_sheet_ungrounding){
+void  Tria::PotentialSheetUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding){
 
 	int     i;
@@ -2251,5 +2251,5 @@
 /*}}}*/
 /*FUNCTION Tria::SmearFunction {{{*/
-void  Tria::SmearFunction(Vector*  smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){
+void  Tria::SmearFunction(Vector<IssmDouble>*  smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius){
 	_error_("not implemented yet");
 
@@ -2524,5 +2524,5 @@
 /*}}}*/
 /*FUNCTION Tria::UpdatePotentialSheetUngrounding{{{*/
-int Tria::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
+int Tria::UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf){
 
 	int i;
@@ -3192,5 +3192,5 @@
 /*}}}*/
 /*FUNCTION Tria::GetSolutionFromInputsDiagnosticHoriz{{{*/
-void  Tria::GetSolutionFromInputsDiagnosticHoriz(Vector* solution){
+void  Tria::GetSolutionFromInputsDiagnosticHoriz(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF2*NUMVERTICES;
@@ -3231,5 +3231,5 @@
 /*}}}*/
 /*FUNCTION Tria::GetSolutionFromInputsDiagnosticHutter{{{*/
-void  Tria::GetSolutionFromInputsDiagnosticHutter(Vector* solution){
+void  Tria::GetSolutionFromInputsDiagnosticHutter(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF2*NUMVERTICES;
@@ -3430,5 +3430,5 @@
 /*}}}*/
 /*FUNCTION Tria::ControlInputGetGradient{{{*/
-void Tria::ControlInputGetGradient(Vector* gradient,int enum_type,int control_index){
+void Tria::ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index){
 
 	int doflist1[NUMVERTICES];
@@ -3489,5 +3489,5 @@
 }/*}}}*/
 /*FUNCTION Tria::Gradj {{{*/
-void  Tria::Gradj(Vector* 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)*/
 
@@ -3553,5 +3553,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjBGradient{{{*/
-void  Tria::GradjBGradient(Vector* gradient,int weight_index,int control_index){
+void  Tria::GradjBGradient(Vector<IssmDouble>* gradient,int weight_index,int control_index){
 
 	int        i,ig;
@@ -3593,5 +3593,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjZGradient{{{*/
-void  Tria::GradjZGradient(Vector* gradient,int weight_index,int control_index){
+void  Tria::GradjZGradient(Vector<IssmDouble>* gradient,int weight_index,int control_index){
 
 	int        i,ig;
@@ -3633,5 +3633,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjBMacAyeal{{{*/
-void  Tria::GradjBMacAyeal(Vector* gradient,int control_index){
+void  Tria::GradjBMacAyeal(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Intermediaries*/
@@ -3690,5 +3690,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjZMacAyeal{{{*/
-void  Tria::GradjZMacAyeal(Vector* gradient,int control_index){
+void  Tria::GradjZMacAyeal(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Intermediaries*/
@@ -3747,5 +3747,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjDragMacAyeal {{{*/
-void  Tria::GradjDragMacAyeal(Vector* gradient,int control_index){
+void  Tria::GradjDragMacAyeal(Vector<IssmDouble>* gradient,int control_index){
 
 	int        i,ig;
@@ -3835,5 +3835,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjDragGradient{{{*/
-void  Tria::GradjDragGradient(Vector* gradient, int weight_index,int control_index){
+void  Tria::GradjDragGradient(Vector<IssmDouble>* gradient, int weight_index,int control_index){
 
 	int        i,ig;
@@ -3879,5 +3879,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjDhDtBalancedthickness{{{*/
-void  Tria::GradjDhDtBalancedthickness(Vector* gradient,int control_index){
+void  Tria::GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Intermediaries*/
@@ -3895,5 +3895,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjVxBalancedthickness{{{*/
-void  Tria::GradjVxBalancedthickness(Vector* gradient,int control_index){
+void  Tria::GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Intermediaries*/
@@ -3938,5 +3938,5 @@
 /*}}}*/
 /*FUNCTION Tria::GradjVyBalancedthickness{{{*/
-void  Tria::GradjVyBalancedthickness(Vector* gradient,int control_index){
+void  Tria::GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index){
 
 	/*Intermediaries*/
@@ -5203,5 +5203,5 @@
 /*}}}*/
 /*FUNCTION Tria::GetVectorFromControlInputs{{{*/
-void  Tria::GetVectorFromControlInputs(Vector* 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 doflist1[NUMVERTICES];
@@ -5476,5 +5476,5 @@
 /*}}}*/
 /*FUNCTION Tria::GetSolutionFromInputsHydrology{{{*/
-void  Tria::GetSolutionFromInputsHydrology(Vector* solution){
+void  Tria::GetSolutionFromInputsHydrology(Vector<IssmDouble>* solution){
 
 	const int    numdof=NDOF1*NUMVERTICES;
Index: /issm/trunk-jpl/src/c/classes/objects/Elements/Tria.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Elements/Tria.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Elements/Tria.h	(revision 13216)
@@ -71,13 +71,13 @@
 		/*}}}*/
 		/*Element virtual functions definitions: {{{*/
-		void   AverageOntoPartition(Vector* partition_contributions,Vector* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
-		void   ComputeBasalStress(Vector* sigma_b);
-		void   ComputeStrainRate(Vector* eps);
+		void   AverageOntoPartition(Vector<IssmDouble>* partition_contributions,Vector<IssmDouble>* partition_areas,IssmDouble* vertex_response,IssmDouble* qmu_part);
+		void   ComputeBasalStress(Vector<IssmDouble>* sigma_b);
+		void   ComputeStrainRate(Vector<IssmDouble>* eps);
 		void   ComputeStressTensor();
 		void   Configure(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
 		void   SetCurrentConfiguration(Elements* elements,Loads* loads,DataSet* nodes,Materials* materials,Parameters* parameters);
-		void   CreateKMatrix(Matrix* Kff, Matrix* Kfs,Vector* df);
-		void   CreatePVector(Vector* pf);
-		void   CreateJacobianMatrix(Matrix* Jff);
+		void   CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,Vector<IssmDouble>* df);
+		void   CreatePVector(Vector<IssmDouble>* pf);
+		void   CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
 		void   Delta18oParameterization(void);
 		int    GetNodeIndex(Node* node);
@@ -88,7 +88,7 @@
 		bool   IsNodeOnShelfFromFlags(IssmDouble* flags);
 		bool   IsOnWater(); 
-		void   GetSolutionFromInputs(Vector* solution);
-		void   GetVectorFromInputs(Vector* vector, int name_enum);
-		void   GetVectorFromResults(Vector* vector,int offset,int enum_in,int interp);
+		void   GetSolutionFromInputs(Vector<IssmDouble>* solution);
+		void   GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum);
+		void   GetVectorFromResults(Vector<IssmDouble>* vector,int offset,int enum_in,int interp);
 		void   InputArtificialNoise(int enum_type,IssmDouble min, IssmDouble max);
 		bool   InputConvergence(IssmDouble* eps, int* enums,int num_enums,int* criterionenums,IssmDouble* criterionvalues,int num_criterionenums);
@@ -103,5 +103,5 @@
 		void   MigrateGroundingLine(IssmDouble* oldfloating,IssmDouble* sheet_ungrounding);
 		int    NodalValue(IssmDouble* pvalue, int index, int natureofdataenum,bool process_units);
-		void   PotentialSheetUngrounding(Vector* potential_sheet_ungrounding);
+		void   PotentialSheetUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
 		void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
 		void   RequestedOutput(int output_enum,int step,IssmDouble time);
@@ -114,8 +114,8 @@
 		IssmDouble SurfaceArea(void);
 		void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
-		int    UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
+		int    UpdatePotentialSheetUngrounding(IssmDouble* vertices_potentially_ungrounding,Vector<IssmDouble>* vec_nodes_on_iceshelf,IssmDouble* nodes_on_iceshelf);
 		IssmDouble TimeAdapt();
 		int*   GetHorizontalNeighboorSids(void);
-		void   SmearFunction(Vector* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius);
+		void   SmearFunction(Vector<IssmDouble>* smearedvector,IssmDouble (*WeightFunction)(IssmDouble distance,IssmDouble radius),IssmDouble radius);
 
 		#ifdef _HAVE_RESPONSES_
@@ -141,18 +141,18 @@
 		IssmDouble DragCoefficientAbsGradient(bool process_units,int weight_index);
 		void   GradientIndexing(int* indexing,int control_index);
-		void   Gradj(Vector* gradient,int control_type,int control_index);
-		void   GradjBGradient(Vector* gradient,int weight_index,int control_index);
-		void   GradjZGradient(Vector* gradient,int weight_index,int control_index);
-		void   GradjBMacAyeal(Vector* gradient,int control_index);
-		void   GradjZMacAyeal(Vector* gradient,int control_index);
-		void   GradjDragMacAyeal(Vector* gradient,int control_index);
-		void   GradjDragStokes(Vector* gradient,int control_index);
-		void   GradjDragGradient(Vector* gradient,int weight_index,int control_index);
-		void   GradjDhDtBalancedthickness(Vector* gradient,int control_index);
-		void   GradjVxBalancedthickness(Vector* gradient,int control_index);
-		void   GradjVyBalancedthickness(Vector* gradient,int control_index);
-		void   GetVectorFromControlInputs(Vector* gradient,int control_enum,int control_index,const char* data);
+		void   Gradj(Vector<IssmDouble>* gradient,int control_type,int control_index);
+		void   GradjBGradient(Vector<IssmDouble>* gradient,int weight_index,int control_index);
+		void   GradjZGradient(Vector<IssmDouble>* gradient,int weight_index,int control_index);
+		void   GradjBMacAyeal(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjZMacAyeal(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjDragMacAyeal(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjDragStokes(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjDragGradient(Vector<IssmDouble>* gradient,int weight_index,int control_index);
+		void   GradjDhDtBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjVxBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
+		void   GradjVyBalancedthickness(Vector<IssmDouble>* gradient,int control_index);
+		void   GetVectorFromControlInputs(Vector<IssmDouble>* gradient,int control_enum,int control_index,const char* data);
 		void   SetControlInputsFromVector(IssmDouble* vector,int control_enum,int control_index);
-		void   ControlInputGetGradient(Vector* gradient,int enum_type,int control_index);
+		void   ControlInputGetGradient(Vector<IssmDouble>* gradient,int enum_type,int control_index);
 		void   ControlInputScaleGradient(int enum_type,IssmDouble scale);
 		void   ControlInputSetGradient(IssmDouble* gradient,int enum_type,int control_index);
@@ -212,6 +212,6 @@
 		ElementVector* CreatePVectorDiagnosticHutter(void);
 		ElementMatrix* CreateJacobianDiagnosticMacayeal(void);
-		void	  GetSolutionFromInputsDiagnosticHoriz(Vector* solution);
-		void	  GetSolutionFromInputsDiagnosticHutter(Vector* solution);
+		void	  GetSolutionFromInputsDiagnosticHoriz(Vector<IssmDouble>* solution);
+		void	  GetSolutionFromInputsDiagnosticHutter(Vector<IssmDouble>* solution);
 		void	  InputUpdateFromSolutionDiagnosticHoriz( IssmDouble* solution);
 		void	  InputUpdateFromSolutionDiagnosticHutter( IssmDouble* solution);
@@ -232,5 +232,5 @@
 		ElementVector* CreatePVectorHydrology(void);
 		void      CreateHydrologyWaterVelocityInput(void);
-		void	  GetSolutionFromInputsHydrology(Vector* solution);
+		void	  GetSolutionFromInputsHydrology(Vector<IssmDouble>* solution);
 		void	  InputUpdateFromSolutionHydrology(IssmDouble* solution);
 		#endif
Index: /issm/trunk-jpl/src/c/classes/objects/ExternalResults/PetscVecExternalResult.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/ExternalResults/PetscVecExternalResult.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/ExternalResults/PetscVecExternalResult.h	(revision 13216)
@@ -28,5 +28,5 @@
 		int id;
 		int enum_type;
-		Vector* value;
+		Vector<IssmDouble>* value;
 		int step;
 		IssmDouble time;
@@ -35,5 +35,5 @@
 		/*PetscVecExternalResult constructors, destructors: {{{*/
 		PetscVecExternalResult();
-		PetscVecExternalResult(int id,int enum_type,Vector* value, int step, IssmDouble time);
+		PetscVecExternalResult(int id,int enum_type,Vector<IssmDouble>* value, int step, IssmDouble time);
 		~PetscVecExternalResult();
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/BoolInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/BoolInput.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/BoolInput.cpp	(revision 13216)
@@ -174,5 +174,5 @@
 /*}}}*/
 /*FUNCTION BoolInput::GetVectorFromInputs{{{*/
-void BoolInput::GetVectorFromInputs(Vector* vector,int* doflist){
+void BoolInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
 
 	_error_("not supporte yet!");
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/BoolInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/BoolInput.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/BoolInput.h	(revision 13216)
@@ -78,5 +78,5 @@
 		void Extrude(void);
 		void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
-		void GetVectorFromInputs(Vector* vector,int* doflist);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/ControlInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/ControlInput.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/ControlInput.cpp	(revision 13216)
@@ -147,5 +147,5 @@
 }/*}}}*/
 /*FUNCTION ControlInput::GetGradient{{{*/
-void ControlInput::GetGradient(Vector* gradient_vec,int* doflist){
+void ControlInput::GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){
 	if(gradient) gradient->GetVectorFromInputs(gradient_vec,doflist);
 }/*}}}*/
@@ -198,10 +198,10 @@
 	return gradient->SpawnResult(step,time);
 }/*}}}*/
-/*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist){{{*/
-void ControlInput::GetVectorFromInputs(Vector* vector,int* doflist){
+/*FUNCTION ControlInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){{{*/
+void ControlInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
 	values->GetVectorFromInputs(vector,doflist);
 }/*}}}*/
-/*FUNCTION ControlInput::GetVectorFromInputs(Vector* vector,int* doflist,const char* data){{{*/
-void ControlInput::GetVectorFromInputs(Vector* vector,int* doflist,const char* data){
+/*FUNCTION ControlInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist,const char* data){{{*/
+void ControlInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist,const char* data){
 	 if(strcmp(data,"value")==0){
 		 _assert_(values);
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/ControlInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/ControlInput.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/ControlInput.h	(revision 13216)
@@ -84,9 +84,9 @@
 		void Extrude(void);
 		void VerticallyIntegrate(Input* thickness_input);
-		void GetVectorFromInputs(Vector* vector,int* doflist,const char* data);
-		void GetVectorFromInputs(Vector* vector,int* doflist);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist,const char* data);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not implemented yet");};
 		ElementResult* SpawnGradient(int step, IssmDouble time);
-		void GetGradient(Vector* gradient_vec,int* doflist);
+		void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist);
 		void ScaleGradient(IssmDouble scale);
 		void SetGradient(Input* gradient_in);
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/DatasetInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/DatasetInput.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/DatasetInput.h	(revision 13216)
@@ -79,8 +79,8 @@
 		void Extrude(void){_error_("not implemented yet");};
 		void VerticallyIntegrate(Input* thickness_input){_error_("not implemented yet");};
-		void GetVectorFromInputs(Vector* vector,int* doflist){_error_("not implemented yet");};
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){_error_("not implemented yet");};
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not implemented yet");};
 		ElementResult* SpawnGradient(int step, IssmDouble time){_error_("not implemented yet");};
-		void GetGradient(Vector* gradient_vec,int* doflist){_error_("not implemented yet");};
+		void GetGradient(Vector<IssmDouble>* gradient_vec,int* doflist){_error_("not implemented yet");};
 		void ScaleGradient(IssmDouble scale){_error_("not implemented yet");};
 		void SetGradient(Input* gradient_in){_error_("not implemented yet");};
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/DoubleInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/DoubleInput.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/DoubleInput.cpp	(revision 13216)
@@ -251,5 +251,5 @@
 /*}}}*/
 /*FUNCTION DoubleInput::GetVectorFromInputs{{{*/
-void DoubleInput::GetVectorFromInputs(Vector* vector,int* doflist){
+void DoubleInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
 
 	_error_("not supporte yet!");
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/DoubleInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/DoubleInput.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/DoubleInput.h	(revision 13216)
@@ -77,5 +77,5 @@
 		void Extrude(void){_error_("not supported yet");};
 		void VerticallyIntegrate(Input* thickness_input);
-		void GetVectorFromInputs(Vector* vector,int* doflist);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/Input.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/Input.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/Input.h	(revision 13216)
@@ -58,5 +58,5 @@
 		virtual void   VerticallyIntegrate(Input* thickness_input)=0;
 		virtual void   Extrude()=0;
-		virtual void   GetVectorFromInputs(Vector* vector,int* doflist)=0;
+		virtual void   GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist)=0;
 		virtual void   GetValuesPtr(IssmDouble** pvalues,int* pnum_values)=0;
 		
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/IntInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/IntInput.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/IntInput.cpp	(revision 13216)
@@ -180,5 +180,5 @@
 /*}}}*/
 /*FUNCTION IntInput::GetVectorFromInputs{{{*/
-void IntInput::GetVectorFromInputs(Vector* vector,int* doflist){
+void IntInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
 
 	_error_("not supporte yet!");
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/IntInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/IntInput.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/IntInput.h	(revision 13216)
@@ -78,5 +78,5 @@
 		void Extrude(void){_error_("not supported yet");};
 		void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
-		void GetVectorFromInputs(Vector* vector,int* doflist);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/PentaP1Input.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/PentaP1Input.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/PentaP1Input.cpp	(revision 13216)
@@ -609,5 +609,5 @@
 /*}}}*/
 /*FUNCTION PentaP1Input::GetVectorFromInputs{{{*/
-void PentaP1Input::GetVectorFromInputs(Vector* vector,int* doflist){
+void PentaP1Input::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
 
 	const int numvertices=6;
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/PentaP1Input.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/PentaP1Input.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/PentaP1Input.h	(revision 13216)
@@ -79,5 +79,5 @@
 		void Extrude(void);
 		void VerticallyIntegrate(Input* thickness_input);
-		void GetVectorFromInputs(Vector* vector,int* doflist);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/TransientInput.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/TransientInput.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/TransientInput.cpp	(revision 13216)
@@ -413,5 +413,5 @@
 /*}}}*/
 /*FUNCTION TransientInput::GetVectorFromInputs{{{*/
-void TransientInput::GetVectorFromInputs(Vector* vector,int* doflist){
+void TransientInput::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
 
 	IssmDouble time;
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/TransientInput.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/TransientInput.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/TransientInput.h	(revision 13216)
@@ -81,5 +81,5 @@
 		void Extrude(void);
 		void VerticallyIntegrate(Input* thickness_forcing){_error_("not supported yet");};
-		void GetVectorFromInputs(Vector* vector,int* doflist);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values){_error_("not supported yet");};
       void GetTimeValues(IssmDouble* values,IssmDouble time){_error_("not implemented yet");};
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/TriaP1Input.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/TriaP1Input.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/TriaP1Input.cpp	(revision 13216)
@@ -340,5 +340,5 @@
 /*}}}*/
 /*FUNCTION TriaP1Input::GetVectorFromInputs{{{*/
-void TriaP1Input::GetVectorFromInputs(Vector* vector,int* doflist){
+void TriaP1Input::GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist){
 
 	const int numvertices=3;
Index: /issm/trunk-jpl/src/c/classes/objects/Inputs/TriaP1Input.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Inputs/TriaP1Input.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Inputs/TriaP1Input.h	(revision 13216)
@@ -79,5 +79,5 @@
 		void Extrude(void){_error_("not supported yet");};
 		void VerticallyIntegrate(Input* thickness_input){_error_("not supported yet");};
-		void GetVectorFromInputs(Vector* vector,int* doflist);
+		void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist);
 		void GetValuesPtr(IssmDouble** pvalues,int* pnum_values);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp	(revision 13216)
@@ -228,5 +228,5 @@
 /*}}}*/
 /*FUNCTION Icefront::CreateKMatrix {{{*/
-void  Icefront::CreateKMatrix(Matrix* Kff, Matrix* Kfs){
+void  Icefront::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
 
 	/*No stiffness loads applied, do nothing: */
@@ -236,5 +236,5 @@
 /*}}}*/
 /*FUNCTION Icefront::CreatePVector {{{*/
-void  Icefront::CreatePVector(Vector* pf){
+void  Icefront::CreatePVector(Vector<IssmDouble>* pf){
 
 	/*Checks in debugging mode*/
@@ -274,10 +274,10 @@
 /*}}}*/
 /*FUNCTION Icefront::CreateJacobianMatrix{{{*/
-void  Icefront::CreateJacobianMatrix(Matrix* Jff){
+void  Icefront::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
 	this->CreateKMatrix(Jff,NULL);
 }
 /*}}}*/
 /*FUNCTION Icefront::PenaltyCreateKMatrix {{{*/
-void  Icefront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, IssmDouble kmax){
+void  Icefront::PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs, IssmDouble kmax){
 	/*do nothing: */
 	return;
@@ -285,5 +285,5 @@
 /*}}}*/
 /*FUNCTION Icefront::PenaltyCreatePVector{{{*/
-void  Icefront::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){
+void  Icefront::PenaltyCreatePVector(Vector<IssmDouble>* pf,IssmDouble kmax){
 	/*do nothing: */
 	return;
@@ -291,5 +291,5 @@
 /*}}}*/
 /*FUNCTION Icefront::PenaltyCreateJacobianMatrix{{{*/
-void  Icefront::PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){
+void  Icefront::PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){
 	this->PenaltyCreateKMatrix(Jff,NULL,kmax);
 }
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h	(revision 13216)
@@ -69,10 +69,10 @@
 		void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
 		void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
-		void  CreateKMatrix(Matrix* Kff, Matrix* Kfs);
-		void  CreatePVector(Vector* pf);
-		void  CreateJacobianMatrix(Matrix* Jff);
-		void  PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax);
-		void  PenaltyCreatePVector(Vector*  pf, IssmDouble kmax);
-		void  PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax);
+		void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+		void  CreatePVector(Vector<IssmDouble>* pf);
+		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
+		void  PenaltyCreatePVector(Vector<IssmDouble>*  pf, IssmDouble kmax);
+		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h	(revision 13216)
@@ -12,6 +12,6 @@
 /*{{{*/
 class Object;
-class Matrix;
-class Vector;
+template <class doublematrix> class Matrix;
+template <class doubletype> class Vector;
 
 #include "../Object.h"
@@ -29,10 +29,10 @@
 		virtual void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
 		virtual void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
-		virtual void  CreateKMatrix(Matrix* Kff, Matrix* Kfs)=0;
-		virtual void  CreatePVector(Vector* pf)=0;
-		virtual void  CreateJacobianMatrix(Matrix* Jff)=0;
-		virtual void  PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax)=0;
-		virtual void  PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs, IssmDouble kmax)=0;
-		virtual void  PenaltyCreatePVector(Vector* pf, IssmDouble kmax)=0;
+		virtual void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs)=0;
+		virtual void  CreatePVector(Vector<IssmDouble>* pf)=0;
+		virtual void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff)=0;
+		virtual void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax)=0;
+		virtual void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs, IssmDouble kmax)=0;
+		virtual void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax)=0;
 		virtual bool  InAnalysis(int analysis_type)=0;
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp	(revision 13216)
@@ -251,5 +251,5 @@
 /*}}}*/
 /*FUNCTION Numericalflux::CreateKMatrix {{{*/
-void  Numericalflux::CreateKMatrix(Matrix* Kff, Matrix* Kfs){
+void  Numericalflux::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
 
 	/*recover some parameters*/
@@ -282,5 +282,5 @@
 /*}}}*/
 /*FUNCTION Numericalflux::CreatePVector {{{*/
-void  Numericalflux::CreatePVector(Vector* pf){
+void  Numericalflux::CreatePVector(Vector<IssmDouble>* pf){
 
 	/*recover some parameters*/
@@ -312,5 +312,5 @@
 /*}}}*/
 /*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{*/
-void  Numericalflux::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){
+void  Numericalflux::PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,IssmDouble kmax){
 
 	/*No stiffness loads applied, do nothing: */
@@ -320,5 +320,5 @@
 /*}}}*/
 /*FUNCTION Numericalflux::PenaltyCreatePVector{{{*/
-void  Numericalflux::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){
+void  Numericalflux::PenaltyCreatePVector(Vector<IssmDouble>* pf,IssmDouble kmax){
 
 	/*No penalty loads applied, do nothing: */
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.h	(revision 13216)
@@ -65,10 +65,10 @@
 		void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
 		void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
-		void  CreateKMatrix(Matrix* Kff, Matrix* Kfs);
-		void  CreatePVector(Vector* pf);
-		void  CreateJacobianMatrix(Matrix* Jff){_error_("Not implemented yet");};
-		void  PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error_("Not implemented yet");};
-		void  PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax);
-		void  PenaltyCreatePVector(Vector* pf, IssmDouble kmax);
+		void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+		void  CreatePVector(Vector<IssmDouble>* pf);
+		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
+		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
+		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
+		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.cpp	(revision 13216)
@@ -201,5 +201,5 @@
 /*}}}*/
 /*FUNCTION Pengrid::CreateKMatrix {{{*/
-void  Pengrid::CreateKMatrix(Matrix* Kff, Matrix* Kfs){
+void  Pengrid::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
 
 	/*No loads applied, do nothing: */
@@ -209,5 +209,5 @@
 /*}}}*/
 /*FUNCTION Pengrid::CreatePVector {{{*/
-void  Pengrid::CreatePVector(Vector* pf){
+void  Pengrid::CreatePVector(Vector<IssmDouble>* pf){
 
 	/*No loads applied, do nothing: */
@@ -217,5 +217,5 @@
 /*}}}*/
 /*FUNCTION Pengrid::PenaltyCreateMatrix {{{*/
-void  Pengrid::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){
+void  Pengrid::PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,IssmDouble kmax){
 
 	/*Retrieve parameters: */
@@ -250,5 +250,5 @@
 /*}}}*/
 /*FUNCTION Pengrid::PenaltyCreatePVector {{{*/
-void  Pengrid::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){
+void  Pengrid::PenaltyCreatePVector(Vector<IssmDouble>* pf,IssmDouble kmax){
 
 	/*Retrieve parameters: */
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.h	(revision 13216)
@@ -70,10 +70,10 @@
 		void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
 		void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
-		void  CreateKMatrix(Matrix* Kff, Matrix* Kfs);
-		void  CreatePVector(Vector* pf);
-		void  CreateJacobianMatrix(Matrix* Jff){_error_("Not implemented yet");};
-		void  PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error_("Not implemented yet");};
-		void  PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax);
-		void  PenaltyCreatePVector(Vector* pf, IssmDouble kmax);
+		void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+		void  CreatePVector(Vector<IssmDouble>* pf);
+		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
+		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
+		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
+		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp	(revision 13216)
@@ -136,5 +136,5 @@
 /*}}}*/
 /*FUNCTION Penpair::CreateKMatrix {{{*/
-void  Penpair::CreateKMatrix(Matrix* Kff, Matrix* Kfs){
+void  Penpair::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
 	/*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/
 	/*No loads applied, do nothing: */
@@ -144,5 +144,5 @@
 /*}}}*/
 /*FUNCTION Penpair::CreatePVector {{{*/
-void  Penpair::CreatePVector(Vector* pf){
+void  Penpair::CreatePVector(Vector<IssmDouble>* pf){
 
 	/*No loads applied, do nothing: */
@@ -152,10 +152,10 @@
 /*}}}*/
 /*FUNCTION Penpair::CreateJacobianMatrix{{{*/
-void  Penpair::CreateJacobianMatrix(Matrix* Jff){
+void  Penpair::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
 	this->CreateKMatrix(Jff,NULL);
 }
 /*}}}*/
 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{*/
-void  Penpair::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){
+void  Penpair::PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,IssmDouble kmax){
 
 	/*Retrieve parameters: */
@@ -183,5 +183,5 @@
 /*}}}*/
 /*FUNCTION Penpair::PenaltyCreatePVector {{{*/
-void  Penpair::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){
+void  Penpair::PenaltyCreatePVector(Vector<IssmDouble>* pf,IssmDouble kmax){
 	/*No loads applied, do nothing: */
 	return;
@@ -189,5 +189,5 @@
 /*}}}*/
 /*FUNCTION Penpair::PenaltyCreateJacobianMatrix{{{*/
-void  Penpair::PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){
+void  Penpair::PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){
 	this->PenaltyCreateKMatrix(Jff,NULL,kmax);
 }
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.h	(revision 13216)
@@ -57,10 +57,10 @@
 		void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
 		void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
-		void  CreateKMatrix(Matrix* Kff, Matrix* Kfs);
-		void  CreatePVector(Vector* pf);
-		void  CreateJacobianMatrix(Matrix* Jff);
-		void  PenaltyCreateKMatrix(Matrix* Kff,Matrix* Kfs,IssmDouble kmax);
-		void  PenaltyCreatePVector(Vector* pf, IssmDouble kmax);
-		void  PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax);
+		void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+		void  CreatePVector(Vector<IssmDouble>* pf);
+		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff,Matrix<IssmDouble>* Kfs,IssmDouble kmax);
+		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
+		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.cpp	(revision 13216)
@@ -309,5 +309,5 @@
 /*}}}*/
 /*FUNCTION Riftfront::PenaltyCreateKMatrix {{{*/
-void  Riftfront::PenaltyCreateKMatrix(Matrix* Kff, Matrix* Kfs,IssmDouble kmax){
+void  Riftfront::PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,IssmDouble kmax){
 
 	/*Retrieve parameters: */
@@ -335,5 +335,5 @@
 /*}}}*/
 /*FUNCTION Riftfront::PenaltyCreatePVector {{{*/
-void  Riftfront::PenaltyCreatePVector(Vector* pf,IssmDouble kmax){
+void  Riftfront::PenaltyCreatePVector(Vector<IssmDouble>* pf,IssmDouble kmax){
 
 	/*Retrieve parameters: */
@@ -361,5 +361,5 @@
 /*}}}*/
 /*FUNCTION Riftfront::CreateKMatrix {{{*/
-void  Riftfront::CreateKMatrix(Matrix* Kff, Matrix* Kfs){
+void  Riftfront::CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs){
 	/*do nothing: */
 	return;
@@ -367,5 +367,5 @@
 /*}}}*/
 /*FUNCTION Riftfront::CreatePVector {{{*/
-void  Riftfront::CreatePVector(Vector* pf){
+void  Riftfront::CreatePVector(Vector<IssmDouble>* pf){
 	/*do nothing: */
 	return;
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.h	(revision 13216)
@@ -77,10 +77,10 @@
 		void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
 		void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
-		void  CreateKMatrix(Matrix* Kff, Matrix* Kfs);
-		void  CreatePVector(Vector* pf);
-		void  CreateJacobianMatrix(Matrix* Jff){_error_("Not implemented yet");};
-		void  PenaltyCreateJacobianMatrix(Matrix* Jff,IssmDouble kmax){_error_("Not implemented yet");};
-		void  PenaltyCreateKMatrix(Matrix* Kff, Matrix* kfs, IssmDouble kmax);
-		void  PenaltyCreatePVector(Vector* pf, IssmDouble kmax);
+		void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
+		void  CreatePVector(Vector<IssmDouble>* pf);
+		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
+		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
+		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
+		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.cpp	(revision 13216)
@@ -193,5 +193,5 @@
 /*}}}*/
 /*FUNCTION Matdamageice::GetVectorFromInputs{{{*/
-void  Matdamageice::GetVectorFromInputs(Vector* vector,int input_enum){
+void  Matdamageice::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
 
 	/*Intermediaries*/
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Matdamageice.h	(revision 13216)
@@ -49,5 +49,5 @@
 		void   InputDuplicate(int original_enum,int new_enum);
 		void   Configure(Elements* elements);
-		void   GetVectorFromInputs(Vector* vector,int input_enum);
+		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum);
 		void   SetCurrentConfiguration(Elements* elementsin,Loads* loadsin,Nodes* nodesin,Vertices* verticesin,Materials* materialsin,Parameters* parametersin);
 		void   GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon);
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Material.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Material.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Material.h	(revision 13216)
@@ -24,5 +24,5 @@
 		virtual void       InputDuplicate(int original_enum,int new_enum)=0;
 		virtual void       Configure(Elements* elements)=0;
-		virtual void       GetVectorFromInputs(Vector* vector,int input_enum)=0;
+		virtual void       GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum)=0;
 		virtual void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon)=0;
 		virtual void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon)=0;
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.cpp	(revision 13216)
@@ -173,5 +173,5 @@
 /*}}}*/
 /*FUNCTION Matice::GetVectorFromInputs{{{*/
-void  Matice::GetVectorFromInputs(Vector* vector,int input_enum){
+void  Matice::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){
 
 	/*Intermediaries*/
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Matice.h	(revision 13216)
@@ -49,5 +49,5 @@
 		void   InputDuplicate(int original_enum,int new_enum);
 		void   Configure(Elements* elements);
-		void   GetVectorFromInputs(Vector* vector,int input_enum);
+		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum);
 		void       SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters);
 		void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon);
Index: /issm/trunk-jpl/src/c/classes/objects/Materials/Matpar.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Materials/Matpar.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Materials/Matpar.h	(revision 13216)
@@ -67,5 +67,5 @@
 		void   InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
 		void   Configure(Elements* elements);
-		void   GetVectorFromInputs(Vector* vector,int input_enum){return;}
+		void   GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){return;}
 		void       GetViscosity2d(IssmDouble* pviscosity, IssmDouble* pepsilon){_error_("not supported");};
 		void       GetViscosity3d(IssmDouble* pviscosity3d, IssmDouble* pepsilon){_error_("not supported");};
Index: /issm/trunk-jpl/src/c/classes/objects/Node.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Node.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Node.cpp	(revision 13216)
@@ -487,5 +487,5 @@
 /*}}}*/
 /*FUNCTION Node::CreateVecSets {{{*/
-void  Node::CreateVecSets(Vector* pv_g,Vector* pv_f,Vector* pv_s){
+void  Node::CreateVecSets(Vector<IssmDouble>* pv_g,Vector<IssmDouble>* pv_f,Vector<IssmDouble>* pv_s){
 
 	IssmDouble gvalue=1.0; //all nodes are in the g set;
@@ -513,5 +513,5 @@
 /*}}}*/
 /*FUNCTION Node::CreateNodalConstraints{{{*/
-void  Node::CreateNodalConstraints(Vector* ys){
+void  Node::CreateNodalConstraints(Vector<IssmDouble>* ys){
 
 	int i;
@@ -794,5 +794,5 @@
 /*}}}*/
 /*FUNCTION Node::VecMerge {{{*/
-void   Node::VecMerge(Vector* ug, IssmDouble* vector_serial,int setenum){
+void   Node::VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum){
 
 	IssmDouble* values=NULL;
@@ -845,5 +845,5 @@
 /*}}}*/
 /*FUNCTION Node::VecReduce {{{*/
-void   Node::VecReduce(Vector* vector, IssmDouble* ug_serial,int setenum){
+void   Node::VecReduce(Vector<IssmDouble>* vector, IssmDouble* ug_serial,int setenum){
 
 	IssmDouble* values=NULL;
Index: /issm/trunk-jpl/src/c/classes/objects/Node.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Node.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Node.h	(revision 13216)
@@ -16,6 +16,6 @@
 class  DataSet;
 class  Vertices;
-class  Vector;
-class  Matrix;
+template <class doubletype> class  Vector;
+template <class doubletype> class  Matrix;
 #include "../Update.h"
 /*}}}*/
@@ -64,5 +64,5 @@
 		/*Node numerical routines {{{*/
 		void   Configure(DataSet* nodes,Vertices* vertices);
-		void   CreateNodalConstraints(Vector* ys);
+		void   CreateNodalConstraints(Vector<IssmDouble>* ys);
 		void   SetCurrentConfiguration(DataSet* nodes,Vertices* vertices);
 		int    Sid(void); 
@@ -82,5 +82,5 @@
 		void   DofInFSet(int dof);
 		int    GetDof(int dofindex,int setenum);
-		void   CreateVecSets(Vector* pv_g,Vector* pv_f,Vector* pv_s);
+		void   CreateVecSets(Vector<IssmDouble>* pv_g,Vector<IssmDouble>* pv_f,Vector<IssmDouble>* pv_s);
 		int    GetConnectivity();
 		void   GetDofList(int* poutdoflist,int approximation_enum,int setenum);
@@ -98,6 +98,6 @@
 		int    IsGrounded();
 		void   UpdateSpcs(IssmDouble* ys);
-		void   VecMerge(Vector* ug, IssmDouble* vector_serial,int setenum);
-		void   VecReduce(Vector* vector, IssmDouble* ug_serial,int setnum);
+		void   VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum);
+		void   VecReduce(Vector<IssmDouble>* vector, IssmDouble* ug_serial,int setnum);
 		
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Options/GenericOption.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/GenericOption.h	(revision 13216)
+++ /issm/trunk-jpl/src/c/classes/objects/Options/GenericOption.h	(revision 13216)
@@ -0,0 +1,129 @@
+/*! \file GenericOption.h 
+ *  \brief: header file for generic option object
+ */
+
+#ifndef _GENERIC_OPTION_
+#define _GENERIC_OPTION_
+
+/*Headers:{{{*/
+#ifdef HAVE_CONFIG_H
+	#include <config.h>
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "../../../include/include.h"
+#include "../../../shared/Exceptions/exceptions.h"
+#include "../../../io/io.h"
+#include "../../../EnumDefinitions/EnumDefinitions.h"
+#include "./OptionUtilities.h"
+
+#include "../Object.h"
+/*}}}*/
+
+template <class OptionType> 
+class GenericOption: public Option {
+
+	public:
+
+		char* name;
+		OptionType value;
+
+		int   numel; //in case OptionType is an array
+		int   ndims; //in case OptionType is a multi-dimensional array: */
+		int*  size;
+
+		/*GenericOption constructors, destructors*/
+		GenericOption(){ /*{{{*/
+
+			name  =NULL;
+			numel =0;
+			ndims =0;
+			size  =NULL;
+
+
+		} /*}}}*/
+		~GenericOption(){ /*{{{*/
+
+			if(size) xDelete<int>(size);
+			if(name) xDelete<char>(name);
+
+		} /*}}}*/
+
+		/*Object virtual functions definitions:*/
+		void Echo(){ /*{{{*/
+
+			this->DeepEcho();
+
+		} /*}}}*/
+		void DeepEcho(){ /*{{{*/
+
+			char  indent[81]="";
+			this->DeepEcho(indent);
+
+		} /*}}}*/
+		void DeepEcho(char* indent){ /*{{{*/
+
+			char  cstr[81];
+			bool  flag=true;
+
+			if(flag) _pprintLine_(indent << "         name: \"" << name << "\"");
+			if(flag) _pprintLine_(indent << "         numel: " << numel);
+			if(flag) _pprintLine_(indent << "         ndims: " << ndims);
+			if(size){
+				StringFromSize(cstr,size,ndims);
+				if(flag) _pprintLine_(indent << "          size: " << cstr);
+			}
+			else if(flag) _pprintLine_(indent << "          size: [empty]");
+			_printLine_(indent << "         value: " << value);;
+		} /*}}}*/
+		int   Id(){_error_("Not implemented yet");};
+		int   MyRank(){_error_("Not implemented yet");};
+		int   ObjectEnum(){return GenericOptionEnum;};
+		Object* copy(){_error_("Not implemented yet");};
+		
+		/*GenericOption functions: */
+		char* Name(){return name;};
+		int   NumEl(){return numel;};
+		int   NDims(){return ndims;};
+		int*  Size(){return size;};
+		void  Get(OptionType* pvalue){ *pvalue=value; };
+};
+
+#ifdef _HAVE_ADOLC_ //We hook off this specific specialization when not running ADOLC, otherwise we get a redeclaration with the next specialization. 
+template <> inline void GenericOption<IssmPDouble*>::Get(IssmPDouble** pvalue){ /*{{{*/
+
+	/*Copy vector*/
+	IssmPDouble* outvalue=xNew<IssmPDouble>(this->NumEl());
+	for(int i=0;i<this->NumEl();i++) outvalue[i]=this->value[i];
+
+	/*Assign output pointer*/
+	*pvalue=outvalue;
+} /*}}}*/
+#endif
+template <> inline void GenericOption<IssmDouble*>::Get(IssmDouble** pvalue){ /*{{{*/
+
+	/*Copy vector*/
+	IssmDouble* outvalue=xNew<IssmDouble>(this->NumEl());
+	for(int i=0;i<this->NumEl();i++) outvalue[i]=this->value[i];
+
+	/*Assign output pointer*/
+	*pvalue=outvalue;
+} /*}}}*/
+template <> inline void GenericOption<char*>::Get(char** pvalue){ /*{{{*/
+
+	char* outstring=NULL;
+	int   stringsize;
+
+	stringsize=strlen(this->value)+1;
+	outstring=xNew<char>(stringsize);
+	xMemCpy<char>(outstring,this->value,stringsize);
+
+	*pvalue=outstring;
+} 
+/*}}}*/
+
+
+
+#endif  /* _OPTIONOBJECT_H */
+
Index: sm/trunk-jpl/src/c/classes/objects/Options/Option.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/Option.cpp	(revision 13215)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*!\file Option.cpp
- * \brief: implementation of the optionsobject abstract object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../objects.h"
-#include "../../../shared/shared.h"
-#include "../../../Container/Container.h"
-#include "../../../io/io.h"
-#include "../../../include/include.h"
-/*}}}*/
-
-/*Constructors/destructor/copy*/
-/*FUNCTION Option::Option(){{{*/
-Option::Option(){
-
-	name  =NULL;
-	numel =0;
-	ndims =0;
-	size  =NULL;
-
-}
-/*}}}*/
-/*FUNCTION Option::~Option(){{{*/
-Option::~Option(){
-
-	if(size) xDelete<int>(size);
-	if(name) xDelete<char>(name);
-
-}
-/*}}}*/
-
-/*Other*/
-/*FUNCTION Option::Echo {{{*/
-void  Option::Echo(){
-
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_("          name: \"" << name << "\"");
-	if(flag) _pprintLine_("         numel: " << numel);
-	if(flag) _pprintLine_("         ndims: " << ndims);
-	if(size){
-		StringFromSize(cstr,size,ndims);
-		if(flag) _pprintLine_("          size: " << cstr);
-	}
-	else if(flag) _pprintLine_("          size: [empty]");
-}
-/*}}}*/
-/*FUNCTION Option::DeepEcho() {{{*/
-void  Option::DeepEcho(){
-
-	char  indent[81]="";
-
-	Option::DeepEcho(indent);
-
-	return;
-}
-/*}}}*/
-/*FUNCTION Option::DeepEcho(char* indent) {{{*/
-void  Option::DeepEcho(char* indent){
-
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_(indent << "          name: \"" << name << "\"");
-	if(flag) _pprintLine_(indent << "         numel: " << numel);
-	if(flag) _pprintLine_(indent << "         ndims: " << ndims);
-	if(size){
-		StringFromSize(cstr,size,ndims);
-		if(flag) _pprintLine_(indent << "          size: " << cstr);
-	}
-	else if(flag) _pprintLine_(indent << "          size: [empty]");
-}
-/*}}}*/
-/*FUNCTION Option::Name {{{*/
-char* Option::Name(){
-
-	return(name);
-}
-/*}}}*/
-/*FUNCTION Option::NumEl {{{*/
-int   Option::NumEl(){
-
-	return(numel);
-}
-/*}}}*/
-/*FUNCTION Option::NDims {{{*/
-int   Option::NDims(){
-
-	return(ndims);
-}
-/*}}}*/
-/*FUNCTION Option::Size {{{*/
-int*  Option::Size(){
-
-	return(size);
-}
-/*}}}*/
-/*FUNCTION Option::Get {{{*/
-//void* Option::Get(){
-
-//	;
-
-//	return;
-//}
-/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Options/Option.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/Option.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Options/Option.h	(revision 13216)
@@ -18,17 +18,14 @@
 	public:
 
-		char* name;
-		int   numel;
-		int   ndims;
-		int*  size;
-
+		
 		/*Option constructors, destructors {{{*/
-		Option();
-		~Option();
+		Option(){};
+		~Option(){};
 		/*}}}*/
+		
 		/*Object virtual functions definitions:{{{*/
-		virtual void  Echo();
-		virtual void  DeepEcho();
-		virtual void  DeepEcho(char* indent);
+		virtual void  Echo()=0;
+		virtual void  DeepEcho()=0;
+		virtual void  DeepEcho(char* indent)=0;
 		int   Id(){_error_("Not implemented yet");};
 		int   MyRank(){_error_("Not implemented yet");};
@@ -42,12 +39,4 @@
 		virtual int   NDims()=0;
 		virtual int*  Size()=0;
-		virtual void  Get(int* pvalue)=0;
-		virtual void  Get(IssmDouble* pvalue)=0;
-		virtual void  Get(bool* pvalue)=0;
-		virtual void  Get(char** pvalue)=0;
-		virtual void  Get(char*** ppvalue,int *pnumel)=0;
-		virtual void  Get(IssmDouble** pvalue,int *pnumel)=0;
-		virtual void  Get(Options** pvalue)=0;
-		virtual void  Get(Options*** ppvalue,int *pnumel)=0;
 
 };
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionCell.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionCell.cpp	(revision 13215)
+++ 	(revision )
@@ -1,127 +1,0 @@
-/*!\file OptionCell.cpp
- * \brief: implementation of the optionscell object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../objects.h"
-#include "../../../shared/shared.h"
-#include "../../../io/io.h"
-#include "../../../Container/Container.h"
-#include "../../../include/include.h"
-/*}}}*/
-
-/*Constructors/destructor/copy*/
-/*FUNCTION OptionCell::OptionCell(){{{*/
-OptionCell::OptionCell(){
-
-	values    =NULL;
-
-}
-/*}}}*/
-/*FUNCTION OptionCell::~OptionCell(){{{*/
-OptionCell::~OptionCell(){
-
-	if (values){
-		delete values;
-		values    =NULL;
-	}
-
-}
-/*}}}*/
-
-/*Other*/
-/*FUNCTION OptionCell::Echo {{{*/
-void  OptionCell::Echo(){
-
-	char cstr[81];
-	bool flag     = true;
-
-	if(flag) _pprintLine_("OptionCell Echo:");
-	Option::Echo();
-
-	if (values && size) {
-		StringFromSize(cstr,size,ndims);
-		if(flag) _pprintLine_("        values: " << cstr << " " << "cell");
-	}
-	else if(flag) _pprintLine_("        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionCell::DeepEcho() {{{*/
-void  OptionCell::DeepEcho(){
-
-	char  indent[81]="";
-
-	OptionCell::DeepEcho(indent);
-
-	return;
-}
-/*}}}*/
-/*FUNCTION OptionCell::DeepEcho(char* indent) {{{*/
-void  OptionCell::DeepEcho(char* indent){
-
-	int   i;
-	int*  dims;
-	char  indent2[81];
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_(indent << "OptionCell DeepEcho:");
-	Option::DeepEcho(indent);
-
-	xMemCpy<char>(indent2,indent,(strlen(indent)+1));
-	strcat(indent2,"  ");
-
-	if (values->Size()) {
-		dims=xNew<int>(ndims);
-		for (i=0; i<values->Size(); i++) {
-			ColumnWiseDimsFromIndex(dims,i,size,ndims);
-			StringFromDims(cstr,dims,ndims);
-			if(flag) _pprintLine_(indent << "        values: -------- begin " << cstr << " --------");
-			((Option *)values->GetObjectByOffset(i))->DeepEcho(indent2);
-			if(flag) _pprintLine_(indent << "        values: --------  end  " << cstr << " --------");
-		}
-		xDelete<int>(dims);
-	}
-	else if(flag) _pprintLine_(indent << "        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionCell::Name {{{*/
-char* OptionCell::Name(){
-
-	return(Option::Name());
-}
-/*}}}*/
-/*FUNCTION OptionCell::NumEl {{{*/
-int   OptionCell::NumEl(){
-
-	return(Option::NumEl());
-}
-/*}}}*/
-/*FUNCTION OptionCell::NDims {{{*/
-int   OptionCell::NDims(){
-
-	return(Option::NDims());
-}
-/*}}}*/
-/*FUNCTION OptionCell::Size {{{*/
-int*  OptionCell::Size(){
-
-	return(Option::Size());
-}
-/*}}}*/
-/*FUNCTION OptionCell::Get(Options** pvalue) {{{*/
-void OptionCell::Get(Options** pvalue){
-
-	/*Assign output pointer*/
-	*pvalue=this->values;
-}
-/*}}}*/
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionCell.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionCell.h	(revision 13215)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*! \file OptionCell.h 
- *  \brief: header file for optioncell object
- */
-
-#ifndef _OPTIONCELL_H_
-#define _OPTIONCELL_H_
-
-/*Headers:{{{*/
-#include "../../../include/include.h"
-#include "../../../shared/Exceptions/exceptions.h"
-#include "../../../EnumDefinitions/EnumDefinitions.h"
-
-#include "./Option.h"
-/*}}}*/
-
-class OptionCell: public Option {
-
-	public:
-
-		Options* values;
-
-		/*OptionCell constructors, destructors {{{*/
-		OptionCell();
-		~OptionCell();
-		/*}}}*/
-		/*Object virtual functions definitions:{{{*/
-		void  Echo();
-		void  DeepEcho();
-		void  DeepEcho(char* indent);
-		int   Id(){_error_("Not implemented yet");};
-		int   MyRank(){_error_("Not implemented yet");};
-		int   ObjectEnum(){return OptionCellEnum;};
-		Object* copy(){_error_("Not implemented yet");};
-		/*}}}*/
-
-		/*virtual functions: */
-		char* Name();
-		int   NumEl();
-		int   NDims();
-		int*  Size();
-		void  Get(int* pvalue){_error_("An OptionCell object cannot return a int");};
-		void  Get(IssmDouble* pvalue){_error_("An OptionCell object cannot return a IssmDouble");};
-		void  Get(bool* pvalue){  _error_("An OptionCell object cannot return a bool");};
-		void  Get(char** pvalue){ _error_("An OptionCell object cannot return a string");};
-		void  Get(char*** ppvalue,int *pnumel){ _error_("An OptionCell object cannot return a string vec");};
-		void  Get(IssmDouble** pvalue,int *pnumel){ _error_("An OptionCell object cannot return a IssmDouble vec");};
-		void  Get(Options** pvalue);
-		void  Get(Options*** ppvalue,int *pnumel){ _error_("An OptionCell object cannot return an Options DataSet vec");};
-
-};
-#endif  /* _OPTIONCELL_H */
-
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionChar.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionChar.cpp	(revision 13215)
+++ 	(revision )
@@ -1,176 +1,0 @@
-/*!\file OptionChar.cpp
- * \brief: implementation of the optionschar object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../objects.h"
-#include "../../../shared/shared.h"
-#include "../../../io/io.h"
-#include "../../../Container/Container.h"
-#include "../../../include/include.h"
-/*}}}*/
-
-/*Constructors/destructor/copy*/
-/*FUNCTION OptionChar::OptionChar(){{{*/
-OptionChar::OptionChar(){
-
-	values    =NULL;
-
-}
-/*}}}*/
-/*FUNCTION OptionChar::~OptionChar(){{{*/
-OptionChar::~OptionChar(){
-
-	if (values) xDelete<char>(values);
-
-}
-/*}}}*/
-
-/*Other*/
-/*FUNCTION OptionChar::Echo {{{*/
-void  OptionChar::Echo(){
-
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_("OptionChar Echo:");
-	Option::Echo();
-
-	if (values && size) {
-//		if (numel == 1) {
-		if (1) {
-//			if(flag) _pprintLine_("        values: \"" << values[0] << "\"");
-			if(flag) _pprintLine_("        values: \"" << values << "\"");
-		}
-		else {
-			StringFromSize(cstr,size,ndims);
-			if(flag) _pprintLine_("        values: " << cstr << " " << "char");
-		}
-	}
-	else if(flag) _pprintLine_("        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionChar::DeepEcho() {{{*/
-void  OptionChar::DeepEcho(){
-
-	char  indent[81]="";
-
-	OptionChar::DeepEcho(indent);
-
-	return;
-}
-/*}}}*/
-/*FUNCTION OptionChar::DeepEcho(char* indent) {{{*/
-void  OptionChar::DeepEcho(char* indent){
-
-	int   i,nstr,ipt=0;
-	int*  dims;
-	char  indent2[81];
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_(indent << "OptionChar DeepEcho:");
-	Option::DeepEcho(indent);
-
-	xMemCpy<char>(indent2,indent,(strlen(indent)+1));
-	strcat(indent2,"  ");
-
-	if (values) {
-		if (ndims == 2 && size[0] == 1) {
-			if(flag) _pprintLine_(indent << "        values: \"" << values << "\"");
-		}
-		else {
-			nstr=size[0];
-			for (i=2; i<ndims; i++) nstr*=size[i];
-
-			dims=xNew<int>(ndims);
-			for (i=0; i<nstr; i++) {
-				RowWiseDimsFromIndex(dims,ipt,size,ndims);
-				StringFromDims(cstr,dims,ndims);
-				if(flag) _pprintLine_(indent << "        values" << cstr << ": \"" << size[1] << "*s\"");
-				ipt+=size[1];
-			}
-			xDelete<int>(dims);
-		}
-	}
-	else if(flag) _pprintLine_(indent << "        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionChar::Name {{{*/
-char* OptionChar::Name(){
-
-	return(Option::Name());
-}
-/*}}}*/
-/*FUNCTION OptionChar::NumEl {{{*/
-int   OptionChar::NumEl(){
-
-	return(Option::NumEl());
-}
-/*}}}*/
-/*FUNCTION OptionChar::NDims {{{*/
-int   OptionChar::NDims(){
-
-	return(Option::NDims());
-}
-/*}}}*/
-/*FUNCTION OptionChar::Size {{{*/
-int*  OptionChar::Size(){
-
-	return(Option::Size());
-}
-/*}}}*/
-/*FUNCTION OptionChar::Get(char** pvalue) {{{*/
-void OptionChar::Get(char** pvalue){
-
-	char* outstring=NULL;
-	int   stringsize;
-
-	stringsize=strlen(this->values)+1;
-
-	outstring=xNew<char>(stringsize);
-	xMemCpy<char>(outstring,this->values,stringsize);
-
-	*pvalue=outstring;
-}
-/*}}}*/
-/*FUNCTION OptionChar::Get(char*** ppvalue,int *pnumel) {{{*/
-void OptionChar::Get(char*** ppvalue,int *pnumel){
-
-	char* outstring=NULL;
-	int   stringsize;
-	int   i,nstr,ipt=0;
-
-	/*We should first check that the size is at least one*/
-	if(this->NumEl()<=0){
-		_error_("option \"" << this->name << "\" is empty and cannot return a string vector");
-	}
-
-	/*Calculate the size and number of strings*/
-	stringsize=this->size[1]+1;
-	nstr=this->size[0];
-	for (i=2; i<this->ndims; i++) nstr*=this->size[i];
-
-	/*Break concatenated string into individual strings*/
-	*ppvalue=xNew<char*>(nstr);
-	for (i=0; i<nstr; i++) {
-		outstring=xNew<char>(stringsize);
-		xMemCpy<char>(outstring,&(this->values[ipt]),(stringsize-1));
-		outstring[stringsize-1]='\0';
-		(*ppvalue)[i]=outstring;
-		ipt+=stringsize-1;
-	}
-
-	/*Assign output pointer*/
-	if(numel) *pnumel=nstr;
-}
-/*}}}*/
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionChar.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionChar.h	(revision 13215)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*! \file OptionChar.h 
- *  \brief: header file for optionchar object
- */
-
-#ifndef _OPTIONCHAR_H_
-#define _OPTIONCHAR_H_
-
-/*Headers:{{{*/
-#include "../../../include/include.h"
-#include "../../../shared/Exceptions/exceptions.h"
-#include "../../../EnumDefinitions/EnumDefinitions.h"
-
-#include "./Option.h"
-/*}}}*/
-
-class OptionChar: public Option {
-
-	public:
-
-		char* values;
-
-		/*OptionChar constructors, destructors {{{*/
-		OptionChar();
-		~OptionChar();
-		/*}}}*/
-		/*Object virtual functions definitions:{{{*/
-		void  Echo();
-		void  DeepEcho();
-		void  DeepEcho(char* indent);
-		int   Id(){_error_("Not implemented yet");};
-		int   MyRank(){_error_("Not implemented yet");};
-		int   ObjectEnum(){return OptionCharEnum;};
-		Object* copy(){_error_("Not implemented yet");};
-		/*}}}*/
-
-		/*virtual functions: */
-		char* Name();
-		int   NumEl();
-		int   NDims();
-		int*  Size();
-		void  Get(int* pvalue){_error_("An OptionChar object cannot return a int");};
-		void  Get(IssmDouble* pvalue){_error_("An OptionChar object cannot return a IssmDouble");};
-		void  Get(bool* pvalue){  _error_("An OptionChar object cannot return a bool");};
-		void  Get(char** pvalue);
-		void  Get(char*** ppvalue,int *pnumel);
-		void  Get(IssmDouble** pvalue,int *pnumel){ _error_("An OptionChar object cannot return a IssmDouble vec");};
-		void  Get(Options** pvalue){ _error_("An OptionChar object cannot return an Options DataSet");};
-		void  Get(Options*** ppvalue,int *pnumel){ _error_("An OptionChar object cannot return an Options DataSet vec");};
-
-};
-#endif  /* _OPTIONCHAR_H */
-
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionDouble.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionDouble.cpp	(revision 13215)
+++ 	(revision )
@@ -1,162 +1,0 @@
-/*!\file OptionDouble.cpp
- * \brief: implementation of the optionsIssmDouble object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../objects.h"
-#include "../../../shared/shared.h"
-#include "../../../io/io.h"
-#include "../../../Container/Container.h"
-#include "../../../include/include.h"
-/*}}}*/
-
-/*Constructors/destructor/copy*/
-/*FUNCTION OptionDouble::OptionDouble(){{{*/
-OptionDouble::OptionDouble(){
-
-	values    =NULL;
-
-}
-/*}}}*/
-/*FUNCTION OptionDouble::~OptionDouble(){{{*/
-OptionDouble::~OptionDouble(){
-
-	if (values) xDelete<IssmDouble>(values);
-
-}
-/*}}}*/
-
-/*Other*/
-/*FUNCTION OptionDouble::Echo {{{*/
-void  OptionDouble::Echo(){
-
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_("OptionDouble Echo:");
-	Option::Echo();
-
-	if (values && size) {
-		if(numel == 1) if(flag) _pprintLine_("        values: " << values[0]);
-		else {
-			StringFromSize(cstr,size,ndims);
-			if(flag) _pprintLine_("        values: " << cstr << " " << "IssmDouble");
-		}
-	}
-	else if(flag) _pprintLine_("        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionDouble::DeepEcho() {{{*/
-void  OptionDouble::DeepEcho(){
-
-	char  indent[81]="";
-
-	OptionDouble::DeepEcho(indent);
-
-	return;
-}
-/*}}}*/
-/*FUNCTION OptionDouble::DeepEcho(char* indent) {{{*/
-void  OptionDouble::DeepEcho(char* indent){
-
-	int   i;
-	int*  dims;
-	char  indent2[81];
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_(indent << "OptionDouble DeepEcho:");
-	Option::DeepEcho(indent);
-
-	xMemCpy<char>(indent2,indent,(strlen(indent)+1));
-	strcat(indent2,"  ");
-
-	if (values) {
-		dims=xNew<int>(ndims);
-		if(numel==1) if(flag) _pprintLine_(indent << "        values: " << values[0]);
-		else{
-			for (i=0; i<numel; i++) {
-				RowWiseDimsFromIndex(dims,i,size,ndims);
-				StringFromDims(cstr,dims,ndims);
-				if(flag) _pprintLine_(indent << "        values" << cstr << ": " << values[i]);
-			}
-		}
-		xDelete<int>(dims);
-	}
-	else if(flag) _pprintLine_(indent << "        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionDouble::Name {{{*/
-char* OptionDouble::Name(){
-
-	return(Option::Name());
-}
-/*}}}*/
-/*FUNCTION OptionDouble::NumEl {{{*/
-int   OptionDouble::NumEl(){
-
-	return(Option::NumEl());
-}
-/*}}}*/
-/*FUNCTION OptionDouble::NDims {{{*/
-int   OptionDouble::NDims(){
-
-	return(Option::NDims());
-}
-/*}}}*/
-/*FUNCTION OptionDouble::Size {{{*/
-int*  OptionDouble::Size(){
-
-	return(Option::Size());
-}
-/*}}}*/
-/*FUNCTION OptionDouble::Get(int* pvalue) {{{*/
-void OptionDouble::Get(int* pvalue){
-
-	/*We should first check that the size is one*/
-	if(this->NumEl()!=1){
-		_error_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single int");
-	}
-
-	/*Assign output pointer*/
-	*pvalue=reCast<int>(values[0]);
-}
-/*}}}*/
-/*FUNCTION OptionDouble::Get(IssmDouble* pvalue) {{{*/
-void OptionDouble::Get(IssmDouble* pvalue){
-
-	/*We should first check that the size is one*/
-	if(this->NumEl()!=1){
-		_error_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single IssmDouble");
-	}
-
-	/*Assign output pointer*/
-	*pvalue=this->values[0];
-}
-/*}}}*/
-/*FUNCTION OptionDouble::Get(IssmDouble** pvalue,int* numel) {{{*/
-void OptionDouble::Get(IssmDouble** pvalue,int* numel){
-
-	/*We should first check that the size is at least one*/
-	if(this->NumEl()<=0){
-		_error_("option \"" << this->name << "\" is empty and cannot return a IssmDouble vector");
-	}
-
-	/*Copy vector*/
-	IssmDouble* outvalue=xNew<IssmDouble>(this->NumEl());
-	for(int i=0;i<this->NumEl();i++) outvalue[i]=this->values[i];
-
-	/*Assign output pointer*/
-	*pvalue=outvalue;
-	if(numel) *numel=this->NumEl();
-}
-/*}}}*/
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionDouble.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionDouble.h	(revision 13215)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*! \file OptionDouble.h 
- *  \brief: header file for optionIssmDouble object
- */
-
-#ifndef _OPTIONDOUBLE_H_
-#define _OPTIONDOUBLE_H_
-
-/*Headers:{{{*/
-#include "../../../include/include.h"
-#include "../../../shared/Exceptions/exceptions.h"
-#include "../../../EnumDefinitions/EnumDefinitions.h"
-
-#include "./Option.h"
-/*}}}*/
-
-class OptionDouble: public Option {
-
-	public:
-
-		IssmDouble* values;
-
-		/*OptionDouble constructors, destructors {{{*/
-		OptionDouble();
-		~OptionDouble();
-		/*}}}*/
-		/*Object virtual functions definitions:{{{*/
-		void  Echo();
-		void  DeepEcho();
-		void  DeepEcho(char* indent);
-		int   Id(){_error_("Not implemented yet");};
-		int   MyRank(){_error_("Not implemented yet");};
-		int   ObjectEnum(){return OptionDoubleEnum;};
-		Object* copy(){_error_("Not implemented yet");};
-		/*}}}*/
-
-		/*virtual functions: */
-		char* Name();
-		int   NumEl();
-		int   NDims();
-		int*  Size();
-		void  Get(int* pvalue);
-		void  Get(IssmDouble* pvalue);
-		void  Get(bool* pvalue){  _error_("An OptionDouble object cannot return a bool");};
-		void  Get(char** pvalue){ _error_("An OptionDouble object cannot return a string");};
-		void  Get(char*** ppvalue,int *pnumel){ _error_("An OptionDouble object cannot return a string vec");};
-		void  Get(IssmDouble** pvalue,int* pnumel);
-		void  Get(Options** pvalue){ _error_("An OptionDouble object cannot return an Options DataSet");};
-		void  Get(Options*** ppvalue,int *pnumel){ _error_("An OptionDouble object cannot return an Options DataSet vec");};
-
-};
-#endif  /* _OPTIONDOUBLE_H */
-
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionLogical.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionLogical.cpp	(revision 13215)
+++ 	(revision )
@@ -1,133 +1,0 @@
-/*!\file OptionLogical.cpp
- * \brief: implementation of the optionslogical object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../objects.h"
-#include "../../../shared/shared.h"
-#include "../../../io/io.h"
-#include "../../../Container/Container.h"
-#include "../../../include/include.h"
-/*}}}*/
-
-/*Constructors/destructor/copy*/
-/*FUNCTION OptionLogical::OptionLogical(){{{*/
-OptionLogical::OptionLogical(){
-
-	values    =NULL;
-
-}
-/*}}}*/
-/*FUNCTION OptionLogical::~OptionLogical(){{{*/
-OptionLogical::~OptionLogical(){
-
-	if (values) xDelete<bool>(values);
-
-}
-/*}}}*/
-
-/*Other*/
-/*FUNCTION OptionLogical::Echo {{{*/
-void  OptionLogical::Echo(){
-
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_("OptionLogical Echo:");
-	Option::Echo();
-
-	if (values && size) {
-		if(numel == 1) if(flag) _pprintLine_("        values: " << (values[0] ? "true" : "false"));
-		else{
-			StringFromSize(cstr,size,ndims);
-			if(flag) _pprintLine_("        values: " << cstr << " " << "logical");
-		}
-	}
-	else if(flag) _pprintLine_("        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionLogical::DeepEcho() {{{*/
-void  OptionLogical::DeepEcho(){
-
-	char  indent[81]="";
-
-	OptionLogical::DeepEcho(indent);
-
-	return;
-}
-/*}}}*/
-/*FUNCTION OptionLogical::DeepEcho(char* indent) {{{*/
-void  OptionLogical::DeepEcho(char* indent){
-
-	int   i;
-	int*  dims;
-	char  indent2[81];
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_(indent << "OptionLogical DeepEcho:");
-	Option::DeepEcho(indent);
-
-	xMemCpy<char>(indent2,indent,(strlen(indent)+1));
-	strcat(indent2,"  ");
-
-	if (values) {
-		if(numel==1) if(flag) _pprintLine_(indent << "        values: " << (values[0] ? "true" : "false"));
-		else{
-			dims=xNew<int>(ndims);
-			for (i=0; i<numel; i++) {
-				RowWiseDimsFromIndex(dims,i,size,ndims);
-				StringFromDims(cstr,dims,ndims);
-				if(flag) _pprintLine_(indent << "        values" << cstr << ": " << (values[i] ? "true" : "false"));
-			}
-			xDelete<int>(dims);
-		}
-	}
-	else if(flag) _pprintLine_(indent << "        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionLogical::Name {{{*/
-char* OptionLogical::Name(){
-
-	return(Option::Name());
-}
-/*}}}*/
-/*FUNCTION OptionLogical::NumEl {{{*/
-int   OptionLogical::NumEl(){
-
-	return(Option::NumEl());
-}
-/*}}}*/
-/*FUNCTION OptionLogical::NDims {{{*/
-int   OptionLogical::NDims(){
-
-	return(Option::NDims());
-}
-/*}}}*/
-/*FUNCTION OptionLogical::Size {{{*/
-int*  OptionLogical::Size(){
-
-	return(Option::Size());
-}
-/*}}}*/
-/*FUNCTION OptionLogical::Get(bool* pvalue) {{{*/
-void OptionLogical::Get(bool* pvalue){
-
-	/*We should first check that the size is one*/
-	if(this->NumEl()!=1){
-		_error_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single bool");
-	}
-
-	/*Assign output pointer*/
-	*pvalue=this->values[0];
-}
-/*}}}*/
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionLogical.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionLogical.h	(revision 13215)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*! \file OptionLogical.h 
- *  \brief: header file for optionlogical object
- */
-
-#ifndef _OPTIONLOGICAL_H_
-#define _OPTIONLOGICAL_H_
-
-/*Headers:{{{*/
-#include "../../../include/include.h"
-#include "../../../shared/Exceptions/exceptions.h"
-#include "../../../EnumDefinitions/EnumDefinitions.h"
-
-#include "./Option.h"
-/*}}}*/
-
-class OptionLogical: public Option {
-
-	public:
-
-		bool* values;
-
-		/*OptionLogical constructors, destructors {{{*/
-		OptionLogical();
-		~OptionLogical();
-		/*}}}*/
-		/*Object virtual functions definitions:{{{*/
-		void  Echo();
-		void  DeepEcho();
-		void  DeepEcho(char* indent);
-		int   Id(){_error_("Not implemented yet");};
-		int   MyRank(){_error_("Not implemented yet");};
-		int   ObjectEnum(){return OptionLogicalEnum;};
-		Object* copy(){_error_("Not implemented yet");};
-		/*}}}*/
-
-		/*virtual functions: */
-		char* Name();
-		int   NumEl();
-		int   NDims();
-		int*  Size();
-		void  Get(int* pvalue){_error_("An OptionLogical object cannot return a int");};
-		void  Get(IssmDouble* pvalue){_error_("An OptionLogical object cannot return a IssmDouble");};
-		void  Get(bool* pvalue);
-		void  Get(char** pvalue){ _error_("An OptionLogical object cannot return a string");};
-		void  Get(char*** ppvalue,int *pnumel){ _error_("An OptionLogical object cannot return a string vec");};
-		void  Get(IssmDouble** pvalue,int *pnumel){ _error_("An OptionLogical object cannot return a IssmDouble vec");};
-		void  Get(Options** pvalue){ _error_("An OptionLogical object cannot return an Options DataSet");};
-		void  Get(Options*** ppvalue,int *pnumel){ _error_("An OptionLogical object cannot return an Options DataSet vec");};
-
-};
-#endif  /* _OPTIONLOGICAL_H */
-
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionStruct.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionStruct.cpp	(revision 13215)
+++ 	(revision )
@@ -1,153 +1,0 @@
-/*!\file OptionStruct.cpp
- * \brief: implementation of the optionsstruct object
- */
-
-/*Headers:*/
-/*{{{*/
-#ifdef HAVE_CONFIG_H
-	#include <config.h>
-#else
-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-#include "../objects.h"
-#include "../../../shared/shared.h"
-#include "../../../io/io.h"
-#include "../../../Container/Container.h"
-#include "../../../include/include.h"
-/*}}}*/
-
-/*Constructors/destructor/copy*/
-/*FUNCTION OptionStruct::OptionStruct(){{{*/
-OptionStruct::OptionStruct(){
-
-	values    =NULL;
-
-}
-/*}}}*/
-/*FUNCTION OptionStruct::~OptionStruct(){{{*/
-OptionStruct::~OptionStruct(){
-
-	int   i;
-
-	if(values){
-		for(i=0; i<numel; i++) {
-			delete values[i];
-			values[i] =NULL;
-		}
-		xDelete<Options*>(values);
-	}
-
-}
-/*}}}*/
-
-/*Other*/
-/*FUNCTION OptionStruct::Echo {{{*/
-void  OptionStruct::Echo(){
-
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_("OptionStruct Echo:");
-	Option::Echo();
-
-	if (values && size) {
-		StringFromSize(cstr,size,ndims);
-		if(flag) _pprintLine_("        values: " << cstr << " " << "struct");
-	}
-	else if(flag) _pprintLine_("        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionStruct::DeepEcho() {{{*/
-void  OptionStruct::DeepEcho(){
-
-	char  indent[81]="";
-
-	OptionStruct::DeepEcho(indent);
-
-	return;
-}
-/*}}}*/
-/*FUNCTION OptionStruct::DeepEcho(char* indent) {{{*/
-void  OptionStruct::DeepEcho(char* indent){
-
-	int   i,j;
-	int*  dims;
-	char  indent2[81];
-	char  cstr[81];
-	bool  flag=true;
-
-	if(flag) _pprintLine_(indent << "OptionStruct DeepEcho:");
-	Option::DeepEcho(indent);
-
-	xMemCpy<char>(indent2,indent,(strlen(indent)+1));
-	strcat(indent2,"  ");
-
-	if (values) {
-		dims=xNew<int>(ndims);
-		for (i=0; i<numel; i++) {
-			ColumnWiseDimsFromIndex(dims,i,size,ndims);
-			StringFromDims(cstr,dims,ndims);
-			if (values[i]->Size()){
-				if(flag) _pprintLine_(indent << "        values: -------- begin " << cstr << " --------");
-				for (j=0; j<values[i]->Size(); j++) ((Option *)values[i]->GetObjectByOffset(j))->DeepEcho(indent2);
-				if(flag) _pprintLine_(indent << "        values: --------  end  " << cstr << " --------");
-			}
-			else if(flag) _pprintLine_(indent << "        values: " << cstr << " [empty]");
-		}
-		xDelete<int>(dims);
-	}
-	else if(flag) _pprintLine_(indent << "        values: [empty]");
-}
-/*}}}*/
-/*FUNCTION OptionStruct::Name {{{*/
-char* OptionStruct::Name(){
-
-	return(Option::Name());
-}
-/*}}}*/
-/*FUNCTION OptionStruct::NumEl {{{*/
-int   OptionStruct::NumEl(){
-
-	return(Option::NumEl());
-}
-/*}}}*/
-/*FUNCTION OptionStruct::NDims {{{*/
-int   OptionStruct::NDims(){
-
-	return(Option::NDims());
-}
-/*}}}*/
-/*FUNCTION OptionStruct::Size {{{*/
-int*  OptionStruct::Size(){
-
-	return(Option::Size());
-}
-/*}}}*/
-/*FUNCTION OptionStruct::Get(Options** pvalue) {{{*/
-void OptionStruct::Get(Options** pvalue){
-
-	/*We should first check that the size is one*/
-	if(this->NumEl()!=1){
-		_error_("option \"" << this->name << "\" has " << this->NumEl() << " elements and cannot return a single options dataset");
-	}
-
-	/*Assign output pointer*/
-	*pvalue=this->values[0];
-}
-/*}}}*/
-/*FUNCTION OptionStruct::Get(Options*** ppvalue,int* numel) {{{*/
-void OptionStruct::Get(Options*** ppvalue,int* numel){
-
-	/*We should first check that the size is at least one*/
-	if(this->NumEl()<=0){
-		_error_("option \"" << this->name << "\" is empty and cannot return an options dataset vector");
-	}
-
-	/*Assign output pointer*/
-	*ppvalue=this->values;
-	if(numel) *numel=this->NumEl();
-}
-/*}}}*/
Index: sm/trunk-jpl/src/c/classes/objects/Options/OptionStruct.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Options/OptionStruct.h	(revision 13215)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*! \file OptionStruct.h 
- *  \brief: header file for optionstruct object
- */
-
-#ifndef _OPTIONSTRUCT_H_
-#define _OPTIONSTRUCT_H_
-
-/*Headers:{{{*/
-#include "../../../include/include.h"
-#include "../../../shared/Exceptions/exceptions.h"
-#include "../../../EnumDefinitions/EnumDefinitions.h"
-
-#include "./Option.h"
-/*}}}*/
-
-class OptionStruct: public Option {
-
-	public:
-
-		Options** values;
-
-		/*OptionStruct constructors, destructors {{{*/
-		OptionStruct();
-		~OptionStruct();
-		/*}}}*/
-		/*Object virtual functions definitions:{{{*/
-		void  Echo();
-		void  DeepEcho();
-		void  DeepEcho(char* indent);
-		int   Id(){_error_("Not implemented yet");};
-		int   MyRank(){_error_("Not implemented yet");};
-		int   ObjectEnum(){return OptionStructEnum;};
-		Object* copy(){_error_("Not implemented yet");};
-		/*}}}*/
-
-		/*virtual functions: */
-		char* Name();
-		int   NumEl();
-		int   NDims();
-		int*  Size();
-		void  Get(int* pvalue){_error_("An OptionStruct object cannot return a int");};
-		void  Get(IssmDouble* pvalue){_error_("An OptionStruct object cannot return a IssmDouble");};
-		void  Get(bool* pvalue){  _error_("An OptionStruct object cannot return a bool");};
-		void  Get(char** pvalue){ _error_("An OptionStruct object cannot return a string");};
-		void  Get(char*** ppvalue,int *pnumel){ _error_("An OptionStruct object cannot return a string vec");};
-		void  Get(IssmDouble** pvalue,int *pnumel){ _error_("An OptionStruct object cannot return a IssmDouble vec");};
-		void  Get(Options** pvalue);
-		void  Get(Options*** ppvalue,int *pnumel);
-
-};
-#endif  /* _OPTIONSTRUCT_H */
-
Index: /issm/trunk-jpl/src/c/classes/objects/Params/BoolParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/BoolParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/BoolParam.h	(revision 13216)
@@ -53,6 +53,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -66,6 +66,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/DoubleMatArrayParam.h	(revision 13216)
@@ -56,6 +56,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims);
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << "cannot return a FILE");}
 
@@ -69,6 +69,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a int vec array");}
 		void  SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a int mat array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << "cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array);
Index: /issm/trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/DoubleMatParam.h	(revision 13216)
@@ -55,6 +55,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN);
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -68,6 +68,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");}
 		void  SetValue(int* intarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");};
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/DoubleParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/DoubleParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/DoubleParam.h	(revision 13216)
@@ -54,6 +54,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN);
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -67,6 +67,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/DoubleVecParam.h	(revision 13216)
@@ -54,6 +54,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN);
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -67,6 +67,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");};
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/FileParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/FileParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/FileParam.h	(revision 13216)
@@ -53,6 +53,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){*pfid=value;};
 
@@ -66,6 +66,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("File param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/GenericParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/GenericParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/GenericParam.h	(revision 13216)
@@ -47,5 +47,5 @@
                   _printLine_("   value: " << myP);;
                 }
-                 void  Echo() {DeepEcho();};
+                void  Echo() {DeepEcho();};
                 int   Id(){ return -1; };
                 int   MyRank() { extern int my_rank; return my_rank;} ;
@@ -77,6 +77,6 @@
                 void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a IssmDouble array");}
                 void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a matrix array");}
-                void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Vec");}
-                void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Mat");}
+                void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Vec");}
+                void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a Mat");}
                 void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot return a FILE");}
 
@@ -90,6 +90,6 @@
                 void  SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");}
                 void  SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a IssmDouble array");}
-                void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Vec");}
-                void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Mat");}
+                void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Vec");}
+                void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a Mat");}
                 void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold a FILE");}
                 void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(myEnumVal) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/IntMatParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/IntMatParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/IntMatParam.h	(revision 13216)
@@ -55,6 +55,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");};
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -68,6 +68,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int vec array");};
 		void  SetValue(int* intarray,int M,int N);
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/IntParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/IntParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/IntParam.h	(revision 13216)
@@ -54,6 +54,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -67,6 +67,6 @@
 		void  SetValue(IssmDouble* IssmDoublearray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");}
 		void  SetValue(IssmDouble* pIssmDoublearray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a IssmDouble array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/IntVecParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/IntVecParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/IntVecParam.h	(revision 13216)
@@ -55,6 +55,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -68,6 +68,6 @@
 		void  SetValue(int* intarray,int M);
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int mat array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/MatrixParam.cpp	(revision 13216)
@@ -26,6 +26,6 @@
 }
 /*}}}*/
-/*FUNCTION MatrixParam::MatrixParam(int enum_type,Matrix* value){{{*/
-MatrixParam::MatrixParam(int in_enum_type,Matrix* in_value){
+/*FUNCTION MatrixParam::MatrixParam(int enum_type,Matrix<IssmDouble>* value){{{*/
+MatrixParam::MatrixParam(int in_enum_type,Matrix<IssmDouble>* in_value){
 
 	enum_type=in_enum_type;
@@ -87,6 +87,6 @@
 /*MatrixParam virtual functions definitions: */
 /*FUNCTION MatrixParam::GetParameterValue{{{*/
-void  MatrixParam::GetParameterValue(Matrix** poutput){
-	Matrix* output=NULL;
+void  MatrixParam::GetParameterValue(Matrix<IssmDouble>** poutput){
+	Matrix<IssmDouble>* output=NULL;
 
 	if(value){
@@ -102,5 +102,5 @@
 /*}}}*/
 /*FUNCTION MatrixParam::SetValue{{{*/
-void  MatrixParam::SetValue(Matrix* matrix){
+void  MatrixParam::SetValue(Matrix<IssmDouble>* matrix){
 	
 	/*avoid leak: */
Index: /issm/trunk-jpl/src/c/classes/objects/Params/MatrixParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/MatrixParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/MatrixParam.h	(revision 13216)
@@ -25,10 +25,10 @@
 		/*just hold 3 values for 3 vertices: */
 		int enum_type;
-		Matrix* value;
+		Matrix<IssmDouble>* value;
 
 	public:
 		/*MatrixParam constructors, destructors: {{{*/
 		MatrixParam();
-		MatrixParam(int enum_type,Matrix* value);
+		MatrixParam(int enum_type,Matrix<IssmDouble>* value);
 		~MatrixParam();
 		/*}}}*/
@@ -54,6 +54,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a vec");}
-		void  GetParameterValue(Matrix** poutput);
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** poutput);
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -67,6 +67,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat);
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat);
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/Param.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/Param.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/Param.h	(revision 13216)
@@ -38,6 +38,6 @@
 		virtual void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN)=0;
 		virtual void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims)=0;
-		virtual void  GetParameterValue(Vector** pvec)=0;
-		virtual void  GetParameterValue(Matrix** pmat)=0;
+		virtual void  GetParameterValue(Vector<IssmDouble>** pvec)=0;
+		virtual void  GetParameterValue(Matrix<IssmDouble>** pmat)=0;
 		virtual void  GetParameterValue(FILE** pfid)=0;
 		
@@ -51,6 +51,6 @@
 		virtual void  SetValue(int* intarray,int M)=0;
 		virtual void  SetValue(int* pintarray,int M,int N)=0;
-		virtual void  SetValue(Vector* vec)=0;
-		virtual void  SetValue(Matrix* mat)=0;
+		virtual void  SetValue(Vector<IssmDouble>* vec)=0;
+		virtual void  SetValue(Matrix<IssmDouble>* mat)=0;
 		virtual void  SetValue(FILE* fid)=0;
 		virtual void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array)=0;
Index: /issm/trunk-jpl/src/c/classes/objects/Params/StringArrayParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/StringArrayParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/StringArrayParam.h	(revision 13216)
@@ -56,6 +56,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Vec param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -69,6 +69,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/StringParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/StringParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/StringParam.h	(revision 13216)
@@ -54,6 +54,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Bool param of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");}
 
@@ -67,6 +67,6 @@
 		void  SetValue(int* intarray,int M){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
 		void  SetValue(int* pintarray,int M,int N){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a int array");}
-		void  SetValue(Vector* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/TransientParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/TransientParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/TransientParam.h	(revision 13216)
@@ -55,6 +55,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM,int* pN){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Vector** pvec){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a Vec");}
-		void  GetParameterValue(Matrix** pmat){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** pvec){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a Vec");}
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a Mat");}
 		void  GetParameterValue(FILE** pfid){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot return a FILE");}
 
@@ -68,6 +68,6 @@
 		void  SetValue(int* intarray,int M){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a int vec array");}
 		void  SetValue(int* intarray,int M,int N){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a int mat array");};
-		void  SetValue(Vector* vec){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a Vec");}
-		void  SetValue(Matrix* mat){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a Vec");}
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Parameter " <<EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/VectorParam.cpp	(revision 13216)
@@ -27,5 +27,5 @@
 /*}}}*/
 /*FUNCTION VectorParam::VectorParam(int enum_type,IssmVector value){{{*/
-VectorParam::VectorParam(int in_enum_type,Vector* in_value){
+VectorParam::VectorParam(int in_enum_type,Vector<IssmDouble>* in_value){
 
 	enum_type=in_enum_type;
@@ -89,6 +89,6 @@
 /*VectorParam virtual functions definitions: */
 /*FUNCTION VectorParam::GetParameterValue{{{*/
-void  VectorParam::GetParameterValue(Vector** poutput){
-	Vector*  output=NULL;
+void  VectorParam::GetParameterValue(Vector<IssmDouble>** poutput){
+	Vector<IssmDouble>*  output=NULL;
 
 	if(value){
@@ -105,5 +105,5 @@
 /*}}}*/
 /*FUNCTION VectorParam::SetValue{{{*/
-void  VectorParam::SetValue(Vector* vector){
+void  VectorParam::SetValue(Vector<IssmDouble>* vector){
 
 	/*avoid leak: */
Index: /issm/trunk-jpl/src/c/classes/objects/Params/VectorParam.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Params/VectorParam.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Params/VectorParam.h	(revision 13216)
@@ -25,10 +25,10 @@
 		/*just hold 3 values for 3 vertices: */
 		int enum_type;
-		Vector* value;
+		Vector<IssmDouble>* value;
 
 	public:
 		/*VectorParam constructors, destructors: {{{*/
 		VectorParam();
-		VectorParam(int enum_type,Vector* value);
+		VectorParam(int enum_type,Vector<IssmDouble>* value);
 		~VectorParam();
 		/*}}}*/
@@ -54,6 +54,6 @@
 		void  GetParameterValue(IssmDouble** pIssmDoublearray,int* pM, int* pN){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a IssmDouble array");}
 		void  GetParameterValue(IssmDouble*** parray, int* pM,int** pmdims, int** pndims){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a matrix array");}
-		void  GetParameterValue(Matrix** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
-		void  GetParameterValue(Vector** poutput);
+		void  GetParameterValue(Matrix<IssmDouble>** pmat){_error_("Param "<< EnumToStringx(enum_type) << " cannot return a Mat");}
+		void  GetParameterValue(Vector<IssmDouble>** poutput);
 		void  GetParameterValue(FILE** pfid){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot return a FILE");}
 
@@ -67,6 +67,6 @@
 		void  SetValue(int* intarray,int M){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");}
 		void  SetValue(int* pintarray,int M,int N){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a int array");}
-		void  SetValue(Vector* vec);
-		void  SetValue(Matrix* mat){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");}
+		void  SetValue(Vector<IssmDouble>* vec);
+		void  SetValue(Matrix<IssmDouble>* mat){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a Mat");}
 		void  SetValue(FILE* fid){_error_("Vector of enum " << enum_type << " (" << EnumToStringx(enum_type) << ") cannot hold a FILE");}
 		void  SetValue(IssmDouble** array, int M, int* mdim_array, int* ndim_array){_error_("Param "<< EnumToStringx(enum_type) << " cannot hold an array of matrices");}
Index: /issm/trunk-jpl/src/c/classes/objects/Vertex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Vertex.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Vertex.cpp	(revision 13216)
@@ -199,5 +199,5 @@
 /*}}}*/
 /*FUNCTION Vertex::UpdateVertexPosition {{{*/
-void  Vertex::UpdatePosition(Vector* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed){
+void  Vertex::UpdatePosition(Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed){
 
 	IssmDouble oldz,newz;
Index: /issm/trunk-jpl/src/c/classes/objects/Vertex.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Vertex.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/Vertex.h	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../classes.h"
 class IoModel;
-class Vector;
+template <class doubletype> class Vector;
 class Parameters;
 #include "../../shared/Exceptions/exceptions.h"
@@ -60,5 +60,5 @@
 		int   Sid(void); 
 		int   Connectivity(void); 
-		void  UpdatePosition(Vector* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed);
+		void  UpdatePosition(Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed);
 		/*}}}*/
 };
Index: /issm/trunk-jpl/src/c/classes/objects/objects.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/objects.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/classes/objects/objects.h	(revision 13216)
@@ -70,9 +70,5 @@
 /*Option parsing objects: */
 #include "./Options/Option.h"
-#include "./Options/OptionDouble.h"
-#include "./Options/OptionLogical.h"
-#include "./Options/OptionChar.h"
-#include "./Options/OptionStruct.h"
-#include "./Options/OptionCell.h"
+#include "./Options/GenericOption.h"
 #include "./Options/OptionUtilities.h"
 
Index: /issm/trunk-jpl/src/c/io/Disk/diskio.h
===================================================================
--- /issm/trunk-jpl/src/c/io/Disk/diskio.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/io/Disk/diskio.h	(revision 13216)
@@ -6,7 +6,5 @@
 #define _DISK_IO_H_
 
-#include "../../classes/objects/objects.h"
-#include "../../Container/Container.h"
-#include "../../include/include.h"
+#include <stdio.h>
 
 FILE* pfopen(char* filename,const char* format);
Index: /issm/trunk-jpl/src/c/matlab/io/FetchMatlabData.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/FetchMatlabData.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/FetchMatlabData.cpp	(revision 13216)
@@ -481,8 +481,8 @@
 
 /*ISSM objects*/
-/*FUNCTION FetchData(Matrix** pmatrix,const mxArray* dataref){{{*/
-void FetchData(Matrix** pmatrix,const mxArray* dataref){
-
-	Matrix* outmatrix=NULL;
+/*FUNCTION FetchData(Matrix<double>** pmatrix,const mxArray* dataref){{{*/
+void FetchData(Matrix<double>** pmatrix,const mxArray* dataref){
+
+	Matrix<double>* outmatrix=NULL;
 	int dummy=0;
 
@@ -502,13 +502,13 @@
 }
 /*}}}*/
-/*FUNCTION FetchData(Vector** pvector,const mxArray* dataref){{{*/
-void FetchData(Vector** pvector,const mxArray* dataref){
-
-	Vector* vector=NULL;
+/*FUNCTION FetchData(Vector<double>** pvector,const mxArray* dataref){{{*/
+void FetchData(Vector<double>** pvector,const mxArray* dataref){
+
+	Vector<double>* vector=NULL;
 	int dummy;
 
 	if(mxIsEmpty(dataref)){
 		/*Nothing to pick up. Just initialize matrix pointer to NULL: */
-		vector=new Vector(0);
+		vector=new Vector<double>(0);
 	}
 	else if (mxIsClass(dataref,"double") ){
Index: /issm/trunk-jpl/src/c/matlab/io/MatlabMatrixToMatrix.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/MatlabMatrixToMatrix.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/MatlabMatrixToMatrix.cpp	(revision 13216)
@@ -22,11 +22,11 @@
 /*}}}*/
 
-Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix){
+Matrix<double>* MatlabMatrixToMatrix(const mxArray* mxmatrix){
 
 	int dummy;
-	Matrix* matrix=NULL;
+	Matrix<double>* matrix=NULL;
 
 	/*allocate matrix object: */
-	matrix=new Matrix();
+	matrix=new Matrix<double>();
 
 	#ifdef _HAVE_PETSC_
Index: /issm/trunk-jpl/src/c/matlab/io/MatlabMatrixToSeqMat.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/MatlabMatrixToSeqMat.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/MatlabMatrixToSeqMat.cpp	(revision 13216)
@@ -19,9 +19,9 @@
 /*}}}*/
 
-SeqMat* MatlabMatrixToSeqMat(const mxArray* dataref){
+SeqMat<double>* MatlabMatrixToSeqMat(const mxArray* dataref){
 
-	SeqMat* output=NULL;
+	SeqMat<double>* output=NULL;
 
-	output=new SeqMat();
+	output=new SeqMat<double>();
 	MatlabMatrixToDoubleMatrix(&output->matrix,&output->M,&output->N,dataref);
 	return output;
Index: /issm/trunk-jpl/src/c/matlab/io/MatlabVectorToSeqVec.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/MatlabVectorToSeqVec.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/MatlabVectorToSeqVec.cpp	(revision 13216)
@@ -19,9 +19,9 @@
 /*}}}*/
 
-SeqVec* MatlabVectorToSeqVec(const mxArray* dataref){
+SeqVec<double>* MatlabVectorToSeqVec(const mxArray* dataref){
 
-	SeqVec* output=NULL;
+	SeqVec<double>* output=NULL;
 
-	output=new SeqVec();
+	output=new SeqVec<double>();
 	MatlabVectorToDoubleVector(&output->vector,&output->M,dataref);
 	return output;
Index: /issm/trunk-jpl/src/c/matlab/io/MatlabVectorToVector.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/MatlabVectorToVector.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/MatlabVectorToVector.cpp	(revision 13216)
@@ -22,11 +22,11 @@
 /*}}}*/
 
-Vector* MatlabVectorToVector(const mxArray* mxvector){
+Vector<double>* MatlabVectorToVector(const mxArray* mxvector){
 
 	int dummy;
-	Vector* vector=NULL;
+	Vector<double>* vector=NULL;
 
 	/*allocate vector object: */
-	vector=new Vector();
+	vector=new Vector<double>();
 
 	#ifdef _HAVE_PETSC_
Index: /issm/trunk-jpl/src/c/matlab/io/OptionParse.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/OptionParse.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/OptionParse.cpp	(revision 13216)
@@ -15,11 +15,10 @@
 #include "./matlabio.h"
 
-/*FUNCTION OptionDoubleParse {{{*/
-OptionDouble* OptionDoubleParse( char* name, const mxArray* prhs[]){
+GenericOption<double*>* OptionDoubleParse( char* name, const mxArray* prhs[]){ /*{{{*/
 
-	OptionDouble *odouble = NULL;
+	GenericOption<double*> *odouble = NULL;
 
 	/*check and parse the name  */
-	odouble=new OptionDouble;
+	odouble=new GenericOption<double*>();
 	odouble->name =xNew<char>(strlen(name)+1);
 	memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
@@ -29,15 +28,14 @@
 		_error_("Value of option \"" << odouble->name  << "\" must be class \"double\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
 	}
-	FetchData(&odouble->values,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]);
+	FetchData(&odouble->value,&odouble->numel,&odouble->ndims,&odouble->size,prhs[0]);
 
 	return(odouble);
 }/*}}}*/
-/*FUNCTION OptionLogicalParse {{{*/
-OptionLogical* OptionLogicalParse( char* name, const mxArray* prhs[]){
+GenericOption<bool*>* OptionLogicalParse( char* name, const mxArray* prhs[]){ /*{{{*/
 
-	OptionLogical *ological = NULL;
+	GenericOption<bool*> *ological = NULL;
 
 	/*check and parse the name  */
-	ological=new OptionLogical;
+	ological=new GenericOption<bool*>();
 	ological->name =xNew<char>(strlen(name)+1);
 	memcpy(ological->name,name,(strlen(name)+1)*sizeof(char));
@@ -47,15 +45,14 @@
 		_error_("Value of option \"" << ological->name  << "\" must be class \"logical\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
 	}
-	FetchData(&ological->values,&ological->numel,&ological->ndims,&ological->size,prhs[0]);
+	FetchData(&ological->value,&ological->numel,&ological->ndims,&ological->size,prhs[0]);
 
 	return(ological);
 }/*}}}*/
-/*FUNCTION OptionCharParse {{{*/
-OptionChar* OptionCharParse( char* name, const mxArray* prhs[]){
+GenericOption<char*>* OptionCharParse( char* name, const mxArray* prhs[]){ /*{{{*/
 
-	OptionChar  *ochar = NULL;
+	GenericOption<char*>  *ochar = NULL;
 
 	/*check and parse the name  */
-	ochar=new OptionChar();
+	ochar=new GenericOption<char*>();
 	ochar->name =xNew<char>(strlen(name)+1);
 	memcpy(ochar->name,name,(strlen(name)+1)*sizeof(char));
@@ -65,15 +62,14 @@
 		_error_("Value of option \"" << ochar->name  << "\" must be class \"char\", not class \"" << mxGetClassName(prhs[0]) <<"\".");
 	}
-	FetchData(&ochar->values,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]);
+	FetchData(&ochar->value,&ochar->numel,&ochar->ndims,&ochar->size,prhs[0]);
 
 	return(ochar);
 }/*}}}*/
-/*FUNCTION OptionStructParse {{{*/
-OptionStruct* OptionStructParse( char* name, const mxArray* prhs[]){
+GenericOption<Options**>* OptionStructParse( char* name, const mxArray* prhs[]){ /*{{{*/
 
 	int            i;
 	char           namei[161];
-	OptionStruct  *ostruct    = NULL;
-	Option        *option     = NULL;
+	Option*                   option      = NULL;
+	GenericOption<Options**>  *ostruct    = NULL;
 	const mwSize  *ipt        = NULL;
 	const mxArray *structi;
@@ -81,5 +77,5 @@
 
 	/*check and parse the name  */
-	ostruct=new OptionStruct;
+	ostruct=new GenericOption<Options**>();
 	ostruct->name =xNew<char>(strlen(name)+1);
 	memcpy(ostruct->name,name,(strlen(name)+1)*sizeof(char));
@@ -94,9 +90,9 @@
 	ostruct->size =xNew<int>(ostruct->ndims);
 	for (i=0; i<ostruct->ndims; i++) ostruct->size[i]=(int)ipt[i];
-	if (ostruct->numel) ostruct->values=xNew<Options*>(ostruct->numel);
+	if (ostruct->numel) ostruct->value=xNew<Options*>(ostruct->numel);
 
 	/*loop through and process each element of the struct array  */
 	for (sindex=0; sindex<ostruct->numel; sindex++) {
-		ostruct->values[sindex]=new Options;
+		ostruct->value[sindex]=new Options;
 
 		/*loop through and process each field for the element  */
@@ -106,5 +102,5 @@
 
 			option=(Option*)OptionParse(namei,&structi);
-			ostruct->values[sindex]->AddObject((Object*)option);
+			ostruct->value[sindex]->AddObject((Object*)option);
 			option=NULL;
 		}
@@ -113,6 +109,5 @@
 	return(ostruct);
 }/*}}}*/
-/*FUNCTION OptionCellParse {{{*/
-OptionCell* OptionCellParse( char* name, const mxArray* prhs[]){
+GenericOption<Options*>* OptionCellParse( char* name, const mxArray* prhs[]){ /*{{{*/
 
 	int            i;
@@ -120,5 +115,5 @@
 	char           namei[161];
 	char           cstr[81];
-	OptionCell    *ocell      = NULL;
+	GenericOption<Options*> *ocell      = NULL;
 	Option        *option     = NULL;
 	const mwSize  *ipt        = NULL;
@@ -127,5 +122,5 @@
 
 	/*check and parse the name  */
-	ocell=new OptionCell;
+	ocell=new GenericOption<Options*>();
 	ocell->name =xNew<char>(strlen(name)+1);
 	memcpy(ocell->name,name,(strlen(name)+1)*sizeof(char));
@@ -141,5 +136,5 @@
 	ocell->size =xNew<int>(ocell->ndims);
 	for (i=0; i<ocell->ndims; i++) ocell->size[i]=(int)ipt[i];
-	ocell->values=new Options;
+	ocell->value=new Options;
 
 	/*loop through and process each element of the cell array  */
@@ -156,5 +151,5 @@
 
 		option=(Option*)OptionParse(namei,&celli);
-		ocell->values->AddObject((Object*)option);
+		ocell->value->AddObject((Object*)option);
 		option=NULL;
 	}
@@ -163,6 +158,5 @@
 	return(ocell);
 }/*}}}*/
-/*FUNCTION OptionParse{{{*/
-Option* OptionParse(char* name, const mxArray* prhs[]){
+Option* OptionParse(char* name, const mxArray* prhs[]){ /*{{{*/
 
 	Option *option = NULL;
Index: /issm/trunk-jpl/src/c/matlab/io/WriteMatlabData.cpp
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/WriteMatlabData.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/WriteMatlabData.cpp	(revision 13216)
@@ -217,5 +217,5 @@
 /*}}}*/
 /*FUNCTION WriteData(mxArray** pdataref,Matrix* matrix){{{*/
-void WriteData(mxArray** pdataref,Matrix* matrix){
+void WriteData(mxArray** pdataref,Matrix<double>* matrix){
 		
 	int      i,j;
@@ -255,6 +255,6 @@
 }
 /*}}}*/
-/*FUNCTION WriteData(mxArray** pdataref,Vector* vector){{{*/
-void WriteData(mxArray** pdataref,Vector* vector){
+/*FUNCTION WriteData(mxArray** pdataref,Vector<double>* vector){{{*/
+void WriteData(mxArray** pdataref,Vector<double>* vector){
 	
 	mxArray* dataref=NULL;
Index: /issm/trunk-jpl/src/c/matlab/io/matlabio.h
===================================================================
--- /issm/trunk-jpl/src/c/matlab/io/matlabio.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/matlab/io/matlabio.h	(revision 13216)
@@ -18,8 +18,8 @@
 #include <mex.h>
 
-void WriteData(mxArray** pdataref,Matrix* matrix);
+void WriteData(mxArray** pdataref,Matrix<double>* matrix);
 void WriteData(mxArray** pdataref,double* matrix, int M,int N);
 void WriteData(mxArray** pdataref,int*    matrix, int M,int N);
-void WriteData(mxArray** pdataref,Vector* vector);
+void WriteData(mxArray** pdataref,Vector<double>* vector);
 void WriteData(mxArray** pdataref,double* vector, int M);
 void WriteData(mxArray** pdataref,int integer);
@@ -35,10 +35,10 @@
 void FetchData(bool** pmatrix,int* pM,int *pN,const mxArray* dataref);
 void FetchData(bool** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
-void FetchData(Matrix** pmatrix,const mxArray* dataref);
+void FetchData(Matrix<double>** pmatrix,const mxArray* dataref);
 void FetchData(int** pvector,int* pM,const mxArray* dataref);
 void FetchData(float** pvector,int* pM,const mxArray* dataref);
 void FetchData(double** pvector,int* pM,const mxArray* dataref);
 void FetchData(bool** pvector,int* pM,const mxArray* dataref);
-void FetchData(Vector** pvector,const mxArray* dataref);
+void FetchData(Vector<double>** pvector,const mxArray* dataref);
 void FetchData(char** pstring,const mxArray* dataref);
 void FetchData(char** pmatrix,int* pnumel,int* pndims,int** psize,const mxArray* dataref);
@@ -52,9 +52,9 @@
 
 Option* OptionParse(char* name, const mxArray* prhs[]);
-OptionDouble*   OptionDoubleParse( char* name, const mxArray* prhs[]);
-OptionLogical*  OptionLogicalParse( char* name, const mxArray* prhs[]);
-OptionChar*     OptionCharParse( char* name, const mxArray* prhs[]);
-OptionStruct*   OptionStructParse( char* name, const mxArray* prhs[]);
-OptionCell*     OptionCellParse( char* name, const mxArray* prhs[]);
+GenericOption<double*>*   OptionDoubleParse( char* name, const mxArray* prhs[]);
+GenericOption<bool*>*     OptionLogicalParse( char* name, const mxArray* prhs[]);
+GenericOption<char*>*     OptionCharParse( char* name, const mxArray* prhs[]);
+GenericOption<Options**>* OptionStructParse( char* name, const mxArray* prhs[]);
+GenericOption<Options*>*  OptionCellParse( char* name, const mxArray* prhs[]);
 
 mxArray* mxGetAssignedField(const mxArray* pmxa_array,int number, const char* field);
@@ -63,6 +63,6 @@
 
 /*Matlab to Matrix routines: */
-Matrix* MatlabMatrixToMatrix(const mxArray* mxmatrix);
-Vector* MatlabVectorToVector(const mxArray* mxvector);
+Matrix<double>* MatlabMatrixToMatrix(const mxArray* mxmatrix);
+Vector<double>* MatlabVectorToVector(const mxArray* mxvector);
 
 /*Matlab to double* routines: */
@@ -74,6 +74,6 @@
 
 /*Matlab to SeqMat routines: */
-SeqMat* MatlabMatrixToSeqMat(const mxArray* dataref);
-SeqVec* MatlabVectorToSeqVec(const mxArray* dataref);
+SeqMat<double>* MatlabMatrixToSeqMat(const mxArray* dataref);
+SeqVec<double>* MatlabVectorToSeqVec(const mxArray* dataref);
 
 /*Matlab to Petsc routines: */
Index: /issm/trunk-jpl/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/AverageOntoPartitionx/AverageOntoPartitionx.cpp	(revision 13216)
@@ -29,7 +29,7 @@
 
 	/*output: */
-	Vector* partition_contributions=NULL;
-	Vector* partition_areas=NULL;
-	Vector* vec_average=NULL;
+	Vector<IssmDouble>* partition_contributions=NULL;
+	Vector<IssmDouble>* partition_areas=NULL;
+	Vector<IssmDouble>* vec_average=NULL;
 	double* average=NULL;
 
@@ -44,7 +44,7 @@
 
 	/*allocate: */
-	partition_contributions=new Vector(npart);
-	partition_areas=new Vector(npart);
-	vec_average=new Vector(npart);
+	partition_contributions=new Vector<IssmDouble>(npart);
+	partition_areas=new Vector<IssmDouble>(npart);
+	vec_average=new Vector<IssmDouble>(npart);
 
 	/*loop on each element, and add contribution of the element to the partition (surface weighted average): */
Index: /issm/trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.cpp	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void	ComputeBasalStressx( Vector** psigma,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
+void	ComputeBasalStressx( Vector<IssmDouble>** psigma,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
 
 	/*Intermediary*/
@@ -19,5 +19,5 @@
 
 	/*output: */
-	Vector* sigma=NULL;
+	Vector<IssmDouble>* sigma=NULL;
 
 	/*Recover numberofelements: */
@@ -25,5 +25,5 @@
 
 	/*Allocate sigma on numberofelements: */
-	sigma=new Vector(reCast<int>(numberofelements));
+	sigma=new Vector<IssmDouble>(reCast<int>(numberofelements));
 
 	/*Compute basal stress for each element: */
Index: /issm/trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ComputeBasalStressx/ComputeBasalStressx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void	ComputeBasalStressx( Vector** pp_g,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
+void	ComputeBasalStressx( Vector<IssmDouble>** pp_g,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
 
 #endif  /* _COMPUTEBASALSTRESSX_H */
Index: /issm/trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.cpp	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void	ComputeStrainRatex( Vector** peps,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
+void	ComputeStrainRatex( Vector<IssmDouble>** peps,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,Parameters* parameters){
 
 	/*Intermediary*/
@@ -19,5 +19,5 @@
 
 	/*output: */
-	Vector* eps=NULL;
+	Vector<IssmDouble>* eps=NULL;
 
 	/*Recover numberofelements: */
@@ -25,5 +25,5 @@
 
 	/*Allocate eps on numberofelements (only 1 dof): */
-	eps=new Vector(numberofelements);
+	eps=new Vector<IssmDouble>(numberofelements);
 
 	/*Compute basal stress for each element: */
Index: /issm/trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ComputeStrainRatex/ComputeStrainRatex.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void	ComputeStrainRatex(Vector** eps_g,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
+void	ComputeStrainRatex(Vector<IssmDouble>** eps_g,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
 
 #endif  /* _COMPUTESTRAINRATEX_H */
Index: /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.cpp	(revision 13216)
@@ -11,5 +11,5 @@
 #include "./ContourToMeshx.h"
 
-int ContourToMeshx( Vector** pin_nod,Vector** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue) {
+int ContourToMeshx( Vector<IssmDouble>** pin_nod,Vector<IssmDouble>** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue) {
 
 	int noerr=1;
@@ -30,9 +30,9 @@
 
 	/*output: */
-	Vector* in_nod=NULL;
-	Vector* in_elem=NULL;
+	Vector<IssmDouble>* in_nod=NULL;
+	Vector<IssmDouble>* in_elem=NULL;
 
-	in_nod=new Vector(nods);
-	in_elem=new Vector(nel);
+	in_nod=new Vector<IssmDouble>(nods);
+	in_elem=new Vector<IssmDouble>(nel);
 
 	/*initialize thread parameters: */
Index: /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshx.h	(revision 13216)
@@ -16,5 +16,5 @@
 	int nods;
 	int edgevalue;
-	Vector* in_nod;
+	Vector<IssmDouble>* in_nod;
 	double* x;
 	double* y;
@@ -24,5 +24,5 @@
 
 /* local prototypes: */
-int ContourToMeshx( Vector** pin_nods,Vector** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue);
+int ContourToMeshx( Vector<IssmDouble>** pin_nods,Vector<IssmDouble>** pin_elem, double* index, double* x, double* y,DataSet* contours,char* interptype,int nel,int nods, int edgevalue);
 
 void* ContourToMeshxt(void* vContourToMeshxThreadStruct);
Index: /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ContourToMeshx/ContourToMeshxt.cpp	(revision 13216)
@@ -33,5 +33,5 @@
 	double* x=NULL;
 	double* y=NULL;
-	Vector* in_nod=NULL;
+	Vector<IssmDouble>* in_nod=NULL;
 
 
Index: /issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.cpp	(revision 13216)
@@ -4,5 +4,5 @@
 #include "./ContourToNodesx.h"
 
-int ContourToNodesx( Vector** pflags,double* x, double* y, int nods, Contour** contours,int numcontours,int edgevalue){
+int ContourToNodesx( Vector<IssmDouble>** pflags,double* x, double* y, int nods, Contour** contours,int numcontours,int edgevalue){
 
 	int i;
@@ -17,7 +17,7 @@
 
 	/*output: */
-	Vector* flags=NULL;
+	Vector<IssmDouble>* flags=NULL;
 
-	flags=new Vector(nods);
+	flags=new Vector<IssmDouble>(nods);
 
 	/*Loop through all contours: */
@@ -39,5 +39,5 @@
 }
 
-int ContourToNodesx( Vector** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue){
+int ContourToNodesx( Vector<IssmDouble>** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue){
 
 	int i;
@@ -52,7 +52,7 @@
 
 	/*output: */
-	Vector* flags=NULL;
+	Vector<IssmDouble>* flags=NULL;
 
-	flags=new Vector(nods);
+	flags=new Vector<IssmDouble>(nods);
 
 	/*Loop through all contours: */
Index: /issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ContourToNodesx/ContourToNodesx.h	(revision 13216)
@@ -11,6 +11,6 @@
 
 /* local prototypes: */
-int ContourToNodesx( Vector** pflags,double* x, double* y, int nods, Contour** contours,int numcontours,int edgevalue);
-int ContourToNodesx( Vector** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue);
+int ContourToNodesx( Vector<IssmDouble>** pflags,double* x, double* y, int nods, Contour** contours,int numcontours,int edgevalue);
+int ContourToNodesx( Vector<IssmDouble>** pflags,double* x, double* y, int nods, DataSet* contours, int edgevalue);
 
 #endif /* _CONTOURTONODESX_H */
Index: /issm/trunk-jpl/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.cpp	(revision 13216)
@@ -9,10 +9,10 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void ControlInputGetGradientx( Vector** pgradient, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters){
+void ControlInputGetGradientx( Vector<IssmDouble>** pgradient, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters){
 
 	/*Intermediaries*/
 	int  num_controls;
 	int *control_type = NULL;
-	Vector*  gradient=NULL;
+	Vector<IssmDouble>*  gradient=NULL;
 
 	/*Retrieve some parameters*/
@@ -21,5 +21,5 @@
 
 	/*Allocate and populate gradient*/
-	gradient=new Vector(num_controls*vertices->NumberOfVertices());
+	gradient=new Vector<IssmDouble>(num_controls*vertices->NumberOfVertices());
 
 	for(int i=0;i<num_controls;i++){
Index: /issm/trunk-jpl/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ControlInputGetGradientx/ControlInputGetGradientx.h	(revision 13216)
@@ -8,5 +8,5 @@
 #include "../../Container/Container.h"
 
-void	ControlInputGetGradientx( Vector** pgradient, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
+void	ControlInputGetGradientx( Vector<IssmDouble>** pgradient, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
 
 #endif
Index: /issm/trunk-jpl/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.cpp	(revision 13216)
@@ -30,5 +30,5 @@
 
 }
-void ControlInputSetGradientx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* gradient){
+void ControlInputSetGradientx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector<IssmDouble>* gradient){
 
 	/*Serialize gradient*/
Index: /issm/trunk-jpl/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ControlInputSetGradientx/ControlInputSetGradientx.h	(revision 13216)
@@ -9,5 +9,5 @@
 
 void	ControlInputSetGradientx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,double* gradient);
-void	ControlInputSetGradientx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* gradient);
+void	ControlInputSetGradientx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector<IssmDouble>* gradient);
 
 #endif
Index: /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.cpp	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax){
+void CreateJacobianMatrixx(Matrix<IssmDouble>** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax){
 	
 	int      i,connectivity;
@@ -17,5 +17,5 @@
 	Element *element = NULL;
 	Load    *load    = NULL;
-	Matrix*  Jff     = NULL;
+	Matrix<IssmDouble>*  Jff     = NULL;
 
 	/*Checks*/
@@ -29,5 +29,5 @@
 
 	/*Initialize Jacobian Matrix*/
-	Jff=new Matrix(fsize,fsize,connectivity,numberofdofspernode);
+	Jff=new Matrix<IssmDouble>(fsize,fsize,connectivity,numberofdofspernode);
 	
 	/*Create and assemble matrix*/
Index: /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/CreateJacobianMatrixx/CreateJacobianMatrixx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void CreateJacobianMatrixx(Matrix** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax);
+void CreateJacobianMatrixx(Matrix<IssmDouble>** pJff,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,IssmDouble kmax);
 
 #endif  /* _CREATEJACOBIANMATRIXX_H */
Index: /issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.cpp	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void CreateNodalConstraintsx( Vector** pys, Nodes* nodes,int configuration_type){
+void CreateNodalConstraintsx( Vector<IssmDouble>** pys, Nodes* nodes,int configuration_type){
 
 	int i;
@@ -18,5 +18,5 @@
 
 	/*output: */
-	Vector* ys=NULL;
+	Vector<IssmDouble>* ys=NULL;
 
 	/*figure out how many dofs we have: */
@@ -24,5 +24,5 @@
 
 	/*allocate:*/
-	ys=new Vector(numberofdofs);
+	ys=new Vector<IssmDouble>(numberofdofs);
 
 	/*go through all nodes, and for the ones corresponding to this configuration_type, fill the 
Index: /issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/CreateNodalConstraintsx/CreateNodalConstraintsx.h	(revision 13216)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void CreateNodalConstraintsx( Vector** pys, Nodes* nodes,int configuration_type);
+void CreateNodalConstraintsx( Vector<IssmDouble>** pys, Nodes* nodes,int configuration_type);
 
 #endif  /* _CREATENODALCONSTRAINTSX_H */
Index: /issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/EnumToStringx/EnumToStringx.cpp	(revision 13216)
@@ -254,4 +254,5 @@
 		case VerticesEnum : return "Vertices";
 		case ResultsEnum : return "Results";
+		case AdolcParamEnum : return "AdolcParam";
 		case BoolInputEnum : return "BoolInput";
 		case BoolParamEnum : return "BoolParam";
@@ -474,4 +475,5 @@
 		case XYZPEnum : return "XYZP";
 		case OptionEnum : return "Option";
+		case GenericOptionEnum : return "GenericOption";
 		case OptionCellEnum : return "OptionCell";
 		case OptionCharEnum : return "OptionChar";
Index: /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.cpp	(revision 13216)
@@ -9,5 +9,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void	GetSolutionFromInputsx( Vector** psolution, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters){
+void	GetSolutionFromInputsx( Vector<IssmDouble>** psolution, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters){
 
 	/*intermediary: */
@@ -19,5 +19,5 @@
 
 	/*output: */
-	Vector* solution=NULL;
+	Vector<IssmDouble>* solution=NULL;
 
 	/*retrive parameters: */
@@ -29,5 +29,5 @@
 	
 	/*Initialize solution: */
-	solution=new Vector(gsize);
+	solution=new Vector<IssmDouble>(gsize);
 	
 	/*Go through elements and plug solution: */
Index: /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GetSolutionFromInputsx/GetSolutionFromInputsx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void GetSolutionFromInputsx( Vector** psolution, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
+void GetSolutionFromInputsx( Vector<IssmDouble>** psolution, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters);
 
 #endif  /* _GETSOLUTIONFROMINPUTSXX_H */
Index: /issm/trunk-jpl/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.cpp	(revision 13216)
@@ -9,9 +9,9 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void GetVectorFromControlInputsx(Vector** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,const char* data){
+void GetVectorFromControlInputsx(Vector<IssmDouble>** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,const char* data){
 
 	int  num_controls;
 	int *control_type = NULL;
-	Vector*  vector=NULL;
+	Vector<IssmDouble>*  vector=NULL;
 
 	/*Retrieve some parameters*/
@@ -20,5 +20,5 @@
 
 	/*Allocate and populate gradient*/
-	vector=new Vector(num_controls*vertices->NumberOfVertices());
+	vector=new Vector<IssmDouble>(num_controls*vertices->NumberOfVertices());
 
 	for(int i=0;i<num_controls;i++){
@@ -42,5 +42,5 @@
 	
 	/*intermediary: */
-	Vector* vec_vector=NULL;
+	Vector<IssmDouble>* vec_vector=NULL;
 
 	GetVectorFromControlInputsx( &vec_vector, elements,nodes, vertices, loads, materials, parameters,data);
Index: /issm/trunk-jpl/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GetVectorFromControlInputsx/GetVectorFromControlInputsx.h	(revision 13216)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void	GetVectorFromControlInputsx( Vector** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,const char* data="value");
+void	GetVectorFromControlInputsx( Vector<IssmDouble>** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,const char* data="value");
 void	GetVectorFromControlInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,const char* data="value");
 
Index: /issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp	(revision 13216)
@@ -9,13 +9,13 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void GetVectorFromInputsx( Vector** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){
+void GetVectorFromInputsx( Vector<IssmDouble>** pvector, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters, int name, int type){
 
 	int i;
-	Vector* vector=NULL;
+	Vector<IssmDouble>* vector=NULL;
 
 	if(type==VertexEnum){
 
 		/*Allocate vector*/
-		vector=new Vector(vertices->NumberOfVertices());
+		vector=new Vector<IssmDouble>(vertices->NumberOfVertices());
 
 		/*Look up in elements*/
@@ -47,5 +47,5 @@
 	
 	/*intermediary: */
-	Vector* vec_vector=NULL;
+	Vector<IssmDouble>* vec_vector=NULL;
 
 	GetVectorFromInputsx( &vec_vector, elements,nodes, vertices, loads, materials, parameters, name, type);
Index: /issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.h	(revision 13216)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void	GetVectorFromInputsx( Vector** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int name,int type);
+void	GetVectorFromInputsx( Vector<IssmDouble>** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int name,int type);
 void	GetVectorFromInputsx( IssmDouble** pvector, Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int name,int type);
 
Index: /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.cpp	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void Gradjx(Vector** pgradient,IssmDouble** pnorm_list, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters){
+void Gradjx(Vector<IssmDouble>** pgradient,IssmDouble** pnorm_list, Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters){
 
 	int     i,j,numberofvertices;
@@ -17,6 +17,6 @@
 	IssmDouble  *norm_list     = NULL;
 	int     *control_type  = NULL;
-	Vector  *gradient      = NULL;
-	Vector **gradient_list = NULL;
+	Vector<IssmDouble>  *gradient      = NULL;
+	Vector<IssmDouble> **gradient_list = NULL;
 	
 	/*retrieve some parameters: */
@@ -26,10 +26,10 @@
 
 	/*Allocate gradient_list */
-	gradient_list = xNew<Vector*>(num_controls);
+	gradient_list = xNew<Vector<IssmDouble>*>(num_controls);
 	norm_list = xNew<IssmDouble>(num_controls);
 	for(i=0;i<num_controls;i++){
-		gradient_list[i]=new Vector(num_controls*numberofvertices);
+		gradient_list[i]=new Vector<IssmDouble>(num_controls*numberofvertices);
 	}
-	gradient=new Vector(num_controls*numberofvertices);
+	gradient=new Vector<IssmDouble>(num_controls*numberofvertices);
 
 	/*Compute all gradient_list*/
@@ -65,5 +65,5 @@
 	}
 	if(pgradient)  *pgradient=gradient;
-	xDelete<Vector*>(gradient_list);
+	xDelete<Vector<IssmDouble>*>(gradient_list);
 	xDelete<int>(control_type);
 }
Index: /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Gradjx/Gradjx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void Gradjx(Vector** pgrad_g,IssmDouble** pgrad_norm,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters);
+void Gradjx(Vector<IssmDouble>** pgrad_g,IssmDouble** pgrad_norm,Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials,Parameters* parameters);
 
 #endif  /* _GRADJX_H */
Index: /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp	(revision 13216)
@@ -17,5 +17,5 @@
 	IssmDouble*  vertices_ungrounding             = NULL;
 	IssmDouble*  old_floatingice                  = NULL;
-	Vector*      vec_old_floatingice              = NULL;
+	Vector<IssmDouble>*      vec_old_floatingice              = NULL;
 	Element* element                          = NULL;
 	
@@ -55,13 +55,13 @@
 
 /*FUNCTION CreateNodesOnFloatingIce {{{*/
-Vector* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){ 
+Vector<IssmDouble>* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){ 
 
 	int     i,numnods;
-	Vector*   vec_nodes_on_floatingice = NULL;
+	Vector<IssmDouble>*   vec_nodes_on_floatingice = NULL;
 	Node *node                     = NULL;
 
 	/*First, initialize nodes_on_floatingice, which will track which nodes have changed status: */
 	numnods=nodes->NumberOfNodes(configuration_type);
-	vec_nodes_on_floatingice=new Vector(numnods);
+	vec_nodes_on_floatingice=new Vector<IssmDouble>(numnods);
 
 	/*Loop through nodes, and fill vec_nodes_on_floatingice: */
@@ -86,10 +86,10 @@
 	int      i,numberofvertices;
 	IssmDouble*  vertices_potentially_ungrounding      = NULL;
-	Vector*      vec_vertices_potentially_ungrounding  = NULL;
+	Vector<IssmDouble>*      vec_vertices_potentially_ungrounding  = NULL;
 	Element* element                               = NULL;
 
 	/*Initialize vector with number of vertices*/
 	numberofvertices=vertices->NumberOfVertices();
-	vec_vertices_potentially_ungrounding=new Vector(numberofvertices); //grounded vertex that could start floating
+	vec_vertices_potentially_ungrounding=new Vector<IssmDouble>(numberofvertices); //grounded vertex that could start floating
 
 	/*Fill vector vertices_potentially_floating: */
@@ -116,6 +116,6 @@
 	IssmDouble*  nodes_on_floatingice                  = NULL;
 	IssmDouble*  elements_neighboring_floatingce      = NULL;
-	Vector*      vec_elements_neighboring_floatingice = NULL;
-	Vector*      vec_nodes_on_floatingice              = NULL;
+	Vector<IssmDouble>*      vec_elements_neighboring_floatingice = NULL;
+	Vector<IssmDouble>*      vec_nodes_on_floatingice              = NULL;
 	Node*    node                                  = NULL;
 	Element* element                               = NULL;
@@ -134,5 +134,5 @@
 		
 		/*Vector of size number of elements*/
-		vec_elements_neighboring_floatingice=new Vector(elements->NumberOfElements(),true);
+		vec_elements_neighboring_floatingice=new Vector<IssmDouble>(elements->NumberOfElements(),true);
 
 		/*Figure out if any of the nodes of the element will be floating -> elements neighbouting the floating ice*/
Index: /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h	(revision 13216)
@@ -14,5 +14,5 @@
 void       GroundinglineMigrationx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters);
 
-Vector*        CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type);
+Vector<IssmDouble>*        CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type);
 IssmDouble*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters);
 IssmDouble*    PropagateFloatingiceToGroundedNeighbors(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,IssmDouble* vertices_potentially_ungrounding);
Index: /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.cpp	(revision 13216)
@@ -9,5 +9,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* solution){
+void InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector<IssmDouble>* solution){
 
 	IssmDouble* serial_solution=NULL;
Index: /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InputUpdateFromSolutionx/InputUpdateFromSolutionx.h	(revision 13216)
@@ -10,9 +10,9 @@
 
 /* local prototypes: */
-void		InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* solution);
+void		InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector<IssmDouble>* solution);
 void        InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution);
 
 //with timestep
-void		InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* solution,int timestep);
+void		InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector<IssmDouble>* solution,int timestep);
 void        InputUpdateFromSolutionx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,IssmDouble* solution, int timestep);
 
Index: /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.cpp	(revision 13216)
@@ -9,5 +9,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void InputUpdateFromVectorDakotax( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* vector, int name, int type){
+void InputUpdateFromVectorDakotax( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector<IssmDouble>* vector, int name, int type){
 
 	double* serial_vector=NULL;
Index: /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorDakotax/InputUpdateFromVectorDakotax.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void	InputUpdateFromVectorDakotax( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* vector, int name,int type);
+void	InputUpdateFromVectorDakotax( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector<IssmDouble>* vector, int name,int type);
 void	InputUpdateFromVectorDakotax( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,double* vector, int name,int type);
 void	InputUpdateFromVectorDakotax( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int* vector, int name,int type);
Index: /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.cpp	(revision 13216)
@@ -9,5 +9,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* vector, int name, int type){
+void InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector<IssmDouble>* vector, int name, int type){
 
 	IssmDouble* serial_vector=NULL;
Index: /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InputUpdateFromVectorx/InputUpdateFromVectorx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void	InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* vector, int name,int type);
+void	InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector<IssmDouble>* vector, int name,int type);
 void	InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,IssmDouble* vector, int name,int type);
 void	InputUpdateFromVectorx( Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,int* vector, int name,int type);
Index: /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.cpp	(revision 13216)
@@ -17,8 +17,8 @@
 
 /*InterpFromGridToMeshx{{{*/
-int InterpFromGridToMeshx( Vector** pdata_mesh,double* x_in, int x_rows, double* y_in, int y_rows, double* data, int M, int N, double* x_mesh, double* y_mesh, int nods,double default_value, int interpenum){
+int InterpFromGridToMeshx( Vector<IssmDouble>** pdata_mesh,double* x_in, int x_rows, double* y_in, int y_rows, double* data, int M, int N, double* x_mesh, double* y_mesh, int nods,double default_value, int interpenum){
 
 	/*output: */
-	Vector* data_mesh=NULL;
+	Vector<IssmDouble>* data_mesh=NULL;
 	
 	/*Intermediary*/
@@ -47,5 +47,5 @@
 
 	/*Allocate output vector: */
-	data_mesh=new Vector(nods);
+	data_mesh=new Vector<IssmDouble>(nods);
 
 	/*Find out what kind of coordinates (x_in,y_in) have been given is input*/
@@ -127,5 +127,5 @@
 	double *y             = gate->y;
 	int     nods          = gate->nods;
-	Vector *data_mesh     = gate->data_mesh;
+	Vector<IssmDouble>*data_mesh     = gate->data_mesh;
 	double *data          = gate->data;
 	double  default_value = gate->default_value;
Index: /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InterpFromGridToMeshx/InterpFromGridToMeshx.h	(revision 13216)
@@ -24,8 +24,8 @@
 	double* x_mesh;
 	double* y_mesh;
-	Vector*     data_mesh;
+	Vector<IssmDouble>*     data_mesh;
 } InterpFromGridToMeshxThreadStruct;
 
-int    InterpFromGridToMeshx( Vector** pdata_mesh,double* x, int x_rows, double* y, int y_rows, double* data, int M, int N, double* x_mesh, double* y_mesh, int nods, double default_value, int interpenum=BilinearInterpEnum);
+int    InterpFromGridToMeshx( Vector<IssmDouble>** pdata_mesh,double* x, int x_rows, double* y, int y_rows, double* data, int M, int N, double* x_mesh, double* y_mesh, int nods, double default_value, int interpenum=BilinearInterpEnum);
 void*  InterpFromGridToMeshxt(void* vInterpFromGridToMeshxThreadStruct);
 bool   findindices(int* pn,int* pm,double* x,int x_rows, double* y,int y_rows, double xgrid,double ygrid);
Index: /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.cpp	(revision 13216)
@@ -10,9 +10,9 @@
 #include "../modules.h"
 
-int InterpFromMesh2dx( Vector** pdata_prime,double* index_data, double* x_data, double* y_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, int nods_prime,
+int InterpFromMesh2dx( Vector<IssmDouble>** pdata_prime,double* index_data, double* x_data, double* y_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, int nods_prime,
 		double* default_values,int num_default_values,Contour** contours,int numcontours){
 	
 	/*Output*/
-	Vector* data_prime=NULL;
+	Vector<IssmDouble>* data_prime=NULL;
 
 	/*Intermediary*/
@@ -27,5 +27,5 @@
 
 	/*contours: */
-	Vector*    vec_incontour=NULL;
+	Vector<IssmDouble>*    vec_incontour=NULL;
 	double*    incontour=NULL;
 
@@ -71,5 +71,5 @@
 
 	/*Initialize output*/
-	data_prime=new Vector(nods_prime,false,SeqVecType);
+	data_prime=new Vector<IssmDouble>(nods_prime,false,SeqVecType);
 	if(num_default_values){
 		if(num_default_values==1)for (i=0;i<nods_prime;i++) data_prime->SetValue(i,default_values[0],INS_VAL);
Index: /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dx.h	(revision 13216)
@@ -23,5 +23,5 @@
 	double ymin,ymax;
 	int    nods_prime;
-	Vector*    data_prime;
+	Vector<IssmDouble>*    data_prime;
 	double* x_prime;
 	double* y_prime;
@@ -33,5 +33,5 @@
 } InterpFromMesh2dxThreadStruct;
 
-int InterpFromMesh2dx( Vector** pdata_prime,double* index_data, double* x_data, double* y_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, int nods_prime,
+int InterpFromMesh2dx( Vector<IssmDouble>** pdata_prime,double* index_data, double* x_data, double* y_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, int nods_prime,
 		double* default_values,int num_default_values,Contour** contours,int numcontours);
 
Index: /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMesh2dx/InterpFromMesh2dxt.cpp	(revision 13216)
@@ -32,5 +32,5 @@
 	double  ymax               = gate->ymax;
 	int     nods_prime         = gate->nods_prime;
-	Vector *data_prime         = gate->data_prime;
+	Vector<IssmDouble>* data_prime         = gate->data_prime;
 	double *x_prime            = gate->x_prime;
 	double *y_prime            = gate->y_prime;
Index: /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.cpp	(revision 13216)
@@ -7,8 +7,8 @@
 #include "../../include/include.h"
 
-int InterpFromMeshToMesh3dx( Vector** pdata_prime,double* index_data, double* x_data, double* y_data, double* z_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, double* z_prime, int nods_prime,double default_value) {
+int InterpFromMeshToMesh3dx( Vector<IssmDouble>** pdata_prime,double* index_data, double* x_data, double* y_data, double* z_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, double* z_prime, int nods_prime,double default_value) {
 
 	/*Output*/
-	Vector* data_prime=NULL;
+	Vector<IssmDouble>* data_prime=NULL;
 
 	/*Intermediary*/
@@ -54,5 +54,5 @@
 
 	/*Initialize output*/
-	data_prime=new Vector(nods_prime);
+	data_prime=new Vector<IssmDouble>(nods_prime);
 	for (i=0;i<nods_prime;i++) data_prime->SetValue(i,default_value,INS_VAL);
 
Index: /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/InterpFromMeshToMesh3dx/InterpFromMeshToMesh3dx.h	(revision 13216)
@@ -9,5 +9,5 @@
 #include "../../classes/objects/objects.h"
 
-int InterpFromMeshToMesh3dx( Vector** pdata_prime,double* index_data, double* x_data, double* y_data, double* z_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, double* z_prime, int nods_prime,double default_value);
+int InterpFromMeshToMesh3dx( Vector<IssmDouble>** pdata_prime,double* index_data, double* x_data, double* y_data, double* z_data, int nods_data,int nels_data, double* data, int data_length, double* x_prime, double* y_prime, double* z_prime, int nods_prime,double default_value);
 
 #endif /* _INTERPFROMMESHTOMESH3DX_H */
Index: /issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Krigingx/Krigingx.cpp	(revision 13216)
@@ -48,5 +48,5 @@
 
 	/*Get output*/
-	options->Get(&output,"output","prediction");
+	options->Get(&output,"output",(char*)"prediction");
 
 	if(strcmp(output,"quadtree")==0){
Index: /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Krigingx/pKrigingx.cpp	(revision 13216)
@@ -41,5 +41,5 @@
 
 	/*Get output*/
-	options->Get(&output,"output","prediction");
+	options->Get(&output,"output",(char*)"prediction");
 
 	if(strcmp(output,"quadtree")==0){
Index: /issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.cpp	(revision 13216)
@@ -7,8 +7,8 @@
 #include "./Mergesolutionfromftogx.h"
 
-void	Mergesolutionfromftogx( Vector** pug, Vector* uf, Vector* ys, Nodes* nodes, Parameters* parameters, bool flag_ys0){
+void	Mergesolutionfromftogx( Vector<IssmDouble>** pug, Vector<IssmDouble>* uf, Vector<IssmDouble>* ys, Nodes* nodes, Parameters* parameters, bool flag_ys0){
 
 	/*output: */
-	Vector* ug=NULL;
+	Vector<IssmDouble>* ug=NULL;
 
 	/*intermediary: */
@@ -34,5 +34,5 @@
 
 	/*initialize ug: */
-	ug=new Vector(gsize);
+	ug=new Vector<IssmDouble>(gsize);
 
 	/*Merge f set back into g set: */
Index: /issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Mergesolutionfromftogx/Mergesolutionfromftogx.h	(revision 13216)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void	Mergesolutionfromftogx( Vector** pug, Vector* uf, Vector* ys, Nodes* nodes, Parameters* parameters, bool flag_ys0=false);
+void	Mergesolutionfromftogx( Vector<IssmDouble>** pug, Vector<IssmDouble>* uf, Vector<IssmDouble>* ys, Nodes* nodes, Parameters* parameters, bool flag_ys0=false);
 
 #endif  /* _MERGESOLUTIONFROMFTOGX_H */
Index: /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/ModelProcessorx/ModelProcessorx.h	(revision 13216)
@@ -11,4 +11,6 @@
 class IoModel;
 class Parameters;
+class DofIndexing;
+
 #include "../../io/io.h"
 
Index: /issm/trunk-jpl/src/c/modules/Orthx/Orthx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Orthx/Orthx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Orthx/Orthx.cpp	(revision 13216)
@@ -5,8 +5,8 @@
 #include "./Orthx.h"
 
-void	Orthx( Vector** pnewgradj, Vector* gradj, Vector* oldgradj){
+void	Orthx( Vector<IssmDouble>** pnewgradj, Vector<IssmDouble>* gradj, Vector<IssmDouble>* oldgradj){
 	
 	/*output: */
-	Vector* newgradj=NULL;
+	Vector<IssmDouble>* newgradj=NULL;
 
 	/*intermediary:*/
Index: /issm/trunk-jpl/src/c/modules/Orthx/Orthx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Orthx/Orthx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Orthx/Orthx.h	(revision 13216)
@@ -11,5 +11,5 @@
 
 /* local prototypes: */
-void	Orthx( Vector** pnewgradj, Vector* gradj, Vector* oldgradj);
+void	Orthx( Vector<IssmDouble>** pnewgradj, Vector<IssmDouble>* gradj, Vector<IssmDouble>* oldgradj);
 
 #endif  /* _ORTHX_H */
Index: /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.cpp	(revision 13216)
@@ -4,9 +4,9 @@
 #include "./PointCloudFindNeighborsx.h"
 
-int PointCloudFindNeighborsx( Vector** pflags,double* x, double* y, int nods, double mindistance,double multithread){
+int PointCloudFindNeighborsx( Vector<IssmDouble>** pflags,double* x, double* y, int nods, double mindistance,double multithread){
 
 	/*output: */
-	Vector* flags=NULL;
-	flags=new Vector(nods);
+	Vector<IssmDouble>* flags=NULL;
+	flags=new Vector<IssmDouble>(nods);
 
 	/*threading: */
Index: /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsx.h	(revision 13216)
@@ -11,5 +11,5 @@
 
 /* local prototypes: */
-int PointCloudFindNeighborsx( Vector** pflags,double* x, double* y, int nods, double mindistance,double multithread);
+int PointCloudFindNeighborsx( Vector<IssmDouble>** pflags,double* x, double* y, int nods, double mindistance,double multithread);
 
 /*threading: */
@@ -20,5 +20,5 @@
 	int nods;
 	double mindistance;
-	Vector* flags;
+	Vector<IssmDouble>* flags;
 
 
Index: /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/PointCloudFindNeighborsx/PointCloudFindNeighborsxt.cpp	(revision 13216)
@@ -17,5 +17,5 @@
 	int     nods;
 	double  mindistance;
-	Vector*     flags;
+	Vector<IssmDouble>*     flags;
 
 	/*recover handle and gate: */
Index: /issm/trunk-jpl/src/c/modules/Reduceloadx/Reduceloadx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reduceloadx/Reduceloadx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Reduceloadx/Reduceloadx.cpp	(revision 13216)
@@ -12,9 +12,9 @@
 #include "../../io/io.h"
 
-void	Reduceloadx( Vector* pf, Matrix* Kfs, Vector* y_s,bool flag_ys0){
+void	Reduceloadx( Vector<IssmDouble>* pf, Matrix<IssmDouble>* Kfs, Vector<IssmDouble>* y_s,bool flag_ys0){
 
 	/*intermediary*/
-	Vector*     y_s0   = NULL;
-	Vector*     Kfsy_s = NULL;
+	Vector<IssmDouble>*     y_s0   = NULL;
+	Vector<IssmDouble>*     Kfsy_s = NULL;
 	int         Kfsm,Kfsn;
 	int         global_m,global_n;
@@ -32,5 +32,5 @@
 		/*pf = pf - Kfs * y_s;*/
 		Kfs->GetLocalSize(&Kfsm,&Kfsn);
-		Kfsy_s=new Vector(Kfsm,fromlocalsize);
+		Kfsy_s=new Vector<IssmDouble>(Kfsm,fromlocalsize);
 		if (flag_ys0){
 
Index: /issm/trunk-jpl/src/c/modules/Reduceloadx/Reduceloadx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reduceloadx/Reduceloadx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Reduceloadx/Reduceloadx.h	(revision 13216)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void	Reduceloadx( Vector* pf, Matrix* Kfs, Vector* ys,bool flag_ys0=false);
+void	Reduceloadx( Vector<IssmDouble>* pf, Matrix<IssmDouble>* Kfs, Vector<IssmDouble>* ys,bool flag_ys0=false);
 
 #endif  /* _REDUCELOADX_H */
Index: /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.cpp	(revision 13216)
@@ -6,8 +6,8 @@
 #include "./Reducevectorgtofx.h"
  
-void Reducevectorgtofx(Vector** puf, Vector* ug, Nodes* nodes,Parameters* parameters){
+void Reducevectorgtofx(Vector<IssmDouble>** puf, Vector<IssmDouble>* ug, Nodes* nodes,Parameters* parameters){
 
 	/*output: */
-	Vector* uf=NULL;
+	Vector<IssmDouble>* uf=NULL;
 
 	/*variables: */
@@ -26,5 +26,5 @@
 	else{
 		/*allocate: */
-		uf=new Vector(fsize);
+		uf=new Vector<IssmDouble>(fsize);
 
 		if(nodes->NumberOfNodes(configuration_type)){ 
Index: /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Reducevectorgtofx/Reducevectorgtofx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void Reducevectorgtofx(Vector** puf, Vector* ug, Nodes* nodes,Parameters* parameters);
+void Reducevectorgtofx(Vector<IssmDouble>** puf, Vector<IssmDouble>* ug, Nodes* nodes,Parameters* parameters);
 
 #endif  /* _REDUCEVECTORGTOFX_H */
Index: /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.cpp	(revision 13216)
@@ -6,8 +6,8 @@
 #include "./Reducevectorgtosx.h"
 
-void Reducevectorgtosx(Vector** pys, Vector* yg, Nodes* nodes,Parameters* parameters){
+void Reducevectorgtosx(Vector<IssmDouble>** pys, Vector<IssmDouble>* yg, Nodes* nodes,Parameters* parameters){
 
 	/*output: */
-	Vector* ys=NULL;
+	Vector<IssmDouble>* ys=NULL;
 
 	/*variables: */
@@ -26,5 +26,5 @@
 	else{
 		/*allocate: */
-		ys=new Vector(ssize);
+		ys=new Vector<IssmDouble>(ssize);
 
 		if(nodes->NumberOfNodes(configuration_type)){ 
Index: /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Reducevectorgtosx/Reducevectorgtosx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void Reducevectorgtosx(Vector** pys, Vector* yg, Nodes* nodes,Parameters* parameters);
+void Reducevectorgtosx(Vector<IssmDouble>** pys, Vector<IssmDouble>* yg, Nodes* nodes,Parameters* parameters);
 
 #endif  /* _REDUCEVECTORGTOSX_H */
Index: /issm/trunk-jpl/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.cpp	(revision 13216)
@@ -28,5 +28,5 @@
 }
 
-void SetControlInputsFromVectorx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector* vector){
+void SetControlInputsFromVectorx(Elements* elements,Nodes* nodes, Vertices* vertices, Loads* loads, Materials* materials, Parameters* parameters,Vector<IssmDouble>* vector){
 	
 	IssmDouble* serial_vector=NULL;
Index: /issm/trunk-jpl/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/SetControlInputsFromVectorx/SetControlInputsFromVectorx.h	(revision 13216)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void SetControlInputsFromVectorx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector* vector);
+void SetControlInputsFromVectorx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,Vector<IssmDouble>* vector);
 void SetControlInputsFromVectorx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads, Materials* materials,  Parameters* parameters,IssmDouble* vector);
 
Index: /issm/trunk-jpl/src/c/modules/Solverx/Solverx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Solverx/Solverx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Solverx/Solverx.cpp	(revision 13216)
@@ -14,5 +14,5 @@
 #endif
 
-void	Solverx(Vector** puf, Matrix* Kff, Vector* pf, Vector* uf0,Vector* df, Parameters* parameters){
+void	Solverx(Vector<IssmDouble>** puf, Matrix<IssmDouble>* Kff, Vector<IssmDouble>* pf, Vector<IssmDouble>* uf0,Vector<IssmDouble>* df, Parameters* parameters){
 
 	/*Intermediary: */
@@ -20,5 +20,5 @@
 
 	/*output: */
-	Vector *uf=NULL;
+	Vector<IssmDouble> *uf=NULL;
 
 	/*In debugging mode, check that stiffness matrix and load vectors are not NULL (they can be empty)*/
@@ -27,5 +27,5 @@
 
 	/*Initialize vector: */
-	uf=new Vector();
+	uf=new Vector<IssmDouble>();
 
 	/*According to matrix type, use specific solvers: */
Index: /issm/trunk-jpl/src/c/modules/Solverx/Solverx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/Solverx/Solverx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Solverx/Solverx.h	(revision 13216)
@@ -15,5 +15,5 @@
 
 /* local prototypes: */
-void	Solverx(Vector** puf, Matrix* Kff, Vector* pf, Vector* uf0,Vector* df, Parameters* parameters);
+void	Solverx(Vector<IssmDouble>** puf, Matrix<IssmDouble>* Kff, Vector<IssmDouble>* pf, Vector<IssmDouble>* uf0,Vector<IssmDouble>* df, Parameters* parameters);
 
 #ifdef _HAVE_PETSC_
@@ -23,5 +23,5 @@
 #endif
 
-void SolverxSeq(SeqVec** puf,SeqMat* Kff, SeqVec* pf,Parameters* parameters);
+void SolverxSeq(SeqVec<IssmDouble>** puf,SeqMat<IssmDouble>* Kff, SeqVec<IssmDouble>* pf,Parameters* parameters);
 void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n);
 
Index: /issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/Solverx/SolverxSeq.cpp	(revision 13216)
@@ -23,10 +23,10 @@
 #endif
 
-void SolverxSeq(SeqVec** puf,SeqMat* Kff, SeqVec* pf, Parameters* parameters){/*{{{*/
+void SolverxSeq(SeqVec<IssmDouble>** puf,SeqMat<IssmDouble>* Kff, SeqVec<IssmDouble>* pf, Parameters* parameters){/*{{{*/
 
 	#ifdef _HAVE_GSL_
 	/*Intermediary: */
 	int M,N,N2,s;
-	SeqVec *uf = NULL;
+	SeqVec<IssmDouble> *uf = NULL;
 
 	Kff->GetSize(&M,&N);
@@ -41,5 +41,5 @@
 	SolverxSeq(x,Kff->matrix,pf->vector,N);
 #endif
-	uf=new SeqVec(x,N);	
+	uf=new SeqVec<IssmDouble>(x,N);
 	xDelete(x);
 
Index: /issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/StringToEnumx/StringToEnumx.cpp	(revision 13216)
@@ -258,11 +258,12 @@
 	      else if (strcmp(name,"Vertices")==0) return VerticesEnum;
 	      else if (strcmp(name,"Results")==0) return ResultsEnum;
+	      else if (strcmp(name,"AdolcParam")==0) return AdolcParamEnum;
 	      else if (strcmp(name,"BoolInput")==0) return BoolInputEnum;
 	      else if (strcmp(name,"BoolParam")==0) return BoolParamEnum;
-	      else if (strcmp(name,"Contour")==0) return ContourEnum;
          else stage=3;
    }
    if(stage==3){
-	      if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
+	      if (strcmp(name,"Contour")==0) return ContourEnum;
+	      else if (strcmp(name,"ControlInput")==0) return ControlInputEnum;
 	      else if (strcmp(name,"DatasetInput")==0) return DatasetInputEnum;
 	      else if (strcmp(name,"DofIndexing")==0) return DofIndexingEnum;
@@ -383,9 +384,9 @@
 	      else if (strcmp(name,"VzMesh")==0) return VzMeshEnum;
 	      else if (strcmp(name,"Enthalpy")==0) return EnthalpyEnum;
-	      else if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
          else stage=4;
    }
    if(stage==4){
-	      if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
+	      if (strcmp(name,"EnthalpyPicard")==0) return EnthalpyPicardEnum;
+	      else if (strcmp(name,"ThicknessAbsGradient")==0) return ThicknessAbsGradientEnum;
 	      else if (strcmp(name,"ThicknessAlongGradient")==0) return ThicknessAlongGradientEnum;
 	      else if (strcmp(name,"ThicknessAcrossGradient")==0) return ThicknessAcrossGradientEnum;
@@ -484,4 +485,5 @@
 	      else if (strcmp(name,"XYZP")==0) return XYZPEnum;
 	      else if (strcmp(name,"Option")==0) return OptionEnum;
+	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
 	      else if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
 	      else if (strcmp(name,"OptionChar")==0) return OptionCharEnum;
Index: /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.cpp	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){
+void SystemMatricesx(Matrix<IssmDouble>** pKff, Matrix<IssmDouble>** pKfs, Vector<IssmDouble>** ppf, Vector<IssmDouble>** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,bool kflag,bool pflag,bool penalty_kflag,bool penalty_pflag){
 	
 	/*intermediary: */
@@ -21,8 +21,8 @@
 	
 	/*output: */
-	Matrix*    Kff  = NULL;
-	Matrix*    Kfs  = NULL;
-	Vector*    pf   = NULL;
-	Vector*    df=NULL;
+	Matrix<IssmDouble>*    Kff  = NULL;
+	Matrix<IssmDouble>*    Kfs  = NULL;
+	Vector<IssmDouble>*    pf   = NULL;
+	Vector<IssmDouble>*    df=NULL;
 	IssmDouble kmax = 0;
 
@@ -49,7 +49,7 @@
 	if(kflag){
 
-		Kff=new Matrix(fsize,fsize,connectivity,numberofdofspernode);
-		Kfs=new Matrix(fsize,ssize,connectivity,numberofdofspernode);
-		df=new Vector(fsize);
+		Kff=new Matrix<IssmDouble>(fsize,fsize,connectivity,numberofdofspernode);
+		Kfs=new Matrix<IssmDouble>(fsize,ssize,connectivity,numberofdofspernode);
+		df=new Vector<IssmDouble>(fsize);
 
 		/*Fill stiffness matrix from elements: */
@@ -73,5 +73,5 @@
 	if(pflag){
 
-		pf=new Vector(fsize);
+		pf=new Vector<IssmDouble>(fsize);
 
 		/*Fill right hand side vector, from elements: */
Index: /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/SystemMatricesx/SystemMatricesx.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void SystemMatricesx(Matrix** pKff, Matrix** pKfs, Vector** ppf, Vector** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,
+void SystemMatricesx(Matrix<IssmDouble>** pKff, Matrix<IssmDouble>** pKfs, Vector<IssmDouble>** ppf, Vector<IssmDouble>** pdf, IssmDouble* pkmax,Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters,
 			bool kflag=true,bool pflag=true,bool penalty_kflag=true,bool penalty_pflag=true);
 
Index: /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.cpp	(revision 13216)
@@ -20,5 +20,5 @@
 /*}}}*/
 
-void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area){
+void TriMeshx(Matrix<IssmDouble>** pindex,Vector<IssmDouble>** px,Vector<IssmDouble>** py,Matrix<IssmDouble>** psegments,Vector<IssmDouble>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area){
 
 	/*indexing: */
@@ -27,9 +27,9 @@
 	/*output: */
 	double* index=NULL;
-	Matrix* index_matrix=NULL;
+	Matrix<IssmDouble>* index_matrix=NULL;
 	double* x=NULL;
 	double* y=NULL;
 	double* segments=NULL;
-	Matrix* segments_matrix=NULL;
+	Matrix<IssmDouble>* segments_matrix=NULL;
 	double* segmentmarkerlist=NULL;
 
@@ -192,12 +192,12 @@
 
 	/*Output : */
-	index_matrix=new Matrix(index,out.numberoftriangles,3,1,SeqMatType);
+	index_matrix=new Matrix<IssmDouble>(index,out.numberoftriangles,3,1,SeqMatType);
 	*pindex=index_matrix;
 	
-	segments_matrix=new Matrix(segments,out.numberofsegments,3,1,SeqMatType);
+	segments_matrix=new Matrix<IssmDouble>(segments,out.numberofsegments,3,1,SeqMatType);
 	*psegments=segments_matrix;
 
-	*px=new Vector(x,out.numberofpoints,SeqMatType);
-	*py=new Vector(y,out.numberofpoints,SeqMatType);
-	*psegmentmarkerlist=new Vector(segmentmarkerlist,out.numberofsegments,SeqMatType);
+	*px=new Vector<IssmDouble>(x,out.numberofpoints,SeqMatType);
+	*py=new Vector<IssmDouble>(y,out.numberofpoints,SeqMatType);
+	*psegmentmarkerlist=new Vector<IssmDouble>(segmentmarkerlist,out.numberofsegments,SeqMatType);
 }
Index: /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/TriMeshx/TriMeshx.h	(revision 13216)
@@ -11,5 +11,5 @@
 
 /* local prototypes: */
-void TriMeshx(Matrix** pindex,Vector** px,Vector** py,Matrix** psegments,Vector** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area);
+void TriMeshx(Matrix<IssmDouble>** pindex,Vector<IssmDouble>** px,Vector<IssmDouble>** py,Matrix<IssmDouble>** psegments,Vector<IssmDouble>** psegmentmarkerlist,DataSet* domain,DataSet* rifts,double area);
 
 #endif  /* _TRIMESHX_H */
Index: /issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.cpp	(revision 13216)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vector* yg){
+void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vector<IssmDouble>* yg){
 	
 	int configuration_type;
Index: /issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/UpdateDynamicConstraintsx/UpdateDynamicConstraintsx.h	(revision 13216)
@@ -9,5 +9,5 @@
 #include "../../classes/objects/objects.h"
 
-void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vector* yg);
+void UpdateDynamicConstraintsx(Constraints* constraints,Nodes* nodes,Parameters* parameters,Vector<IssmDouble>* yg);
 
 #endif  /* _UPDATESPCSX_H */
Index: /issm/trunk-jpl/src/c/modules/UpdateVertexPositionsx/UpdateVertexPositionsx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/UpdateVertexPositionsx/UpdateVertexPositionsx.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/UpdateVertexPositionsx/UpdateVertexPositionsx.cpp	(revision 13216)
@@ -13,5 +13,5 @@
 
 	int     i;
-	Vector*     vz        = NULL;
+	Vector<IssmDouble>*     vz        = NULL;
 	Vertex *vertex    = NULL;
 	IssmDouble *thickness = NULL;
@@ -23,5 +23,5 @@
 
 	/*Allocate vector*/
-	vz=new Vector(vertices->NumberOfVertices());
+	vz=new Vector<IssmDouble>(vertices->NumberOfVertices());
 
 	/*Update verices new geometry: */
Index: /issm/trunk-jpl/src/c/modules/VecMergex/VecMergex.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/VecMergex/VecMergex.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/VecMergex/VecMergex.cpp	(revision 13216)
@@ -9,6 +9,5 @@
 #include "../../toolkits/toolkits.h"
 #include "../../EnumDefinitions/EnumDefinitions.h"
-
-void VecMergex(Vector* ug, Vector* uf, Nodes* nodes, Parameters* parameters, int SetEnum){
+void VecMergex(Vector<IssmDouble>* ug, Vector<IssmDouble>* uf, Nodes* nodes, Parameters* parameters, int SetEnum){
 
 	/*variables: */
Index: /issm/trunk-jpl/src/c/modules/VecMergex/VecMergex.h
===================================================================
--- /issm/trunk-jpl/src/c/modules/VecMergex/VecMergex.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/modules/VecMergex/VecMergex.h	(revision 13216)
@@ -10,5 +10,5 @@
 
 /* local prototypes: */
-void VecMergex(Vector* ug, Vector* uf, Nodes* nodes, Parameters* parameters, int SetEnum);
+void VecMergex(Vector<IssmDouble>* ug, Vector<IssmDouble>* uf, Nodes* nodes, Parameters* parameters, int SetEnum);
 
 #endif  /* _VECMERGEX_H */
Index: /issm/trunk-jpl/src/c/shared/Alloc/alloc.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Alloc/alloc.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/shared/Alloc/alloc.cpp	(revision 13216)
@@ -62,5 +62,5 @@
 }
 
-void xdelete(Matrix** pv){
+void xdelete(Matrix<IssmDouble>** pv){
 	
 	if (pv && *pv){
@@ -73,5 +73,5 @@
 }
 
-void xdelete(Vector** pv){
+void xdelete(Vector<IssmDouble>** pv){
 
 	if (pv && *pv){
Index: /issm/trunk-jpl/src/c/shared/Alloc/alloc.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Alloc/alloc.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/shared/Alloc/alloc.h	(revision 13216)
@@ -5,12 +5,17 @@
 #ifndef _ALLOC_H_
 #define _ALLOC_H_
-class Matrix;
-class Vector;
+
+#include "../../include/include.h"
+
+template <class doubletype> class Matrix;
+template <class doubletype> class Vector;
 void* xmalloc(int size);
 void* xcalloc(int n,int size);
 void  xfree(void** pvptr);
 void* xrealloc ( void* pv, int size);
-void xdelete(Matrix** pvptr);
-void xdelete(Vector** pvptr);
+void xdelete(Matrix<IssmDouble>** pvptr);
+void xdelete(Vector<IssmDouble>** pvptr);
+
+#include "./xNewDelete.h"
 
 #endif
Index: /issm/trunk-jpl/src/c/shared/Exp/IsInPoly.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Exp/IsInPoly.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/shared/Exp/IsInPoly.cpp	(revision 13216)
@@ -15,5 +15,5 @@
 
 /*IsInPoly {{{*/
-int IsInPoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){
+int IsInPoly(Vector<IssmDouble>* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){
 
 	int i;
@@ -56,5 +56,5 @@
 }/*}}}*/
 /*IsOutsidePoly {{{*/
-int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){
+int IsOutsidePoly(Vector<IssmDouble>* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue){
 
 	int i,j;
Index: /issm/trunk-jpl/src/c/shared/Exp/exp.h
===================================================================
--- /issm/trunk-jpl/src/c/shared/Exp/exp.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/shared/Exp/exp.h	(revision 13216)
@@ -10,6 +10,6 @@
 #include "../../toolkits/toolkits.h"
 
-int IsInPoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue);
-int IsOutsidePoly(Vector* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue);
+int IsInPoly(Vector<IssmDouble>* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue);
+int IsOutsidePoly(Vector<IssmDouble>* in,double* xc,double* yc,int numvertices,double* x,double* y,int i0,int i1, int edgevalue);
 int IsInPolySerial(double* in,double* xc,double* yc,int numvertices,double* x,double* y,int nods, int edgevalue);
 int DomainOutlineWrite(int nprof,int* profnvertices,double** pprofx,double** pprofy,bool* closed,char* domainname);
Index: /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp
===================================================================
--- /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/shared/Numerics/GaussPoints.cpp	(revision 13216)
@@ -4,5 +4,4 @@
 #include "./GaussPoints.h"
 #include "../Alloc/alloc.h"
-#include "../../io/io.h"
 #include "../Exceptions/exceptions.h"
 #include <math.h>
Index: /issm/trunk-jpl/src/c/solutions/ResetBoundaryConditions.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solutions/ResetBoundaryConditions.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solutions/ResetBoundaryConditions.cpp	(revision 13216)
@@ -11,5 +11,5 @@
 	
 	/*variables: */
-	Vector*    yg    = NULL;
+	Vector<IssmDouble>*    yg    = NULL;
 	Nodes *nodes = NULL;
 	int    i;
Index: /issm/trunk-jpl/src/c/solutions/convergence.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solutions/convergence.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solutions/convergence.cpp	(revision 13216)
@@ -8,5 +8,5 @@
 #include "../EnumDefinitions/EnumDefinitions.h"
 
-void convergence(bool* pconverged, Matrix* Kff,Vector* pf,Vector* uf,Vector* old_uf,Parameters* parameters){
+void convergence(bool* pconverged, Matrix<IssmDouble>* Kff,Vector<IssmDouble>* pf,Vector<IssmDouble>* uf,Vector<IssmDouble>* old_uf,Parameters* parameters){
 
 	/*output*/
@@ -14,9 +14,9 @@
 
 	/*intermediary*/
-	Vector* KU=NULL;
-	Vector* KUF=NULL;
-	Vector* KUold=NULL;
-	Vector* KUoldF=NULL;
-	Vector* duf=NULL;
+	Vector<IssmDouble>* KU=NULL;
+	Vector<IssmDouble>* KUF=NULL;
+	Vector<IssmDouble>* KUold=NULL;
+	Vector<IssmDouble>* KUoldF=NULL;
+	Vector<IssmDouble>* duf=NULL;
 	IssmDouble ndu,nduinf,nu;
 	IssmDouble nKUF;
Index: /issm/trunk-jpl/src/c/solutions/gradient_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solutions/gradient_core.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solutions/gradient_core.cpp	(revision 13216)
@@ -18,7 +18,7 @@
 	IssmDouble  norm_inf;
 	IssmDouble *norm_list    = NULL;
-	Vector*     new_gradient = NULL;
-	Vector*     gradient     = NULL;
-	Vector*     old_gradient = NULL;
+	Vector<IssmDouble>*     new_gradient = NULL;
+	Vector<IssmDouble>*     gradient     = NULL;
+	Vector<IssmDouble>*     old_gradient = NULL;
 
 	/*Compute gradient*/
Index: /issm/trunk-jpl/src/c/solutions/solutions.h
===================================================================
--- /issm/trunk-jpl/src/c/solutions/solutions.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/solutions/solutions.h	(revision 13216)
@@ -33,5 +33,5 @@
 
 //convergence:
-void convergence(bool* pconverged, Matrix* K_ff,Vector* p_f,Vector* u_f,Vector* u_f_old,Parameters* parameters);
+void convergence(bool* pconverged, Matrix<IssmDouble>* K_ff,Vector<IssmDouble>* p_f,Vector<IssmDouble>* u_f,Vector<IssmDouble>* u_f_old,Parameters* parameters);
 bool controlconvergence(IssmDouble J,IssmDouble tol_cm);
 bool steadystateconvergence(FemModel* femmodel);
Index: /issm/trunk-jpl/src/c/solvers/solver_adjoint_linear.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solvers/solver_adjoint_linear.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solvers/solver_adjoint_linear.cpp	(revision 13216)
@@ -13,11 +13,11 @@
 
 	/*intermediary: */
-	Matrix*  Kff = NULL;
-	Matrix*  Kfs = NULL;
-	Vector*  ug  = NULL;
-	Vector*  uf  = NULL;
-	Vector*  pf  = NULL;
-	Vector*  df  = NULL;
-	Vector*  ys  = NULL;
+	Matrix<IssmDouble>*  Kff = NULL;
+	Matrix<IssmDouble>*  Kfs = NULL;
+	Vector<IssmDouble>*  ug  = NULL;
+	Vector<IssmDouble>*  uf  = NULL;
+	Vector<IssmDouble>*  pf  = NULL;
+	Vector<IssmDouble>*  df  = NULL;
+	Vector<IssmDouble>*  ys  = NULL;
 	int  configuration_type;
 
Index: /issm/trunk-jpl/src/c/solvers/solver_linear.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solvers/solver_linear.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solvers/solver_linear.cpp	(revision 13216)
@@ -11,11 +11,11 @@
 
 	/*intermediary: */
-	Matrix*  Kff = NULL;
-	Matrix*  Kfs = NULL;
-	Vector*  ug  = NULL;
-	Vector*  uf  = NULL;
-	Vector*  pf  = NULL;
-	Vector*  df  = NULL;
-	Vector*  ys  = NULL;
+	Matrix<IssmDouble>*  Kff = NULL;
+	Matrix<IssmDouble>*  Kfs = NULL;
+	Vector<IssmDouble>*  ug  = NULL;
+	Vector<IssmDouble>*  uf  = NULL;
+	Vector<IssmDouble>*  pf  = NULL;
+	Vector<IssmDouble>*  df  = NULL;
+	Vector<IssmDouble>*  ys  = NULL;
 	int  configuration_type;
 
Index: /issm/trunk-jpl/src/c/solvers/solver_newton.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solvers/solver_newton.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solvers/solver_newton.cpp	(revision 13216)
@@ -18,16 +18,16 @@
 	int    count;
 	IssmDouble kmax;
-	Matrix* Kff = NULL;
-	Matrix* Kfs    = NULL;
-	Matrix* Jff = NULL;
-	Vector* ug  = NULL;
-	Vector* old_ug = NULL;
-	Vector* uf  = NULL;
-	Vector* old_uf = NULL;
-	Vector* duf = NULL;
-	Vector* pf  = NULL;
-	Vector* pJf    = NULL;
-	Vector* df  = NULL;
-	Vector* ys  = NULL;
+	Matrix<IssmDouble>* Kff = NULL;
+	Matrix<IssmDouble>* Kfs    = NULL;
+	Matrix<IssmDouble>* Jff = NULL;
+	Vector<IssmDouble>* ug  = NULL;
+	Vector<IssmDouble>* old_ug = NULL;
+	Vector<IssmDouble>* uf  = NULL;
+	Vector<IssmDouble>* old_uf = NULL;
+	Vector<IssmDouble>* duf = NULL;
+	Vector<IssmDouble>* pf  = NULL;
+	Vector<IssmDouble>* pJf    = NULL;
+	Vector<IssmDouble>* df  = NULL;
+	Vector<IssmDouble>* ys  = NULL;
 
 	/*parameters:*/
Index: /issm/trunk-jpl/src/c/solvers/solver_nonlinear.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solvers/solver_nonlinear.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solvers/solver_nonlinear.cpp	(revision 13216)
@@ -14,13 +14,13 @@
 
 	/*intermediary: */
-	Matrix* Kff = NULL;
-	Matrix* Kfs = NULL;
-	Vector* ug  = NULL;
-	Vector* old_ug = NULL;
-	Vector* uf  = NULL;
-	Vector* old_uf = NULL;
-	Vector* pf  = NULL;
-	Vector* df  = NULL;
-	Vector* ys  = NULL;
+	Matrix<IssmDouble>* Kff = NULL;
+	Matrix<IssmDouble>* Kfs = NULL;
+	Vector<IssmDouble>* ug  = NULL;
+	Vector<IssmDouble>* old_ug = NULL;
+	Vector<IssmDouble>* uf  = NULL;
+	Vector<IssmDouble>* old_uf = NULL;
+	Vector<IssmDouble>* pf  = NULL;
+	Vector<IssmDouble>* df  = NULL;
+	Vector<IssmDouble>* ys  = NULL;
 	
 	Loads* loads=NULL;
Index: /issm/trunk-jpl/src/c/solvers/solver_stokescoupling_nonlinear.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solvers/solver_stokescoupling_nonlinear.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solvers/solver_stokescoupling_nonlinear.cpp	(revision 13216)
@@ -14,18 +14,18 @@
 
 	/*intermediary: */
-	Matrix*  Kff_horiz = NULL;
-	Matrix* Kfs_horiz   = NULL;
-	Vector*  ug_horiz  = NULL;
-	Vector*  uf_horiz  = NULL;
-	Vector*  old_uf_horiz = NULL;
-	Vector*  pf_horiz  = NULL;
-	Vector*  df_horiz  = NULL;
-	Matrix*  Kff_vert  = NULL;
-	Matrix*  Kfs_vert  = NULL;
-	Vector*  ug_vert   = NULL;
-	Vector*  uf_vert   = NULL;
-	Vector*  pf_vert   = NULL;
-	Vector*  df_vert   = NULL;
-	Vector*  ys   = NULL;
+	Matrix<IssmDouble>*  Kff_horiz = NULL;
+	Matrix<IssmDouble>* Kfs_horiz   = NULL;
+	Vector<IssmDouble>*  ug_horiz  = NULL;
+	Vector<IssmDouble>*  uf_horiz  = NULL;
+	Vector<IssmDouble>*  old_uf_horiz = NULL;
+	Vector<IssmDouble>*  pf_horiz  = NULL;
+	Vector<IssmDouble>*  df_horiz  = NULL;
+	Matrix<IssmDouble>*  Kff_vert  = NULL;
+	Matrix<IssmDouble>*  Kfs_vert  = NULL;
+	Vector<IssmDouble>*  ug_vert   = NULL;
+	Vector<IssmDouble>*  uf_vert   = NULL;
+	Vector<IssmDouble>*  pf_vert   = NULL;
+	Vector<IssmDouble>*  df_vert   = NULL;
+	Vector<IssmDouble>*  ys   = NULL;
 	bool converged;
 	int  constraints_converged;
Index: /issm/trunk-jpl/src/c/solvers/solver_thermal_nonlinear.cpp
===================================================================
--- /issm/trunk-jpl/src/c/solvers/solver_thermal_nonlinear.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/c/solvers/solver_thermal_nonlinear.cpp	(revision 13216)
@@ -12,15 +12,15 @@
 
 	/*solution : */
-	Vector* tg=NULL; 
-	Vector* tf=NULL; 
-	Vector* tf_old=NULL; 
-	Vector* ys=NULL; 
+	Vector<IssmDouble>* tg=NULL; 
+	Vector<IssmDouble>* tf=NULL; 
+	Vector<IssmDouble>* tf_old=NULL; 
+	Vector<IssmDouble>* ys=NULL; 
 	IssmDouble melting_offset;
 
 	/*intermediary: */
-	Matrix* Kff=NULL;
-	Matrix* Kfs=NULL;
-	Vector* pf=NULL;
-	Vector* df=NULL;
+	Matrix<IssmDouble>* Kff=NULL;
+	Matrix<IssmDouble>* Kfs=NULL;
+	Vector<IssmDouble>* pf=NULL;
+	Vector<IssmDouble>* df=NULL;
 
 	bool converged;
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h	(revision 13216)
@@ -1,4 +1,4 @@
 /*!\file:  SeqMat.h
- * \brief wrapper to SeqMat objects, which are just wrappers to a simple IssmDouble* buffer.
+ * \brief wrapper to SeqMat objects, which are just wrappers to a simple IssmDouble or IssmPDouble* buffer.
  */ 
 
@@ -14,9 +14,17 @@
 #endif
 
-#include "../toolkitsenums.h"
+#include "../../shared/Exceptions/exceptions.h"
+#include "../../shared/MemOps/xMemCpy.h"
+#include "../../shared/Alloc/alloc.h"
+#include "../../include/macros.h"
+#include "./SeqVec.h"
 
 /*}}}*/
-class SeqVec;
-
+
+/*We need to template this class, in case we want to create Matrices that hold IssmDouble* matrix or IssmPDouble* matrix. 
+  Such matrices would be useful for use without or with the matlab or python interface (which do not care for IssmDouble types, 
+  but only rely on IssmPDouble types)*/
+
+template <class doubletype> 
 class SeqMat{
 
@@ -24,28 +32,200 @@
 	
 		int M,N; 
-		IssmDouble* matrix; 
-
-		/*SeqMat constructors, destructors {{{*/
-		SeqMat();
-		SeqMat(int M,int N);
-		SeqMat(int M,int N,IssmDouble sparsity);
-		SeqMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity);
-		SeqMat(int M,int N,int connectivity,int numberofdofspernode);
-		~SeqMat();
-		/*}}}*/
-		/*SeqMat specific routines {{{*/
-		void Echo(void);
-		void Assemble(void);
-		IssmDouble Norm(NormMode norm_type);
-		void GetSize(int* pM,int* pN);
-		void GetLocalSize(int* pM,int* pN);
-		void MatMult(SeqVec* X,SeqVec* AX);
-		SeqMat* Duplicate(void);
-		IssmDouble* ToSerial(void);
-		void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode);
-		void Convert(MatrixType type);
-		/*}}}*/
+		doubletype* matrix;  /*here, doubletype is either IssmDouble or IssmPDouble*/
+
+		/*SeqMat constructors, destructors*/
+		/*FUNCTION SeqMat(){{{*/
+		SeqMat(){
+
+			this->M=0;
+			this->N=0;
+			this->matrix=NULL;
+		}
+		/*}}}*/
+		/*FUNCTION SeqMat(int M,int N){{{*/
+		SeqMat(int pM,int pN){
+
+			this->M=pM;
+			this->N=pN;
+			this->matrix=NULL;
+			if(M*N) this->matrix=xNewZeroInit<doubletype>(pM*pN);
+		}
+		/*}}}*/
+		/*FUNCTION SeqMat(int M,int N, doubletype sparsity){{{*/
+		SeqMat(int pM,int pN, doubletype sparsity){
+
+			this->M=pM;
+			this->N=pN;
+			this->matrix=NULL;
+			if(M*N) this->matrix=xNewZeroInit<doubletype>(pM*pN);
+		}
+		/*}}}*/
+		/*FUNCTION SeqMat(doubletype* serial_mat,int M,int N,doubletype sparsity){{{*/
+		SeqMat(doubletype* serial_mat,int pM,int pN,doubletype sparsity){
+
+			int i,j;
+
+			this->M=pM;
+			this->N=pN;
+			this->matrix=NULL;
+			if(M*N){
+				this->matrix=xNewZeroInit<doubletype>(pM*pN);
+				xMemCpy<doubletype>(this->matrix,serial_mat,pM*pN);
+			}
+
+		}
+		/*}}}*/
+		/*FUNCTION SeqMat(int M,int N, int connectivity, int numberofdofspernode){{{*/
+		SeqMat(int pM,int pN, int connectivity,int numberofdofspernode){
+
+			this->M=pM;
+			this->N=pN;
+			this->matrix=NULL;
+			if(M*N) this->matrix=xNewZeroInit<doubletype>(pM*pN);
+		}
+		/*}}}*/
+		/*FUNCTION ~SeqMat(){{{*/
+		~SeqMat(){
+
+			xDelete<doubletype>(this->matrix);
+			M=0;
+			N=0;
+		}
+		/*}}}*/
+
+		/*SeqMat specific routines */
+		/*FUNCTION Echo{{{*/
+		void Echo(void){
+
+			int i,j;
+			_printLine_("SeqMat size " << this->M << "-" << this->N);
+			for(i=0;i<M;i++){
+				for(j=0;j<N;j++){
+					_printString_(this->matrix[N*i+j] << " ");
+				}
+				_printLine_("");
+			}
+		}
+		/*}}}*/
+		/*FUNCTION Assemble{{{*/
+		void Assemble(void){
+
+			/*do nothing*/
+
+		}
+		/*}}}*/
+		/*FUNCTION Norm{{{*/
+		doubletype Norm(NormMode mode){
+
+			doubletype norm;
+			doubletype absolute;
+			int i,j;
+
+			switch(mode){
+				case NORM_INF:
+					norm=0;
+					for(i=0;i<this->M;i++){
+						absolute=0;
+						for(j=0;j<this->N;j++){
+							absolute+=fabs(this->matrix[N*i+j]);
+						}
+						norm=max(norm,absolute);
+					}
+					return norm;
+					break; 
+				default:
+					_error_("unknown norm !");
+					break;
+			}
+		}
+		/*}}}*/
+		/*FUNCTION GetSize{{{*/
+		void GetSize(int* pM,int* pN){
+
+			*pM=this->M;
+			*pN=this->N;
+
+		}
+		/*}}}*/
+		/*FUNCTION GetLocalSize{{{*/
+		void GetLocalSize(int* pM,int* pN){
+
+			*pM=this->M;
+			*pN=this->N;
+
+		}
+		/*}}}*/
+		/*FUNCTION MatMult{{{*/
+		void MatMult(SeqVec<doubletype>* X,SeqVec<doubletype>* AX){
+
+			int i,j;
+			int XM,AXM;
+			doubletype dummy;
+
+			X->GetSize(&XM);
+			AX->GetSize(&AXM);
+
+			if(M!=AXM)_error_("A and AX should have the same number of rows!");
+			if(N!=XM)_error_("A and X should have the same number of columns!");
+
+			for(i=0;i<M;i++){
+				dummy=0;
+				for(j=0;j<N;j++){
+					dummy+= this->matrix[N*i+j]*X->vector[j];
+				}
+				AX->vector[i]=dummy;
+			}
+
+		}
+		/*}}}*/
+		/*FUNCTION Duplicate{{{*/
+		SeqMat* Duplicate(void){
+
+			doubletype dummy=0;
+
+			return new SeqMat(this->matrix,this->M,this->N,dummy);
+
+		}
+		/*}}}*/
+		/*FUNCTION ToSerial{{{*/
+		doubletype* ToSerial(void){
+
+			doubletype* buffer=NULL;
+
+			if(this->M*this->N){
+				buffer=xNew<doubletype>(this->M*this->N);
+				xMemCpy<doubletype>(buffer,this->matrix,this->M*this->N);
+			}
+			return buffer;
+
+		}
+		/*}}}*/
+		/*FUNCTION SetValues{{{*/
+		void SetValues(int m,int* idxm,int n,int* idxn,doubletype* values,InsMode mode){
+
+			int i,j;
+			switch(mode){
+				case ADD_VAL:
+					for(i=0;i<m;i++) for(j=0;j<n;j++) this->matrix[N*idxm[i]+idxn[j]]+=values[n*i+j];
+					break;
+				case INS_VAL:
+					for(i=0;i<m;i++) for(j=0;j<n;j++) this->matrix[N*idxm[i]+idxn[j]]=values[n*i+j];
+					break;
+				default:
+					_error_("unknown insert mode!");
+					break;
+			}
+
+		}
+		/*}}}*/
+		/*FUNCTION Convert{{{*/
+		void Convert(MatrixType type){
+
+			/*do nothing*/
+
+		}
+		/*}}}*/		
 
 };
-		
+
 #endif //#ifndef _SEQMAT_H_
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h	(revision 13216)
@@ -14,41 +14,239 @@
 #endif
 
-#include "../toolkitsenums.h"
+#include "../../shared/Exceptions/exceptions.h"
+#include "../../shared/MemOps/xMemCpy.h"
+#include "../../shared/Alloc/alloc.h"
+#include "../../include/macros.h"
 
 /*}}}*/
 
+/*We need to template this class, in case we want to create vectors that hold IssmDouble* matrix or IssmPDouble* matrix. 
+  Such vectors would be useful for use without or with the matlab or python interface (which do not care for IssmDouble types, 
+  but only rely on IssmPDouble types)*/
+
+template <class doubletype> 
 class SeqVec{
 
 	public:
 	
-		IssmDouble* vector;
+		doubletype* vector;
 		int M;
 
-		/*SeqVec constructors, destructors {{{*/
-		SeqVec();
-		SeqVec(int M,bool fromlocalsize=false);
-		SeqVec(IssmDouble* buffer, int M);
-		~SeqVec();
-		/*}}}*/
-		/*SeqVec specific routines {{{*/
-		void Echo(void);
-		void Assemble(void);
-		void SetValues(int ssize, int* list, IssmDouble* values, InsMode mode);
-		void SetValue(int dof, IssmDouble value, InsMode  mode);
-		void GetValue(IssmDouble* pvalue, int dof);
-		void GetSize(int* pM);
-		void GetLocalSize(int* pM);
-		SeqVec* Duplicate(void);
-		void Set(IssmDouble value);
-		void AXPY(SeqVec* X, IssmDouble a);
-		void AYPX(SeqVec* X, IssmDouble a);
-		IssmDouble* ToMPISerial(void);
-		void Copy(SeqVec* to);
-		IssmDouble Norm(NormMode norm_type);
-		void Scale(IssmDouble scale_factor);
-		void PointwiseDivide(SeqVec* x,SeqVec* y);
-		IssmDouble Dot(SeqVec* vector);
+		/*SeqVec constructors, destructors*/
+		/*FUNCTION SeqVec(){{{*/
+		SeqVec(){
+
+			this->M=0;
+			this->vector=NULL;
+		}
+		/*}}}*/
+		/*FUNCTION SeqVec(int M,bool fromlocalsize){{{*/
+		SeqVec(int pM,bool fromlocalsize){
+
+			this->M=pM;
+			this->vector=NULL;
+			if(this->M) this->vector=xNewZeroInit<doubletype>(pM);
+		}
+		/*}}}*/
+		/*FUNCTION SeqVec(doubletype* serial_vec,int M){{{*/
+		SeqVec(doubletype* buffer,int pM){
+
+			int i,j;
+
+			this->M=pM;
+			this->vector=NULL;
+			if(this->M){
+				this->vector=xNew<doubletype>(pM);
+				xMemCpy<doubletype>(this->vector,buffer,pM);
+			}
+		}
+		/*}}}*/
+		/*FUNCTION ~SeqVec(){{{*/
+		~SeqVec(){
+			xDelete<doubletype>(this->vector);
+			M=0;
+		}
+		/*}}}*/
+
+		/*SeqVec specific routines*/
+		/*FUNCTION Echo{{{*/
+		void Echo(void){
+
+			int i;
+			_printLine_("SeqVec size " << this->M);
+			for(i=0;i<M;i++){
+				_printString_(vector[i] << "\n ");
+			}
+		}
+		/*}}}*/
+		/*FUNCTION Assemble{{{*/
+		void Assemble(void){
+
+			/*do nothing*/
+
+		}
+		/*}}}*/
+		/*FUNCTION SetValues{{{*/
+		void SetValues(int ssize, int* list, doubletype* values, InsMode mode){
+
+			int i;
+			switch(mode){
+				case ADD_VAL:
+					for(i=0;i<ssize;i++) this->vector[list[i]]+=values[i];
+					break;
+				case INS_VAL:
+					for(i=0;i<ssize;i++) this->vector[list[i]]=values[i];
+					break;
+				default:
+					_error_("unknown insert mode!");
+					break;
+			}
+
+		}
+		/*}}}*/
+		/*FUNCTION SetValue{{{*/
+		void SetValue(int dof, doubletype value, InsMode mode){
+
+			switch(mode){
+				case ADD_VAL:
+					this->vector[dof]+=value;
+					break;
+				case INS_VAL:
+					this->vector[dof]=value;
+					break;
+				default:
+					_error_("unknown insert mode!");
+					break;
+			}
+		}
+		/*}}}*/
+		/*FUNCTION GetValue{{{*/
+		void GetValue(doubletype* pvalue,int dof){
+
+			*pvalue=this->vector[dof];
+
+		}
+		/*}}}*/
+		/*FUNCTION GetSize{{{*/
+		void GetSize(int* pM){
+
+			*pM=this->M;
+
+		}
+		/*}}}*/
+		/*FUNCTION GetLocalSize{{{*/
+		void GetLocalSize(int* pM){
+
+			*pM=this->M;
+
+		}
+		/*}}}*/
+		/*FUNCTION Duplicate{{{*/
+		SeqVec* Duplicate(void){
+
+			return new SeqVec(this->vector,this->M);
+
+		}
+		/*}}}*/
+		/*FUNCTION Set{{{*/
+		void Set(doubletype value){
+
+			int i;
+			for(i=0;i<this->M;i++)this->vector[i]=value;
+
+		}
+		/*}}}*/
+		/*FUNCTION AXPY{{{*/
+		void AXPY(SeqVec* X, doubletype a){
+
+			int i;
+
+			/*y=a*x+y where this->vector is y*/
+			for(i=0;i<this->M;i++)this->vector[i]=a*X->vector[i]+this->vector[i];
+
+		}
+		/*}}}*/
+		/*FUNCTION AYPX{{{*/
+		void AYPX(SeqVec* X, doubletype a){
+
+			int i;
+
+			/*y=x+a*y where this->vector is y*/
+			for(i=0;i<this->M;i++)this->vector[i]=X->vector[i]+a*this->vector[i];
+
+		}
+		/*}}}*/
+		/*FUNCTION ToMPISerial{{{*/
+		doubletype* ToMPISerial(void){
+
+			doubletype* buffer=NULL;
+
+			if(this->M){
+				buffer=xNew<doubletype>(this->M);
+				xMemCpy<doubletype>(buffer,this->vector,this->M);
+			}
+			return buffer;
+
+		}
+		/*}}}*/
+		/*FUNCTION Copy{{{*/
+		void Copy(SeqVec* to){
+
+			int i;
+
+			to->M=this->M;
+			for(i=0;i<this->M;i++)to->vector[i]=this->vector[i];
+
+		}
+		/*}}}*/
+		/*FUNCTION Norm{{{*/
+		doubletype Norm(NormMode mode){
+
+			doubletype norm;
+			int i;
+
+			switch(mode){
+				case NORM_INF:
+					norm=0; for(i=0;i<this->M;i++)norm=max(norm,fabs(this->vector[i]));
+					return norm;
+					break;
+				case NORM_TWO:
+					norm=0; 
+					for(i=0;i<this->M;i++)norm+=pow(this->vector[i],2);
+					return sqrt(norm);
+					break;
+				default:
+					_error_("unknown norm !");
+					break;
+			}
+		}
+		/*}}}*/
+		/*FUNCTION Scale{{{*/
+		void Scale(doubletype scale_factor){
+
+			int i;
+			for(i=0;i<this->M;i++)this->vector[i]=scale_factor*this->vector[i];
+
+		}
+		/*}}}*/
+		/*FUNCTION Dot{{{*/
+		doubletype Dot(SeqVec* input){
+
+			int i;
+
+			doubletype dot=0;
+			for(i=0;i<this->M;i++)dot+=this->vector[i]*input->vector[i];
+			return dot;
+
+		}
+		/*}}}*/
+		/*FUNCTION PointwiseDivide{{{*/
+		void PointwiseDivide(SeqVec* x,SeqVec* y){
+
+			int i;
+			/*pointwise w=x/y where this->vector is w: */
+			for(i=0;i<this->M;i++)this->vector[i]=x->vector[i]/y->vector[i];
+		}
 		/*}}}*/
 };
-
 #endif //#ifndef _SEQVEC_H_
Index: /issm/trunk-jpl/src/c/toolkits/issm/issmtoolkit.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/issmtoolkit.h	(revision 13215)
+++ /issm/trunk-jpl/src/c/toolkits/issm/issmtoolkit.h	(revision 13216)
@@ -6,6 +6,4 @@
 #define _ISSM_TOOLKIT_H_
 
-#include "../../include/include.h"
-
 #include "./SeqMat.h"
 #include "./SeqVec.h"
Index: /issm/trunk-jpl/src/modules/ContourToMesh/ContourToMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/ContourToMesh/ContourToMesh.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/ContourToMesh/ContourToMesh.cpp	(revision 13216)
@@ -37,6 +37,6 @@
 
 	/* output: */
-	Vector *in_nod  = NULL;
-	Vector *in_elem = NULL;
+	Vector<double> *in_nod  = NULL;
+	Vector<double> *in_elem = NULL;
 
 	/*Boot module: */
Index: /issm/trunk-jpl/src/modules/ContourToNodes/ContourToNodes.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/ContourToNodes/ContourToNodes.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/ContourToNodes/ContourToNodes.cpp	(revision 13216)
@@ -35,5 +35,5 @@
 
 	/* output: */
-	Vector*  flags=NULL;
+	Vector<double>*  flags=NULL;
 	int  nods;
 
Index: /issm/trunk-jpl/src/modules/Exp2Kml/Exp2Kml.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/Exp2Kml/Exp2Kml.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/Exp2Kml/Exp2Kml.cpp	(revision 13216)
@@ -37,5 +37,5 @@
 	FetchData(&options,NRHS,nrhs,prhs);
 
-	options->Get(&choles,"holes","no");
+	options->Get(&choles,"holes",(char*)"no");
 	if (!strncmp(choles,"y",1) || !strncmp(choles,"on",2)) holes=true;
 
Index: /issm/trunk-jpl/src/modules/InterpFromGridToMesh/InterpFromGridToMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/InterpFromGridToMesh/InterpFromGridToMesh.cpp	(revision 13216)
@@ -37,5 +37,5 @@
 
 	/* output: */
-	Vector*  data_mesh=NULL;
+	Vector<double>*  data_mesh=NULL;
 
 	/*Boot module: */
Index: /issm/trunk-jpl/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/InterpFromMesh2d/InterpFromMesh2d.cpp	(revision 13216)
@@ -61,5 +61,5 @@
 
 	/* output: */
-	Vector*  data_prime=NULL;
+	Vector<double>*  data_prime=NULL;
 
 	/*Boot module: */
Index: /issm/trunk-jpl/src/modules/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/InterpFromMeshToMesh3d/InterpFromMeshToMesh3d.cpp	(revision 13216)
@@ -55,5 +55,5 @@
 
 	/* output: */
-	Vector*  data_prime=NULL;
+	Vector<double>*  data_prime=NULL;
 
 	/*Boot module: */
Index: /issm/trunk-jpl/src/modules/KMLFileRead/KMLFileRead.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/KMLFileRead/KMLFileRead.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/KMLFileRead/KMLFileRead.cpp	(revision 13216)
@@ -56,7 +56,7 @@
 	FetchData(&options,NRHS,nrhs,prhs);
 
-	options->Get(&echo    ,"echo"    ,"off");
-	options->Get(&deepecho,"deepecho","off");
-	options->Get(&write   ,"write"   ,"off");
+	options->Get(&echo    ,"echo"    ,(char*)"off");
+	options->Get(&deepecho,"deepecho",(char*)"off");
+	options->Get(&write   ,"write"   ,(char*)"off");
 
 	/*some checks*/
Index: /issm/trunk-jpl/src/modules/KMLOverlay/KMLOverlay.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/KMLOverlay/KMLOverlay.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/KMLOverlay/KMLOverlay.cpp	(revision 13216)
@@ -41,11 +41,11 @@
 	FetchData(&options,NRHS,nrhs,prhs);
 
-	options->Get(&lataxis ,&nlat ,"lataxis" );
+	options->Get(&lataxis ,&nlat ,(char*)"lataxis");
 	if (verbose && lataxis) for (i=0; i<nlat; i++) _printLine_("  lataxis [" << i << "]=" << lataxis[i]);
-	options->Get(&longaxis,&nlong,"longaxis");
+	options->Get(&longaxis,&nlong,(char*)"longaxis");
 	if (verbose && longaxis) for (i=0; i<nlong; i++) _printLine_("  longaxis[" << i << "]=" << longaxis[i]);
-	options->Get(&pimages,&nimages,"images");
+	options->Get(&pimages,&nimages,(char*)"images");
 	if (verbose && pimages) for (i=0; i<nimages; i++) _printLine_("  pimages[" << i << "]=\"" << pimages[i] << "\"");
-	options->Get(&dzip,"zip",0.);
+	options->Get(&dzip,(char*)"zip",0.);
 	if (verbose) _printLine_("  dzip=" << dzip);
 
Index: /issm/trunk-jpl/src/modules/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/PointCloudFindNeighbors/PointCloudFindNeighbors.cpp	(revision 13216)
@@ -17,5 +17,5 @@
 
 	/* output: */
-	Vector*  flags=NULL;
+	Vector<double>*  flags=NULL;
 
 	/*Boot module: */
Index: /issm/trunk-jpl/src/modules/TriMesh/TriMesh.cpp
===================================================================
--- /issm/trunk-jpl/src/modules/TriMesh/TriMesh.cpp	(revision 13215)
+++ /issm/trunk-jpl/src/modules/TriMesh/TriMesh.cpp	(revision 13216)
@@ -17,9 +17,9 @@
 
 	/* output: */
-	Matrix *index             = NULL;
-	Vector *x                 = NULL;
-	Vector *y                 = NULL;
-	Matrix *segments          = NULL;
-	Vector *segmentmarkerlist = NULL;
+	Matrix<double> *index             = NULL;
+	Vector<double> *x                 = NULL;
+	Vector<double> *y                 = NULL;
+	Matrix<double> *segments          = NULL;
+	Vector<double> *segmentmarkerlist = NULL;
 
 	/*Boot module: */
