Index: ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18785)
+++ ../trunk-jpl/src/c/shared/Enum/EnumDefinitions.h	(revision 18786)
@@ -490,6 +490,9 @@
 	PenpairEnum,
 	ProfilerEnum,
 	MatrixParamEnum,
+	MassconEnum,
+	MassconNameEnum,
+	MassconLevelsetEnum,
 	NodeSIdEnum,
 	VectorParamEnum,
 	RiftfrontEnum,
Index: ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18785)
+++ ../trunk-jpl/src/c/shared/Enum/EnumToStringx.cpp	(revision 18786)
@@ -487,6 +487,9 @@
 		case PenpairEnum : return "Penpair";
 		case ProfilerEnum : return "Profiler";
 		case MatrixParamEnum : return "MatrixParam";
+		case MassconEnum : return "Masscon";
+		case MassconNameEnum : return "MassconName";
+		case MassconLevelsetEnum : return "MassconLevelset";
 		case NodeSIdEnum : return "NodeSId";
 		case VectorParamEnum : return "VectorParam";
 		case RiftfrontEnum : return "Riftfront";
Index: ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp
===================================================================
--- ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18785)
+++ ../trunk-jpl/src/c/shared/Enum/StringToEnumx.cpp	(revision 18786)
@@ -496,19 +496,22 @@
 	      else if (strcmp(name,"Penpair")==0) return PenpairEnum;
 	      else if (strcmp(name,"Profiler")==0) return ProfilerEnum;
 	      else if (strcmp(name,"MatrixParam")==0) return MatrixParamEnum;
+	      else if (strcmp(name,"Masscon")==0) return MassconEnum;
+	      else if (strcmp(name,"MassconName")==0) return MassconNameEnum;
+	      else if (strcmp(name,"MassconLevelset")==0) return MassconLevelsetEnum;
 	      else if (strcmp(name,"NodeSId")==0) return NodeSIdEnum;
 	      else if (strcmp(name,"VectorParam")==0) return VectorParamEnum;
 	      else if (strcmp(name,"Riftfront")==0) return RiftfrontEnum;
 	      else if (strcmp(name,"RiftfrontType")==0) return RiftfrontTypeEnum;
 	      else if (strcmp(name,"Segment")==0) return SegmentEnum;
 	      else if (strcmp(name,"SegmentRiftfront")==0) return SegmentRiftfrontEnum;
