Index: /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
===================================================================
--- /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 25486)
+++ /issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp	(revision 25487)
@@ -648,4 +648,5 @@
 	bool        active_element;
 	int         domaintype;
+	int         current_mask;
 	IssmDouble  h_max;
 	IssmDouble  sedheadmin;
@@ -687,11 +688,13 @@
 	for(int i=1;i<numnodes;i++) if(sedhead[i]<=sedheadmin)sedheadmin=sedhead[i];
 	for(int i=0;i<numnodes;i++){
-		GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->nodes[i]);
+		current_mask=old_active[i];
 		/*If mask was already one, keep one or colapse*/
 		if(old_active[i]>0.){
 			vec_mask->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
+			current_mask=1;
 			/* If epl thickness gets under colapse thickness, close the layer if there is no residual*/
 			if(epl_thickness[i]<colapse_thick && residual[i]<=0.){
 				vec_mask->SetValue(basalelement->nodes[i]->Sid(),0.,INS_VAL);
+				current_mask=0;
 				recurence->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
 			}
@@ -701,4 +704,5 @@
 			if(residual[i]>0.){
 				vec_mask->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
+				current_mask=1;
 				recurence->SetValue(basalelement->nodes[i]->Sid(),1.,INS_VAL);
 			}
@@ -707,14 +711,18 @@
 				epl_thickness[i]=init_thick;
 				vec_mask->SetValue(basalelement->nodes[i]->Sid(),0.,INS_VAL);
-			}
-		}
-		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now)*/
-		if(eplhead[i]>=h_max && active_element){
-			for(int j=0;j<numnodes;j++){
-				/*Increase of the domain is on the downstream node in term of sediment head*/
-				if((sedhead[j] == sedheadmin) && (i!=j)){
-					vec_mask->SetValue(basalelement->nodes[j]->Sid(),1.,INS_VAL);
-					if(old_active[j]==0.){
-						recurence->SetValue(basalelement->nodes[j]->Sid(),1.,INS_VAL);
+				current_mask=0;
+			}
+		}
+		/*Increase of the efficient system is needed if the epl head reach the maximum value (sediment max value for now) we check that only if the epl is active here*/
+		if(current_mask>0){
+			GetHydrologyDCInefficientHmax(&h_max,basalelement,basalelement->nodes[i]);
+			if(eplhead[i]>=h_max && active_element){
+				for(int j=0;j<numnodes;j++){
+					/*Increase of the domain is on the downstream node in term of sediment head*/
+					if((sedhead[j] == sedheadmin) && (i!=j)){
+						vec_mask->SetValue(basalelement->nodes[j]->Sid(),1.,INS_VAL);
+						if(old_active[j]==0.){
+							recurence->SetValue(basalelement->nodes[j]->Sid(),1.,INS_VAL);
+						}
 					}
 				}
