Index: /issm/trunk/src/c/objects/ParameterInputs.cpp
===================================================================
--- /issm/trunk/src/c/objects/ParameterInputs.cpp	(revision 3388)
+++ /issm/trunk/src/c/objects/ParameterInputs.cpp	(revision 3389)
@@ -385,6 +385,5 @@
 	}
 
-	ISSMERROR("create UpdateFromDakota routine, to call UpdateFromDakota in the elements, so it does not conflict
-			with UpdateFromInputs! in the elements");
+	ISSMERROR("create UpdateFromDakota routine, to call UpdateFromDakota in the elements, so it does not conflict with UpdateFromInputs! in the elements");
 
 
Index: /issm/trunk/src/c/objects/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Penta.cpp	(revision 3388)
+++ /issm/trunk/src/c/objects/Penta.cpp	(revision 3389)
@@ -38,4 +38,19 @@
 }
 /*}}}*/
+/*FUNCTION Penta other constructor {{{1*/
+Penta::Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Hook* penta_hnumpar, ElementProperties* penta_properties):
+	hnodes(penta_hnodes),
+	hmatice(penta_hmatice),
+	hmatpar(penta_hmatpar),
+	hnumpar(penta_hnumpar),
+	properties(penta_properties)
+{
+
+	/*all the initialization has been done by the initializer, just fill in the id: */
+	this->id=penta_id;
+
+	return;
+}
+/*}}}*/
 /*FUNCTION Penta destructor {{{1*/
 Penta::~Penta(){
@@ -44,5 +59,93 @@
 /*}}}*/
 
-/*Object marshall*/
+/*Object management: */
+/*FUNCTION Configure {{{1*/
+void  Penta::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){
+
+	int i;
+
+	DataSet* loadsin=NULL;
+	DataSet* nodesin=NULL;
+	DataSet* materialsin=NULL;
+	DataSet* parametersin=NULL;
+
+	/*Recover pointers :*/
+	loadsin=(DataSet*)ploadsin;
+	nodesin=(DataSet*)pnodesin;
+	materialsin=(DataSet*)pmaterialsin;
+	parametersin=(DataSet*)pparametersin;
+
+	/*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);
+	hnumpar.configure(parametersin);
+
+}
+/*}}}*/
+/*FUNCTION copy {{{1*/
+Object* Penta::copy() {
+	return new Penta(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,&this->hnumpar,&this->properties); 
+}
+/*}}}*/
+/*FUNCTION Demarshall {{{1*/
+void  Penta::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);
+	hnumpar.Demarshall(&marshalled_dataset);
+
+	/*demarshall properties: */
+	properties.Demarshall(&marshalled_dataset);
+
+	/*return: */
+	*pmarshalled_dataset=marshalled_dataset;
+	return;
+}
+/*}}}*/
+/*FUNCTION DeepEcho{{{1*/
+
+void Penta::DeepEcho(void){
+
+	printf("Penta:\n");
+	printf("   id: %i\n",id);
+	hnodes.DeepEcho();
+	hmatice.DeepEcho();
+	hmatpar.DeepEcho();
+	hnumpar.DeepEcho();
+	properties.DeepEcho();
+
+	return;
+}
+/*}}}*/
+/*FUNCTION Echo{{{1*/
+
+void Penta::Echo(void){
+
+	printf("Penta:\n");
+	printf("   id: %i\n",id);
+	hnodes.Echo();
+	hmatice.Echo();
+	hmatpar.Echo();
+	hnumpar.Echo();
+	properties.Echo();
+
+	return;
+}
+/*}}}*/
 /*FUNCTION Marshall {{{1*/
 void  Penta::Marshall(char** pmarshalled_dataset){
@@ -88,89 +191,4 @@
 }
 /*}}}*/