-	      else if (strcmp(name,"SpcDynamic")==0) return SpcDynamicEnum;
-	      else if (strcmp(name,"SpcStatic")==0) return SpcStaticEnum;
-	      else if (strcmp(name,"SpcTransient")==0) return SpcTransientEnum;
          else stage=5;
    }
    if(stage==5){
-	      if (strcmp(name,"StringArrayParam")==0) return StringArrayParamEnum;
+	      if (strcmp(name,"SpcDynamic")==0) return SpcDynamicEnum;
+	      else if (strcmp(name,"SpcStatic")==0) return SpcStaticEnum;
+	      else if (strcmp(name,"SpcTransient")==0) return SpcTransientEnum;
+	      else if (strcmp(name,"StringArrayParam")==0) return StringArrayParamEnum;
 	      else if (strcmp(name,"StringParam")==0) return StringParamEnum;
 	      else if (strcmp(name,"Seg")==0) return SegEnum;
 	      else if (strcmp(name,"SegInput")==0) return SegInputEnum;
@@ -625,13 +628,13 @@
 	      else if (strcmp(name,"P0")==0) return P0Enum;
 	      else if (strcmp(name,"P1")==0) return P1Enum;
 	      else if (strcmp(name,"P1DG")==0) return P1DGEnum;
-	      else if (strcmp(name,"P1bubble")==0) return P1bubbleEnum;
-	      else if (strcmp(name,"P1bubblecondensed")==0) return P1bubblecondensedEnum;
-	      else if (strcmp(name,"P2")==0) return P2Enum;
          else stage=6;
    }
    if(stage==6){
-	      if (strcmp(name,"P2bubble")==0) return P2bubbleEnum;
+	      if (strcmp(name,"P1bubble")==0) return P1bubbleEnum;
+	      else if (strcmp(name,"P1bubblecondensed")==0) return P1bubblecondensedEnum;
+	      else if (strcmp(name,"P2")==0) return P2Enum;
+	      else if (strcmp(name,"P2bubble")==0) return P2bubbleEnum;
 	      else if (strcmp(name,"P2bubblecondensed")==0) return P2bubblecondensedEnum;
 	      else if (strcmp(name,"P2xP1")==0) return P2xP1Enum;
 	      else if (strcmp(name,"P1xP2")==0) return P1xP2Enum;
@@ -748,13 +751,13 @@
 	      else if (strcmp(name,"GenericOption")==0) return GenericOptionEnum;
 	      else if (strcmp(name,"OptionCell")==0) return OptionCellEnum;
 	      else if (strcmp(name,"OptionStruct")==0) return OptionStructEnum;
-	      else if (strcmp(name,"Cuffey")==0) return CuffeyEnum;
-	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
-	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
          else stage=7;
    }
    if(stage==7){
-	      if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
+	      if (strcmp(name,"Cuffey")==0) return CuffeyEnum;
+	      else if (strcmp(name,"Paterson")==0) return PatersonEnum;
+	      else if (strcmp(name,"Arrhenius")==0) return ArrheniusEnum;
+	      else if (strcmp(name,"LliboutryDuval")==0) return LliboutryDuvalEnum;
 	      else if (strcmp(name,"TransientIslevelset")==0) return TransientIslevelsetEnum;
 	      else if (strcmp(name,"ExtrapolationVariable")==0) return ExtrapolationVariableEnum;
 	      else if (strcmp(name,"IceMaskNodeActivation")==0) return IceMaskNodeActivationEnum;
Index: ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp
===================================================================
--- ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 18785)
+++ ../trunk-jpl/src/c/modules/ModelProcessorx/CreateOutputDefinitions.cpp	(revision 18786)
@@ -113,7 +113,40 @@
 				xDelete<int>(misfit_weights_enum_s);
 				/*}}}*/
 			}
+			else if (output_definition_enums[i]==MassconEnum){
+				/*Deal with masscons: {{{*/
+				
+				/*masscon variables: */
+				int          nummasscons;
+				char**       masscon_name_s             = NULL;    
+				IssmDouble** masscon_levelset_s           = NULL;
+				int*         masscon_levelset_M_s    = NULL;
+				int*         masscon_levelset_N_s    = NULL;
 
+				/*Fetch name and levelset, etc ... (see src/m/classes/masscon.m): */
+				iomodel->FetchMultipleData(&masscon_name_s,&nummasscons,MassconNameEnum);
+				iomodel->FetchMultipleData(&masscon_levelset_s,&masscon_levelset_M_s,&masscon_levelset_N_s,&nummasscons,MassconLevelsetEnum);
+				for(j=0;j<nummasscons;j++){
+
+					/*Create a masscon object: */
+					output_definitions->AddObject(new Masscon(masscon_name_s[j],masscon_levelset_s[j],masscon_levelset_M_s[j]));
+
+				}
+
+				/*Free ressources:*/
+				for(j=0;j<nummasscons;j++){
+					char* string=NULL;
+					IssmDouble* matrix = NULL;
+
+					string = masscon_name_s[j];    xDelete<char>(string);
+					matrix = masscon_levelset_s[j]; xDelete<IssmDouble>(matrix);
+				}
+				xDelete<char*>(masscon_name_s);
+				xDelete<IssmDouble*>(masscon_levelset_s);
+				xDelete<int>(masscon_levelset_M_s);
+				xDelete<int>(masscon_levelset_N_s);
+				/*}}}*/
+			}
 			else _error_("output definition enum " << output_definition_enums[i] << "not supported yet!");
 		}
 	}
Index: ../trunk-jpl/src/c/Makefile.am
===================================================================
--- ../trunk-jpl/src/c/Makefile.am	(revision 18785)
+++ ../trunk-jpl/src/c/Makefile.am	(revision 18786)
@@ -436,6 +436,7 @@
 					./modules/ConstraintsStatex/RiftConstraintsState.cpp\
 					./classes/Massfluxatgate.h \
 					./classes/Misfit.h \
