Index: /issm/trunk/src/c/objects/Beam.h
===================================================================
--- /issm/trunk/src/c/objects/Beam.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Beam.h	(revision 3632)
@@ -24,5 +24,5 @@
 class Beam: public Element{
 
-	private: 
+	public:
 
 		/*ids:*/
@@ -36,5 +36,4 @@
 		Inputs* inputs;
 	
-	public:
 
 		/*constructors, destructors: {{{1*/
Index: /issm/trunk/src/c/objects/Icefront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Icefront.cpp	(revision 3631)
+++ /issm/trunk/src/c/objects/Icefront.cpp	(revision 3632)
@@ -21,43 +21,38 @@
 /*FUNCTION Icefront::Icefront() {{{1*/
 Icefront::Icefront(){
-	return;
-}
-/*}}}*/
-/*FUNCTION Icefront::Icefront(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, ...) {{{1*/
-Icefront::Icefront(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type, 
-		int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double	icefront_b[MAX_ICEFRONT_GRIDS]){
-	
-	this->Init(icefront_type,icefront_fill,icefront_sid, icefront_mparid, icefront_eid, icefront_element_type, 
-		icefront_node_ids,icefront_h,icefront_b);
-
-}
-/*}}}*/
-/*FUNCTION Icefront::Init {{{1*/
-void Icefront::Init(char icefront_type[ICEFRONTSTRING],int icefront_fill,int icefront_sid, int icefront_mparid, int icefront_eid, int icefront_element_type, 
-		int icefront_node_ids[MAX_ICEFRONT_GRIDS],double icefront_h[MAX_ICEFRONT_GRIDS],double	icefront_b[MAX_ICEFRONT_GRIDS]){
-
-	int i;
-	
-	strcpy(type,icefront_type);
-	fill=icefront_fill;
-	sid=icefront_sid;
-	
-	mparid=icefront_mparid;
-	
-	eid=icefront_eid;
-	element_type=icefront_element_type;
-	for(i=0;i<MAX_ICEFRONT_GRIDS;i++){
-		node_ids[i]=icefront_node_ids[i];
-		node_offsets[i]=UNDEF;
-		nodes[i]=NULL;
-		h[i]=icefront_h[i];
-		b[i]=icefront_b[i];
-	}
-	
-	matpar=NULL;
-	matpar_offset=UNDEF;
-
-	element=NULL;
-	element_offset=UNDEF;
+	this->inputs=NULL;
+	this->parameters=NULL;
+}
+/*}}}*/
+/*FUNCTION Icefront::Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id){{{1*/
+Icefront::Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id):
+	hnodes(icefront_node_ids,num_nodes),
+	helement(&icefront_matice_id,1),
+	hmatpar(&icefront_matpar_id,1)
+{
+
+	/*all the initialization has been done by the initializer, just fill in the id: */
+	this->id=icefront_id;
+	this->parameters=NULL;
+	this->inputs=new Inputs();
+}
+/*}}}*/
+/*FUNCTION Icefront::Icefront(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, DataSet* parameters, Inputs* icefront_inputs) {{{1*/
+Icefront::Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement, Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs):
+	hnodes(icefront_hnodes),
+	helement(icefront_helement),
+	hmatpar(icefront_hmatpar)
+{
+
+	/*all the initialization has been done by the initializer, just fill in the id: */
+	this->id=icefront_id;
+	if(icefront_inputs){
+		this->inputs=(Inputs*)icefront_inputs->Copy();
+	}
+	else{
+		this->inputs=new Inputs();
+	}
+	/*point parameters: */
+	this->parameters=icefront_parameters;
 }
 /*}}}*/
@@ -66,63 +61,38 @@
 
 	int segment_width;
-	int element_type;
 	int i1,i2,i3,i4;
 	int element;
 
 	/*icefront intermediary data: */
-	char icefront_type[ICEFRONTSTRING];
+	int  icefront_node_ids[MAX_ICEFRONT_GRIDS];
+	int  num_nodes;
+	int  icefront_mparid;
+	int  icefront_eid;
 	int  icefront_fill;
-	int  icefront_element_type;
-	int  icefront_eid;
-	int  icefront_mparid;
-	int  icefront_node_ids[MAX_ICEFRONT_GRIDS];
-	double icefront_h[MAX_ICEFRONT_GRIDS];
-	double	icefront_b[MAX_ICEFRONT_GRIDS];
 
 	/*First, retrieve element index and element type: */
 	if (strcmp(iomodel->meshtype,"2d")==0){
 		segment_width=4;
-		element_type=TriaEnum;
 	}
 	else{
 		segment_width=6;
-		element_type=PentaEnum;
 	}
 	element=(int)(*(iomodel->pressureload+segment_width*i+segment_width-2)-1); //element is in the penultimate column (grid1 grid2 ... elem fill)
 
+	/*Setup all ids, so we can get our hooks setup: */
 	icefront_mparid=iomodel->numberofelements+1; //matlab indexing
-	icefront_mparid=iomodel->numberofelements+1; //matlab indexing
-	icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1); 
 	icefront_eid=(int) *(iomodel->pressureload+segment_width*i+segment_width-2); //matlab indexing
-	icefront_element_type=element_type;
-
-	i1=(int)*(iomodel->pressureload+segment_width*i+0);
-	i2=(int)*(iomodel->pressureload+segment_width*i+1);
-
-	icefront_node_ids[0]=i1;
-	icefront_node_ids[1]=i2;
-
-	icefront_h[0]=iomodel->thickness[i1-1];
-	icefront_h[1]=iomodel->thickness[i2-1];
-
-	icefront_b[0]=iomodel->bed[i1-1];
-	icefront_b[1]=iomodel->bed[i2-1];
+
+	icefront_node_ids[0]=(int)*(iomodel->pressureload+segment_width*i+0);
+	icefront_node_ids[1]=(int)*(iomodel->pressureload+segment_width*i+1);
 
 	if (iomodel->sub_analysis_type==HorizAnalysisEnum){
 		if ((int)*(iomodel->elements_type+2*element+0)==MacAyealFormulationEnum){ //this is a collapsed 3d element, icefront will be 2d
-			strcpy(icefront_type,"segment");
+			num_nodes=2;
 		}
 		else if ((int)*(iomodel->elements_type+2*element+0)==PattynFormulationEnum){ //this is a real 3d element, icefront will be 3d.
-			strcpy(icefront_type,"quad");
-			i3=(int)*(iomodel->pressureload+segment_width*i+2);
-			i4=(int)*(iomodel->pressureload+segment_width*i+3);
-			icefront_node_ids[2]=i3;
-			icefront_node_ids[3]=i4;
-
-			icefront_h[2]=iomodel->thickness[i3-1];
-			icefront_h[3]=iomodel->thickness[i4-1];
-
-			icefront_b[2]=iomodel->bed[i3-1];
-			icefront_b[3]=iomodel->bed[i4-1];
+			num_nodes=4;
+			icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2);
+			icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3);
 		}
 		else{
@@ -132,19 +102,24 @@
 	else if (iomodel->sub_analysis_type==StokesAnalysisEnum){
 		//We have a Stokes element, so we need a 3d Icefront
-		strcpy(icefront_type,"quad");
-		i3=(int)*(iomodel->pressureload+segment_width*i+2);
-		i4=(int)*(iomodel->pressureload+segment_width*i+3);
-		icefront_node_ids[2]=i3;
-		icefront_node_ids[3]=i4;
-
-		icefront_h[2]=iomodel->thickness[i3-1];
-		icefront_h[3]=iomodel->thickness[i4-1];
-
-		icefront_b[2]=iomodel->bed[i3-1];
-		icefront_b[3]=iomodel->bed[i4-1];
+		num_nodes=4;
+		icefront_node_ids[2]=(int)*(iomodel->pressureload+segment_width*i+2);
+		icefront_node_ids[3]=(int)*(iomodel->pressureload+segment_width*i+3);
 	}
 	else ISSMERROR("Not supported yet!");
 
-	this->Init(icefront_type,icefront_fill,icefront_id,icefront_mparid,icefront_eid,icefront_element_type,icefront_node_ids,icefront_h,icefront_b);
+	/*Ok, get the hooks setup: */
+	this->hnodes.Init(icefront_node_ids,num_nodes);
+	this->helement.Init(&icefront_element_id,1);
+	this->hmatpar.Init(&icefront_matpar_id,1);
+
+	//intialize inputs, and add as many inputs per element as requested: 
+	this->inputs=new Inputs();
+		
+	icefront_fill=(int)*(iomodel->pressureload+segment_width*i+segment_width-1); 
+	this->inputs->AddInput(new IntInput(FillEnum,icefront_fill));
+
+	//this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
+	this->parameters=NULL;
+
 }
 
