Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10427)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 10428)
@@ -1419,51 +1419,72 @@
 void  Penta::InputExtrude(int enum_type,int object_type){
 
-	Penta *penta          = NULL;
-	Input *original_input = NULL;
+	int     i,num_inputs;
+	Penta  *penta       = NULL;
+	Input **base_inputs = NULL;
+	Input  *copy        = NULL;
 
 	/*Are we on the base, not on the surface?:*/
-	if(IsOnBed()){
-		/*OK, we are on bed. we will follow the steps:
-		 * 1: find input and extrude it.
-		 * 2: follow the upper element until we reach the surface
-		 * 3: for each element, we will add a copy of the extruded input*/
-
-		/*Step1: Extrude the original input: */
-		if (object_type==MeshElementsEnum)
-		 original_input=(Input*)this->inputs->GetInput(enum_type);
-		else if (object_type==MaterialsEnum)
-		 original_input=(Input*)matice->inputs->GetInput(enum_type);
-		else
-		 _error_("object of type %s not supported yet",EnumToStringx(object_type));
-		if(!original_input) _error_("%s%s"," could not find input with enum:",EnumToStringx(enum_type));
-		original_input->Extrude();
-
-		/*Stop if there is only one layer of element*/
-		if (this->IsOnSurface()) return;
-
-		/*Step 2: this input has been extruded for this element, now follow the upper element*/
-		penta=this;
-		for(;;){
-
-			/* get upper Penta*/
-			penta=penta->GetUpperElement();
-			_assert_(penta->Id()!=this->id);
-
-			/*Add input of the basal element to penta->inputs*/
-			Input* copy=NULL;
-			copy=(Input*)original_input->copy();
-			if (object_type==MeshElementsEnum)
-			 penta->inputs->AddInput((Input*)copy);
-			else if (object_type==MaterialsEnum)
-			 penta->matice->inputs->AddInput((Input*)copy);
-			else
-			 _error_("object of type %s not supported yet",EnumToStringx(object_type));
-
-			/*Stop if we have reached the surface*/
-			if (penta->IsOnSurface()) break;
-		}
-	}
-
-	return;
+	if(!IsOnBed()) return;
+
+	/*Step1: Get and Extrude original input: */
+	if (object_type==ElementEnum){
+		num_inputs=1;
+		base_inputs=(Input**)xmalloc(num_inputs*sizeof(Input*));
+		base_inputs[0]=(Input*)this->inputs->GetInput(enum_type);
+	}
+	else if (object_type==MaterialsEnum){
+		num_inputs=1;
+		base_inputs=(Input**)xmalloc(num_inputs*sizeof(Input*));
+		base_inputs[0]=(Input*)this->inputs->GetInput(enum_type);
+	}
+	else if (object_type==NodeEnum){
+		num_inputs=6;
+		base_inputs=(Input**)xmalloc(num_inputs*sizeof(Input*));
+		for(i=0;i<num_inputs;i++){
+			base_inputs[i]=(Input*)this->nodes[i]->inputs->GetInput(enum_type);
+		}
+	}
+	else{
+		_error_("object of type %s not supported yet",EnumToStringx(object_type));
+	}
+	for(i=0;i<num_inputs;i++){
+		if(!base_inputs[i]) _error_("could not find input with enum %s in object %s",EnumToStringx(enum_type),EnumToStringx(object_type));
+		base_inputs[i]->Extrude();
+	}
+
+	/*Stop if there is only one layer of element*/
+	if (this->IsOnSurface()) return;
+
+	/*Step 2: this input has been extruded for this element, now follow the upper element*/
+	penta=this;
+	for(;;){
+
+		/* get upper Penta*/
+		penta=penta->GetUpperElement();
+		_assert_(penta->Id()!=this->id);
+
+		/*Add input of the basal element to penta->inputs*/
+		for(i=0;i<num_inputs;i++){
+			copy=(Input*)base_inputs[i]->copy();
+			if (object_type==ElementEnum){
+				penta->inputs->AddInput((Input*)copy);
+			}
+			else if (object_type==MaterialsEnum){
+				penta->matice->inputs->AddInput((Input*)copy);
+			}
+			else if (object_type==NodeEnum){
+				penta->nodes[i]->inputs->AddInput((Input*)copy);
+			}
+			else{
+				_error_("object of type %s not supported yet",EnumToStringx(object_type));
+			}
+		}
+
+		/*Stop if we have reached the surface*/
+		if (penta->IsOnSurface()) break;
+	}
+
+	/*clean-up and return*/
+	xfree((void**)&base_inputs);
 }
 /*}}}*/