+					./classes/Masscon.h \
 					./modules/ModelProcessorx/CreateOutputDefinitions.cpp\
 					./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.h\
 					./modules/OutputDefinitionsResponsex/OutputDefinitionsResponsex.cpp\
Index: ../trunk-jpl/src/c/classes/classes.h
===================================================================
--- ../trunk-jpl/src/c/classes/classes.h	(revision 18785)
+++ ../trunk-jpl/src/c/classes/classes.h	(revision 18786)
@@ -18,6 +18,7 @@
 #include "./Segment.h"
 #include "./Massfluxatgate.h"
 #include "./Misfit.h"
+#include "./Masscon.h"
 
 /*Constraints: */
 #include "./Constraints/Constraints.h"
Index: ../trunk-jpl/src/c/classes/Masscon.h
===================================================================
--- ../trunk-jpl/src/c/classes/Masscon.h	(revision 0)
+++ ../trunk-jpl/src/c/classes/Masscon.h	(revision 18786)
@@ -0,0 +1,105 @@
+/*!\file Masscon.h
+ * \brief: header file for Masscon object
+ */
+
+#ifndef _MASSCON_H_
+#define _MASSCON_H_
+
+/*Headers:*/
+/*{{{*/
+#include "./Definition.h"
+#include "../datastructures/datastructures.h"
+#include "./Elements/Element.h"
+#include "./Elements/Elements.h"
+#include "./FemModel.h"
+#include "../classes/Params/Parameters.h"
+/*}}}*/
+
+class Masscon: public Object, public Definition{
+
+	public: 
+
+		char*       name;
+		IssmDouble* levelset;
+		int         M;
+		
+		/*Masscon constructors, destructors :*/
+		Masscon(){/*{{{*/
+
+			this->name = NULL;
+			this->levelset=NULL;
+			this->M=0;
+
+		}
+		/*}}}*/
+		Masscon(char* in_name, IssmDouble* levelsetin, int Min){ /*{{{*/
+
+			this->name   = xNew<char>(strlen(in_name)+1);
+			xMemCpy<char>(this->name,in_name,strlen(in_name)+1);
+
+			this->levelset   = xNew<IssmDouble>(Min);
+			xMemCpy<IssmDouble>(this->levelset, levelsetin, Min);
+
+			this->M=Min;
+
+		}
+		/*}}}*/
+		~Masscon(){/*{{{*/
+			if(this->name)xDelete(this->name); 
+			if(this->levelset)xDelete(this->levelset);
+		}
+		/*}}}*/
+		/*Object virtual function resolutoin: */
+		void Echo(void){/*{{{*/
+			_printf_(" Masscon: " << name << "\n");
+			_printf_("    levelset: " << this->levelset << "\n");
+			_printf_("    M: " << this->M << "\n");
+		}
+		/*}}}*/
+		void DeepEcho(void){/*{{{*/
+			this->Echo();
+		}
+		/*}}}*/
+		int Id(void){/*{{{*/
+			return -1;
+		}
+		/*}}}*/
+		int ObjectEnum(void){/*{{{*/
+			return MassconEnum;
+		}
+		/*}}}*/
+		Object* copy() {/*{{{*/
+			Masscon* mf = new Masscon(this->name,this->levelset,this->M);
+			return (Object*) mf;
+		}
+		/*}}}*/
+		/*Definition virtual function resolutoin: */
+		char* Name(){/*{{{*/
+
+			char* name2=xNew<char>(strlen(this->name)+1);
+			xMemCpy(name2,this->name,strlen(this->name)+1);
+
+			return name2;
+		}
+		/*}}}*/
+		 IssmDouble Response(FemModel* femmodel){/*{{{*/
+
+			 int i;
+			 IssmDouble mass_t=0.;
+			 IssmDouble all_mass_t=0.;
+
+
+			 for(i=0;i<femmodel->elements->Size();i++){
+				 Element* element=(Element*)femmodel->elements->GetObjectByOffset(i);
+				 mass_t+=element->Masscon(this->levelset);
+			 }
+
+			 ISSM_MPI_Allreduce ( (void*)&mass_t,(void*)&all_mass_t,1,ISSM_MPI_DOUBLE,ISSM_MPI_SUM,IssmComm::GetComm());
+			 mass_t=all_mass_t;
+			 
+			 return mass_t;
+		 }
+			/*}}}*/
+};
+
+#endif  /* _MASSCON_H_ */
Index: ../trunk-jpl/src/c/classes/Elements/Element.h
===================================================================
--- ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 18785)
+++ ../trunk-jpl/src/c/classes/Elements/Element.h	(revision 18786)
@@ -204,6 +204,7 @@
 		virtual bool   IsOnBase()=0;
 		virtual bool   IsOnSurface()=0;
 		virtual void   GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating)=0;
