Index: /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 25487)
+++ /issm/trunk-jpl/src/c/classes/Elements/Penta.cpp	(revision 25488)
@@ -3414,19 +3414,18 @@
 	tria->inputs=this->inputs;
 	tria->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED)
-	this->SpawnTriaHook(xDynamicCast<ElementHook*>(tria),index1,index2,index3);
 
 	if(index1==0 && index2==1 && index3==2){
 		tria->iscollapsed = 1;
+		if(this->nodes)tria->nodes=this->nodes;
+		if(this->vertices)tria->vertices=this->vertices;
 	}
 	else if(index1==3 && index2==4 && index3==5){
 		tria->iscollapsed = 2;
-	}
-
+		if(this->nodes)tria->nodes=&this->nodes[3];
+		if(this->vertices)tria->vertices=&this->vertices[3];
+	}
+	else _error_("Spawn supported only for surface and basal elements");
 	/*Spawn material*/
 	tria->material=(Material*)this->material->copy2(tria);
-
-	/*recover nodes, material*/
-	tria->nodes=(Node**)tria->hnodes[analysis_counter]->deliverp();
-	tria->vertices=(Vertex**)tria->hvertices->deliverp();
 
 	/*Return new Tria*/
@@ -4650,5 +4649,5 @@
 	int interp;
 	int type;
-	
+
 	/*Branch according to whether we have a transient or not input: */
 	type=this->inputs->GetInputObjectEnum(name);
@@ -4658,5 +4657,5 @@
 		PentaInput* pentainput2 = this->inputs->GetPentaInput(DummyEnum);
 		interp=pentainput->GetInterpolation();
-		
+
 		if (interp==P0Enum){
 			/*Update the value if this element belongs to the partition: */
@@ -4698,5 +4697,5 @@
 
 		/*double check:*/
-		if (nsteps!=nt && nt!=1) _error_("Penta:InputScaleFromDakota error message: transient input " << EnumToStringx(name) <<  
+		if (nsteps!=nt && nt!=1) _error_("Penta:InputScaleFromDakota error message: transient input " << EnumToStringx(name) <<
 				" should have the same number of time steps as the number of time values distributed by Dakota: " << nt << "\n");
 
@@ -4717,5 +4716,5 @@
 					/*scale P0 value  for this element, corresponding to the partition:*/
 					IssmDouble value = pentainput->element_values[0];
-					if(nt==1) value*=distributed_values[(int)partition[this->Sid()]]; //we scale all the time steps  with the same distributed_value 
+					if(nt==1) value*=distributed_values[(int)partition[this->Sid()]]; //we scale all the time steps  with the same distributed_value
 					else value*=distributed_values[(int)partition[this->Sid()]*nsteps+i]; //we scale all the time steps with distributed value for each step
 
@@ -4729,5 +4728,5 @@
 					values[j]=pentainput->element_values[j];
 					if(partition[this->vertices[i]->Sid()]!=-1){
-						if(nt==1) values[j]*=distributed_values[(int)partition[this->vertices[j]->Sid()]];//we scale all the time steps  with the same distributed_value 
+						if(nt==1) values[j]*=distributed_values[(int)partition[this->vertices[j]->Sid()]];//we scale all the time steps  with the same distributed_value
 						else values[j]*=distributed_values[(int)partition[this->vertices[j]->Sid()]*nsteps+i];//we scale all the time steps with distributed value for each step
 					}
