Index: /issm/trunk/src/c/DataSet/DataSet.h
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.h	(revision 3934)
+++ /issm/trunk/src/c/DataSet/DataSet.h	(revision 3935)
@@ -133,4 +133,5 @@
 		Input* GetInput(int enum_name);
 		Inputs* SpawnTriaInputs(int* indices);
+		Inputs* SpawnBeamInputs(int* indices);
 		
 		void GetParameterValue(bool* pvalue,int enum_type);
Index: /issm/trunk/src/c/DataSet/Inputs.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/Inputs.cpp	(revision 3934)
+++ /issm/trunk/src/c/DataSet/Inputs.cpp	(revision 3935)
@@ -576,4 +576,30 @@
 }
 /*}}}*/
+/*FUNCTION Inputs::SpawnBeamInputs{{{1*/
+Inputs* Inputs::SpawnBeamInputs(int* indices){
+
+	/*Intermediary*/
+	vector<Object*>::iterator object;
+	Input* inputin=NULL;
+	Input* inputout=NULL;
+
+	/*Output*/
+	Inputs* newinputs=new Inputs();
+
+	/*Go through inputs and call Spawn function*/
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		/*Create new input*/
+		inputin=(Input*)(*object); 
+		inputout=inputin->SpawnBeamInput(indices);
+
+		/*Add input to new inputs*/
+		newinputs->AddObject(inputout);
+	}
+
+	/*Assign output pointer*/
+	return newinputs;
+}
+/*}}}*/
 /*FUNCTION Inputs::SpawnTriaInputs{{{1*/
 Inputs* Inputs::SpawnTriaInputs(int* indices){
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 3935)
@@ -459,4 +459,48 @@
 
 	return tria;
+}
+/*}}}*/
+/*FUNCTION Penta::SpawnBeam {{{1*/
+void* Penta::SpawnBeam(int g0, int g1){
+
+	/*out of grids g0,g1 and g2 from Penta, build a beam element: */
+	Beam* beam=NULL;
+	int indices[2];
+	int zero=0;
+	Hook       *beam_hnodes     = NULL;
+	Hook       *beam_hmatice    = NULL;
+	Hook       *beam_hmatpar    = NULL;
+	Parameters *beam_parameters = NULL;
+	Inputs     *beam_inputs     = NULL;
+
+	indices[0]=g0;
+	indices[1]=g1;
+
+	beam_hnodes =this->hnodes.Spawn(indices,2);
+	beam_hmatice=this->hmatice.Spawn(&zero,1);
+	beam_hmatpar=this->hmatpar.Spawn(&zero,1);
+	beam_parameters=this->parameters;
+	beam_inputs=(Inputs*)this->inputs->SpawnBeamInputs(indices);
+
+	beam=new Beam();
+	beam->id=this->id;
+	beam->inputs=beam_inputs;
+	beam->parameters=beam_parameters;
+
+	/*now deal with hooks and objects: */
+	beam->hnodes.copy(beam_hnodes);
+	beam->hmatice.copy(beam_hmatice);
+	beam->hmatpar.copy(beam_hmatpar);
+
+	/*recover objects: */
+	//beam->nodes=(Node**)beam->hnodes.deliverp();
+	//beam->matice=(Matice*)beam->hmatice.delivers();
+	//beam->matpar=(Matpar*)beam->hmatpar.delivers();
+
+	delete beam_hnodes;
+	delete beam_hmatice;
+	delete beam_hmatpar;
+
+	return beam;
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 3935)
@@ -56,4 +56,5 @@
 		int   MarshallSize();
 		int   MyRank();
+		void*  SpawnBeam(int g0, int g1);
 		void*  SpawnTria(int g0, int g1, int g2);
 		void  SetClone(int* minranks);
Index: /issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/BeamVertexInput.cpp	(revision 3935)
@@ -130,4 +130,18 @@
 }
 /*}}}*/
