Index: /issm/trunk/src/c/DataSet/DataSet.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 4020)
+++ /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 4021)
@@ -550,5 +550,5 @@
 /*Objects methods*/
 /*FUNCTION DataSet::Configure{{{1*/
-void DataSet::Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,analysis_counter,analysis_type){
+void DataSet::Configure(DataSet* elements,DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_counter,int analysis_type){
 
 	vector<Object*>::iterator object;
@@ -562,5 +562,5 @@
 
 			element=(Element*)(*object);
-			element->Configure(elements,loads,nodes,materials,parameters);
+			element->Configure(elements,loads,nodes,materials,parameters,analysis_counter);
 		}
 		if(EnumIsLoad((*object)->Enum())){
@@ -924,5 +924,5 @@
 
 			rgb=(Rgb*)(*object);
-			if(rgb->InAnalysis(analysis_type))count++
+			if(rgb->InAnalysis(analysis_type))count++;
 		}
 	}
Index: /issm/trunk/src/c/DataSet/DataSet.h
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.h	(revision 4020)
+++ /issm/trunk/src/c/DataSet/DataSet.h	(revision 4021)
@@ -58,5 +58,5 @@
 		void  FlagClones(int numberofnodes);
 		int   NumberOfDofs(int analysis_type);
-		int   NumberOfRgbs();
+		int   NumberOfRgbs(int analysis_type);
 		void  SetupSpcs(DataSet* nodes,Vec yg,int analysis_type);
 		void  SetupMpcs(Mat Rmg,DataSet* nodes,int analysis_type);
Index: /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp	(revision 4020)
+++ /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.cpp	(revision 4021)
@@ -10,5 +10,5 @@
 #include "../../EnumDefinitions/EnumDefinitions.h"
 
-int	ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_type){
+int	ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials,Parameters* parameters,int analysis_counter,int analysis_type){
 
 	/*Intermediary*/
Index: /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.h
===================================================================
--- /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.h	(revision 4020)
+++ /issm/trunk/src/c/modules/ConfigureObjectsx/ConfigureObjectsx.h	(revision 4021)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-int ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters,int analysis_type);
+int ConfigureObjectsx( DataSet* elements, DataSet* loads, DataSet* nodes, DataSet* vertices, DataSet* materials, Parameters* parameters,int analysis_counter, int analysis_type);
 
 #endif  /* _CONFIGUREOBJECTSX_H */
Index: /issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp
===================================================================
--- /issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp	(revision 4020)
+++ /issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.cpp	(revision 4021)
@@ -10,5 +10,5 @@
 
 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofgrids,double* elements,
-		int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, char* meshtype,int num_procs){
+		int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, int dim,int num_procs){
 
 	int noerr=1;
@@ -30,5 +30,5 @@
 	int  edgecut=1;
 
-	if(strcmp(meshtype,"2d")==0){
+	if(dim==2){
 		epart=(int*)xmalloc(numberofelements*sizeof(int));
 		npart=(int*)xmalloc(numberofgrids*sizeof(int));
Index: /issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h
===================================================================
--- /issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 4020)
+++ /issm/trunk/src/c/modules/MeshPartitionx/MeshPartitionx.h	(revision 4021)
@@ -8,5 +8,5 @@
 /* local prototypes: */
 int MeshPartitionx(int** pepart, int** pnpart, int numberofelements,int numberofgrids,double* elements,
-		int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, char* meshtype,int numareas);
+		int numberofelements2d,int numberofgrids2d,double* elements2d,int numlayers,int elements_width, int dim,int numareas);
 	
 #endif /* _MESHPARTITIONX_H */
Index: /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp
===================================================================
--- /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 4020)
+++ /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.cpp	(revision 4021)
@@ -13,34 +13,40 @@
 #include "../../io/io.h"
 #include "../../objects/objects.h"
-
-void OutputResults(DataSet* results,char* filename){
-
-	int i;
-	Result* result=NULL;
-	FILE* fid=NULL;
-	extern int my_rank;
-
-	/* Open output file to write raw binary data: */
-	if(my_rank==0){
-		fid=pfopen(filename,"wb");
-
-		for(i=0;i<results->Size();i++){
-			result=(Result*)results->GetObjectByOffset(i);
-
-			/*write result to disk: */
-			result->WriteData(fid);
-		}
 		
-		/*Close file: */
-		pfclose(fid,filename);
-	}
+void OutputResults(FemModel* femmodel, char* filename,int analysis_type){
 
 
-	/*output if we have rifts: */
-	if(numrifts){
-		OutputRiftsx( &riftproperties,fem_dh->loads,numrifts);
-		results->AddObject(new Result(results->Size()+1,0,1,"riftproperties",riftproperties));
-	}
-
+	ISSMERROR(" not supported yet!");
+	
+	
+//	
+//	
+//	int i;
+//	Result* result=NULL;
+//	FILE* fid=NULL;
+//	extern int my_rank;
+//
+//	/* Open output file to write raw binary data: */
+//	if(my_rank==0){
+//		fid=pfopen(filename,"wb");
+//
+//		for(i=0;i<results->Size();i++){
+//			result=(Result*)results->GetObjectByOffset(i);
+//
+//			/*write result to disk: */
+//			result->WriteData(fid);
+//		}
+//		
+//		/*Close file: */
+//		pfclose(fid,filename);
+//	}
+//
+//
+//	/*output if we have rifts: */
+//	if(numrifts){
+//		OutputRiftsx( &riftproperties,fem_dh->loads,numrifts);
+//		results->AddObject(new Result(results->Size()+1,0,1,"riftproperties",riftproperties));
+//	}
+//
 
 }
Index: /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h
===================================================================
--- /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 4020)
+++ /issm/trunk/src/c/modules/OutputResultsx/OutputResultsx.h	(revision 4021)
@@ -9,5 +9,5 @@
 
 /* local prototypes: */
-void OutputResults(DataSet* results,char* filename);
+void OutputResults(FemModel* femmodel, char* filename,int analysis_type);
 
 #endif  /* _OUTPUTRESULTS_H */
Index: /issm/trunk/src/c/objects/Elements/Beam.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Beam.cpp	(revision 4021)
@@ -33,25 +33,30 @@
 
 /*Object management*/
