Index: /issm/trunk/src/c/Makefile.am
===================================================================
--- /issm/trunk/src/c/Makefile.am	(revision 4881)
+++ /issm/trunk/src/c/Makefile.am	(revision 4882)
@@ -163,4 +163,6 @@
 					./objects/Elements/PentaHook.h\
 					./objects/Elements/PentaHook.cpp\
+					./objects/Elements/PentaRef.h\
+					./objects/Elements/PentaRef.cpp\
 					./objects/Materials/Matice.h\
 					./objects/Materials/Matice.cpp\
@@ -727,4 +729,6 @@
 					./objects/Elements/PentaHook.h\
 					./objects/Elements/PentaHook.cpp\
+					./objects/Elements/PentaRef.h\
+					./objects/Elements/PentaRef.cpp\
 					./objects/Materials/Matice.h\
 					./objects/Materials/Matice.cpp\
Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4881)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 4882)
@@ -27,8 +27,7 @@
 	this->matpar=NULL;
 	this->neighbors=NULL;
-	
 	this->inputs=NULL;
+	this->parameters=NULL;
 	this->results=NULL;
-	this->parameters=NULL;
 }
 /*}}}*/
@@ -41,7 +40,7 @@
 /*}}}*/
 /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{1*/
-Penta::Penta(int penta_id, int index, IoModel* iomodel,int nummodels):
-
-	PentaHook(nummodels,index+1,iomodel->numberofelements+1) //index+1: matice id, iomodel->numberofelements+1: matpar id
+Penta::Penta(int penta_id, int index, IoModel* iomodel,int nummodels)
+	:PentaRef(nummodels)
+	,PentaHook(nummodels,index+1,iomodel->numberofelements+1) //index+1: matice id, iomodel->numberofelements+1: matpar id
                                                                       { //i is the element index
 
@@ -58,18 +57,9 @@
 	this->id=penta_id;
 
-	/*penta_elements_ids: */
-	if isnan(iomodel->upperelements[index]){
-		penta_elements_ids[1]=this->id; //upper penta is the same penta
-	}
-	else{
-		penta_elements_ids[1]=(int)(iomodel->upperelements[index]);
-	}
-	
-	if isnan(iomodel->lowerelements[index]){
-		penta_elements_ids[0]=this->id; //lower penta is the same penta
-	}
-	else{
-		penta_elements_ids[0]=(int)(iomodel->lowerelements[index]);
-	}
+	/*Build neighbors list*/
+	if isnan(iomodel->upperelements[index]) penta_elements_ids[1]=this->id; //upper penta is the same penta
+	else                                    penta_elements_ids[1]=(int)(iomodel->upperelements[index]);
+	if isnan(iomodel->lowerelements[index]) penta_elements_ids[0]=this->id; //lower penta is the same penta
+	else                                    penta_elements_ids[0]=(int)(iomodel->lowerelements[index]);
 	this->InitHookNeighbors(penta_elements_ids);
 
@@ -1752,7 +1742,8 @@
 	/*Intermediaries*/
 	IssmInt i;
-	int penta_node_ids[6];
-	int penta_vertex_ids[6];
-	double nodeinputs[6];
+	int     penta_type;
+	int     penta_node_ids[6];
+	int     penta_vertex_ids[6];
+	double  nodeinputs[6];
 
 	/*Checks if debuging*/
@@ -1760,4 +1751,15 @@
 	ISSMASSERT(iomodel->elements);
 	/*}}}*/
+
+	/*Recover element type*/
+	if ((analysis_type==PrognosticAnalysisEnum || analysis_type==BalancedthicknessAnalysisEnum) && iomodel->prognostic_DG){
+		/*P1 Discontinuous Galerkin*/
+		penta_type=P1DGEnum;
+	}
+	else{
+		/*P1 Continuous Galerkin*/
+		penta_type=P1Enum;
+	}
+	this->SetElementType(penta_type,analysis_counter);
 
 	/*Recover vertices ids needed to initialize inputs*/
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 4881)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 4882)
@@ -3,6 +3,6 @@
  */
 
-#ifndef _PENTA_H
-#define _PENTA_H
+#ifndef _PENTA_H_
+#define _PENTA_H_
 
 /*Headers:*/
@@ -10,4 +10,5 @@
 #include "./Element.h"
 #include "./PentaHook.h"
+#include "./PentaRef.h"
 class  Object;
 class Parameters;
@@ -19,10 +20,9 @@
 class Tria;
 
+#include "../../include/include.h"
 #include "../../shared/Exceptions/exceptions.h"
-#include "../../include/include.h"
-
 /*}}}*/
 