+		virtual void   GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* levelsetvalues)=0;
 		virtual IssmDouble GetGroundedPortion(IssmDouble* xyz_list)=0;
 		virtual void   GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;
 		virtual Node*  GetNode(int node_number)=0;
@@ -272,6 +273,7 @@
 		virtual IssmDouble IceVolumeAboveFloatation(void)=0;
 		virtual IssmDouble TotalSmb(void)=0;
 		virtual IssmDouble Misfit(int modelenum,int observationenum,int weightsenum)=0;
+		virtual IssmDouble Masscon(IssmDouble* levelset)=0;
 		virtual IssmDouble MisfitArea(int weightsenum)=0;
 		virtual int    VertexConnectivity(int vertexindex)=0;
 		virtual void   VerticalSegmentIndices(int** pindices,int* pnumseg)=0;
Index: ../trunk-jpl/src/c/classes/Elements/Tria.cpp
===================================================================
--- ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 18785)
+++ ../trunk-jpl/src/c/classes/Elements/Tria.cpp	(revision 18786)
@@ -667,6 +667,56 @@
 
 }
 /*}}}*/
+void        Tria::GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* gl){/*{{{*/
+	
+	/*Computeportion of the element that has a positive levelset*/ 
+
+	bool               negative=true;
+	int                point;
+	const IssmPDouble  epsilon= 1.e-15;
+	IssmDouble         f1,f2;
+
+	/*Be sure that values are not zero*/
+	if(gl[0]==0.) gl[0]=gl[0]+epsilon;
+	if(gl[1]==0.) gl[1]=gl[1]+epsilon;
+	if(gl[2]==0.) gl[2]=gl[2]+epsilon;
+
+	/*Check that not all nodes are positive or negative*/
+	if(gl[0]>0 && gl[1]>0 && gl[2]>0){ // All positive
+		point=0;
+		f1=1.;
+		f2=1.;
+	}
+	else if(gl[0]<0 && gl[1]<0 && gl[2]<0){ //All negative
+		point=0;
+		f1=0.;
+		f2=0.;
+	}
+	else{
+		if(gl[0]*gl[1]*gl[2]<0) negative=false;
+
+		if(gl[0]*gl[1]>0){ //Nodes 0 and 1 are similar, so points must be found on segment 0-2 and 1-2
+			point=2;
+			f1=gl[2]/(gl[2]-gl[0]);
+			f2=gl[2]/(gl[2]-gl[1]);
+		}
+		else if(gl[1]*gl[2]>0){ //Nodes 1 and 2 are similar, so points must be found on segment 0-1 and 0-2
+			point=0;
+			f1=gl[0]/(gl[0]-gl[1]);
+			f2=gl[0]/(gl[0]-gl[2]);
+		}
+		else if(gl[0]*gl[2]>0){ //Nodes 0 and 2 are similar, so points must be found on segment 1-0 and 1-2
+			point=1;
+			f1=gl[1]/(gl[1]-gl[2]);
+			f2=gl[1]/(gl[1]-gl[0]);
+		}
+	}
+	*point1=point;
+	*fraction1=f1;
+	*fraction2=f2;
+	*mainlynegative=negative;
+}
+/*}}}*/
 void       Tria::GetGroundedPart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlyfloating){/*{{{*/
 	/*Computeportion of the element that is grounded*/ 
 
@@ -2715,7 +2765,63 @@
 	return Jelem;
 }
 /*}}}*/