@@ -158,9 +133,41 @@
 
 /*Object marshall*/
+/*FUNCTION Icefront Configure {{{1*/
+void  Icefront::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin);
+	
+/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
+	 * datasets, using internal ids and offsets hidden in hooks: */
+	hnodes.configure(nodesin);
+	helement.configure(elementsin);
+	hmatpar.configure(materialsin);
+
+	/*point parameters to real dataset: */
+	this->parameters=parametersin;
+}
+/*}}}*/
+/*FUNCTION Icefront copy {{{1*/
+Object* Icefront::copy() {
+	return new Icefront(this->id,&this->hnodes,&this->helement,&this->hmatpar,this->parameters,this->inputs);
+}
+/*}}}*/
+/*FUNCTION Icefront DeepEcho {{{1*/
+void Icefront::DeepEcho(void){
+
+	printf("Icefront:\n");
+	printf("   id: %i\n",id);
+	hnodes.Echo();
+	helement.Echo();
+	hmatpar.Echo();
+	printf("   parameters\n");
+	parameters->Echo();
+	printf("   inputs\n");
+	inputs->Echo();
+}		
+/*}}}*/
 /*FUNCTION Icefront Demarshall {{{1*/
 void  Icefront::Demarshall(char** pmarshalled_dataset){
 
-	int i;
 	char* marshalled_dataset=NULL;
+	int   i;
 
 	/*recover marshalled_dataset: */
@@ -170,24 +177,16 @@
 	 *object data (thanks to DataSet::Demarshall):*/
 
-	memcpy(&type,marshalled_dataset,sizeof(type));marshalled_dataset+=sizeof(type);
-	memcpy(&fill,marshalled_dataset,sizeof(fill));marshalled_dataset+=sizeof(fill);
-	memcpy(&sid,marshalled_dataset,sizeof(sid));marshalled_dataset+=sizeof(sid);
-	
-	memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
-	memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
-
-	memcpy(&element_type,marshalled_dataset,sizeof(element_type));marshalled_dataset+=sizeof(element_type);
-	memcpy(&eid,marshalled_dataset,sizeof(eid));marshalled_dataset+=sizeof(eid);
-	memcpy(&element_offset,marshalled_dataset,sizeof(element_offset));marshalled_dataset+=sizeof(element_offset);
-
-	memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
-	memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
-	
-	memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h);
-	memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b);
-
-	for(i=0;i<MAX_ICEFRONT_GRIDS;i++)nodes[i]=NULL;
-	matpar=NULL;
-	element=NULL;
+	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
+
+	/*demarshall hooks: */
+	hnodes.Demarshall(&marshalled_dataset);
+	helement.Demarshall(&marshalled_dataset);
+	hmatpar.Demarshall(&marshalled_dataset);
+	
+	/*demarshall inputs: */
+	inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 
+
+	/*parameters: may not exist even yet, so let Configure handle it: */
+	this->parameters=NULL;
 
 	/*return: */
@@ -196,36 +195,60 @@
 }
 /*}}}*/
+/*FUNCTION Icefront Echo {{{1*/
+void Icefront::Echo(void){
+
+	this->DeepEcho();
+}
+/*}}}*/
+/*FUNCTION Icefront Enum {{{1*/
+int Icefront::Enum(void){
+
+	return IcefrontEnum;
+
+}
+/*}}}*/
+/*FUNCTION Icefront GetId {{{1*/
+int    Icefront::GetId(void){ return sid; }
+/*}}}*/
+/*FUNCTION Icefront GetName {{{1*/
+char* Icefront::GetName(void){
+	return "icefront";
+}
+/*}}}*/
 /*FUNCTION Icefront Marshall {{{1*/
 void  Icefront::Marshall(char** pmarshalled_dataset){
 
+
 	char* marshalled_dataset=NULL;
 	int   enum_type=0;
+	char* marshalled_inputs=NULL;
+	int   marshalled_inputs_size;
 
 	/*recover marshalled_dataset: */
 	marshalled_dataset=*pmarshalled_dataset;
 
-	/*get enum type of Icefront: */
-	enum_type=IcefrontEnum;
-	
+	/*get enum type of Tria: */
+	enum_type=TriaEnum;
+
 	/*marshall enum: */
 	memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
-	
-	/*marshall Icefront data: */
-	memcpy(marshalled_dataset,&type,sizeof(type));marshalled_dataset+=sizeof(type);
-	memcpy(marshalled_dataset,&fill,sizeof(fill));marshalled_dataset+=sizeof(fill);
-	memcpy(marshalled_dataset,&sid,sizeof(sid));marshalled_dataset+=sizeof(sid);
-	
-	memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid);
-	memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset);
-	
-	memcpy(marshalled_dataset,&element_type,sizeof(element_type));marshalled_dataset+=sizeof(element_type);
-	memcpy(marshalled_dataset,&eid,sizeof(eid));marshalled_dataset+=sizeof(eid);
-	memcpy(marshalled_dataset,&element_offset,sizeof(element_offset));marshalled_dataset+=sizeof(element_offset);
-	
-	memcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids);
-	memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets);
-	
-	memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h);
-	memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b);
+
+	/*marshall Tria data: */
+	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
+
+	/*Marshall hooks: */
+	hnodes.Marshall(&marshalled_dataset);
+	helement.Marshall(&marshalled_dataset);
+	hmatpar.Marshall(&marshalled_dataset);
+
+	/*Marshall inputs: */
+	marshalled_inputs_size=inputs->MarshallSize();
+	marshalled_inputs=inputs->Marshall();
+	memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
+	marshalled_dataset+=marshalled_inputs_size;
+
+	/*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
+
+	xfree((void**)&marshalled_inputs);
 
 	*pmarshalled_dataset=marshalled_dataset;
@@ -236,57 +259,20 @@
 int   Icefront::MarshallSize(){
 
-	return sizeof(type)+
-	  sizeof(fill)+
-		sizeof(sid)+
-		sizeof(mparid)+
-		sizeof(matpar_offset)+
-		sizeof(eid)+
-		sizeof(element_offset)+
-		sizeof(element_type)+
-		sizeof(node_ids)+
-		sizeof(node_offsets)+
-		sizeof(h)+
-		sizeof(b)+
-		sizeof(int); //sizeof(int) for enum type
+	return sizeof(id)
+		+hnodes.MarshallSize()
+		+helement.MarshallSize()
+		+hmatpar.MarshallSize()
+		+inputs->MarshallSize()
+		+sizeof(int); //sizeof(int) for enum type
+}
+/*}}}*/
+/*FUNCTION Icefront MyRank {{{1*/
+int    Icefront::MyRank(void){ 
+	extern int my_rank;
+	return my_rank; 
 }
 /*}}}*/
 
 /*Object functions*/
