Index: /issm/trunk-jpl/src/c/cores/transient_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/transient_core.cpp	(revision 23079)
+++ /issm/trunk-jpl/src/c/cores/transient_core.cpp	(revision 23080)
@@ -93,13 +93,15 @@
 		IssmDouble *oceangridx;
 		IssmDouble *oceangridy;
-		IssmDouble *icebase_oceangrid;
-		IssmDouble* x_ice = NULL;
-		IssmDouble* y_ice = NULL;
-		IssmDouble* lat_ice = NULL;
-		IssmDouble* lon_ice = NULL;
-		IssmDouble* z_ice = NULL;
-		IssmDouble* icebase= NULL;
-		int*        index_ice= NULL;
-		int*        index_ocean = NULL;
+		IssmDouble *icebase_oceangrid = NULL;
+		IssmDouble *icemask_oceangrid = NULL;
+		IssmDouble* x_ice             = NULL;
+		IssmDouble* y_ice             = NULL;
+		IssmDouble* lat_ice           = NULL;
+		IssmDouble* lon_ice           = NULL;
+		IssmDouble* z_ice             = NULL;
+		IssmDouble* icebase           = NULL;
+		IssmDouble* icemask           = NULL;
+		int*        index_ice         = NULL;
+		int*        index_ocean       = NULL;
 		int         ngrids_ice=femmodel->vertices->NumberOfVertices();
 		int         nels_ice=femmodel->elements->NumberOfElements();
@@ -138,5 +140,5 @@
 		femmodel->parameters->SetParam(oceangridy,ngrids_ocean,OceanGridYEnum);
 
-		/*Interpolate ice base onto ocean grid*/
+		/*Interpolate ice base and mask onto ocean grid*/
 		femmodel->GetMesh(femmodel->vertices,femmodel->elements,&x_ice,&y_ice,&z_ice,&index_ice);
 		BamgTriangulatex(&index_ocean,&nels_ocean,oceangridx,oceangridy,ngrids_ocean);
@@ -157,5 +159,26 @@
 						oceangridx,oceangridy,ngrids_ocean,options);
 		delete options;
-
+		xDelete<IssmDouble>(icebase);
+
+		GetVectorFromInputsx(&icemask,femmodel,MaskIceLevelsetEnum,VertexSIdEnum);
+		Options* options2 = new Options();
+		GenericOption<double> *odouble2 = new GenericOption<double>();
+		const char* name2 = "default";
+		odouble2->name =xNew<char>(strlen(name2)+1);
+		memcpy(odouble2->name,name2,(strlen(name2)+1)*sizeof(char));
+		odouble2->value=+1.;
+		odouble2->numel=1;
+		odouble2->ndims=1;
+		odouble2->size=NULL;
+		options2->AddOption(odouble2);
+		InterpFromMeshToMesh2dx(&icemask_oceangrid,index_ice,lon_ice,lat_ice,ngrids_ice,nels_ice,
+					icemask,ngrids_ice,1,oceangridx,oceangridy,ngrids_ocean,options2);
+		delete options2;
+		xDelete<IssmDouble>(icemask);
+
+		/*Put +9999 for places where there is no ice!*/
+		for(int i=0;i<ngrids_ocean;i++) if(icemask_oceangrid[i]>0.) icebase_oceangrid[i]=+9999.;
+		xDelete<IssmDouble>(icemask_oceangrid);
+			
 		if(my_rank==0){
 			ISSM_MPI_Send(icebase_oceangrid,ngrids_ocean,ISSM_MPI_DOUBLE,0,10001008,tomitgcmcomm);
@@ -170,5 +193,4 @@
 		xDelete<IssmDouble>(y_ice);
 		xDelete<IssmDouble>(z_ice);
-		xDelete<IssmDouble>(icebase);
 		xDelete<IssmDouble>(icebase_oceangrid);
 		xDelete<IssmDouble>(oceangridx);
@@ -266,11 +288,33 @@
 			/*Interpolate ice base and mask onto ocean grid*/
 			GetVectorFromInputsx(&icebase,femmodel,BaseEnum,VertexSIdEnum);
+			Options* options = new Options();
+			GenericOption<double> *odouble = new GenericOption<double>();
+			const char* name = "default";
+			odouble->name =xNew<char>(strlen(name)+1);
+			memcpy(odouble->name,name,(strlen(name)+1)*sizeof(char));
+			odouble->value=+9999.;
+			odouble->numel=1;
+			odouble->ndims=1;
+			odouble->size=NULL;
+			options->AddOption(odouble);
 			InterpFromMeshToMesh2dx(&icebase_oceangrid,index_ice,lon_ice,lat_ice,ngrids_ice,nels_ice,
-						icebase,ngrids_ice,1,oceangridx,oceangridy,ngrids_ocean,NULL);
+						icebase,ngrids_ice,1,oceangridx,oceangridy,ngrids_ocean,options);
+			delete options;
 			xDelete<IssmDouble>(icebase);
 
 			GetVectorFromInputsx(&icemask,femmodel,MaskIceLevelsetEnum,VertexSIdEnum);
+			Options* options2 = new Options();
+			GenericOption<double> *odouble2 = new GenericOption<double>();
+			const char* name2 = "default";
+			odouble2->name =xNew<char>(strlen(name2)+1);
+			memcpy(odouble2->name,name2,(strlen(name2)+1)*sizeof(char));
+			odouble2->value=+1.;
+			odouble2->numel=1;
+			odouble2->ndims=1;
+			odouble2->size=NULL;
+			options2->AddOption(odouble2);
 			InterpFromMeshToMesh2dx(&icemask_oceangrid,index_ice,lon_ice,lat_ice,ngrids_ice,nels_ice,
-						icemask,ngrids_ice,1,oceangridx,oceangridy,ngrids_ocean,NULL);
+						icemask,ngrids_ice,1,oceangridx,oceangridy,ngrids_ocean,options2);
+			delete options2;
 			xDelete<IssmDouble>(icemask);
 