-/*FUNCTION Demarshall {{{1*/
-void  Penta::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);
-	hnumpar.Demarshall(&marshalled_dataset);
-
-	/*demarshall properties: */
-	properties.Demarshall(&marshalled_dataset);
-
-	/*return: */
-	*pmarshalled_dataset=marshalled_dataset;
-	return;
-}
-/*}}}*/
-
-/*Object processing: */
-/*FUNCTION Echo{{{1*/
-
-void Penta::Echo(void){
-
-	printf("Penta:\n");
-	printf("   id: %i\n",id);
-	hnodes.Echo();
-	hmatice.Echo();
-	hmatpar.Echo();
-	hnumpar.Echo();
-	properties.Echo();
-
-	return;
-}
-/*}}}*/
-/*FUNCTION DeepEcho{{{1*/
-
-void Penta::DeepEcho(void){
-
-	printf("Penta:\n");
-	printf("   id: %i\n",id);
-	hnodes.DeepEcho();
-	hmatice.DeepEcho();
-	hmatpar.DeepEcho();
-	hnumpar.DeepEcho();
-	properties.DeepEcho();
-
-	return;
-}
-/*}}}*/
-/*FUNCTION Configure {{{1*/
-void  Penta::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){
-
-	int i;
-
-	DataSet* loadsin=NULL;
-	DataSet* nodesin=NULL;
-	DataSet* materialsin=NULL;
-	DataSet* parametersin=NULL;
-
-	/*Recover pointers :*/
-	loadsin=(DataSet*)ploadsin;
-	nodesin=(DataSet*)pnodesin;
-	materialsin=(DataSet*)pmaterialsin;
-	parametersin=(DataSet*)pparametersin;
-
-	/*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);
-	hnumpar.configure(parametersin);
-
-}
-/*}}}*/
 /*FUNCTION SpawnTria {{{1*/
 void*  Penta::SpawnTria(int g0, int g1, int g2){
@@ -206,4 +224,74 @@
 }
 /*}}}*/
+/*FUNCTION UpdateFromInputs {{{1*/
+void  Penta::UpdateFromInputs(void* vinputs){
+
+	int     dofs[1]={0};
+	double  temperature_list[6];
+	double  temperature_average;
+	double  B_list[6];
+	double  B_average;
+
+	/*dynamic objects pointed to by hooks: */
+	Node**  nodes=NULL;
+	Matice* matice=NULL;
+
+	ParameterInputs* inputs=NULL;
+
+	/*If on water, skip: */
+	if(this->properties.onwater)return;
+
+	/*recover objects from hooks: */
+	nodes=(Node**)hnodes.deliverp();
+	matice=(Matice*)hmatice.delivers();
+
+	/*recover pointers: */
+	inputs=(ParameterInputs*)vinputs;
+
+	/*Update internal data if inputs holds new values: */
+	inputs->Recover("thickness",&this->properties.h[0],1,dofs,6,(void**)nodes);
+	inputs->Recover("surface",&this->properties.s[0],1,dofs,6,(void**)nodes);
+	inputs->Recover("bed",&this->properties.b[0],1,dofs,6,(void**)nodes);
+	inputs->Recover("drag",&this->properties.k[0],1,dofs,6,(void**)nodes);
+	inputs->Recover("melting",&this->properties.melting[0],1,dofs,6,(void**)nodes);
+	inputs->Recover("accumulation_param",&this->properties.accumulation[0],1,dofs,6,(void**)nodes);
+
+	//Update material if necessary
+	if(inputs->Recover("temperature",&temperature_list[0],1,dofs,6,(void**)nodes)){
+		if(matice && !this->properties.collapse){
+			//B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])
+			//			+Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;
+			temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;
+			B_average=Paterson(temperature_average);
+			matice->SetB(B_average);
+		}
+	}
+
+	if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,6,(void**)nodes)){
+		if(matice && this->properties.collapse){
+			temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;
+			B_average=Paterson(temperature_average);
+			//B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])
+			//			+Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;
+			matice->SetB(B_average);
+		}
+	}
+
+	if(inputs->Recover("B",&B_list[0],1,dofs,6,(void**)nodes)){
+		if(matice){
+			B_average=(B_list[0]+B_list[1]+B_list[2]+B_list[3]+B_list[4]+B_list[5])/6.0;
+			matice->SetB(B_average);
+		}
+	}
+
+}
+/*}}}*/
+/*FUNCTION UpdateFromDakota {{{1*/
+void  Penta::UpdateFromDakota(void* vinputs){
+
+	ISSMERROR("not supported yet!");
+
+}
+/*}}}*/
 
 /*Object functions*/
@@ -248,9 +336,4 @@
 	VecSetValues(pg,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
 
-}
-/*}}}*/
-/*FUNCTION copy {{{1*/
-Object* Penta::copy() {
-	return new Penta(*this); 
 }
 /*}}}*/
@@ -3976,67 +4059,4 @@
 }
 /*}}}*/