-/*FUNCTION Beam::Configure{{{1*/
-void  Beam::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){
-
-	int i;
-	
-	/*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);
-	hmatice.configure(materialsin);
-	hmatpar.configure(materialsin);
-
-	/*point parameters to real dataset: */
-	this->parameters=parametersin;
-
-}
-/*}}}*/
 /*FUNCTION Beam::copy{{{1*/
 Object* Beam::copy() {
-	
-	return new Beam(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,this->parameters,this->inputs);
-
+
+	int i;
+	Beam* beam=NULL;
+
+	beam=new Beam();
+
+	/*copy fields: */
+	beam->id=this->id;
+	if(this->inputs){
+		beam->inputs=(Inputs*)this->inputs->Copy();
+	}
+	else{
+		beam->inputs=new Inputs();
+	}
+	/*point parameters: */
+	beam->parameters=this->parameters;
+
+	/*pointers: */
+	beam->nodes=(Node**)xmalloc(2*sizeof(Node*)); 
+	for(i=0;i<2;i++)beam->nodes[i]=this->nodes[i];
+	beam->matice=this->matice;
+	beam->matpar=this->matpar;
+
+	return beam;
 }
 /*}}}*/
@@ -59,9 +64,13 @@
 void Beam::DeepEcho(void){
 
+	int i;
+
 	printf("Beam:\n");
 	printf("   id: %i\n",id);
-	hnodes.DeepEcho();
-	hmatice.DeepEcho();
-	hmatpar.DeepEcho();
+	for(i=0;i<2;i++){
+		nodes[i]->DeepEcho();
+	}
+	matice->DeepEcho();
+	matpar->DeepEcho();
 	printf("   parameters\n");
 	parameters->DeepEcho();
@@ -74,29 +83,5 @@
 /*FUNCTION Beam::Demarshall{{{1*/
 void  Beam::Demarshall(char** pmarshalled_dataset){
-
-	char* marshalled_dataset=NULL;
-	int   i;
-
-	/*recover marshalled_dataset: */
-	marshalled_dataset=*pmarshalled_dataset;
-
-	/*this time, no need to get enum type, the pointer directly points to the beginning of the 
-	 *object data (thanks to DataSet::Demarshall):*/
-	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
-
-	/*demarshall hooks: */
-	hnodes.Demarshall(&marshalled_dataset);
-	hmatice.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: */
-	*pmarshalled_dataset=marshalled_dataset;
-	return;
+	ISSMERROR("not supported yet!");
 }
 /*}}}*/
@@ -104,9 +89,13 @@
 void Beam::Echo(void){
 
+	int i;
+
 	printf("Beam:\n");
 	printf("   id: %i\n",id);
-	hnodes.Echo();
-	hmatice.Echo();
-	hmatpar.Echo();
+	for(i=0;i<2;i++){
+		nodes[i]->DeepEcho();
+	}
+	matice->DeepEcho();
+	matpar->DeepEcho();
 	printf("   parameters\n");
 	parameters->Echo();
@@ -128,50 +117,10 @@
 /*FUNCTION Beam::Marshall{{{1*/
 void  Beam::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 Beam: */
-	enum_type=BeamEnum;
-	
-	/*marshall enum: */
-	memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
-	
-	/*marshall Beam data: */
-	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
-
-	/*Marshall hooks: */
-	hnodes.Marshall(&marshalled_dataset);
-	hmatice.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;
-	return;
+	ISSMERROR("not supported yet!");
 }
 /*}}}*/
 /*FUNCTION Beam::MarshallSize{{{1*/
 int   Beam::MarshallSize(){
-	
-	return sizeof(id)
-		+hnodes.MarshallSize()
-		+hmatice.MarshallSize()
-		+hmatpar.MarshallSize()
-		+inputs->MarshallSize()
-		+sizeof(int); //sizeof(int) for enum type
+	ISSMERROR("not supported yet!");
 }
 /*}}}*/
@@ -207,16 +156,6 @@
 	double gauss[numgrids][numgrids]={{1,0},{0,1}};
 
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-	Matpar* matpar=NULL;
-	Matice* matice=NULL;
-	
 	/*Get dof list on which we will plug the pressure values: */
 	GetDofList1(&doflist[0]);
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	matpar=(Matpar*)hmatpar.delivers();
-	matice=(Matice*)hmatice.delivers();
 
 	/*Get node data: */
@@ -288,10 +227,4 @@
 	double one0,one1;
 	
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-
 	connectivity[0]=nodes[0]->GetConnectivity();
 	connectivity[1]=nodes[1]->GetConnectivity();
@@ -387,14 +320,4 @@
 	bool onsurface;
 	int  connectivity[2];
-
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-	Matpar* matpar=NULL;
-	Matice* matice=NULL;
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	matpar=(Matpar*)hmatpar.delivers();
-	matice=(Matice*)hmatice.delivers();
 
 	/*recover doflist: */
@@ -510,10 +433,4 @@
 	int numberofdofspernode;
 	
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	
 	for(i=0;i<2;i++){
 		nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode);
@@ -531,10 +448,4 @@
 void  Beam::GetDofList1(int* doflist){
 
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	
 	int i;
 	for(i=0;i<2;i++){
@@ -564,10 +475,4 @@
 /*FUNCTION Beam::GetMatPar{{{1*/
 void* Beam::GetMatPar(){
-
-	/*dynamic objects pointed to by hooks: */
-	Matpar* matpar=NULL;
-
-	/*recover objects from hooks: */
-	matpar=(Matpar*)hmatpar.delivers();
 
 	return matpar;
@@ -591,13 +496,7 @@
 	Node** pnodes=NULL;
 
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-	
 	/*recover nodes: */
 	pnodes=(Node**)vpnodes;
 
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	
 	for(i=0;i<3;i++){
 		pnodes[i]=nodes[i];
@@ -677,6 +576,4 @@
 	/*Check that name is an element input*/
 	if (!IsInput(name)) return;
-	Node**  nodes=NULL;
-
 	switch(type){
 
@@ -687,5 +584,4 @@
 
 			/*Get values on the 6 vertices*/
-			nodes=(Node**)hnodes.deliverp();
 			for (int i=0;i<2;i++){
 				values[i]=vector[nodes[i]->GetVertexDof()];
@@ -780,5 +676,4 @@
 	bool     found      = false;
 	int      count      = 0;
-	Node   **nodes      = NULL;
 	double  *this_patch = NULL;
 
@@ -801,7 +696,4 @@
 		count=*pcount;
 
-		/*Recover nodes: */
-		nodes=(Node**)hnodes.deliverp();
-
 		/*set this_patch to point at the beginning of the patches row, where we will plug our information :*/
 		this_patch=patches+numcols*count;
Index: /issm/trunk/src/c/objects/Elements/Beam.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Beam.h	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Beam.h	(revision 4021)
@@ -14,4 +14,7 @@
 class Inputs;
 class IoModel;
+class Node;
+class Matice;
+class Matpar;
 
 #include "../../shared/Exceptions/exceptions.h"
@@ -26,7 +29,7 @@
 		int id;
 
-		Hook hnodes;  //hook to 2 nodes
-		Hook hmatice; //hook to 1 matice
-		Hook hmatpar; //hook to 1 matpar
+		Node**  nodes; //2 nodes
+		Matice* matice;
+		Matpar* matpar;
 		
 		Parameters* parameters; //pointer to solution parameters
@@ -39,4 +42,5 @@
 		/*}}}*/
 		/*object management: {{{1*/
+		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
 		void  Echo();
 		void  DeepEcho();
@@ -48,5 +52,4 @@
 		bool  IsInput(int name);
 		int   MyRank();
-		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
 		Object* copy();
 		void  SetClone(int* minranks);
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4021)
@@ -78,10 +78,10 @@
 
 	//collpase flags
-	collapse=(bool*)xcalloc(nummodels*sizeof(bool));
-
-}
-/*}}}*/
-/*FUNCTION Penta::Update(IoModel* iomodel,int analysis_counter) {{{1*/
-Penta::Update(IoModel* iomodel,int analysis_counter){ 
+	collapse=(bool*)xcalloc(nummodels,sizeof(bool));
+
+}
+/*}}}*/
+/*FUNCTION Penta::Update(IoModel* iomodel,int analysis_counter,int analysis_type) {{{1*/
+void Penta::Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type){ 
 
 	/*Intermediaries*/
@@ -107,5 +107,5 @@
 
 	/*hooks: */
-	this->SettHookNodes(penta_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
+	this->SetHookNodes(penta_node_ids,analysis_counter); this->nodes=NULL; //set hook to nodes, for this analysis type
 
 	//intialize inputs, and add as many inputs per element as requested: 
@@ -227,4 +227,6 @@
 Object* Penta::copy() {
 
+	int i;
+
 	Penta* penta=NULL;
 
@@ -243,6 +245,6 @@
 
 	/*now deal with hooks and objects: */
-	penta->InitHookNodes(this->nummodels);
-	for(i=0;i<this->nummodels;i++)penta->hnodes[i].copy(&this->hnodes[i]);
+	penta->InitHookNodes(this->numanalyses);
+	for(i=0;i<this->numanalyses;i++)penta->hnodes[i].copy(&this->hnodes[i]);
 	penta->hmatice.copy(&this->hmatice);
 	penta->hmatpar.copy(&this->hmatpar);
@@ -294,12 +296,12 @@
 
 	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
-	memcpy(&nummodels,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
+	memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
 
 	/*allocate dynamic memory: */
-	collapse=(bool*)xmalloc(nummodels*sizeof(bool));
-	InitHookNodes(nummodels);
+	collapse=(bool*)xmalloc(numanalyses*sizeof(bool));
+	InitHookNodes(numanalyses);
 
 	/*demarshall hooks: */
-	for(i=0;i<nummodels;i++)hnodes[i].Demarshall(&marshalled_dataset);
+	for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset);
 	hmatice.Demarshall(&marshalled_dataset);
 	hmatpar.Demarshall(&marshalled_dataset);
@@ -316,5 +318,5 @@
 
 	/*demarshall internal parameters: */
-	memcpy(collapse,marshalled_dataset,nummodels*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool);
+	memcpy(collapse,marshalled_dataset,numanalyses*sizeof(bool));marshalled_dataset+=numanalyses*sizeof(bool);
 
 	/*parameters: may not exist even yet, so let Configure handle it: */
@@ -347,5 +349,5 @@
 	inputs->DeepEcho();
 	printf("   collapse: \n   ");
-	for(i=0;i<nummodels;i++)printf("%s|",value?"true":"false");
+	for(i=0;i<numanalyses;i++)printf("%s|",collapse[i]?"true":"false");
 	return;
 }
@@ -384,8 +386,8 @@
 	/*marshall Penta data: */
 	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
-	memcpy(marshalled_dataset,&nummodels,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
+	memcpy(marshalled_dataset,&numanalyses,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
 
 	/*Marshall hooks: */
-	for(i=0;i<nummodels;i++)hnodes[i].Marshall(&marshalled_dataset);
+	for(i=0;i<numanalyses;i++)hnodes[i].Marshall(&marshalled_dataset);
 	hmatice.Marshall(&marshalled_dataset);
 	hmatpar.Marshall(&marshalled_dataset);
@@ -399,5 +401,5 @@
 
 	/*marshall internal parameters: */
-	memcpy(marshalled_dataset,collapse,nummodels*sizeof(bool));marshalled_dataset+=nummodels*sizeof(bool);
+	memcpy(marshalled_dataset,collapse,numanalyses*sizeof(bool));marshalled_dataset+=numanalyses*sizeof(bool);
 
 	/*parameters: don't do anything about it. parameters are marshalled somewhere else!*/
@@ -415,5 +417,5 @@
 	int hnodes_size=0;;
 
-	for(i=0;i<nummodels;i++)hnodes_size+=hnodes[i].MarshallSize;
+	for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i].MarshallSize();
 
 	return sizeof(id)
@@ -423,5 +425,5 @@
 		+hneighbors.MarshallSize()
 		+inputs->MarshallSize()
-		+nummodels*sizeof(bool)
+		+numanalyses*sizeof(bool)
 		+sizeof(int); //sizeof(int) for enum type
 }
@@ -429,4 +431,6 @@
 /*FUNCTION Penta::SpawnTria {{{1*/
 void*  Penta::SpawnTria(int g0, int g1, int g2){
+
+	int i;
 
 	/*out of grids g0,g1 and g2 from Penta, build a tria element: */
@@ -460,4 +464,6 @@
 /*FUNCTION Penta::SpawnBeam {{{1*/
 void* Penta::SpawnBeam(int g0, int g1){
+
+	int i;
 
 	/*out of grids g0,g1 and g2 from Penta, build a beam element: */
@@ -1173,5 +1179,5 @@
 		else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
 	}
-	else if (analysis_type==SlopecomputeAnalysisEnum){
+	else if (analysis_type==SlopeComputeAnalysisEnum){
 		CreateKMatrixSlopeCompute( Kgg,analysis_type,sub_analysis_type);
 	}
@@ -1667,5 +1673,5 @@
 
 		/*build friction object, used later on: */
-		friction=new Friction("2d",inputs,matpar);
+		friction=new Friction("2d",inputs,matpar,analysis_type);
 
 		for(i=0;i<numgrids2d;i++){
@@ -2250,5 +2256,5 @@
 		else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
 	}
-	else if (analysis_type==SlopecomputeAnalysisEnum){
+	else if (analysis_type==SlopeComputeAnalysisEnum){
 		CreatePVectorSlopeCompute( pg,analysis_type,sub_analysis_type);
 	}
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 4021)
@@ -43,9 +43,9 @@
 		Penta();
 		Penta(int penta_id,int i, IoModel* iomodel,int nummodels);
+		void Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type);
 		~Penta();
 		/*}}}*/
 		/*FUNCTION object management {{{1*/
 		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
-		void Update(IoModel* iomodel,int analysis_counter,int analysis_type);
 		Object* copy();
 		void  DeepEcho();
Index: /issm/trunk/src/c/objects/Elements/PentaHook.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/PentaHook.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/PentaHook.cpp	(revision 4021)
@@ -24,5 +24,5 @@
 PentaHook::PentaHook(){
 	numanalyses=UNDEF;
-	this->hooks=NULL;
+	this->hnodes=NULL;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Sing.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Sing.cpp	(revision 4021)
@@ -36,14 +36,5 @@
 void  Sing::Configure(DataSet* elementsin,DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin,int analysis_counter){
 
-	int i;
-	
-	/*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);
-	hmatice.configure(materialsin);
-	hmatpar.configure(materialsin);
-
-	/*point parameters to real dataset: */
-	this->parameters=parametersin;
+	ISSMERROR(" not supported yet!");
 
 }
@@ -51,7 +42,27 @@
 /*FUNCTION Sing::copy {{{1*/
 Object* Sing::copy() {
-	
-	return new Sing(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,this->parameters,this->inputs);
-
+
+	int i;
+	Sing* sing=NULL;
+
+	sing=new Sing();
+
+	/*copy fields: */
+	sing->id=this->id;
+	if(this->inputs){
+		sing->inputs=(Inputs*)this->inputs->Copy();
+	}
+	else{
+		sing->inputs=new Inputs();
+	}
+	/*point parameters: */
+	sing->parameters=this->parameters;
+
+	/*pointers: */
+	sing->node=this->node;
+	sing->matice=this->matice;
+	sing->matpar=this->matpar;
+
+	return sing;
 }
 /*}}}*/
@@ -61,7 +72,7 @@
 	printf("Sing:\n");
 	printf("   id: %i\n",id);
-	hnodes.DeepEcho();
-	hmatice.DeepEcho();
-	hmatpar.DeepEcho();
+	node->DeepEcho();
+	matice->DeepEcho();
+	matpar->DeepEcho();
 	printf("   parameters\n");
 	parameters->DeepEcho();
@@ -74,28 +85,5 @@
 /*FUNCTION Sing::Demarshall {{{1*/
 void  Sing::Demarshall(char** pmarshalled_dataset){
-
-	char* marshalled_dataset=NULL;
-
-	/*recover marshalled_dataset: */
-	marshalled_dataset=*pmarshalled_dataset;
-
-	/*this time, no need to get enum type, the pointer directly points to the beginning of the 
-	 *object data (thanks to DataSet::Demarshall):*/
-	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
-
-	/*demarshall hooks: */
-	hnodes.Demarshall(&marshalled_dataset);
-	hmatice.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: */
-	*pmarshalled_dataset=marshalled_dataset;
-	return;
+	ISSMERROR(" not supported yet!");
 }
 /*}}}*/
@@ -106,7 +94,7 @@
 	printf("Sing:\n");
 	printf("   id: %i\n",id);
-	hnodes.Echo();
-	hmatice.Echo();
-	hmatpar.Echo();
+	node->Echo();
+	matice->Echo();
+	matpar->Echo();
 	printf("   parameters\n");
 	parameters->Echo();
@@ -126,51 +114,10 @@
 /*FUNCTION Sing::Marshall {{{1*/
 void  Sing::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 Sing: */
-	enum_type=SingEnum;
-	
-	/*marshall enum: */
-	memcpy(marshalled_dataset,&enum_type,sizeof(enum_type));marshalled_dataset+=sizeof(enum_type);
-	
-	/*marshall Sing data: */
-	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
-	
-	/*Marshall hooks: */
-	hnodes.Marshall(&marshalled_dataset);
-	hmatice.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;
-	return;
+	ISSMERROR(" not supported yet!");
 }
 /*}}}*/
 /*FUNCTION Sing::MashallSize {{{1*/
 int   Sing::MarshallSize(){
-
-	return sizeof(id)
-		+hnodes.MarshallSize()
-		+hmatice.MarshallSize()
-		+hmatpar.MarshallSize()
-		+inputs->MarshallSize()
-		+sizeof(int); //sizeof(int) for enum type
+	ISSMERROR(" not supported yet!");
 }
 /*}}}*/
@@ -202,14 +149,6 @@
 	double rho_ice,g;
 
-	/*dynamic objects pointed to by hooks: */
-	Matpar* matpar=NULL;
-	Matice* matice=NULL;
-
 	/*Get dof list on which we will plug the pressure values: */
 	GetDofList1(&dof);
-
-	/*recover objects from hooks: */
-	matpar=(Matpar*)hmatpar.delivers();
-	matice=(Matice*)hmatice.delivers();
 
 	/*pressure is lithostatic: */
@@ -263,12 +202,6 @@
 	int    connectivity;
 
-	/*dynamic objects pointed to by hooks: */
-	Node**  node=NULL;
-
-	/*recover objects from hooks: */
-	node=(Node**)hnodes.deliverp();
-
 	/*Find connectivity of the node and divide Ke_gg by this connectivity*/
-	connectivity=node[0]->GetConnectivity();
+	connectivity=node->GetConnectivity();
 	Ke_gg[0][0]=1/(double)connectivity;
 	Ke_gg[1][1]=1/(double)connectivity;
@@ -314,14 +247,4 @@
 	int       connectivity;
 
-	/*dynamic objects pointed to by hooks: */
-	Node**  node=NULL;
-	Matpar* matpar=NULL;
-	Matice* matice=NULL;
-
-	/*recover objects from hooks: */
-	node=(Node**)hnodes.deliverp();
-	matpar=(Matpar*)hmatpar.delivers();
-	matice=(Matice*)hmatice.delivers();
-
 	inputs->GetParameterValue(&slope[0],SurfaceSlopeXEnum);
 	inputs->GetParameterValue(&slope[1],SurfaceSlopeYEnum);
@@ -330,5 +253,5 @@
 
 	//Get connectivity of the node
-	connectivity=node[0]->GetConnectivity();
+	connectivity=node->GetConnectivity();
 
 	//compute slope2 
@@ -379,11 +302,5 @@
 	int numberofdofspernode;
 	
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	
-	nodes[0]->GetDofList(&doflist_per_node[0],&numberofdofspernode);
+	node->GetDofList(&doflist_per_node[0],&numberofdofspernode);
 	for(i=0;i<numberofdofspernode;i++){
 		doflist[i]=doflist_per_node[i];
@@ -398,12 +315,6 @@
 void  Sing::GetDofList1(int* doflist){
 
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	
 	int i;
-	doflist[0]=nodes[0]->GetDofList1();
+	doflist[0]=node->GetDofList1();
 
 }
@@ -415,10 +326,4 @@
 void* Sing::GetMatPar(){
 
-	/*dynamic objects pointed to by hooks: */
-	Matpar* matpar=NULL;
-
-	/*recover objects from hooks: */
-	matpar=(Matpar*)hmatpar.delivers();
-
 	return matpar;
 }
@@ -429,14 +334,8 @@
 	Node** pnodes=NULL;
 
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-	
 	/*recover nodes: */
 	pnodes=(Node**)vpnodes;
 
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	
-	pnodes[0]=nodes[0];
+	pnodes[0]=node;
 }
 /*}}}*/
@@ -503,5 +402,4 @@
 	/*Check that name is an element input*/
 	if (!IsInput(name)) return;
-	Node*  node=NULL;
 
 	switch(type){
@@ -513,5 +411,4 @@
 
 			/*Get values on the 6 vertices*/
-			node=(Node*)this->hnodes.delivers();
 			value=vector[node->GetVertexDof()];
 
@@ -602,5 +499,4 @@
 	bool     found      = false;
 	int      count      = 0;
-	Node   **nodes      = NULL;
 	double  *this_patch = NULL;
 
@@ -623,7 +519,4 @@
 		count=*pcount;
 
-		/*Recover nodes: */
-		nodes=(Node**)hnodes.deliverp();
-
 		/*set this_patch to point at the beginning of the patches row, where we will plug our information :*/
 		this_patch=patches+numcols*count;
@@ -633,5 +526,5 @@
 
 		/*Fill in vertices ids: */
-		for(i=0;i<1;i++) this_patch[2+i]=nodes[i]->GetVertexId(); //vertices id start at column 3 of the patch.
+		for(i=0;i<1;i++) this_patch[2+i]=node->GetVertexId(); //vertices id start at column 3 of the patch.
 
 		/*We found the input, get it to fill the interpolation type, and the nodal values:*/
Index: /issm/trunk/src/c/objects/Elements/Sing.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Sing.h	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Sing.h	(revision 4021)
@@ -13,4 +13,7 @@
 class Inputs;
 class IoModel;
+class Node;
+class Matice;
+class Matpar;
 
 #include "../../include/include.h"
@@ -26,7 +29,7 @@
 		int id;
 
-		Hook hnodes;  //hook to 1 nodes
-		Hook hmatice; //hook to 1 matice
-		Hook hmatpar; //hook to 1 matpar
+		Node* node; 
+		Matice* matice;
+		Matpar* matpar;
 		
 		Parameters* parameters; //pointer to solution parameters
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4021)
@@ -28,5 +28,4 @@
 	this->inputs=NULL;
 	this->parameters=NULL;
-	this->collapse=NULL;
 }
 /*}}}*/
@@ -35,5 +34,4 @@
 	delete inputs;
 	this->parameters=NULL;
-	xfree((void**)&collapse);
 }
 /*}}}*/
@@ -56,5 +54,4 @@
 
 	this->InitHookNodes(nummodels);this->nodes=NULL;
-	this->InitHookNodes(tria_node_ids); this->nodes=NULL;
 	this->InitHookMatice(tria_matice_id);this->matice=NULL;
 	this->InitHookMatpar(tria_matpar_id);this->matpar=NULL;
@@ -66,5 +63,5 @@
 /*}}}*/
 /*FUNCTION Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){{{1*/
-Tria::Update(IoModel* iomodel,int analysis_counter,int analysis_type){ //i is the element index
+void Tria::Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type){ //i is the element index
 
 	/*Intermediaries*/
@@ -85,5 +82,5 @@
 
 	/*Recover nodes ids needed to initialize the node hook.*/
-	if (iomodel->analysis_type==Prognostic2AnalysisEnum || iomodel->analysis_type==Balancedthickness2AnalysisEnum){
+	if (analysis_type==Prognostic2AnalysisEnum || analysis_type==Balancedthickness2AnalysisEnum){
 		/*Discontinuous Galerkin*/
 		tria_node_ids[0]=iomodel->nodecounter+3*index+1;
@@ -214,4 +211,5 @@
 Object* Tria::copy() {
 
+	int i;
 	Tria* tria=NULL;
 
@@ -231,6 +229,6 @@
 
 	/*now deal with hooks and objects: */
-	tria->InitHookNodes(this->nummodels);
-	for(i=0;i<this->nummodels;i++)tria->hnodes[i].copy(&this->hnodes[i]);
+	tria->InitHookNodes(this->numanalyses);
+	for(i=0;i<this->numanalyses;i++)tria->hnodes[i].copy(&this->hnodes[i]);
 	tria->hmatice.copy(&this->hmatice);
 	tria->hmatpar.copy(&this->hmatpar);
@@ -279,11 +277,11 @@
 	memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id);
 	memcpy(&interpolation_type,marshalled_dataset,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type);
-	memcpy(&nummodels,marshalled_dataset,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
+	memcpy(&numanalyses,marshalled_dataset,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
 
 	/*allocate dynamic memory: */
-	InitHookNodes(nummodels);
+	InitHookNodes(numanalyses);
 
 	/*demarshall hooks: */
-	for(i=0;i<nummodels;i++)hnodes[i].Demarshall(&marshalled_dataset);
+	for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset);
 	hmatice.Demarshall(&marshalled_dataset);
 	hmatpar.Demarshall(&marshalled_dataset);
@@ -362,8 +360,8 @@
 	memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id);
 	memcpy(marshalled_dataset,&interpolation_type,sizeof(interpolation_type));marshalled_dataset+=sizeof(interpolation_type);
-	memcpy(marshalled_dataset,&nummodels,sizeof(nummodels));marshalled_dataset+=sizeof(nummodels);
+	memcpy(marshalled_dataset,&numanalyses,sizeof(numanalyses));marshalled_dataset+=sizeof(numanalyses);
 
 	/*Marshall hooks: */
-	for(i=0;i<nummodels;i++)hnodes[i].Marshall(&marshalled_dataset);
+	for(i=0;i<numanalyses;i++)hnodes[i].Marshall(&marshalled_dataset);
 	hmatice.Marshall(&marshalled_dataset);
 	hmatpar.Marshall(&marshalled_dataset);
@@ -389,7 +387,6 @@
 	int hnodes_size=0;;
 
-	for(i=0;i<nummodels;i++)hnodes_size+=hnodes[i].MarshallSize;
-
-	
+	for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i].MarshallSize();
+
 	return sizeof(id)
 		+hnodes_size
@@ -403,4 +400,6 @@
 /*FUNCTION Tria::SpawnBeam {{{1*/
 void* Tria::SpawnBeam(int g0, int g1){
+
+	int i;
 
 	/*out of grids g0,g1 and g2 from Tria, build a beam element: */
@@ -1534,5 +1533,5 @@
 	/*build friction object, used later on: */
 	if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
-	friction=new Friction("2d",inputs,matpar);
+	friction=new Friction("2d",inputs,matpar,analysis_type);
 
 	/* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
@@ -2300,5 +2299,5 @@
 		else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet");
 	}
-	else if (analysis_type==SlopecomputeAnalysisEnum){
+	else if (analysis_type==SlopeComputeAnalysisEnum){
 		CreatePVectorSlopeCompute( pg,analysis_type,sub_analysis_type);
 	}
@@ -3196,5 +3195,5 @@
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
 	if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!");
-	friction=new Friction("3d",inputs,matpar);
+	friction=new Friction("3d",inputs,matpar,analysis_type);
 	
 	/* Ice/ocean heat exchange flux on ice shelf base */
@@ -4268,5 +4267,5 @@
 	/*Build frictoin element, needed later: */
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
-	friction=new Friction("2d",inputs,matpar);
+	friction=new Friction("2d",inputs,matpar,analysis_type);
 
 	/* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
@@ -4423,5 +4422,5 @@
 	/*Build frictoin element, needed later: */
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
-	friction=new Friction("2d",inputs,matpar);
+	friction=new Friction("2d",inputs,matpar,analysis_type);
 
 	/* Get gaussian points and weights (make this a statically initialized list of points? fstd): */
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 4021)
@@ -37,10 +37,10 @@
 		/*FUNCTION constructors, destructors {{{1*/
 		Tria();
-		Tria(int tria_id,int i, IoModel* iomodel);
+		Tria(int tria_id,int i, IoModel* iomodel,int nummodels);
+		void  Update(int index,IoModel* iomodel,int analysis_counter,int analysis_type);
 		~Tria();
 		/*}}}*/
 		/*FUNCTION object management {{{1*/
 		void  Configure(DataSet* elements,DataSet* loads,DataSet* nodes,DataSet* materials,Parameters* parameters,int analysis_counter);
-		void  Update(IoModel* iomodel,int analysis_counter,int analysis_type);
 		Object* copy();
 		void  DeepEcho();
Index: /issm/trunk/src/c/objects/Elements/TriaHook.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/TriaHook.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Elements/TriaHook.cpp	(revision 4021)
@@ -24,5 +24,5 @@
 TriaHook::TriaHook(){
 	numanalyses=UNDEF;
-	this->hooks=NULL;
+	this->hnodes=NULL;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Loads/Icefront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Icefront.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Loads/Icefront.cpp	(revision 4021)
@@ -41,5 +41,5 @@
 
 	/*First, retrieve element index and element type: */
-	if (strcmp(iomodel->meshtype,"2d")==0){
+	if (iomodel->dim==2){
 		segment_width=4;
 	}
@@ -56,5 +56,5 @@
 	icefront_node_ids[1]=(int)*(iomodel->pressureload+segment_width*i+1);
 
-	if (iomodel->sub_analysis_type==HorizAnalysisEnum){
+	if (analysis_type==DiagnosticHorizAnalysisEnum){
 		if ((int)*(iomodel->elements_type+2*element+0)==MacAyealFormulationEnum){ //this is a collapsed 3d element, icefront will be 2d
 			icefront_type=SegmentIcefrontEnum;
@@ -67,5 +67,5 @@
 		else ISSMERROR(" element type %i not supported yet",(int)*(iomodel->elements_type+2*element+0));
 	}
-	else if (iomodel->sub_analysis_type==StokesAnalysisEnum){
+	else if (analysis_type==DiagnosticStokesAnalysisEnum){
 		//We have a Stokes element, so we need a 3d Icefront
 		icefront_type=QuadIceFrontEnum;
@@ -108,5 +108,5 @@
 	/*copy fields: */
 	icefront->id=this->id;
-	icefront->analysis=this->analysis;
+	icefront->analysis_type=this->analysis_type;
 	if(this->inputs){
 		icefront->inputs=(Inputs*)this->inputs->Copy();
@@ -122,9 +122,4 @@
 	icefront->helement.copy(&this->helement);
 	icefront->hmatpar.copy(&this->hmatpar);
-
-	/*recover objects: */
-	icefront->nodes=(Node**)icefront->hnodes.deliverp();
-	icefront->element=(Element*)icefront->helement.delivers();
-	icefront->matpar=(Matpar*)icefront->hmatpar.delivers();
 
 	return icefront;
Index: /issm/trunk/src/c/objects/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Loads/Numericalflux.cpp	(revision 4021)
@@ -129,5 +129,5 @@
 	/*copy fields: */
 	numericalflux->id=this->id;
-	numericalflux->analysis=this->analysis;
+	numericalflux->analysis_type=this->analysis_type;
 	if(this->inputs){
 		numericalflux->inputs=(Inputs*)this->inputs->Copy();
@@ -141,9 +141,5 @@
 	/*now deal with hooks and objects: */
 	numericalflux->hnodes.copy(&this->hnodes);
-	numericalflux->helement.copy(&this->helement);
-
-	/*recover objects: */
-	numericalflux->nodes=(Node**)numericalflux->hnodes.deliverp();
-	numericalflux->element=(Element*)numericalflux->helement.delivers();
+	numericalflux->helements.copy(&this->helements);
 
 	return numericalflux;
Index: /issm/trunk/src/c/objects/Loads/Pengrid.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Loads/Pengrid.cpp	(revision 4021)
@@ -76,5 +76,5 @@
 	/*copy fields: */
 	pengrid->id=this->id;
-	pengrid->analysis=this->analysis;
+	pengrid->analysis_type=this->analysis_type;
 	if(this->inputs){
 		pengrid->inputs=(Inputs*)this->inputs->Copy();
@@ -87,12 +87,7 @@
 
 	/*now deal with hooks and objects: */
-	pengrid->hnode.copy(&this->hnodes);
+	pengrid->hnode.copy(&this->hnode);
 	pengrid->helement.copy(&this->helement);
 	pengrid->hmatpar.copy(&this->hmatpar);
-
-	/*recover objects: */
-	pengrid->node=(Node**)pengrid->hnode.deliverp();
-	pengrid->element=(Element*)pengrid->helement.delivers();
-	pengrid->matpar=(Matpar*)pengrid->hmatpar.delivers();
 
 	//let's not forget internals
@@ -456,6 +451,6 @@
 
 	//recover slope: */
-	penta->inputs->GetParameterValue(&slope[0],node,BedSlopexEnum);
-	penta->inputs->GetParameterValue(&slope[1],node,BedSlopeyEnum);
+	penta->inputs->GetParameterValue(&slope[0],node,BedSlopeXEnum);
+	penta->inputs->GetParameterValue(&slope[1],node,BedSlopeYEnum);
 	
 	/*recover parameters: */
Index: /issm/trunk/src/c/objects/Loads/Penpair.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Loads/Penpair.cpp	(revision 4021)
@@ -56,11 +56,8 @@
 	/*copy fields: */
 	penpair->id=this->id;
-	penpair->analysis=this->analysis;
+	penpair->analysis_type=this->analysis_type;
 
 	/*now deal with hooks and objects: */
 	penpair->hnodes.copy(&this->hnodes);
-
-	/*recover objects: */
-	penpair->nodes=(Node**)penpair->hnodes.deliverp();
 
 	return penpair;
Index: /issm/trunk/src/c/objects/Loads/Riftfront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Loads/Riftfront.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Loads/Riftfront.cpp	(revision 4021)
@@ -103,5 +103,5 @@
 	/*copy fields: */
 	riftfront->id=this->id;
-	riftfront->analysis=this->analysis;
+	riftfront->analysis_type=this->analysis_type;
 	if(this->inputs){
 		riftfront->inputs=(Inputs*)this->inputs->Copy();
@@ -115,11 +115,6 @@
 	/*now deal with hooks and objects: */
 	riftfront->hnodes.copy(&this->hnodes);
-	riftfront->helement.copy(&this->helement);
+	riftfront->helements.copy(&this->helements);
 	riftfront->hmatpar.copy(&this->hmatpar);
-
-	/*recover objects: */
-	riftfront->nodes=(Node**)riftfront->hnodes.deliverp();
-	riftfront->element=(Element*)riftfront->helement.delivers();
-	riftfront->matpar=(Matpar*)riftfront->hmatpar.delivers();
 
 	return riftfront;
Index: /issm/trunk/src/c/objects/Materials/Matice.cpp
===================================================================
--- /issm/trunk/src/c/objects/Materials/Matice.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Materials/Matice.cpp	(revision 4021)
@@ -42,4 +42,5 @@
 	double matice_B;
 	double matice_n;
+	int    num_vertices;
 
 	/*intermediary: */
@@ -47,8 +48,8 @@
 
 	/*2d or 3d? */
-	if(strcmp(iomodel->meshtype,"2d")==0){
+	if(iomodel->dim==2){
 		num_vertices=3; //tria elements
 	}
-	else if(strcmp(iomodel->meshtype,"3d")==0){
+	else if(iomodel->dim==3){
 		num_vertices=6; //penta elements
 	}
Index: /issm/trunk/src/c/objects/Node.cpp
===================================================================
--- /issm/trunk/src/c/objects/Node.cpp	(revision 4020)
+++ /issm/trunk/src/c/objects/Node.cpp	(revision 4021)
@@ -67,5 +67,5 @@
 
 	/*indexing:*/
-	DistributeNumDofs(&numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node
+	DistributeNumDofs(&numdofs,analysis_type); //number of dofs per node
 
 	this->indexing.Init(numdofs);
@@ -74,5 +74,5 @@
 	vertex_id=this->id; //node and vertex have the same id, as we are running galerkin continuous, with same number of nodes and vertices.
 
-	if (strcmp(iomodel->meshtype,"3d")==0){
+	if (iomodel->dim==3){
 		if (isnan(iomodel->uppernodes[i])){
 			upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves.
@@ -93,6 +93,6 @@
 
 	/*Diagnostic Horiz*/
-	if (iomodel->analysis_type==DiagnosticAnalysisEnum && iomodel->sub_analysis_type==HorizAnalysisEnum){
-		if (strcmp(iomodel->meshtype,"3d")==0){
+	if (analysis_type==DiagnosticHorizAnalysisEnum){
+		if (iomodel->dim==3){
 			/*We have a  3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
 			if (!iomodel->deadgrids) ISSMERROR("iomodel->deadgrids is NULL");
@@ -113,5 +113,5 @@
 
 	/*Diagnostic Stokes*/
-	if (iomodel->analysis_type==DiagnosticAnalysisEnum && iomodel->sub_analysis_type==StokesAnalysisEnum){
+	if (analysis_type==DiagnosticStokesAnalysisEnum){
 		/*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */
 		if (!iomodel->borderstokes) ISSMERROR("iomodel->borderstokes is NULL");
@@ -130,5 +130,5 @@
 
 	/*Diagnostic Hutter*/
-	if (iomodel->analysis_type==DiagnosticAnalysisEnum && iomodel->sub_analysis_type==HutterAnalysisEnum){
+	if (analysis_type==DiagnosticHutterAnalysisEnum){
 		/*Spc all nodes that are not Hutter*/
 		if (!iomodel->gridonhutter) ISSMERROR("iomodel->gridonhutter is NULL");
@@ -142,11 +142,11 @@
 	/*Prognostic/ Melting/ Slopecompute/ Balancedvelocities/ Balancedthickness*/
 	if (
-				iomodel->analysis_type==PrognosticAnalysisEnum || 
-				iomodel->analysis_type==MeltingAnalysisEnum || 
-				iomodel->analysis_type==SlopecomputeAnalysisEnum || 
-				iomodel->analysis_type==BalancedvelocitiesAnalysisEnum || 
-				iomodel->analysis_type==BalancedthicknessAnalysisEnum
+				analysis_type==PrognosticAnalysisEnum || 
+				analysis_type==MeltingAnalysisEnum || 
+				analysis_type==SlopeComputeAnalysisEnum || 
+				analysis_type==BalancedvelocitiesAnalysisEnum || 
+				analysis_type==BalancedthicknessAnalysisEnum
 				){
-		if (strcmp(iomodel->meshtype,"3d")==0){
+		if (iomodel->dim==3){
 			/*On a 3d mesh, we may have collapsed elements, hence dead grids. Freeze them out: */
 			if (!iomodel->gridonbed) ISSMERROR("iomodel->gridonbed is NULL");
@@ -183,5 +183,5 @@
 
 	/*indexing:*/
-	DistributeNumDofs(&numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node
+	DistributeNumDofs(&numdofs,analysis_type); //number of dofs per node
 
 	this->indexing.Init(numdofs);
@@ -191,5 +191,5 @@
 	vertex_id=i+1; //matlab indexing
 
-	if (strcmp(iomodel->meshtype,"3d")==0){
+	if (iomodel->dim==3){
 		if (isnan(iomodel->uppernodes[i])){
 			upper_node_id=this->id; //nodes on surface do not have upper nodes, only themselves.
Index: /issm/trunk/src/c/shared/Dofs/DistributeNumDofs.cpp
===================================================================
--- /issm/trunk/src/c/shared/Dofs/DistributeNumDofs.cpp	(revision 4020)
+++ /issm/trunk/src/c/shared/Dofs/DistributeNumDofs.cpp	(revision 4021)
@@ -7,5 +7,5 @@
 #include "../shared.h"
 
-int DistributeNumDofs(int *pnumdofs,int analysis_type,int sub_analysis_type){
+int DistributeNumDofs(int *pnumdofs,int analysis_type){
 
 	int numdofs=2; //default numdofs
@@ -13,33 +13,17 @@
 
 	/*ok, according to analysis type: */
-	if (analysis_type==ControlAnalysisEnum){
-		if (sub_analysis_type==HorizAnalysisEnum){
-			numdofs=2;
-		}
-		else if (sub_analysis_type==VertAnalysisEnum){
-			numdofs=1;
-		}
-		else if (sub_analysis_type==StokesAnalysisEnum){
-			numdofs=4;
-		}
-		else if (sub_analysis_type==HutterAnalysisEnum){
-			numdofs=2;
-		}
+	if (analysis_type==DiagnosticHorizAnalysisEnum){
+		numdofs=2;
 	}
-	else if (analysis_type==DiagnosticAnalysisEnum){
-		if (sub_analysis_type==HorizAnalysisEnum){
-			numdofs=2;
-		}
-		else if (sub_analysis_type==VertAnalysisEnum){
-			numdofs=1;
-		}
-		else if (sub_analysis_type==StokesAnalysisEnum){
-			numdofs=4;
-		}
-		else if (sub_analysis_type==HutterAnalysisEnum){
-			numdofs=2;
-		}
+	else if (analysis_type==DiagnosticVertAnalysisEnum){
+		numdofs=1;
 	}
-	else if (analysis_type==SlopecomputeAnalysisEnum){
+	else if (analysis_type==DiagnosticStokesAnalysisEnum){
+		numdofs=4;
+	}
+	else if (analysis_type==DiagnosticHutterAnalysisEnum){
+		numdofs=2;
+	}
+	else if (analysis_type==SlopeComputeAnalysisEnum){
 		numdofs=1;
 	}
Index: /issm/trunk/src/c/shared/Dofs/dofs.h
===================================================================
--- /issm/trunk/src/c/shared/Dofs/dofs.h	(revision 4020)
+++ /issm/trunk/src/c/shared/Dofs/dofs.h	(revision 4021)
@@ -7,5 +7,5 @@
 
 double* dofsetgen(int numdofs,int* doflist,int dofspernode,int totaldofs);
-int DistributeNumDofs(int *pnumdofs,int analysis_type,int sub_analysis_type);
+int DistributeNumDofs(int *pnumdofs,int analysis_type);
 
 
Index: /issm/trunk/src/c/solutions/diagnostic.cpp
===================================================================
--- /issm/trunk/src/c/solutions/diagnostic.cpp	(revision 4020)
+++ /issm/trunk/src/c/solutions/diagnostic.cpp	(revision 4021)
@@ -38,5 +38,5 @@
 	double   start_init, finish_init;
 
-	int analyses[5]={DiagnosticHorizAnalysisEnum,DiagnosticVertAnalysisEnum,DiagnosticStokesAnalysisEnum,DiagnosticHutterAnalysisEnum,SlopecomputeAnalysisEnum};
+	int analyses[5]={DiagnosticHorizAnalysisEnum,DiagnosticVertAnalysisEnum,DiagnosticStokesAnalysisEnum,DiagnosticHutterAnalysisEnum,SlopeComputeAnalysisEnum};
 
 	MODULEBOOT();
@@ -95,5 +95,5 @@
 
 		_printf_("write results to disk:\n");
-		OutputResults(femmodel,outputfilename);
+		OutputResults(femmodel,outputfilename,DiagnosticAnalysisEnum);
 	}
 	else{
Index: /issm/trunk/src/c/solutions/solutions.h
===================================================================
--- /issm/trunk/src/c/solutions/solutions.h	(revision 4020)
+++ /issm/trunk/src/c/solutions/solutions.h	(revision 4021)
@@ -13,18 +13,18 @@
 
 /*cores: */
-Results* gradjcompute_core(Model* model);
-void* diagnostic_core(Model* model);
-Results* prognostic_core(Model* model);
-Results* prognostic2_core(Model* model);
-Results* balancedthickness_core(Model* model);
-Results* balancedthickness2_core(Model* model);
-Results* balancedvelocities_core(Model* model);
-Results* slopecompute_core(Model* model);
-Results* control_core(Model* model);
-Results* steadystate_core(Model* model);
-Results* transient_core(Model* model);
-Results* transient_core_2d(Model* model);
-Results* transient_core_3d(Model* model);
-Results* thermal_core(Model* model);
+Results* gradjcompute_core(FemModel* model);
+void* diagnostic_core(FemModel* model);
+Results* prognostic_core(FemModel* model);
+Results* prognostic2_core(FemModel* model);
+Results* balancedthickness_core(FemModel* model);
+Results* balancedthickness2_core(FemModel* model);
+Results* balancedvelocities_core(FemModel* model);
+Results* slopecompute_core(FemModel* model);
+Results* control_core(FemModel* model);
+Results* steadystate_core(FemModel* model);
+Results* transient_core(FemModel* model);
+Results* transient_core_2d(FemModel* model);
+Results* transient_core_3d(FemModel* model);
+Results* thermal_core(FemModel* model);
 void slope_core(FemModel* fem,int sub_analysis_type);
 
@@ -51,6 +51,6 @@
 void WriteLockFile(char* filename);
 
-void ControlInitialization(Model* model);
-void ControlRestart(Model* model,double* param_g);
+void ControlInitialization(FemModel* model);
+void ControlRestart(FemModel* model,double* param_g);
 
 void CreateFemModel(FemModel* femmodel,ConstDataHandle MODEL,int analysis_type,int sub_analysis_type);
Index: /issm/trunk/src/c/toolkits/metis/metisincludes.h
===================================================================
--- /issm/trunk/src/c/toolkits/metis/metisincludes.h	(revision 4020)
+++ /issm/trunk/src/c/toolkits/metis/metisincludes.h	(revision 4021)
@@ -9,5 +9,5 @@
 #include <metis.h>
 
-extern "C" void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *);
+void METIS_PartMeshNodal(int *, int *, idxtype *, int *, int *, int *, int *, idxtype *, idxtype *);
 
 #endif