-/*FUNCTION Icefront Configure {{{1*/
-
-void  Icefront::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){
-
-	DataSet* elementsin=NULL;
-	DataSet* nodesin=NULL;
-	DataSet* materialsin=NULL;
-
-	/*Recover pointers :*/
-	elementsin=(DataSet*)pelementsin;
-	nodesin=(DataSet*)pnodesin;
-	materialsin=(DataSet*)pmaterialsin;
-	
-	/*Link this load with its nodes: */
-	if (strcmp(type,"segment")==0){
-		ResolvePointers((Object**)nodes,node_ids,node_offsets,2,nodesin);
-	}
-	else{
-		ResolvePointers((Object**)nodes,node_ids,node_offsets,4,nodesin);
-	}
-
-	
-	/*Same for materials: */
-	ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);
-
-
-	/*Same for element: */
-	ResolvePointers((Object**)&element,&eid,&element_offset,1,elementsin);
-
-}
-/*}}}*/
-/*FUNCTION Icefront copy {{{1*/
-Object* Icefront::copy() {
-	return new Icefront(*this); 
-}
-/*}}}*/
 /*FUNCTION Icefront CreateKMatrix {{{1*/
 
@@ -704,96 +690,7 @@
 }
 /*}}}*/
-/*FUNCTION Icefront DeepEcho {{{1*/
-void Icefront::DeepEcho(void){
-
-	int i;
-	
-	printf("Icefront:\n");
-	printf("   type: %s\n",type);
-	printf("   fill: %i\n",fill);
-	printf("   sid: %i\n",sid);
-	
-	printf("   mparid: %i\n",mparid);
-	printf("   matpar_offset: %i\n",matpar_offset);
-	printf("   matpar: \n");
-	
-	printf("   element_type: %i\n",element_type);
-	printf("   eid: %i\n",eid);
-	printf("   element_offset: %i\n",eid);
-	printf("   element\n");
-		
-	if (strcmp(type,"segment")==0){
-		printf("   node_ids=[%i,%i]\n",node_ids[0],node_ids[1]);
-		printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1]);
-		printf("   h=[%g,%g]\n",h[0],h[1]);
-		printf("   b=[%g,%g]\n",b[0],b[1]);
-		for(i=0;i<2;i++){
-			if(nodes[i])nodes[i]->Echo();
-		}
-	}
-	else{
-		printf("   node_ids=[%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3]);
-		printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3]);
-		printf("   h=[%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3]);
-		printf("   b=[%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3]);
-		for(i=0;i<4;i++){
-			if(nodes[i])nodes[i]->Echo();
-		}
-	}
-
-	return;
-}		
-/*}}}*/
 /*FUNCTION Icefront DistributeNumDofs {{{1*/
 void  Icefront::DistributeNumDofs(int* numdofspernode,int analysis_type,int sub_analysis_type){return;}
 		