+/*FUNCTION BeamVertexInput::SpawnBeamInput{{{1*/
+Input* BeamVertexInput::SpawnBeamInput(int* indices){
+
+	/*output*/
+	BeamVertexInput* outinput=NULL;
+
+	/*Create new Beam input (copy of current input)*/
+	outinput=new BeamVertexInput(this->enum_type,&this->values[0]);
+
+	/*Assign output*/
+	return outinput;
+
+}
+/*}}}*/
 /*FUNCTION BeamVertexInput::SpawnTriaInput{{{1*/
 Input* BeamVertexInput::SpawnTriaInput(int* indices){
Index: /issm/trunk/src/c/objects/Inputs/BeamVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BeamVertexInput.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/BeamVertexInput.h	(revision 3935)
@@ -47,4 +47,5 @@
 		void  UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
+		Input* SpawnBeamInput(int* indices);
 		Input* SpawnTriaInput(int* indices);
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/BoolInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BoolInput.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/BoolInput.cpp	(revision 3935)
@@ -129,4 +129,19 @@
 }
 /*}}}*/
+/*FUNCTION BoolInput::SpawnBeamInput{{{1*/
+Input* BoolInput::SpawnBeamInput(int* indices){
+
+	/*output*/
+	BoolInput* outinput=new BoolInput();
+
+	/*only copy current value*/
+	outinput->enum_type=this->enum_type;
+	outinput->value=this->value;
+
+	/*Assign output*/
+	return outinput;
+
+}
+/*}}}*/
 /*FUNCTION BoolInput::SpawnTriaInput{{{1*/
 Input* BoolInput::SpawnTriaInput(int* indices){
Index: /issm/trunk/src/c/objects/Inputs/BoolInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/BoolInput.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/BoolInput.h	(revision 3935)
@@ -47,4 +47,5 @@
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
+		Input* SpawnBeamInput(int* indices);
 		Input* SpawnTriaInput(int* indices);
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/DoubleInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/DoubleInput.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/DoubleInput.cpp	(revision 3935)
@@ -129,6 +129,6 @@
 }
 /*}}}*/
-/*FUNCTION DoubleInput::SpawnTriaInput{{{1*/
-Input* DoubleInput::SpawnTriaInput(int* indices){
+/*FUNCTION DoubleInput::SpawnBeamInput{{{1*/
+Input* DoubleInput::SpawnBeamInput(int* indices){
 
 	/*output*/
@@ -144,4 +144,19 @@
 }
 /*}}}*/
+/*FUNCTION DoubleInput::SpawnTriaInput{{{1*/
+Input* DoubleInput::SpawnTriaInput(int* indices){
+
+	/*output*/
+	DoubleInput* outinput=new DoubleInput();
+
+	/*only copy current value*/
+	outinput->enum_type=this->enum_type;
+	outinput->value=this->value;
+
+	/*Assign output*/
+	return outinput;
+
+}
+/*}}}*/
 
 /*Object functions*/
Index: /issm/trunk/src/c/objects/Inputs/DoubleInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/DoubleInput.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/DoubleInput.h	(revision 3935)
@@ -47,4 +47,5 @@
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
+		Input* SpawnBeamInput(int* indices);
 		Input* SpawnTriaInput(int* indices);
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/Input.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/Input.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/Input.h	(revision 3935)
@@ -44,4 +44,5 @@
 		virtual void GetVyStrainRate3dPattyn(double* epsilonvy,double* xyz_list, double* gauss)=0;
 		virtual void ChangeEnum(int newenumtype)=0;
+		virtual Input* SpawnBeamInput(int* indices)=0;
 		virtual Input* SpawnTriaInput(int* indices)=0;
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/IntInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/IntInput.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/IntInput.cpp	(revision 3935)
@@ -129,4 +129,18 @@
 }
 /*}}}*/
