Index: /issm/trunk/src/c/objects/Elements/Penta.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5745)
+++ /issm/trunk/src/c/objects/Elements/Penta.cpp	(revision 5746)
@@ -521,5 +521,4 @@
 	
 	/*flags: */
-	bool onbed;
 	int  approximation;
 
@@ -535,11 +534,8 @@
 	if (approximation!=StokesApproximationEnum) ISSMERROR("Not supported yet!");
 
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*retrieve some parameters: */
 	this->parameters->FindParam(&stokesreconditioning,StokesReconditioningEnum);
 	
-	if(!onbed){
+	if(!IsOnBed()){
 		//put zero
 		VecSetValue(sigma_b,id-1,0.0,INSERT_VALUES);
@@ -644,23 +640,15 @@
 	Tria* tria=NULL;
 
-	/*flags: */
-	bool onbed;
-	bool onwater;
-	bool onsurface;
+	/*recover some inputs: */
 	int  approximation;
-
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/*Bail out if this element if:
 	 * -> Not MacAyeal and not on the surface
 	 * -> MacAyeal (2d model) and not on bed) */
-	if ((approximation!=MacAyealApproximationEnum && !onsurface) || (approximation==MacAyealApproximationEnum && !onbed)){
+	if ((approximation!=MacAyealApproximationEnum && !IsOnSurface()) || (approximation==MacAyealApproximationEnum && !IsOnBed())){
 		return 0;
 	}
@@ -953,12 +941,6 @@
 void  Penta::Gradj(Vec gradient,int control_type){
 
-	/*inputs: */
-	bool onwater;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip grad (=0): */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	if (control_type==DragCoefficientEnum){
@@ -1011,5 +993,4 @@
 	double cm_min,cm_max;
 	int    control_type;
-	bool   onbed;
 
 	/*retrieve some parameters: */
@@ -1022,6 +1003,5 @@
 
 		/*The update is done by the element on bed only*/
-		inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-		if (!onbed) return;
+		if (!IsOnBed()) return;
 
 		/*First, get revert to previous parameter value (kept in ControlParameter input)*/
@@ -1074,5 +1054,4 @@
 
 	/*Intermediaries*/
-	bool onbed;
 	int  step,i;
 
@@ -1090,8 +1069,7 @@
 
 	/*recover parameters: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
 
 	/*Are we on the base? If not, return*/
-	if(!onbed) return;
+	if(!IsOnBed()) return;
 
 	/*OK, we are on bed. Initialize global inputs as 0*/
@@ -1389,17 +1367,11 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onsurface;
-	bool onbed;
 	int  approximation;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 	ISSMERROR("Not implemented yet");
 
@@ -1417,22 +1389,16 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onsurface;
-	bool onbed;
 	int  approximation;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal and not on the surface
 	 * -> MacAyeal (2d model) and not on bed) */
-	if ((approximation!=MacAyealApproximationEnum && !onsurface) || (approximation==MacAyealApproximationEnum && !onbed)){
+	if ((approximation!=MacAyealApproximationEnum && !IsOnSurface()) || (approximation==MacAyealApproximationEnum && !IsOnBed())){
 		return 0;
 	}
@@ -1462,22 +1428,16 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onsurface;
-	bool onbed;
 	int  approximation;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal and not on the surface
 	 * -> MacAyeal (2d model) and not on bed) */
-	if ((approximation!=MacAyealApproximationEnum && !onsurface) || (approximation==MacAyealApproximationEnum && !onbed)){
+	if ((approximation!=MacAyealApproximationEnum && !IsOnSurface()) || (approximation==MacAyealApproximationEnum && !IsOnBed())){
 		return 0;
 	}
@@ -1507,22 +1467,16 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onsurface;
-	bool onbed;
 	int  approximation;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal and not on the surface
 	 * -> MacAyeal (2d model) and not on bed) */
-	if ((approximation!=MacAyealApproximationEnum && !onsurface) || (approximation==MacAyealApproximationEnum && !onbed)){
+	if ((approximation!=MacAyealApproximationEnum && !IsOnSurface()) || (approximation==MacAyealApproximationEnum && !IsOnBed())){
 		return 0;
 	}
@@ -1552,22 +1506,16 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onsurface;
-	bool onbed;
 	int  approximation;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal and not on the surface
 	 * -> MacAyeal (2d model) and not on bed) */
-	if ((approximation!=MacAyealApproximationEnum && !onsurface) || (approximation==MacAyealApproximationEnum && !onbed)){
+	if ((approximation!=MacAyealApproximationEnum && !IsOnSurface()) || (approximation==MacAyealApproximationEnum && !IsOnBed())){
 		return 0;
 	}
@@ -1597,22 +1545,16 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onsurface;
-	bool onbed;
 	int  approximation;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal and not on the surface
 	 * -> MacAyeal (2d model) and not on bed) */
-	if ((approximation!=MacAyealApproximationEnum && !onsurface) || (approximation==MacAyealApproximationEnum && !onbed)){
+	if ((approximation!=MacAyealApproximationEnum && !IsOnSurface()) || (approximation==MacAyealApproximationEnum && !IsOnBed())){
 		return 0;
 	}
@@ -1724,22 +1666,16 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onsurface;
-	bool onbed;
 	int  approximation;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal not on the surface
 	 * -> MacAyeal (2d model) and not on bed) */
-	if ((approximation!=MacAyealApproximationEnum && !onsurface) || (approximation==MacAyealApproximationEnum && !onbed)){
+	if ((approximation!=MacAyealApproximationEnum && !IsOnSurface()) || (approximation==MacAyealApproximationEnum && !IsOnBed())){
 		return 0;
 	}
@@ -2041,17 +1977,9 @@
 	Tria*  tria=NULL;
 
-	/*flags: */
-	bool onwater;
-	bool onbed;
-
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Depth Averaging Vx and Vy*/
@@ -2079,17 +2007,9 @@
 	Tria*  tria=NULL;
 
-	/*flags: */
-	bool onbed;
-	bool onwater;
-
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Depth Averaging Vx and Vy*/
@@ -2166,7 +2086,4 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
 	Input* vx_input=NULL;
 	Input* vy_input=NULL;
@@ -2174,14 +2091,9 @@
 	Input* vyold_input=NULL;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
-
 	/*retrieve some parameters: */
 	this->parameters->FindParam(&viscosity_overshoot,ViscosityOvershootEnum);
 
 	/*If on water, skip stiffness: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Find penta on bed as pattyn must be coupled to the dofs on the bed: */
@@ -2246,5 +2158,5 @@
 
 	//Deal with 2d friction at the bedrock interface
-	if((onbed && !shelf)){
+	if(IsOnBed() && !IsOnShelf()){
 
 		/*Build a tria element using the 3 grids of the base of the penta. Then use 
@@ -2271,21 +2183,10 @@
 	int*      doflist=NULL;
 	double    Ke_gg[numdofs][numdofs]={0.0};
-	bool      onbed;
-	bool      onsurface;
 	int       connectivity[2];
 	double    one0,one1;
 	int       i0,i1,j0,j1;
 	
-	/*flags: */
-	bool onwater;
-	
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	
 	/*If on water, skip: */
-	if(onwater)return;
-
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
+	if(IsOnWater())return;
 
 	GetDofList(&doflist);
@@ -2307,5 +2208,5 @@
 
 		/*Create matrix for these two nodes*/
-		if (onbed && onsurface){
+		if (IsOnBed() && IsOnSurface()){
 			Ke_gg[i0][i0]=one0;
 			Ke_gg[i1][i1]=one0;
@@ -2315,5 +2216,5 @@
 			Ke_gg[j1][j1]=one1;
 		}
-		else if (onbed){
+		else if (IsOnBed()){
 			Ke_gg[i0][i0]=one0;
 			Ke_gg[i1][i1]=one0;
@@ -2323,5 +2224,5 @@
 			Ke_gg[j1][j1]=2*one1;
 		}
-		else if (onsurface){
+		else if (IsOnSurface()){
 			Ke_gg[j0][i0]=-one1;
 			Ke_gg[j0][j0]=one1;
@@ -2402,7 +2303,4 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
 	int  approximation;
 	Input* vx_input=NULL;
@@ -2412,11 +2310,8 @@
 
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 
 	/*If on water, skip stiffness: */
 	if(approximation==MacAyealApproximationEnum){
-		if(onwater)return;
+		if(IsOnWater())return;
 
 		/*Figure out if this pentaelem is collapsed. If so, then bailout, except if it is at the 
@@ -2424,10 +2319,10 @@
 		  the stiffness matrix. */
 
-		if (onbed==0){
+		if (!IsOnBed()){
 			/*This element should be collapsed, but this element is not on the bedrock, therefore all its 
 			 * dofs have already been frozen! Do nothing: */
 			return;
 		}
-		else if (onbed==1){
+		else{
 
 			/*This element should be collapsed into a tria element at its base. Create this tria element, 
@@ -2453,5 +2348,5 @@
 
 		/*If on water, skip stiffness: */
-		if(onwater)return;
+		if(IsOnWater())return;
 
 		/*Find penta on bed as this is a macayeal elements: */
@@ -2512,5 +2407,5 @@
 
 		//Deal with 2d friction at the bedrock interface
-		if((onbed && !shelf)){
+		if(IsOnBed() && !IsOnShelf()){
 			/*Build a tria element using the 3 grids of the base of the penta. Then use 
 			 * the tria functionality to build a friction stiffness matrix on these 3
@@ -2585,7 +2480,4 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
 	Input* vx_input=NULL;
 	Input* vy_input=NULL;
@@ -2593,14 +2485,9 @@
 	Input* vyold_input=NULL;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
-
 	/*retrieve some parameters: */
 	this->parameters->FindParam(&viscosity_overshoot,ViscosityOvershootEnum);
 
 	/*If on water, skip stiffness: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Implement standard penta element: */
@@ -2659,5 +2546,5 @@
 
 	//Deal with 2d friction at the bedrock interface
-	if((onbed && !shelf)){
+	if(IsOnBed() && !IsOnShelf()){
 		/*Build a tria element using the 3 grids of the base of the penta. Then use 
 		 * the tria functionality to build a friction stiffness matrix on these 3
@@ -2716,9 +2603,4 @@
 	int approximation;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
-
 	/*retrive parameters: */
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
@@ -2726,11 +2608,8 @@
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water or not Stokes, skip stiffness: */
-	if(onwater || approximation!=StokesApproximationEnum) return;
+	if(IsOnWater() || approximation!=StokesApproximationEnum) return;
 
 	/* Get node coordinates and dof list: */
@@ -2779,5 +2658,5 @@
 	delete gauss; //gauss of previous loop
 
-	if((onbed==1) && (shelf==0)){
+	if(IsOnBed() && !IsOnShelf()){
 
 		/*build friction object, used later on: */
@@ -2843,5 +2722,5 @@
 		delete gauss;
 
-	} //if ( (onbed==1) && (shelf==0))
+	} //if ( (IsOnBed()==1) && (IsOnShelf()==0))
 
 	/*Reduce the matrix */
@@ -2881,18 +2760,10 @@
 	Tria*  tria=NULL;
 
-	/*inputs: */
-	bool onwater; 
-	bool onsurface;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
-
 	/*If on water, skip stiffness: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*If this element  is on the surface, we have a dynamic boundary condition that applies, as a stiffness 
 	 * matrix: */
-	if(onsurface){
+	if(IsOnSurface()){
 		tria=(Tria*)SpawnTria(3,4,5); //nodes 3,4 and 5 are on the surface
 		tria->CreateKMatrixDiagnosticSurfaceVert(Kgg);
@@ -2942,16 +2813,8 @@
 	Tria* tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
-
-	if (!onbed){
+	if(IsOnWater())return;
+
+	if (!IsOnBed()){
 		return;
 	}
@@ -2971,17 +2834,9 @@
 	Tria*  tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Depth Averaging Vx and Vy*/
@@ -3008,18 +2863,9 @@
 	Tria*  tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Spawn Tria element from the base of the Penta: */
@@ -3089,18 +2935,10 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
 	Input* vx_input=NULL;
 	Input* vy_input=NULL;
 	Input* vz_input=NULL;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/* Get node coordinates and dof list: */
@@ -3214,5 +3052,5 @@
 
 	//Ice/ocean heat exchange flux on ice shelf base 
-	if(onbed && shelf){
+	if(IsOnBed() && IsOnShelf()){
 
 		tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
@@ -3233,19 +3071,11 @@
 	Tria* tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*If on water, skip: */
-	if(onwater) return;
+	if(IsOnWater()) return;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal and not on the surface
 	 * -> MacAyeal(2d model) and not on bed) */
-	if (!onbed){
+	if (!IsOnBed()){
 		return;
 	}
@@ -3267,19 +3097,11 @@
 	Tria* tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onsurface;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
-
 	/*If on water, skip: */
-	if(onwater) return;
+	if(IsOnWater()) return;
 
 	/*Bail out if this element if:
 	 * -> Non MacAyeal and not on the surface
 	 * -> MacAyeal(2d model) and not on bed) */
-	if (!onsurface){
+	if (!IsOnSurface()){
 		return;
 	}
@@ -3299,17 +3121,9 @@
 	Tria*  tria=NULL;
 
-	/*flags: */
-	bool onbed;
-	bool onwater;
-
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Depth Averaging Vx and Vy*/
@@ -3335,17 +3149,9 @@
 	Tria*  tria=NULL;
 
-	/*flags: */
-	bool onbed;
-	bool onwater;
-
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Depth Averaging Vx and Vy*/
@@ -3390,21 +3196,11 @@
 
 	/*flags: */
-	bool onwater;
-	bool onbed;
-	bool onsurface;
 	int  connectivity[2];
 
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*recover doflist: */
 	GetDofList(&doflist);
-
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
 
 	/*recover parameters: */
@@ -3453,5 +3249,5 @@
 			GetSegmentJacobianDeterminant(&Jdet,&xyz_list_segment[0][0],gauss);
 
-			if (onsurface){
+			if (IsOnSurface()){
 				for(j=0;j<NDOF2;j++) pe_g[2*node1+j]+=constant_part*pow((surface-z_g)/B,n)*slope[j]*Jdet*gauss->weight/(double)connectivity[1];
 			}
@@ -3463,5 +3259,5 @@
 
 		//Deal with lower surface
-		if (onbed){
+		if (IsOnBed()){
 			constant_part=-1.58*pow((double)10.0,-(double)10.0)*rho_ice*gravity*thickness;
 			ub=constant_part*slope[0];
@@ -3486,14 +3282,6 @@
 	Tria* tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*If on water, skip load: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Figure out if this pentaelem is Macayeal. If so, then bailout, except if it is at the 
@@ -3501,10 +3289,10 @@
 	  the load vector. */
 
-	if (onbed==0){
+	if (!IsOnBed()){
 		/*This element should be collapsed, but this element is not on the bedrock, therefore all its 
 		 * dofs have already been frozen! Do nothing: */
 		return;
 	}
-	else if (onbed==1){
+	else{
 
 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
@@ -3547,13 +3335,9 @@
 
 	/*inputs: */
-	bool onwater;
 	Input* surface_input=NULL;
 	Input* thickness_input=NULL;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip load: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Implement standard penta element: */
@@ -3655,7 +3439,4 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
 	int  approximation;
 	Input* vx_input=NULL;
@@ -3665,7 +3446,4 @@
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
@@ -3674,8 +3452,5 @@
 
 	/*If on water or not Stokes, skip load: */
-	if(onwater || approximation!=StokesApproximationEnum) return;
-
-	/*If on water, skip load: */
-	if(onwater)return;
+	if(IsOnWater() || approximation!=StokesApproximationEnum) return;
 
 	/*recovre material parameters: */
@@ -3741,5 +3516,5 @@
 
 	/*Deal with 2d friction at the bedrock interface: */
-	if ( (onbed==1) && (shelf==1)){
+	if(IsOnBed() && IsOnShelf()){
 
 		for(i=0;i<NUMVERTICES2D;i++){
@@ -3778,5 +3553,5 @@
 		/*Free ressources:*/
 		delete gauss;
-	} //if ( (onbed==1) && (shelf==1))
+	} //if ( (IsOnBed()==1) && (IsOnShelf()==1))
 
 	/*Reduce the matrix */
@@ -3794,17 +3569,8 @@
 void  Penta::CreatePVectorAdjointStokes(Vec p_g){
 
-	int i;
 	Tria* tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onsurface;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onsurface,ElementOnSurfaceEnum);
-
 	/*If on water, skip: */
-	if(onwater || !onsurface)return;
+	if(IsOnWater() || !IsOnSurface())return;
 
 	/*Call Tria's function*/
@@ -3846,19 +3612,13 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onbed;
 	Input* vx_input=NULL;
 	Input* vy_input=NULL;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*If we are on the bedrock, spawn a tria on the bedrock, and use it to build the 
 	 *diagnostic base vertical stifness: */
-	if(onbed){
+	if(IsOnBed()){
 		tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 are on the bedrock
 		tria->CreatePVectorDiagnosticBaseVert(pg);
@@ -3919,18 +3679,10 @@
 	/*Collapsed formulation: */
 	Tria*  tria=NULL;
-
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
 	
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Depth Averaging Vx and Vy*/
@@ -3956,17 +3708,9 @@
 	Tria*  tria=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*Is this element on the bed? :*/
-	if(!onbed)return;
+	if(!IsOnBed())return;
 
 	/*Spawn Tria element from the base of the Penta: */
@@ -4031,7 +3775,4 @@
 
 	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
 	Input* vx_input=NULL;
 	Input* vy_input=NULL;
@@ -4039,14 +3780,9 @@
 	Input* temperature_input=NULL;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
-
 	/*retrieve some parameters: */
 	this->parameters->FindParam(&dt,DtEnum);
 
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/* Get node coordinates and dof list: */
@@ -4105,5 +3841,5 @@
 
 	/* Ice/ocean heat exchange flux on ice shelf base */
-	if(onbed && shelf){
+	if(IsOnBed() && IsOnShelf()){
 
 		tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
@@ -4113,5 +3849,5 @@
 
 	/* Geothermal flux on ice sheet base and basal friction */
-	if(onbed && !shelf){
+	if(IsOnBed() && !IsOnShelf()){
 
 		tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria.
@@ -4580,20 +4316,14 @@
 	TriaVertexInput* triavertexinput=NULL;
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
+	/*retrieve inputs :*/
 	int  approximation;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	if (approximation==MacAyealApproximationEnum){
 		/*Bail out element if MacAyeal (2d) and not on bed*/
-		if (!onbed) return;
+		if (!IsOnBed()) return;
 
 		/*This element should be collapsed into a tria element at its base. Create this tria element, 
@@ -4612,5 +4342,5 @@
 	else{
 		/*Gradient is computed on bed only (Bbar)*/
-		if (!onbed) return;
+		if (!IsOnBed()) return;
 
 		/*Depth Average B*/
@@ -4636,24 +4366,16 @@
 	double temp_gradient[6]={0,0,0,0,0,0};
 
-	/*inputs: */
-	bool onwater;
-	bool onbed;
-	bool shelf;
+	/*retrieve inputs :*/
 	int approximation;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	/*If on shelf, skip: */
-	if(shelf)return;
+	if(IsOnShelf())return;
 
 	/*Bail out if this element does not touch the bedrock: */
-	if (!onbed) return;
+	if (!IsOnBed()) return;
 
 	if (approximation==MacAyealApproximationEnum || approximation==PattynApproximationEnum){
@@ -4682,13 +4404,9 @@
 void  Penta::InputExtrude(int enum_type,int object_type){
 
-	bool   onbed;
 	Penta *penta          = NULL;
 	Input *original_input = NULL;
 
-	/*recover parameters: */
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	/*Are we on the base, not on the surface?:*/
-	if(onbed){
+	if(IsOnBed()){
 
 		/*OK, we are on bed. we will follow the steps:
@@ -4741,14 +4459,12 @@
 
 	/*Inputs*/
-	bool onbed;
 	int  approximation;
 
 	/*Recover inputs*/
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
 	inputs->GetParameterValue(&approximation,ApproximationEnum);
 
 	/*MacAyeal, everything is done by the element on bed*/
 	if (approximation==MacAyealApproximationEnum){
-		if (!onbed){
+		if (!IsOnBed()){
 			/*Do nothing. Element on bed will take care of it*/
 			return;
@@ -5396,11 +5112,7 @@
 	double     values[numdof];
 	Penta     *penta           = NULL;
-	bool       onbed;
-
-	/*Recover inputs*/
-	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
 
 	/*If not on bed, return*/
-	if (!onbed) return;
+	if (!IsOnBed()) return;
 
 	/*Get dof list: */
@@ -5472,4 +5184,13 @@
 }
 /*}}}*/
+/*FUNCTION Penta::IsOnWater {{{1*/
+bool   Penta::IsOnWater(){
+
+	bool onwater;
+	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
+	return onwater;
+
+}
+/*}}}*/
 /*FUNCTION Penta::IsOnSurface{{{1*/
 bool Penta::IsOnSurface(void){
Index: /issm/trunk/src/c/objects/Elements/Penta.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Penta.h	(revision 5745)
+++ /issm/trunk/src/c/objects/Elements/Penta.h	(revision 5746)
@@ -178,4 +178,5 @@
 		bool	  IsOnBed(void);
 		bool    IsOnShelf(void); 
+		bool    IsOnWater(void); 
 		void	  ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp);
 		void	  ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp);
Index: /issm/trunk/src/c/objects/Elements/Tria.cpp
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5745)
+++ /issm/trunk/src/c/objects/Elements/Tria.cpp	(revision 5746)
@@ -637,5 +637,4 @@
 	int        i,j,ig;
 	int        control_type;
-	bool       onwater,shelf;
 	double     Jelem = 0;
 	double     cm_noisedmp;
@@ -648,6 +647,4 @@
 	this->parameters->FindParam(&control_type,ControlTypeEnum);
 	this->parameters->FindParam(&cm_noisedmp,CmNoiseDmpEnum);
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	Input* drag_input=inputs->GetInput(DragCoefficientEnum);
 	Input* dhdt_input=inputs->GetInput(DhDtEnum);
@@ -655,5 +652,5 @@
 
 	/*If on water, return 0: */
-	if(onwater) return 0;
+	if(IsOnWater()) return 0;
 
 	GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
@@ -824,5 +821,4 @@
 	bool onbed;
 	inputs->GetParameterValue(&onbed,ElementOnBedEnum);
-
 	return onbed;
 }
@@ -830,11 +826,16 @@
 /*FUNCTION Tria::IsOnShelf {{{1*/
 bool   Tria::IsOnShelf(){
-	/*inputs: */
+
 	bool shelf;
-
-	/*retrieve inputs :*/
 	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
-
 	return shelf;
+}
+/*}}}*/
+/*FUNCTION Tria::IsOnWater {{{1*/
+bool   Tria::IsOnWater(){
+
+	bool water;
+	inputs->GetParameterValue(&water,ElementOnWaterEnum);
+	return water;
 }
 /*}}}*/
@@ -876,10 +877,6 @@
 void  Tria::Gradj(Vec gradient,int control_type){
 
-	/*retrieve inputs :*/
-	bool onwater;
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, grad = 0: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	switch(control_type){
@@ -1009,5 +1006,4 @@
 
 	/*inputs: */
-	bool shelf;
 	Input* vx_input=NULL;
 	Input* vy_input=NULL;
@@ -1024,12 +1020,9 @@
 	parameters->FindParam(&analysis_type,AnalysisTypeEnum);
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
-
 	/*retrieve some parameters: */
 	this->parameters->FindParam(&cm_noisedmp,CmNoiseDmpEnum);
 
 	/*Get out if shelf*/
-	if(shelf)return;
+	if(IsOnShelf())return;
 
 	/* Get node coordinates and dof list: */
@@ -1536,5 +1529,4 @@
 	/*Intermediaries*/
 	int        i,ig;
-	bool       onwater;
 	double     thickness,thicknessobs,weight;
 	double     Jdet;
@@ -1544,5 +1536,5 @@
 
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -1550,5 +1542,4 @@
 
 	/*Retrieve all inputs we will be needing: */
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
 	Input* thickness_input   =inputs->GetInput(ThicknessEnum);   ISSMASSERT(thickness_input);
 	Input* thicknessobs_input=inputs->GetInput(ThicknessObsEnum);ISSMASSERT(thicknessobs_input);
@@ -1609,15 +1600,8 @@
 	/* Jacobian: */
 	double Jdet;
-
-	/*inputs: */
-	bool onwater;
-	
 	double  meanvel, epsvel;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -1714,15 +1698,8 @@
 	double scalex=1;
 	double scaley=1;
-
-	/*inputs: */
-	bool onwater;
-
 	double  meanvel, epsvel;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -1824,14 +1801,8 @@
 	double scalex=1;
 	double scaley=1;
-
-	/*inputs: */
-	bool onwater;
 	double  meanvel, epsvel;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -1933,15 +1904,8 @@
 	double S=0;
 	int    fit=-1;
-
-	/*inputs: */
-	bool onwater;
-	
 	double  meanvel, epsvel;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -2043,15 +2007,8 @@
 	double S=0;
 	int    fit=-1;
-
-	/*inputs: */
-	bool onwater;
-
 	double  meanvel, epsvel;
 
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -2195,12 +2152,6 @@
 	double normal[3];
 
-	/*inputs: */
-	bool onwater;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, return 0: */
-	if(onwater)return 0;
+	if(IsOnWater())return 0;
 
 	/* Get node coordinates and dof list: */
@@ -2904,9 +2855,4 @@
 	Input* vxold_input=NULL;
 	Input* vyold_input=NULL;
-	bool onwater,shelf;
-
-	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 
 	/*retrieve some parameters: */
@@ -2914,5 +2860,5 @@
 
 	/*First, if we are on water, return empty matrix: */
-	if(onwater) return;
+	if(IsOnWater()) return;
 
 	/* Get node coordinates and dof list: */
@@ -2975,5 +2921,5 @@
 
 	/*Do not forget to include friction: */
-	if(!shelf){
+	if(!IsOnShelf()){
 		CreateKMatrixDiagnosticMacAyealFriction(Kgg);
 	}
@@ -3026,5 +2972,4 @@
 
 	/*inputs: */
-	bool shelf;
 	int  drag_type;
 	Input* surface_input=NULL;
@@ -3037,5 +2982,4 @@
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
 	surface_input=inputs->GetInput(SurfaceEnum);
@@ -3049,5 +2993,5 @@
 	GetDofList(&doflistp,PattynApproximationEnum);
 
-	if (shelf){
+	if (IsOnShelf()){
 		/*no friction, do nothing*/
 		return;
@@ -3149,5 +3093,4 @@
 
 	/*inputs: */
-	bool shelf;
 	int  drag_type;
 	Input* surface_input=NULL;
@@ -3160,5 +3103,4 @@
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
 	surface_input=inputs->GetInput(SurfaceEnum);
@@ -3171,5 +3113,5 @@
 	GetDofList(&doflist,MacAyealApproximationEnum);
 
-	if (shelf){
+	if (IsOnShelf()){
 		/*no friction, do nothing*/
 		return;
@@ -3269,5 +3211,4 @@
 
 	/*inputs: */
-	bool shelf;
 	int  drag_type;
 	Input* surface_input=NULL;
@@ -3280,5 +3221,4 @@
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
 	surface_input=inputs->GetInput(SurfaceEnum);
@@ -3291,5 +3231,5 @@
 	GetDofList(&doflist,PattynApproximationEnum);
 
-	if (shelf){
+	if (IsOnShelf()){
 		/*no friction, do nothing*/
 		return;
@@ -3357,15 +3297,8 @@
 	const int numdofs=NUMVERTICES*NDOF2;
 	int*         doflist=NULL;
-
 	double Ke_gg[numdofs][numdofs]={0.0};
 
-	/*flags: */
-	bool onwater;
-
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	GetDofList(&doflist);
@@ -4280,9 +4213,7 @@
 	double  pe_g_gaussian[numdof];
 	double  thickness;
-	bool onwater;
 	int  drag_type;
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
 	Input* thickness_input=inputs->GetInput(ThicknessEnum); ISSMASSERT(thickness_input); 
@@ -4291,5 +4222,5 @@
 
 	/*First, if we are on water, return empty vector: */
-	if(onwater) return;
+	if(IsOnWater()) return;
 
 	/* Get node coordinates and dof list: */
@@ -4879,5 +4810,4 @@
 
 	/*flags: */
-	bool onwater;
 	Input* slopex_input=NULL;
 	Input* slopey_input=NULL;
@@ -4885,9 +4815,6 @@
 	GaussTria* gauss=NULL;
 
-	/*recover some inputs: */
-	inputs->GetParameterValue(&onwater,ElementOnWaterEnum);
-
 	/*If on water, skip: */
-	if(onwater)return;
+	if(IsOnWater())return;
 
 	GetDofList(&doflist);
@@ -5630,5 +5557,4 @@
 	double l1l2l3[3];
 	double epsilon[3]; /* epsilon=[exx,eyy,exy];*/
-	bool shelf;
 	int  drag_type;
 	double  cm_noisedmp;
@@ -5639,5 +5565,4 @@
 
 	/*retrieve inputs :*/
-	inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
 	inputs->GetParameterValue(&drag_type,DragTypeEnum);
 	Input* drag_input=inputs->GetInput(DragCoefficientEnum); ISSMASSERT(drag_input);
@@ -5647,5 +5572,5 @@
 
 	/*Get out if shelf*/
-	if(shelf)return;
+	if(IsOnShelf())return;
 
 	/* Get node coordinates and dof list: */
Index: /issm/trunk/src/c/objects/Elements/Tria.h
===================================================================
--- /issm/trunk/src/c/objects/Elements/Tria.h	(revision 5745)
+++ /issm/trunk/src/c/objects/Elements/Tria.h	(revision 5746)
@@ -77,4 +77,5 @@
 		bool   IsOnBed();
 		bool   IsOnShelf(); 
+		bool   IsOnWater(); 
 		void   GetSolutionFromInputs(Vec solution);
 		void   GetVectorFromInputs(Vec vector,int NameEnum);