-class Penta: public Element,public PentaHook{
+class Penta: public Element,public PentaHook,public PentaRef{
 
 	public:
Index: /issm/trunk/src/c/objects/Elements/PentaRef.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/PentaRef.cpp	(revision 4882)
+++ /issm/trunk/src/c/objects/Elements/PentaRef.cpp	(revision 4882)
@@ -0,0 +1,53 @@
+/*!\file PentaRef.c
+ * \brief: implementation of the PentaRef object
+ */
+
+/*Headers:*/
+/*{{{1*/
+#ifdef HAVE_CONFIG_H
+	#include "config.h"
+#else
+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
+#endif
+
+#include "stdio.h"
+#include <string.h>
+#include "../objects.h"
+#include "../../EnumDefinitions/EnumDefinitions.h"
+#include "../../shared/shared.h"
+#include "../../Container/Container.h"
+#include "../../include/include.h"
+/*}}}*/
+
+/*Object constructors and destructor*/
+/*FUNCTION PentaRef::PentaRef(){{{1*/
+PentaRef::PentaRef(){
+	this->element_type_list=NULL;
+}
+/*}}}*/
+/*FUNCTION PentaRef::PentaRef(int* types,int nummodels){{{1*/
+PentaRef::PentaRef(const int nummodels){
+
+	/*Only allocate pointer*/
+	element_type_list=(int*)xmalloc(nummodels*sizeof(int));
+
+}
+/*}}}*/
+/*FUNCTION PentaRef::~PentaRef(){{{1*/
+PentaRef::~PentaRef(){
+	xfree((void**)&element_type_list);
+}
+/*}}}*/
+
+/*Management*/
+/*FUNCTION PentaRef::SetElementType{{{1*/
+void PentaRef::SetElementType(int type,int type_counter){
+
+	ISSMASSERT(type==P1Enum || type==P1DGEnum);
+
+	/*initialize element type*/
+	this->element_type_list[type_counter]=type;
+}
+/*}}}*/
+
+/*Reference Element numerics*/
Index: /issm/trunk/src/c/objects/Elements/PentaRef.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/PentaRef.h	(revision 4882)
+++ /issm/trunk/src/c/objects/Elements/PentaRef.h	(revision 4882)
@@ -0,0 +1,27 @@
+/*!\file:  PentaRef.h
+ * \brief abstract class for handling Penta oriented routines, like nodal functions, 
+ * strain rate generation, etc ...
+ */ 
+
+
+#ifndef _PENTAREF_H_
+#define _PENTAREF_H_
+
+class PentaRef{
+	
+
+	public: 
+		int* element_type_list; //P1CG, P1DG, MINI, P2...
+		int  element_type;
+		
+		PentaRef();
+		PentaRef(const int nummodels);
+		~PentaRef();
+
+		/*Management*/
+		void SetElementType(int type,int type_counter);
+
+		/*Numerics*/
+
+};
+#endif
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4881)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 4882)
@@ -2080,6 +2080,4 @@
 		tria_type=P1Enum;
 	}
-
-	/*Set TriaRef*/
 	this->SetElementType(tria_type,analysis_counter);
 
Index: /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp
===================================================================
--- /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp	(revision 4881)
+++ /issm/trunk/src/c/objects/Inputs/PentaVertexInput.cpp	(revision 4882)
@@ -24,5 +24,11 @@
 /*}}}*/
 /*FUNCTION PentaVertexInput::PentaVertexInput(int in_enum_type,double* values){{{1*/
-PentaVertexInput::PentaVertexInput(int in_enum_type,double* in_values){
+PentaVertexInput::PentaVertexInput(int in_enum_type,double* in_values)
+		:PentaRef(1)
+{
+
+	/*Set PentaRef*/
+	this->SetElementType(P1Enum,0);
+	this->element_type=P1Enum;
 
 	enum_type=in_enum_type;
Index: /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h
===================================================================
--- /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h	(revision 4881)
+++ /issm/trunk/src/c/objects/Inputs/PentaVertexInput.h	(revision 4882)
@@ -10,7 +10,8 @@
 /*{{{1*/
 #include "./Input.h"
+#include "../Elements/PentaRef.h"
 /*}}}*/
 
-class PentaVertexInput: public Input{
+class PentaVertexInput: public Input, public PentaRef{
 
 	public:
Index: /issm/trunk/src/c/objects/objects.h
===================================================================
--- /issm/trunk/src/c/objects/objects.h	(revision 4881)
+++ /issm/trunk/src/c/objects/objects.h	(revision 4882)
@@ -37,4 +37,5 @@
 #include "./Elements/Penta.h"
 #include "./Elements/PentaHook.h"
+#include "./Elements/PentaRef.h"
 #include "./Elements/Tria.h"
 #include "./Elements/TriaHook.h"