-/*}}}*/
-/*FUNCTION Icefront Echo {{{1*/
-void Icefront::Echo(void){
-
-	int i;
-	
-	printf("Icefront:\n");
-	printf("   type: %s\n",type);
-	printf("   fill: %i\n",fill);
-	printf("   sid: %i\n",sid);
-	
-	printf("   mparid: %i\n",mparid);
-	printf("   matpar_offset: %i\n",matpar_offset);
-	printf("   matpar: \n");
-	
-	printf("   element_type: %i\n",element_type);
-	printf("   eid: %i\n",eid);
-	printf("   element_offset: %i\n",eid);
-	printf("   element\n");
-		
-	if (strcmp(type,"segment")==0){
-		printf("   node_ids=[%i,%i]\n",node_ids[0],node_ids[1]);
-		printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1]);
-		printf("   h=[%g,%g]\n",h[0],h[1]);
-		printf("   b=[%g,%g]\n",b[0],b[1]);
-		for(i=0;i<2;i++){
-			if(nodes[i])nodes[i]->Echo();
-		}
-	}
-	else{
-		printf("   node_ids=[%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3]);
-		printf("   node_offsets=[%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3]);
-		printf("   h=[%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3]);
-		printf("   b=[%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3]);
-		for(i=0;i<4;i++){
-			if(nodes[i])nodes[i]->Echo();
-		}
-	}
-
-	return;
-}
-/*}}}*/
-/*FUNCTION Icefront Enum {{{1*/
-int Icefront::Enum(void){
-
-	return IcefrontEnum;
-
-}
 /*}}}*/
 /*FUNCTION Icefront GetDofList{{{1*/
@@ -826,18 +723,4 @@
 	*pnumberofdofspernode=numberofdofspernode;
 
-}
-/*}}}*/
-/*FUNCTION Icefront GetId {{{1*/
-int    Icefront::GetId(void){ return sid; }
-/*}}}*/
-/*FUNCTION Icefront GetName {{{1*/
-char* Icefront::GetName(void){
-	return "icefront";
-}
-/*}}}*/
-/*FUNCTION Icefront MyRank {{{1*/
-int    Icefront::MyRank(void){ 
-	extern int my_rank;
-	return my_rank; 
 }
 /*}}}*/
@@ -1433,29 +1316,2 @@
 }
 /*}}}*/
-/*FUNCTION Icefront UpdateFromInputs {{{1*/
-void  Icefront::UpdateFromInputs(void* vinputs){
-
-	int i;
-	int numberofdofspernode;
-
-	/*element: */
-	double* h_param=NULL;
-	double* b_param=NULL;
-	int  dofs[1]={0};
-
-	ParameterInputs* inputs=NULL;	
-
-	inputs=(ParameterInputs*)vinputs;
-
-	if(strcmp(type,"quad")==0){
-		inputs->Recover("thickness",&h[0],1,dofs,4,(void**)nodes);
-		inputs->Recover("bed",&b[0],1,dofs,4,(void**)nodes);
-	}
-	else{
-		inputs->Recover("thickness",&h[0],1,dofs,2,(void**)nodes);
-		inputs->Recover("bed",&h[0],1,dofs,2,(void**)nodes);
-	}
-
-
-}
-/*}}}*/
Index: /issm/trunk/src/c/objects/Icefront.h
===================================================================
--- /issm/trunk/src/c/objects/Icefront.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Icefront.h	(revision 3632)
@@ -6,15 +6,5 @@
 #define _ICEFRONT_H_
 
-class Element;
-class Load;
-class Matpar;
-class Element;
-class Node;
-
 #include "./Load.h"
-#include "./Matpar.h"
-#include "./Element.h"
-#include "./Node.h"
-#include "../ModelProcessorx/IoModel.h"
 
 #define MAX_ICEFRONT_GRIDS 4 //max number of grids for a certain load
@@ -23,40 +13,23 @@
 class Icefront: public Load {
 
-	private: 
-		char  type[ICEFRONTSTRING];
-		int   fill;
-		int	sid;
+	public:
+		int	id;
 	
-		/*material: */
-		int     mparid; //material id
-		Matpar* matpar; 
-		int     matpar_offset;
-	
-		/*element of icefront: */
-		int 	   element_type;
-		int      eid;  //id of element on ice front
-		Element* element;
-		int      element_offset;
+		Hook* hnodes; //2 or 4 nodes
+		Hook* helement; //tria or penta
+		Hook* hmatpar;
 
-		/*nodes: */
-		int   node_ids[MAX_ICEFRONT_GRIDS]; //node ids
-		Node* nodes[MAX_ICEFRONT_GRIDS]; //node pointers
-		int   node_offsets[MAX_ICEFRONT_GRIDS]; //node offsets in nodes dataset
-
-		/*properties: */
-		double		h[MAX_ICEFRONT_GRIDS]; //thickness
-		double		b[MAX_ICEFRONT_GRIDS]; //bed
-
-	public:
+		Parameters* parameters;
+		Inputs*     inputs;
 
 		/*constructors: {{{1*/
 		Icefront();
-		Icefront(char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double	b[MAX_ICEFRONT_GRIDS]);
-		void Init(char type[ICEFRONTSTRING],int fill,int sid, int mparid, int eid, int element_type, int node_ids[MAX_ICEFRONT_GRIDS],double h[MAX_ICEFRONT_GRIDS],double	b[MAX_ICEFRONT_GRIDS]);
-		Icefront(int sid, int i, IoModel* iomodel);
+		Icefront(int icefront_id,int* icefront_node_ids, int num_nodes, int icefront_element_id, int icefront_matpar_id);
+		Icefront(int icefront_id,Hook* icefront_hnodes, Hook* icefront_helement,Hook* icefront_hmatpar, Parameters* icefront_parameters, Inputs* icefront_inputs);
+		Icefront(int id,int i, IoModel* iomodel);
 		~Icefront();
 		/*}}}*/
 		/*object management: {{{1*/
-		void  Configure(void* elements,void* nodes,void* materials);
+		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters);
 		Object* copy();
 		void  DeepEcho();
@@ -73,11 +46,10 @@
 		/*numerics: {{{1*/
 		void  DistributeNumDofs(int* numdofspernode,int analysis_type,int sub_analysis_type);
-		void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type);
-		void  UpdateFromInputs(void* inputs);
-		void  CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type);
-		void  CreatePVectorDiagnosticHoriz( Vec pg, void* inputs, int analysis_type,int sub_analysis_type);
-		void  CreatePVectorDiagnosticHorizSegment( Vec pg,void* inputs, int analysis_type,int sub_analysis_type);
-		void  CreatePVectorDiagnosticHorizQuad( Vec pg,void* inputs, int analysis_type,int sub_analysis_type);
-		void  CreatePVectorDiagnosticStokes( Vec pg,void* inputs, int analysis_type,int sub_analysis_type);
+		void  CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type);
+		void  CreatePVector(Vec pg, int analysis_type,int sub_analysis_type);
+		void  CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type);
+		void  CreatePVectorDiagnosticHorizSegment( Vec pg,int analysis_type,int sub_analysis_type);
+		void  CreatePVectorDiagnosticHorizQuad( Vec pg, int analysis_type,int sub_analysis_type);
+		void  CreatePVectorDiagnosticStokes( Vec pg, int analysis_type,int sub_analysis_type);
 		void  GetDofList(int* doflist,int* pnumberofdofs);
 		void  SegmentPressureLoad(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, double* normal,double length);
@@ -86,6 +58,6 @@
 		void  QuadPressureLoadStokes(double* pe_g,double rho_water,double rho_ice,double gravity, double* thickness_list, double* bed_list, 
 		                              double* normal1,double* normal2,double* normal3,double* normal4,double* xyz_list);
-		void  PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
-		void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
+		void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type);
+		void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type);
 		/*}}}*/
 };
Index: /issm/trunk/src/c/objects/Load.h
===================================================================
--- /issm/trunk/src/c/objects/Load.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Load.h	(revision 3632)
@@ -13,4 +13,6 @@
 #include "./Object.h"
 #include "../toolkits/toolkits.h"
+#include "../DataSet/DataSet.h"
+#include "../DataSet/Parameters.h"
 
 class Load: public Object{
@@ -26,10 +28,9 @@
 		virtual char* GetName()=0;
 		virtual void  Demarshall(char** pmarshalled_dataset)=0;
-		virtual void  Configure(void* elements,void* nodes,void* materials)=0;
-		virtual void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type)=0;
-		virtual void  CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type)=0;
-		virtual void  UpdateFromInputs(void* inputs)=0;
-		virtual void  PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0;
-		virtual void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0;
+		virtual void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters)=0;
+		virtual void  CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type)=0;
+		virtual void  CreatePVector(Vec pg, int analysis_type,int sub_analysis_type)=0;
+		virtual void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type)=0;
+		virtual void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type)=0;
 
 		int           Enum();
Index: /issm/trunk/src/c/objects/Model.cpp
===================================================================
--- /issm/trunk/src/c/objects/Model.cpp	(revision 3631)
+++ /issm/trunk/src/c/objects/Model.cpp	(revision 3632)
@@ -61,5 +61,5 @@
 	
 	_printf_("   fill model with matlab workspace data\n");
-	IoModelInit(&iomodel,MODEL); 
+	iomodel=new IoModel(MODEL);
 
 	_printf_("   specifying analysis\n");
@@ -99,5 +99,5 @@
 
 	_printf_("   free ressources:\n");
-	DeleteIoModel(&iomodel);
+	delete iomodel;
 
 	/*Use all the data created to create an femmodel: */
@@ -136,5 +136,5 @@
 	
 	_printf_("   fill model with matlab workspace data\n");
-	IoModelInit(&iomodel,MODEL); 
+	iomodel=new IoModel(MODEL);
 
 	_printf_("   specifying analysis\n");