+/*FUNCTION IntInput::SpawnBeamInput{{{1*/
+Input* IntInput::SpawnBeamInput(int* indices){
+
+	/*output*/
+	IntInput* outinput=new IntInput();
+
+	/*only copy current value*/
+	outinput->enum_type=this->enum_type;
+	outinput->value=this->value;
+
+	/*Assign output*/
+	return outinput;
+}
+/*}}}*/
 /*FUNCTION IntInput::SpawnTriaInput{{{1*/
 Input* IntInput::SpawnTriaInput(int* indices){
Index: /issm/trunk/src/c/objects/Inputs/IntInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/IntInput.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/IntInput.h	(revision 3935)
@@ -47,4 +47,5 @@
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
+		Input* SpawnBeamInput(int* indices);
 		Input* SpawnTriaInput(int* indices);
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp	(revision 3935)
@@ -132,4 +132,29 @@
 	extern int my_rank;
 	return my_rank; 
+}
+/*}}}*/
+/*FUNCTION PentaVertexInput::SpawnBeamInput{{{1*/
+Input* PentaVertexInput::SpawnBeamInput(int* indices){
+
+	/*output*/
+	BeamVertexInput* outinput=NULL;
+	double newvalues[2];
+
+	/*Loop over the new indices*/
+	for(int i=0;i<2;i++){
+
+		/*Check index value*/
+		ISSMASSERT(indices[i]>=0 && indices[i]<6);
+
+		/*Assign value to new input*/
+		newvalues[i]=this->values[indices[i]];
+	}
+
+	/*Create new Beam input*/
+	outinput=new BeamVertexInput(this->enum_type,&newvalues[0]);
+
+	/*Assign output*/
+	return outinput;
+
 }
 /*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h	(revision 3935)
@@ -46,4 +46,5 @@
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
+		Input* SpawnBeamInput(int* indices);
 		Input* SpawnTriaInput(int* indices);
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/SingVertexInput.cpp	(revision 3935)
@@ -129,4 +129,11 @@
 }
 /*}}}*/
+/*FUNCTION SingVertexInput::SpawnBeamInput{{{1*/
+Input* SingVertexInput::SpawnBeamInput(int* indices){
+
+	ISSMERROR("Cannot spaw a Beam from a Sing");
+
+}
+/*}}}*/
 /*FUNCTION SingVertexInput::SpawnTriaInput{{{1*/
 Input* SingVertexInput::SpawnTriaInput(int* indices){
Index: /issm/trunk/src/c/objects/Inputs/SingVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/SingVertexInput.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/SingVertexInput.h	(revision 3935)
@@ -46,4 +46,5 @@
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
+		Input* SpawnBeamInput(int* indices);
 		Input* SpawnTriaInput(int* indices);
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp	(revision 3935)
@@ -131,4 +131,29 @@
 }
 /*}}}*/
+/*FUNCTION BeamVertexInput::SpawnBeamInput{{{1*/
+Input* TriaVertexInput::SpawnBeamInput(int* indices){
+
+	/*output*/
+	BeamVertexInput* outinput=NULL;
+	double newvalues[2];
+
+	/*Loop over the new indices*/
+	for(int i=0;i<2;i++){
+
+		/*Check index value*/
+		ISSMASSERT(indices[i]>=0 && indices[i]<3);
+
+		/*Assign value to new input*/
+		newvalues[i]=this->values[indices[i]];
+	}
+
+	/*Create new Beam input*/
+	outinput=new BeamVertexInput(this->enum_type,&newvalues[0]);
+
+	/*Assign output*/
+	return outinput;
+
+}
+/*}}}*/
 /*FUNCTION TriaVertexInput::SpawnTriaInput{{{1*/
 Input* TriaVertexInput::SpawnTriaInput(int* indices){
@@ -142,5 +167,4 @@
 	/*Assign output*/
 	return outinput;
-
 
 }
Index: /issm/trunk/src/c/objects/Inputs/TriaVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/TriaVertexInput.h	(revision 3934)
+++ /issm/trunk/src/c/objects/Inputs/TriaVertexInput.h	(revision 3935)
@@ -47,4 +47,5 @@
 		void    UpdateInputsFromSolution(double* solution, int analysis_type, int sub_analysis_type){ISSMERROR("Not implemented yet!");}
 
+		Input* SpawnBeamInput(int* indices);
 		Input* SpawnTriaInput(int* indices);
 		/*}}}*/