+IssmDouble Tria::Masscon(IssmDouble* levelset){ /*{{{*/
 
+
+	/*intermediary: */
+	IssmDouble* values=NULL;
+	Input*      thickness_input=NULL;
+	IssmDouble  thickness;
+	IssmDouble  weight;
+	IssmDouble  Jdet;
+	IssmDouble  volume;
+	IssmDouble  rho_ice;
+	IssmDouble* xyz_list=NULL;
+	int         point1;
+	IssmDouble  fraction1,fraction2;
+	bool        mainlynegative=true;
+	
+	/*Output:*/
+	volume=0;
+
+	/* Get node coordinates and dof list: */
+	GetVerticesCoordinates(&xyz_list);
+
+	/*Retrieve inputs required:*/
+	thickness_input=this->GetInput(ThicknessEnum); _assert_(thickness_input);
+	
+	/*Retrieve material parameters: */
+	rho_ice=matpar->GetRhoIce();
+
+	/*Retrieve values of the levelset defining the masscon: */
+	values = xNew<IssmDouble>(NUMVERTICES);
+	for(int i=0;i<NUMVERTICES;i++){
+		values[i]=levelset[this->vertices[i]->Sid()];
+	}
+		
+	/*Ok, use the level set values to figure out where we put our gaussian points:*/
+	this->GetLevelsetPositivePart(&point1,&fraction1,&fraction2,&mainlynegative,values);
+	Gauss* gauss = this->NewGauss(point1,fraction1,fraction2,mainlynegative,4);
+
+	volume=0;
+
+	for(int ig=gauss->begin();ig<gauss->end();ig++){
+		gauss->GaussPoint(ig);
+
+		this->JacobianDeterminant(&Jdet,xyz_list,gauss);
+		thickness_input->GetInputValue(&thickness, gauss);
+
+		volume+=thickness*gauss->weight*Jdet;
+	}
+
+	/* clean up and Return: */
+	xDelete<IssmDouble>(xyz_list);
+	xDelete<IssmDouble>(values);
+	delete gauss;
+	return rho_ice*volume;
+}
+/*}}}*/
+
 #ifdef _HAVE_GIA_
 void       Tria::GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x, IssmDouble* y){/*{{{*/
 
Index: ../trunk-jpl/src/c/classes/Elements/Tria.h
===================================================================
--- ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 18785)
+++ ../trunk-jpl/src/c/classes/Elements/Tria.h	(revision 18786)
@@ -68,6 +68,7 @@
 		int         FiniteElement(void);
 		Element*    GetUpperElement(void){_error_("not implemented yet");};
 		Element*    GetBasalElement(void){_error_("not implemented yet");};
+		void        GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* levelsetvalues);
 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list);
 		int         GetNodeIndex(Node* node);
@@ -122,6 +123,7 @@
 		IssmDouble MassFlux(IssmDouble* segment);
 		IssmDouble MassFlux(IssmDouble x1,IssmDouble y1, IssmDouble x2, IssmDouble y2,int segment_id);
 		void       ElementResponse(IssmDouble* presponse,int response_enum);
+		IssmDouble Masscon(IssmDouble* levelset);
 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum);
 		IssmDouble MisfitArea(int weightsenum);
 
Index: ../trunk-jpl/src/c/classes/Elements/Penta.h
===================================================================
--- ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 18785)
+++ ../trunk-jpl/src/c/classes/Elements/Penta.h	(revision 18786)
@@ -73,6 +73,7 @@
 		Penta* GetBasalPenta(void);
 		Element* GetUpperElement(void);
 		Element* GetBasalElement(void);
+		void        GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* levelsetvalues){_error_("not implemented yet");};
 		void   GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating);
 		IssmDouble GetGroundedPortion(IssmDouble* xyz_list);
 		int    GetNodeIndex(Node* node);
@@ -131,6 +132,7 @@
 		void   InputControlUpdate(IssmDouble scalar,bool save_parameter);
 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
 		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+		IssmDouble Masscon(IssmDouble* levelset){_error_("not implemented yet");};
 
 		void   MigrateGroundingLine(IssmDouble* sheet_ungrounding);
 		void   PotentialUngrounding(Vector<IssmDouble>* potential_sheet_ungrounding);