@@ -177,5 +177,5 @@
 
 	_printf_("   free ressources:\n");
-	DeleteIoModel(&iomodel);
+	delete iomodel;
 
 	/*Use all the data created to create an femmodel: */
Index: /issm/trunk/src/c/objects/Node.cpp
===================================================================
--- /issm/trunk/src/c/objects/Node.cpp	(revision 3631)
+++ /issm/trunk/src/c/objects/Node.cpp	(revision 3632)
@@ -25,23 +25,21 @@
 /*FUNCTION Node::Node() default constructor {{{2*/
 Node::Node(){
+	this->inputs=NULL;
 	return;
 }
 /*}}}*/
 /*FUNCTION Node::Node(int id, int vertex_id, int uppernode_id, int numdofs, NodeProperties*) {{{2*/
-Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_numdofs, NodeProperties* node_properties):
+Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_numdofs):
 	indexing(node_numdofs),
-	properties(node_properties),
     hvertex(&node_vertex_id,1),
     hupper_node(&node_upper_node_id,1){
 
 	this->id=node_id;
-
-	return;
-}
-/*}}}*/
-/*FUNCTION Node::Node(int id, DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* uppernode){{{2*/
-Node::Node(int node_id,DofIndexing* node_indexing, NodeProperties* node_properties, Hook* node_vertex, Hook* node_upper_node):
+	this->inputs=new Inputs();
+}
+/*}}}*/
+/*FUNCTION Node::Node(int id, DofIndexing* indexing, Hook* vertex, Hook* uppernode,Inputs* inputs){{{2*/
+Node::Node(int node_id,DofIndexing* node_indexing, Hook* node_vertex, Hook* node_upper_node,Inputs* node_inputs):
 	    indexing(node_indexing),
-		properties(node_properties),
 		hvertex(node_vertex),
 		hupper_node(node_upper_node) {
@@ -50,4 +48,10 @@
 	    this->id=node_id;
 
+		if(node_inputs){
+			this->inputs=(Inputs*)node_inputs->Copy();
+		}
+		else{
+			this->inputs=new Inputs();
+		}
 }
 /*}}}*/
@@ -68,7 +72,4 @@
 
 	this->indexing.Init(numdofs);
-
-	/*properties: */
-	this->properties.Init(i,iomodel);
 
 	/*hooks: */
@@ -159,4 +160,13 @@
 		}
 	}
+	
+	
+	//intialize inputs, and add as many inputs per element as requested: 
+	this->inputs=new Inputs();
+	if (iomodel->gridonbed) this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i]));
+	if (iomodel->gridonsurface) this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i]));
+	if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i]));
+	if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i]));
+
 }
 /*}}}*/
@@ -178,11 +188,5 @@
 	this->indexing.Init(numdofs);
 
-	/*properties (come from vertex number i): */
-	this->properties.Init(
-				(int)iomodel->gridonbed[i],
-				(int)iomodel->gridonsurface[i],
-				(int)iomodel->gridoniceshelf[i],
-				(int)iomodel->gridonicesheet[i]);
-
+	
 	/*hooks: */
 	vertex_id=i+1; //matlab indexing
@@ -203,4 +207,12 @@
 	this->hvertex.Init(&vertex_id,1);
 	this->hupper_node.Init(&upper_node_id,1);
+	
+	//intialize inputs, and add as many inputs per element as requested: 
+	this->inputs=new Inputs();
+	if (iomodel->gridonbed) this->inputs->AddInput(new BoolInput(NodeOnBedEnum,(IssmBool)iomodel->gridonbed[i]));
+	if (iomodel->gridonsurface) this->inputs->AddInput(new BoolInput(NodeOnSurfaceEnum,(IssmBool)iomodel->gridonsurface[i]));
+	if (iomodel->gridoniceshelf) this->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,(IssmBool)iomodel->gridoniceshelf[i]));
+	if (iomodel->gridonicesheet) this->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,(IssmBool)iomodel->gridonicesheet[i]));
+
 
 }
@@ -208,4 +220,5 @@
 /*FUNCTION Node::~Node(){{{2*/
 Node::~Node(){
+	delete inputs;
 	return;
 }
@@ -214,26 +227,18 @@
 /*Object management: {{{1*/
 /*FUNCTION Node::Configure {{{2*/
-void  Node::Configure(void* pnodes, void* pvertices){
+void  Node::Configure(DataSet* nodesin){
 
 	int i;
 
-	DataSet* nodesin=NULL;
-	DataSet* verticesin=NULL;
-
-	/*Recover pointers :*/
-	nodesin=(DataSet*)pnodes;
-	verticesin=(DataSet*)pvertices;
-
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
-	 * datasets, using internal ids and ofthis->indexing.f_sets hidden in hooks: */
-	hvertex.configure(verticesin);
+	 * datasets, using internal ids and offsets hidden in hooks: */
+	hvertex.configure(nodesin);
 	hupper_node.configure(nodesin);
 
 }
-/*}}}*/
 /*FUNCTION Node::copy {{{2*/
 Object* Node::copy() {
 		
-	return new Node(this->id,&this->indexing, &this->properties, &this->hvertex,&this->hupper_node);
+	return new Node(this->id,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs);
 
 }
@@ -246,5 +251,4 @@
 	printf("   id: %i\n",id);
 	indexing.DeepEcho();
-	properties.DeepEcho();
 	printf("Vertex:\n");
 	hvertex.DeepEcho();
@@ -252,4 +256,6 @@
 	//Do not Deepecho the upper_node otherwise DeepEcho will go crazy!
 	hupper_node.Echo();
+	printf("   inputs\n");
+	inputs->DeepEcho();
 
 }
@@ -270,8 +276,10 @@
 	/*demarshall objects: */
 	indexing.Demarshall(&marshalled_dataset);
-	properties.Demarshall(&marshalled_dataset);
 	hvertex.Demarshall(&marshalled_dataset);
 	hupper_node.Demarshall(&marshalled_dataset);
-	
+
+	/*demarshall inputs: */
+	inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 
+
 	/*return: */
 	*pmarshalled_dataset=marshalled_dataset;
@@ -285,7 +293,9 @@
 	printf("   id: %i\n",id);
 	indexing.Echo();
-	properties.Echo();
 	hvertex.Echo();
 	hupper_node.Echo();
+	printf("   inputs\n");
+	inputs->DeepEcho();
+
 
 }
@@ -348,4 +358,6 @@
 	char* marshalled_dataset=NULL;
 	int   enum_type=0;
+	char* marshalled_inputs=NULL;
+	int   marshalled_inputs_size;
 
 	/*recover marshalled_dataset: */
@@ -363,8 +375,16 @@
 	/*marshall objects: */
 	indexing.Marshall(&marshalled_dataset);
-	properties.Marshall(&marshalled_dataset);
 	hvertex.Marshall(&marshalled_dataset);
 	hupper_node.Marshall(&marshalled_dataset);
 
