Index: issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp
===================================================================
--- issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16534)
+++ issm/trunk-jpl/src/c/analyses/HydrologyDCInefficientAnalysis.cpp	(revision 16539)
@@ -6,5 +6,148 @@
 
 /*Model processing*/
-int HydrologyDCInefficientAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
+int  HydrologyDCInefficientAnalysis::DofsPerNode(int** doflist,int meshtype,int approximation){/*{{{*/
 	return 1;
 }/*}}}*/
+void HydrologyDCInefficientAnalysis::UpdateParameters(Parameters** pparameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
+
+	Parameters *parameters = NULL;
+	int         hydrology_model;
+	int         sedimentlimit_flag;
+	int         transfer_flag;
+	bool        isefficientlayer;
+	IssmDouble  sedimentlimit;
+	IssmDouble  penalty_factor;
+	IssmDouble  leakagefactor;
+	IssmDouble  rel_tol;
+
+	/*Get parameters: */
+	parameters=*pparameters;
+
+	/*retrieve some parameters: */
+	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+
+	/*Now, do we really want DC?*/
+	if(hydrology_model!=HydrologydcEnum){
+		*pparameters=parameters;
+		return;
+	}
+
+	iomodel->FetchData(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+	iomodel->FetchData(&sedimentlimit_flag,HydrologydcSedimentlimitFlagEnum);
+	iomodel->FetchData(&transfer_flag,HydrologydcTransferFlagEnum);
+	iomodel->FetchData(&penalty_factor,HydrologydcPenaltyFactorEnum);
+	iomodel->FetchData(&rel_tol,HydrologydcRelTolEnum);
+
+	if(sedimentlimit_flag==1){
+		iomodel->FetchData(&sedimentlimit,HydrologydcSedimentlimitEnum);
+		parameters->AddObject(new DoubleParam(HydrologydcSedimentlimitEnum,sedimentlimit));
+	}
+
+	if(transfer_flag==1){
+		iomodel->FetchData(&leakagefactor,HydrologydcLeakageFactorEnum);
+		parameters->AddObject(new DoubleParam(HydrologydcLeakageFactorEnum,leakagefactor));
+	}
+
+	parameters->AddObject(new DoubleParam(HydrologydcPenaltyFactorEnum,penalty_factor));
+	parameters->AddObject(new IntParam(HydrologyModelEnum,hydrology_model));
+	parameters->AddObject(new BoolParam(HydrologydcIsefficientlayerEnum,isefficientlayer));
+	parameters->AddObject(new IntParam(HydrologydcSedimentlimitFlagEnum,sedimentlimit_flag));
+	parameters->AddObject(new IntParam(HydrologydcTransferFlagEnum,transfer_flag));
+	parameters->AddObject(new DoubleParam(HydrologydcRelTolEnum,rel_tol));
+
+	/*Assign output pointer: */
+	*pparameters=parameters;
+}/*}}}*/
+void HydrologyDCInefficientAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
+
+	bool   isefficientlayer;
+	int    hydrology_model;
+
+	/*Fetch data needed: */
+	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+
+	/*Now, do we really want DC?*/
+	if(hydrology_model!=HydrologydcEnum) return;
+
+	/*Fetch data needed: */
+	iomodel->Constant(&isefficientlayer,HydrologydcIsefficientlayerEnum);
+
+	/*Update elements: */
+	int counter=0;
+	for(int i=0;i<iomodel->numberofelements;i++){
+		if(iomodel->my_elements[i]){
+			Element* element=(Element*)elements->GetObjectByOffset(counter);
+			element->Update(i,iomodel,analysis_counter,analysis_type,P1Enum);
+			counter++;
+		}
+	}
+
+	iomodel->FetchDataToInput(elements,ThicknessEnum);
+	iomodel->FetchDataToInput(elements,SurfaceEnum);
+	iomodel->FetchDataToInput(elements,BedEnum);
+	iomodel->FetchDataToInput(elements,MaskIceLevelsetEnum);
+	iomodel->FetchDataToInput(elements,MeshElementonbedEnum);
+	iomodel->FetchDataToInput(elements,MeshElementonsurfaceEnum);
+	iomodel->FetchDataToInput(elements,BasalforcingsMeltingRateEnum);
+	iomodel->FetchDataToInput(elements,SedimentHeadEnum);
+	if(isefficientlayer)iomodel->FetchDataToInput(elements,HydrologydcMaskEplactiveEnum);
+}/*}}}*/
+void HydrologyDCInefficientAnalysis::CreateNodes(Nodes** pnodes,IoModel* iomodel){/*{{{*/
+
+	/*Fetch parameters: */
+	int  hydrology_model;
+	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+
+	/*Now, do we really want DC?*/
+	if(hydrology_model!=HydrologydcEnum) return;
+
+	if(iomodel->meshtype==Mesh3DEnum) iomodel->FetchData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+	::CreateNodes(pnodes,iomodel,HydrologyDCInefficientAnalysisEnum,P1Enum);
+	iomodel->DeleteData(2,MeshVertexonbedEnum,MeshVertexonsurfaceEnum);
+}/*}}}*/
+void HydrologyDCInefficientAnalysis::CreateConstraints(Constraints** pconstraints,IoModel* iomodel){/*{{{*/
+
+	/*Recover pointer: */
+	Constraints* constraints=*pconstraints;
+
+	/*retrieve some parameters: */
+	int hydrology_model;
+	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+	if(hydrology_model!=HydrologydcEnum) return;
+
+	IoModelToConstraintsx(constraints,iomodel,HydrologydcSpcsedimentHeadEnum,HydrologyDCInefficientAnalysisEnum,P1Enum);
+
+	/*Assign output pointer: */
+	*pconstraints=constraints;
+}/*}}}*/
+void HydrologyDCInefficientAnalysis::CreateLoads(Loads** ploads, IoModel* iomodel){/*{{{*/
+
+	/*Recover pointer: */
+	Loads* loads=*ploads;
+
+	/*Fetch parameters: */
+	int hydrology_model;
+	iomodel->Constant(&hydrology_model,HydrologyModelEnum);
+	if(hydrology_model!=HydrologydcEnum) return;
+
+	iomodel->FetchData(1,MeshVertexonbedEnum);
+
+	//create penalties for nodes: no node can have a temperature over the melting point
+	CreateSingleNodeToElementConnectivity(iomodel);
+	for(int i=0;i<iomodel->numberofvertices;i++){
+		if (iomodel->meshtype==Mesh3DEnum){
+			/*keep only this partition's nodes:*/
+			if(iomodel->my_vertices[i]){
+				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
+			}
+		}
+		else if(reCast<int>(iomodel->Data(MeshVertexonbedEnum)[i])){
+			if(iomodel->my_vertices[i]){
+				loads->AddObject(new Pengrid(iomodel->loadcounter+i+1,i,iomodel,HydrologyDCInefficientAnalysisEnum));
+			}	
+		}
+	}
+	/*Assign output pointer: */
+	*ploads=loads;
+	iomodel->DeleteData(1,MeshVertexonbedEnum);
+}/*}}}*/