-/*FUNCTION UpdateFromInputs {{{1*/
-void  Penta::UpdateFromInputs(void* vinputs){
-
-	int     dofs[1]={0};
-	double  temperature_list[6];
-	double  temperature_average;
-	double  B_list[6];
-	double  B_average;
-
-	/*dynamic objects pointed to by hooks: */
-	Node**  nodes=NULL;
-	Matice* matice=NULL;
-
-	ParameterInputs* inputs=NULL;
-
-	/*If on water, skip: */
-	if(this->properties.onwater)return;
-
-	/*recover objects from hooks: */
-	nodes=(Node**)hnodes.deliverp();
-	matice=(Matice*)hmatice.delivers();
-
-	/*recover pointers: */
-	inputs=(ParameterInputs*)vinputs;
-
-	/*Update internal data if inputs holds new values: */
-	inputs->Recover("thickness",&this->properties.h[0],1,dofs,6,(void**)nodes);
-	inputs->Recover("surface",&this->properties.s[0],1,dofs,6,(void**)nodes);
-	inputs->Recover("bed",&this->properties.b[0],1,dofs,6,(void**)nodes);
-	inputs->Recover("drag",&this->properties.k[0],1,dofs,6,(void**)nodes);
-	inputs->Recover("melting",&this->properties.melting[0],1,dofs,6,(void**)nodes);
-	inputs->Recover("accumulation_param",&this->properties.accumulation[0],1,dofs,6,(void**)nodes);
-
-	//Update material if necessary
-	if(inputs->Recover("temperature",&temperature_list[0],1,dofs,6,(void**)nodes)){
-		if(matice && !this->properties.collapse){
-			//B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])
-			//			+Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;
-			temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;
-			B_average=Paterson(temperature_average);
-			matice->SetB(B_average);
-		}
-	}
-
-	if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,6,(void**)nodes)){
-		if(matice && this->properties.collapse){
-			temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;
-			B_average=Paterson(temperature_average);
-			//B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])
-			//			+Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;
-			matice->SetB(B_average);
-		}
-	}
-
-	if(inputs->Recover("B",&B_list[0],1,dofs,6,(void**)nodes)){
-		if(matice){
-			B_average=(B_list[0]+B_list[1]+B_list[2]+B_list[3]+B_list[4]+B_list[5])/6.0;
-			matice->SetB(B_average);
-		}
-	}
-
-}
-/*}}}*/
 /*FUNCTION SurfaceArea {{{1*/
 double Penta::SurfaceArea(void* inputs,int analysis_type,int sub_analysis_type){
Index: /issm/trunk/src/c/objects/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Penta.h	(revision 3388)
+++ /issm/trunk/src/c/objects/Penta.h	(revision 3389)
@@ -40,17 +40,22 @@
 		Penta();
 		Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id, ElementProperties* properties);
+		Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Hook* penta_hnumpar, ElementProperties* penta_properties);
 		~Penta();
 		/*}}}*/
 		/*FUNCTION object management {{{1*/
+		void  Configure(void* loads,void* nodes,void* materials,void* parameters);
+		Object* copy();
+		void  DeepEcho();
+		void  Demarshall(char** pmarshalled_dataset);
 		void  Echo();
-		void  DeepEcho();
+		int   Enum();
+		int   GetId(); 
+		char* GetName();
 		void  Marshall(char** pmarshalled_dataset);
 		int   MarshallSize();
-		char* GetName();
-		void  Demarshall(char** pmarshalled_dataset);
-		int   Enum();
-		int   GetId(); 
 		int   MyRank();
-		void  Configure(void* loads,void* nodes,void* materials,void* parameters);
+		void*  SpawnTria(int g0, int g1, int g2);
+		void  UpdateFromDakota(void* inputs);
+		void  UpdateFromInputs(void* inputs);
 		/*}}}*/
 		/*FUNCTION element numerical routines {{{1*/
@@ -59,5 +64,4 @@
 		void  CreateKMatrixDiagnosticVert( 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  GetDofList(int* doflist,int* pnumberofdofs);
 		void  GetDofList1(int* doflist);
@@ -76,6 +80,4 @@
 		void          GetThicknessList(double* thickness_list);
 		void          GetBedList(double* bed_list);
-		Object* copy();
-		void*  SpawnTria(int g0, int g1, int g2);
 
 		void  GetStrainRate(double* epsilon, double* velocity, double* xyz_list, double* gauss_coord);
Index: /issm/trunk/src/c/objects/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Tria.cpp	(revision 3388)
+++ /issm/trunk/src/c/objects/Tria.cpp	(revision 3389)
@@ -96,5 +96,5 @@
 Object* Tria::copy() {
 
-	return new Tria(this->id,this->hnodes,this->hmatice,this->hmatpar,this->hnumpar,this->properties);
+	return new Tria(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,&this->hnumpar,&this->properties);
 
 }
@@ -299,5 +299,5 @@
 
 	/*Update internal data if inputs holds new values: */
-	inputs->Recover("thickness",&this->properties.h[0],1,dofs,3,(void**)nodes);
+	/*inputs->Recover("thickness",&this->properties.h[0],1,dofs,3,(void**)nodes);
 	if(inputs->Recover("thickness",&new_h[0],1,dofs,3,(void**)nodes)){
 	//density, needed later:
@@ -311,5 +311,5 @@
 	this->h[i]=new_h[i];
 	}
-	}
+	}*/
 
 	ISSMERROR("not supported yet!");