+	/*Marshall inputs: */
+	marshalled_inputs_size=inputs->MarshallSize();
+	marshalled_inputs=inputs->Marshall();
+	memcpy(marshalled_dataset,marshalled_inputs,marshalled_inputs_size*sizeof(char));
+	marshalled_dataset+=marshalled_inputs_size;
+
+	/*Free ressources:*/
+	xfree((void**)&marshalled_inputs);
+
 	*pmarshalled_dataset=marshalled_dataset;
 	return;
@@ -375,8 +395,8 @@
 
 	return sizeof(id)+
-		+indexing.MarshallSize()+
-		+properties.MarshallSize()+
-		+hvertex.MarshallSize()+
-		+hupper_node.MarshallSize()+
+		indexing.MarshallSize()+
+		hvertex.MarshallSize()+
+		hupper_node.MarshallSize()+
+		inputs->MarshallSize()+
 		sizeof(int); //sizeof(int) for enum type
 }
@@ -513,4 +533,7 @@
 	int          dofx,dofy;
 	int          isnodeonsurface;
+
+	bool onbed;
+	bool onsurface;
 	
 	Node* node=NULL;
@@ -519,7 +542,11 @@
 	double thickness;
 
+	/*recover parameters: */
+	inputs->GetParameterValue(&onbed,NodeOnBedEnum);
+	inputs->GetParameterValue(&onsurface,NodeOnSurfaceEnum);
+
 	/*Are we on the base, not on the surface, and not on a clone node?:*/
 	