Index: ../trunk-jpl/src/c/classes/Elements/Seg.h
===================================================================
--- ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 18785)
+++ ../trunk-jpl/src/c/classes/Elements/Seg.h	(revision 18786)
@@ -108,6 +108,7 @@
 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
 		int         VelocityInterpolation(void){_error_("not implemented yet");};
 		int         TensorInterpolation(void){_error_("not implemented yet");};
+		void        GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* levelsetvalues){_error_("not implemented yet");};
 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};
@@ -156,6 +157,7 @@
 		void       ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
 		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+		IssmDouble Masscon(IssmDouble* levelset){_error_("not implemented yet");};
 
 #ifdef _HAVE_GIA_
 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
Index: ../trunk-jpl/src/c/classes/Elements/Tetra.h
===================================================================
--- ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 18785)
+++ ../trunk-jpl/src/c/classes/Elements/Tetra.h	(revision 18786)
@@ -113,6 +113,7 @@
 		void        ValueP1DerivativesOnGauss(IssmDouble* dvalue,IssmDouble* values,IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");};
 		int         VelocityInterpolation(void);
 		int         TensorInterpolation(void);
+		void        GetLevelsetPositivePart(int* point1,IssmDouble* fraction1,IssmDouble* fraction2, bool* mainlynegative,IssmDouble* levelsetvalues){_error_("not implemented yet");};
 		void        GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");};
 		IssmDouble  GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");};
 		void        GetInputValue(IssmDouble* pvalue,Node* node,int enumtype);
@@ -160,6 +161,7 @@
 		void       ElementResponse(IssmDouble* presponse,int response_enum){_error_("not implemented yet");};
 		IssmDouble Misfit(int modelenum,int observationenum,int weightsenum){_error_("not implemented yet");};
 		IssmDouble MisfitArea(int weightsenum){_error_("not implemented yet");};
+		IssmDouble Masscon(IssmDouble* levelset){_error_("not implemented yet");};
 
 #ifdef _HAVE_GIA_
 		void   GiaDeflection(Vector<IssmDouble>* wg,Vector<IssmDouble>* dwgdt,IssmDouble* x,IssmDouble* y){_error_("not implemented yet");};
Index: ../trunk-jpl/src/m/exp/exp_to_levelset.m
===================================================================
--- ../trunk-jpl/src/m/exp/exp_to_levelset.m	(revision 18785)
+++ ../trunk-jpl/src/m/exp/exp_to_levelset.m	(revision 18786)
@@ -22,8 +22,8 @@
 	%cleanup: remove 0 length segments: 
 	cleanup=1;
 	if cleanup,
-		flags=zeros(length(segments),1);
-		for j=1:length(segments),
+		flags=zeros(size(segments,1),1);
+		for j=1:size(segments,1),
 			segment=segments(j,:);
 			x1=segment(1); x2=segment(3); 
 			y1=segment(2); y2=segment(4); 
@@ -73,8 +73,8 @@
 
 	%cleanup: remove 0 length segments: 
 	if cleanup,
-		flags=zeros(length(segments),1);
-		for j=1:length(segments),
+		flags=zeros(size(segments,1),1);
+		for j=1:size(segments,1),
 			segment=segments(j,:);
 			x1=segment(1); x2=segment(3); 
 			y1=segment(2); y2=segment(4); 
Index: ../trunk-jpl/src/m/plot/applyoptions.m
===================================================================
--- ../trunk-jpl/src/m/plot/applyoptions.m	(revision 18785)
+++ ../trunk-jpl/src/m/plot/applyoptions.m	(revision 18786)
@@ -426,7 +426,7 @@
 		y=y*unit;
 	end
 	hold on,p=plot(x,y,'k.');
-	markersize=getfieldvalue(options,'markersize',5);
+	markersize=getfieldvalue(options,'markersize',12);
 	color=getfieldvalue(options,'cloudcolor','k');
 	set(p,'Color',color);
 	set(p,'MarkerSize',markersize);
Index: ../trunk-jpl/src/m/classes/masscon.m
===================================================================
--- ../trunk-jpl/src/m/classes/masscon.m	(revision 0)
+++ ../trunk-jpl/src/m/classes/masscon.m	(revision 18786)
@@ -0,0 +1,59 @@
+%MASSCON class definition
+%
+%   Usage:
+%      masscon=masscon();
+%      masscon=masscon('name','MassCon58',... %name of a North-East Greenland JPL MassCon
+%                    'levelset',level);
+% 
+%   where level is a levelset vectorial field.
+%
+%   See also: MISFIT
+
+classdef masscon
+	properties (SetAccess=public)
+		%masscon
+		name              = '';
+		levelset          = NaN; %levelset vectorial field which identifies the boundaries of the masscon
+	end
+	
+	methods
+		function obj = masscon(varargin) % {{{
+			if nargin==0,
+				obj=setdefaultparameters(obj);
+			else
+				%use provided options to change fields
+				options=pairoptions(varargin{:});
+
+				%get name
+				obj.name=getfieldvalue(options,'name','');
+				obj.levelset=getfieldvalue(options,'levelset');
+
+			end
+		end % }}}
+		function obj = setdefaultparameters(obj) % {{{
+		end % }}}
+		function md = checkconsistency(obj,md,solution,analyses) % {{{
+
+			if ~ischar(obj.name),
+				error('masscon error message: ''name'' field should be a string!');
+			end
+
+			md = checkfield(md,'fieldname','obj.levelset','field',obj.levelset,'forcing',1,'NaN',1);
+
+		end % }}}
+		function md = disp(obj) % {{{
+		
+			disp(sprintf('   Misfit:\n'));
+
+			fielddisplay(obj,'name','identifier for this masscon response');
+			fielddisplay(obj,'levelset','levelset vectorial field which identifies the boundaries of the masscon');
+
+		end % }}}
+		function md = marshall(obj,md,fid) % {{{
+
+		WriteData(fid,'object',obj,'fieldname','name','format','String');
+		WriteData(fid,'object',obj,'fieldname','levelset','format','DoubleMat','mattype',1);
+
+		end % }}}
+	end
+end
Index: ../trunk-jpl/src/m/enum/MassconNameEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/MassconNameEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/MassconNameEnum.m	(revision 18786)
@@ -0,0 +1,11 @@
+function macro=MassconNameEnum()
+%MASSCONNAMEENUM - Enum of MassconName
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=MassconNameEnum()
+
+macro=StringToEnum('MassconName');
Index: ../trunk-jpl/src/m/enum/MassconEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/MassconEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/MassconEnum.m	(revision 18786)
@@ -0,0 +1,11 @@
+function macro=MassconEnum()
+%MASSCONENUM - Enum of Masscon
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=MassconEnum()
+
+macro=StringToEnum('Masscon');
Index: ../trunk-jpl/src/m/enum/MassconLevelsetEnum.m
===================================================================
--- ../trunk-jpl/src/m/enum/MassconLevelsetEnum.m	(revision 0)
+++ ../trunk-jpl/src/m/enum/MassconLevelsetEnum.m	(revision 18786)
@@ -0,0 +1,11 @@
+function macro=MassconLevelsetEnum()
+%MASSCONLEVELSETENUM - Enum of MassconLevelset
+%
+%   WARNING: DO NOT MODIFY THIS FILE
+%            this file has been automatically generated by src/c/shared/Enum/Synchronize.sh
+%            Please read src/c/shared/Enum/README for more information
+%
+%   Usage:
+%      macro=MassconLevelsetEnum()
+
+macro=StringToEnum('MassconLevelset');
Index: ../trunk-jpl/src/m/enum/EnumDefinitions.py
===================================================================
--- ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 18785)
+++ ../trunk-jpl/src/m/enum/EnumDefinitions.py	(revision 18786)
@@ -479,6 +479,9 @@
 def PenpairEnum(): return StringToEnum("Penpair")[0]
 def ProfilerEnum(): return StringToEnum("Profiler")[0]
 def MatrixParamEnum(): return StringToEnum("MatrixParam")[0]
+def MassconEnum(): return StringToEnum("Masscon")[0]
+def MassconNameEnum(): return StringToEnum("MassconName")[0]
+def MassconLevelsetEnum(): return StringToEnum("MassconLevelset")[0]
 def NodeSIdEnum(): return StringToEnum("NodeSId")[0]
 def VectorParamEnum(): return StringToEnum("VectorParam")[0]
 def RiftfrontEnum(): return StringToEnum("Riftfront")[0]