-	if(properties.onbed==1 & indexing.clone==0 &properties.onsurface==0){
+	if(onbed==1 & indexing.clone==0 & onsurface==0){
 			
 		vertexdof=this->GetVertexDof();
@@ -636,6 +663,11 @@
 	int   i;
 
+	bool onbed;
+
+	/*recover parameters: */
+	inputs->GetParameterValue(&onbed,NodeOnBedEnum);
+
 	/*Is this node on bed? :*/
-	if (properties.onbed){
+	if (onbed){
 
 		if (strcmp(field_name,"velocity")==0){
@@ -802,20 +834,44 @@
 /*FUNCTION Node::IsOnBed {{{2*/
 int   Node::IsOnBed(){
-	return properties.onbed;
+
+	bool onbed;
+
+	/*recover parameters: */
+	inputs->GetParameterValue(&onbed,NodeOnBedEnum);
+
+	return onbed;
 }
 /*}}}*/
 /*FUNCTION Node::IsOnSheet {{{2*/
 int   Node::IsOnSheet(){
-	return properties.onsheet;
+
+	bool onsheet;
+
+	/*recover parameters: */
+	inputs->GetParameterValue(&onsheet,NodeOnIceSheetEnum);
+
+	return onsheet;
 }		
 /*}}}*/
 /*FUNCTION Node::IsOnShelf {{{2*/
 int   Node::IsOnShelf(){
-	return properties.onshelf;
+	
+	bool onshelf;
+
+	/*recover parameters: */
+	inputs->GetParameterValue(&onshelf,NodeOnIceShelfEnum);
+
+	return onshelf;
 }
 /*}}}*/
 /*FUNCTION Node::IsOnSurface {{{2*/
 int   Node::IsOnSurface(){
-	return properties.onsurface;
+
+	bool onsurface;
+
+	/*recover parameters: */
+	inputs->GetParameterValue(&onsurface,NodeOnSurfaceEnum);
+
+	return onsurface;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Node.h
===================================================================
--- /issm/trunk/src/c/objects/Node.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Node.h	(revision 3632)
@@ -7,21 +7,9 @@
 
 /*indefinitions: */
-class Object;
-class Vertex;
-struct IoModel;
-class Hook;
-class DofIndexing;
-class NodeProperties;
-class Node;
-class DofObject;
-
 #include "./Object.h"
 #include "./DofObject.h"
-#include "../DataSet/DataSet.h"
+#include "../DataSet/Inputs.h"
 #include "./Hook.h"
-#include "./Vertex.h"
 #include "./DofIndexing.h"
-#include "./NodeProperties.h"
-#include "../toolkits/toolkits.h"
 #include "../ModelProcessorx/IoModel.h"
 
@@ -33,8 +21,7 @@
 				
 		DofIndexing    indexing;
-		NodeProperties properties;
 		Hook           hvertex;
 		Hook           hupper_node;
-
+		Inputs*  inputs; //properties of this node
 		
 	public:
@@ -42,12 +29,12 @@
 		/*FUNCTION constructors, destructors {{{1*/
 		Node();
-		Node(int id,int vertex_id, int upper_node_id, int numberofdofs, NodeProperties* node_properties);
-		Node(int id,DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* upper_node);
-		Node(int i, IoModel* iomodel);
-		Node(int i,int j,IoModel* iomodel);
+		Node(int id,int vertex_id, int upper_node_id, int numberofdofs);
+		Node(int id,DofIndexing* indexing, Hook* vertex, Hook* upper_node, Inputs* inputs);
+		Node(int id, int i, IoModel* iomodel);
+		Node(int id, int i,int j,IoModel* iomodel);
 		~Node();
 		/*}}}*/
 		/*FUNCTION object management {{{1*/
-		void  Configure(void* pnodes, void* pvertices);
+		void  Configure(DataSet* nodes);
 		void  DeepEcho();
 		void  Demarshall(char** pmarshalled_dataset);
Index: /issm/trunk/src/c/objects/Pengrid.cpp
===================================================================
--- /issm/trunk/src/c/objects/Pengrid.cpp	(revision 3631)
+++ /issm/trunk/src/c/objects/Pengrid.cpp	(revision 3632)
@@ -35,7 +35,6 @@
 /*FUNCTION Pengrid::Pengrid(int id, int node_ids int matpar_id){{{1*/
 Pengrid::Pengrid(int pengrid_id,int pengrid_node_id, int pengrid_element_id,int pengrid_matpar_id): 
-	hnode(pengrid_node_id,1),
-	helement(pengrid_element_id,1),
-	hmatice(&pengrid_matice_id,1),
+	hnode(&pengrid_node_id,1),
+	helement(&pengrid_element_id,1),
 	hmatpar(&pengrid_matpar_id,1)
 {
@@ -76,24 +75,4 @@
 }
 /*}}}*/
-Pengrid::Pengrid(int	pengrid_id, int pengrid_node_id,int pengrid_mparid, int pengrid_dof, int pengrid_active, double pengrid_penalty_offset,int pengrid_thermal_steadystate,int pengrid_stabilize_constraints){
-	
-	id=pengrid_id;
-	node_id=pengrid_node_id;
-	mparid=pengrid_mparid;
-	dof=pengrid_dof;
-	active=pengrid_active;
-	penalty_offset =pengrid_penalty_offset;
-	thermal_steadystate=pengrid_thermal_steadystate;
-	stabilize_constraints=pengrid_stabilize_constraints;
-
-	node_offset=UNDEF;
-	node=NULL;
-	matpar=NULL;
-	matpar_offset=UNDEF;
-
-
-	return;
-}
-/*}}}1*/
 /*FUNCTION Pengrid::Pengrid(int index, int id, IoModel* iomodel){{{1*/
 Pengrid::Pengrid(int id, int index, IoModel* iomodel){ //i is the element index
@@ -112,6 +91,6 @@
 	pengrid_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object
 
-	this->hnode.Init(pengrid_node_ids,1);
-	this->helement.Init(pengrid_element_id,1);
+	this->hnode.Init(&pengrid_node_id,1);
+	this->helement.Init(&pengrid_element_id,1);
 	this->hmatpar.Init(&pengrid_matpar_id,1);
 
@@ -136,5 +115,5 @@
 /*Object management*/
 /*FUNCTION Pengrid::Configure {{{1*/
-void  Pengrid::Configure(DataSet* elementsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
+void  Pengrid::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){
 
 	/*Take care of hooking up all objects for this load, ie links the objects in the hooks to their respective 
@@ -310,8 +289,8 @@
 
 	/*dynamic objects pointed to by hooks: */
-	Node node=NULL;
+	Node* node=NULL;
 
 	/*recover objects from hooks: */
-	node=(Node**)hnode.deliverp();
+	node=(Node*)hnode.delivers();
 	
 	node->GetDofList(&doflist_per_node[0],&numberofdofspernode);
@@ -356,8 +335,6 @@
 	//   The penalty is stable if it doesn't change during to successive iterations.   
 
-	int found=0;
+	int    found=0;
 	const int numgrids=1;
-
-
 	double pressure;
 	double temperature;
@@ -365,10 +342,13 @@
 	double meltingpoint;
 	int    new_active;
-	int  dofs1[1]={0};
-	int  unstable=0;
-	int  reset_penalties=0;
-	
-	ParameterInputs* inputs=NULL;
-
+	int    unstable=0;
+	int    reset_penalties=0;
+	int    stabilize_constraints;
+
+	/*pointers: */
+	Node* node=NULL;
+	Penta* penta=NULL;
+	Matpar*  matpar=NULL;
+	
 	/*check that pengrid is not a clone (penalty to be added only once)*/
 	if (node->IsClone()){
@@ -378,19 +358,22 @@
 	}
 
-	//First recover beta, pressure and temperature vectors;
-	found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" could not find pressure in inputs!");
-
-	found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" could not find temperature in inputs!");
-	
-	found=inputs->Recover("reset_penalties",&reset_penalties);
-
-	if(reset_penalties)zigzag_counter=0;
-
-	//Compute pressure melting point
+	/*recover pointers: */
+	node=(Node*)hnode.delivers();
+	penta=(Penta*)helement.delivers();
+	matpar=(Matpar*)hmatpar.delivers();
+
+	//First recover pressure and temperature values, using the element: */
+	penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
+	penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum);
+
+	//Recover our data:
+	inputs->GetParameterValue(&reset_penalties,ResetPenaltiesEnum);
 	meltingpoint=matpar->GetMeltingPoint();
 	beta=matpar->GetBeta();
-
+	parameters->FindParam(&stabilize_constraints,"stabilize_constraints");
+	
+	if(reset_penalties)zigzag_counter=0;
+
+	//Compute pressure melting point
 	t_pmp=meltingpoint-beta*pressure;
 
@@ -466,18 +449,23 @@
 	int found=0;
 	double Ke[4][4]={0.0};
-	
-	ParameterInputs* inputs=NULL;
-
-	/*recover pointers: */
-	inputs=(ParameterInputs*)vinputs;
+	double penalty_offset;
+
+	/*pointers: */
+	Node* node=NULL;
+	Penta* penta=NULL;
 
 	/*Get dof list: */
 	GetDofList(&doflist[0],&numberofdofspernode);
-	
-	/*recover slope: */
-	found=inputs->Recover("bedslopex",&slope[0],1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" bedslopex needed in inputs!");
-	found=inputs->Recover("bedslopey",&slope[1],1,dofs2,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" bedslopey needed in inputs!");
+
+	/*recover pointers: */
+	node=(Node*)hnode.delivers();
+	penta=(Penta*)helement.delivers();
+
+	//recover slope: */
+	penta->inputs->GetParameterValueAtNode(&slope[0],node,BedSlopexEnum);
+	penta->inputs->GetParameterValueAtNode(&slope[1],node,BedSlopeyEnum);
+	
+	/*recover parameters: */
+	parameters->FindParam(&penalty_offset,"penalty_offset");
 
 	//Create elementary matrix: add penalty to contrain wb (wb=ub*db/dx+vb*db/dy)
@@ -507,18 +495,25 @@
 	double temperature;
 	double beta,t_pmp;
-
-	ParameterInputs* inputs=NULL;
+	double penalty_offset;
+
+	/*pointers: */
+	Node* node=NULL;
+	Penta* penta=NULL;
+	Matpar*  matpar=NULL;
+
+	/*recover pointers: */
+	node=(Node*)hnode.delivers();
+	penta=(Penta*)helement.delivers();
+	matpar=(Matpar*)hmatpar.delivers();
 
 	/*check that pengrid is not a clone (penalty to be added only once)*/
 	if (node->IsClone()) return;
 
-	/*recover pointers: */
-	inputs=(ParameterInputs*)vinputs;
-
-	found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" could not find pressure in inputs!");
-
-	found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" could not find temperature in inputs!");
+	//First recover pressure and temperature values, using the element: */
+	penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
+	penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum);
+
+	/*recover parameters: */
+	parameters->FindParam(&penalty_offset,"penalty_offset");
 
 	/*Get dof list: */
@@ -549,12 +544,10 @@
 	int       doflist[numdof];
 	int       numberofdofspernode;
-
-	ParameterInputs* inputs=NULL;
-
-	/*recover pointers: */
-	inputs=(ParameterInputs*)vinputs;
-
-
-	if(!active)return;
+	double    penalty_offset;
+
+	if(!this->active)return;
+
+	/*recover parameters: */
+	parameters->FindParam(&penalty_offset,"penalty_offset");
 
 	/*Get dof list: */
@@ -610,29 +603,28 @@
 	double latentheat;
 	double t_pmp;
-	double dt;
-
-	ParameterInputs* inputs=NULL;
+	double dt,penalty_offset;
+
+	/*pointers: */
+	Node* node=NULL;
+	Penta* penta=NULL;
+	Matpar*  matpar=NULL;
+
+	/*recover pointers: */
+	node=(Node*)hnode.delivers();
+	penta=(Penta*)helement.delivers();
+	matpar=(Matpar*)hmatpar.delivers();
 
 	/*check that pengrid is not a clone (penalty to be added only once)*/
 	if (node->IsClone()) return;
 
-	/*recover pointers: */
-	inputs=(ParameterInputs*)vinputs;
-
 	/*Get dof list: */
 	GetDofList(&doflist[0],&numberofdofspernode);
 
-	//First recover pressure,melting offset and temperature vectors
-	found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" could not find pressure in inputs!");
-
-	found=inputs->Recover("temperature",&temperature,1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" could not find temperature in inputs!");
-
-	found=inputs->Recover("melting_offset",&melting_offset);
-	if(!found)ISSMERROR(" could not find melting_offset in inputs!");
-
-	found=inputs->Recover("dt",&dt);
-	if(!found)ISSMERROR(" could not find dt in inputs!");
+	//First recover pressure and temperature values, using the element: */
+	penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
+	penta->inputs->GetParameterValueAtNode(&temperature,node,TemperatureEnum);
+	inputs->GetParameterValue(&melting_offset,MeltingOffsetEnum);
+	parameters->FindParam(&dt,"dt");
+	parameters->FindParam(&penalty_offset,"penalty_offset");
 
 	meltingpoint=matpar->GetMeltingPoint();
@@ -679,18 +671,24 @@
 	double beta;
 	double t_pmp;
-
-	ParameterInputs* inputs=NULL;
+	double penalty_offset;
+
+	/*pointers: */
+	Node* node=NULL;
+	Penta* penta=NULL;
+	Matpar*  matpar=NULL;
 
 	/*recover pointers: */
-	inputs=(ParameterInputs*)vinputs;
-
-	if(!active)return;
+	node=(Node*)hnode.delivers();
+	penta=(Penta*)helement.delivers();
+	matpar=(Matpar*)hmatpar.delivers();
+
+	if(!this->active)return;
 
 	/*Get dof list: */
 	GetDofList(&doflist[0],&numberofdofspernode);
 
-	//First recover pressure
-	found=inputs->Recover("pressure",&pressure,1,dofs1,numgrids,(void**)&node);
-	if(!found)ISSMERROR(" could not find pressure in inputs!");
+	//First recover pressure  and penalty_offset
+	penta->inputs->GetParameterValueAtNode(&pressure,node,PressureEnum);
+	parameters->FindParam(&penalty_offset,"penalty_offset");
 
 	//Compute pressure melting point
Index: /issm/trunk/src/c/objects/Pengrid.h
===================================================================
--- /issm/trunk/src/c/objects/Pengrid.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Pengrid.h	(revision 3632)
@@ -38,5 +38,5 @@
 		/*}}}*/
 		/*FUNCTION object management {{{1*/
-		void  Configure(void* elements,void* nodes,void* materials);
+		void  Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin);
 		Object* copy();
 		void  DeepEcho();
Index: /issm/trunk/src/c/objects/Penpair.cpp
===================================================================
--- /issm/trunk/src/c/objects/Penpair.cpp	(revision 3631)
+++ /issm/trunk/src/c/objects/Penpair.cpp	(revision 3632)
@@ -55,11 +55,5 @@
 /*Object marshall*/
 /*FUNCTION Penpair::Configure {{{1*/
-
-void  Penpair::Configure(void* pelementsin,void* pnodesin,void* pmaterialsin){
-
-	DataSet* nodesin=NULL;
-
-	/*Recover pointers :*/
-	nodesin=(DataSet*)pnodesin;
+void  Penpair::Configure(DataSet* elementsin,DataSet* loadsin,DataSet* nodesin,DataSet* verticesin,DataSet* materialsin,Parameters* parametersin){
 
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
@@ -151,14 +145,9 @@
 }
 /*}}}1*/
-/*FUNCTION Penpair::UpdateFromInputs {{{1*/
-void  Penpair::UpdateFromInputs(void* inputs){
-	
-}
-/*}}}1*/
 
 /*Object functions*/
 /*FUNCTION Penpair::CreateKMatrix {{{1*/
 
-void  Penpair::CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
+void  Penpair::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){
 
 	/*No loads applied, do nothing: */
@@ -168,5 +157,5 @@
 /*}}}1*/
 /*FUNCTION Penpair::CreatePVector {{{1*/
-void  Penpair::CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
+void  Penpair::CreatePVector(Vec pg, int analysis_type,int sub_analysis_type){
 
 	/*No loads applied, do nothing: */
@@ -196,5 +185,5 @@
 /*}}}1*/
 /*FUNCTION Penpair::PenaltyCreateKMatrix {{{1*/
-void  Penpair::PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type){
+void  Penpair::PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type){
 	
 	/*If you code this piece, don't forget that a penalty will be inactive if it is dealing with clone nodes*/
@@ -204,5 +193,5 @@
 /*}}}1*/
 /*FUNCTION Penpair::PenaltyCreatePVector {{{1*/
-void  Penpair::PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type){
+void  Penpair::PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type){
 	/*No loads applied, do nothing: */
 	return;
Index: /issm/trunk/src/c/objects/Penpair.h
===================================================================
--- /issm/trunk/src/c/objects/Penpair.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Penpair.h	(revision 3632)
@@ -34,10 +34,9 @@
 		int   GetId(); 
 		int   MyRank();
-		void  Configure(void* elements,void* nodes,void* materials);
-		void  CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type);
-		void  CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type);
-		void  UpdateFromInputs(void* inputs);
-		void  PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
-		void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
+		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* vertices,DataSet* materials,Parameters* parameters);
+		void  CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type);
+		void  CreatePVector(Vec pg, int analysis_type,int sub_analysis_type);
+		void  PenaltyCreateKMatrix(Mat Kgg,double kmax,int analysis_type,int sub_analysis_type);
+		void  PenaltyCreatePVector(Vec pg,double kmax,int analysis_type,int sub_analysis_type);
 		Object* copy();
 
Index: /issm/trunk/src/c/objects/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Penta.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Penta.h	(revision 3632)
@@ -27,5 +27,5 @@
 class Penta: public Element{
 
-	private: 
+	public:
 
 		int id;
@@ -36,6 +36,4 @@
 		Parameters* parameters; //pointer to solution parameters
 		Inputs* inputs;
-
-	public:
 
 		/*FUNCTION constructors, destructors {{{1*/
Index: /issm/trunk/src/c/objects/Sing.h
===================================================================
--- /issm/trunk/src/c/objects/Sing.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Sing.h	(revision 3632)
@@ -18,5 +18,5 @@
 class Sing: public Element{
 
-	private: 
+	public:
 
 		/*ids:*/
@@ -30,5 +30,4 @@
 		Inputs* inputs;
 
-	public:
 
 		/*constructors, destructors: {{{1*/
Index: /issm/trunk/src/c/objects/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Tria.cpp	(revision 3631)
+++ /issm/trunk/src/c/objects/Tria.cpp	(revision 3632)
@@ -63,5 +63,5 @@
 }
 /*}}}*/
-/*FUNCTION Tria::Tria(int id, int i, IoModel* iomodel){{{1*/
+/*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel){{{1*/
 Tria::Tria(int tria_id, int index, IoModel* iomodel){ //i is the element index
 
@@ -154,6 +154,4 @@
 /*FUNCTION Tria::Configure {{{1*/
 void  Tria::Configure(DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){
-
-	int i;
 
 	/*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 
Index: /issm/trunk/src/c/objects/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Tria.h	(revision 3631)
+++ /issm/trunk/src/c/objects/Tria.h	(revision 3632)
@@ -17,5 +17,5 @@
 class Tria: public Element{
 
-	private: 
+	public:
 
 		int  id;
@@ -27,6 +27,4 @@
 		Parameters* parameters; //pointer to solution parameters
 		Inputs*  inputs;
-	
-	public:
 
 		/*FUNCTION constructors, destructors {{{1*/
