Index: /issm/trunk/src/c/objects/Riftfront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Riftfront.cpp	(revision 2907)
+++ /issm/trunk/src/c/objects/Riftfront.cpp	(revision 2908)
@@ -19,4 +19,6 @@
 
 		
+/*Object constructors and destructor*/
+/*FUNCTION Riftfront::constructor {{{1*/
 Riftfront::Riftfront(){
 	/*in case :*/
@@ -24,5 +26,6 @@
 	return;
 }
-
+/*}}}1*/
+/*FUNCTION Riftfront::creation {{{1*/
 Riftfront::Riftfront(char riftfront_type[RIFTFRONTSTRING],int riftfront_id, int riftfront_node_ids[MAX_RIFTFRONT_GRIDS], int riftfront_mparid, double riftfront_h[MAX_RIFTFRONT_GRIDS],double riftfront_b[MAX_RIFTFRONT_GRIDS],double riftfront_s[MAX_RIFTFRONT_GRIDS],double riftfront_normal[2],double riftfront_length,int riftfront_fill,double riftfront_friction, double riftfront_fraction,double riftfront_fractionincrement, double riftfront_penalty_offset, int riftfront_penalty_lock, bool riftfront_active,int riftfront_counter,bool riftfront_prestable,bool riftfront_shelf){
 
@@ -67,63 +70,13 @@
 	return;
 }
-
+/*}}}1*/
+/*FUNCTION Riftfront::destructor {{{1*/
 Riftfront::~Riftfront(){
 	return;
 }
+/*}}}1*/
 		
-void Riftfront::Echo(void){
-
-	int i;
-	
-	printf("Riftfront:\n");
-	printf("   type: %s\n",type);
-	printf("   id: %i\n",id);
-	printf("   mparid: %i\n",mparid);
-
-	printf("   node_ids: ");
-	for(i=0;i<MAX_RIFTFRONT_GRIDS;i++)printf("%i ",node_ids[i]);
-	printf("\n");
-
-	printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]);
-	printf("fill: %i friction %g fraction %g fractionincrement %g \n",fill,friction,fraction,fractionincrement);
-	printf("penalty_offset %g\n",penalty_offset);
-	printf("penalty_lock %i\n",penalty_lock);
-	printf("active %i\n",active);
-	printf("counter %i\n",counter);
-	printf("prestable %i\n",prestable);
-	printf("material_converged %i\n",material_converged);
-	printf("shelf %i\n",shelf);
-}
-
-void Riftfront::DeepEcho(void){
-
-	int i;
-
-	printf("Riftfront:\n");
-	printf("   type: %s\n",type);
-	printf("   id: %i\n",id);
-
-	printf("   node_ids: ");
-	for(i=0;i<MAX_RIFTFRONT_GRIDS;i++)printf("%i ",node_ids[i]);
-	for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){
-		if (nodes[i])nodes[i]->Echo();
-	}
-	printf("\n");
-	
-	printf("   mparid: %i\n",mparid);
-	if(matpar)matpar->Echo();
-
-	printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]);
-	printf("fill: %i friction %g fraction %g fractionincrement %g \n",fill,friction,fraction,fractionincrement);
-	printf("penalty_offset %g\n",penalty_offset);
-	printf("penalty_lock %i\n",penalty_lock);
-	printf("active %i\n",active);
-	printf("counter %i\n",counter);
-	printf("prestable %i\n",prestable);
-	printf("material_converged %i\n",material_converged);
-	printf("shelf %i\n",shelf);
-	
-}		
-
+/*Object marshall*/
+/*FUNCTION Riftfront::Marshall {{{1*/
 void  Riftfront::Marshall(char** pmarshalled_dataset){
 
@@ -169,5 +122,6 @@
 	return;
 }
-		
+/*}}}1*/
+/*FUNCTION Riftfront::MarshallSize {{{1*/
 int   Riftfront::MarshallSize(){
 
@@ -196,10 +150,6 @@
 		sizeof(int); //sizeof(int) for enum type
 }
-
-char* Riftfront::GetName(void){
-	return "riftfront";
-}
-		
-
+/*}}}1*/
+/*FUNCTION Riftfront::Demarshall {{{1*/
 void  Riftfront::Demarshall(char** pmarshalled_dataset){
 
@@ -244,18 +194,8 @@
 	return;
 }
-
-int Riftfront::Enum(void){
-
-	return RiftfrontEnum();
-
-}
-
-int    Riftfront::GetId(void){ return id; }
-
-int    Riftfront::MyRank(void){ 
-	extern int my_rank;
-	return my_rank; 
-}
-
+/*}}}1*/
+
+/*Object functions*/
+/*FUNCTION Riftfront::Configure {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Riftfront::Configure"
@@ -276,20 +216,150 @@
 
 }
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::UpdateFromInputs"
-void  Riftfront::UpdateFromInputs(void* vinputs){
-
-	int  dofs[1]={0};
-	ParameterInputs* inputs=NULL;	
-	
+/*}}}1*/
+/*FUNCTION Riftfront::Constrain {{{1*/
+#define _ZIGZAGCOUNTER_
+
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::Constrain"
+int   Riftfront::Constrain(int* punstable, void* vinputs, int analysis_type){
+
+	const int     numgrids=2;
+	int           dofs[2]={0,1};
+	double        vxvy_list[2][2]; //velocities for all grids 
+	double        max_penetration;
+	double        penetration;
+	int           activate;
+	int           found;
+	int           unstable;
+
+	ParameterInputs* inputs=NULL;
+
 	inputs=(ParameterInputs*)vinputs;
 
-	inputs->Recover("thickness",&h[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);
-	inputs->Recover("bed",&b[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);
-	inputs->Recover("surface",&s[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);
-
-}
-
+
+	/*First recover parameter inputs: */
+	found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
+	if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!");
+
+
+	/*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */
+	penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];
+
+	/*activation: */
+	if(penetration<0)activate=1;
+	else  activate=0;
+
+	/*Here, we try to avoid zigzaging. When a penalty activates and deactivates for more than penalty_lock times, 
+	 * we increase the fraction of melange:*/
+	if(this->counter>this->penalty_lock){
+		/*reset counter: */
+		this->counter=0;
+		/*increase melange fraction: */
+		this->fraction+=this->fractionincrement;
+		if (this->fraction>1)this->fraction=(double)1.0;
+		//printf("riftfront %i fraction: %g\n",this->GetId(),this->fraction);
+	}
+
+	//Figure out stability of this penalty
+	if(this->active==activate){
+		unstable=0;
+	}
+	else{
+		unstable=1;
+		this->counter++;
+	}
+
+	//Set penalty flag
+	this->active=activate;
+
+	//if ((penetration>0) & (this->active==1))printf("Riftfront %i wants to be released\n",GetId());
+
+	/*assign output pointer: */
+	*punstable=unstable;
+}
+/*}}}1*/
+/*FUNCTION Riftfront::copy {{{1*/
+Object* Riftfront::copy() {
+	return new Riftfront(*this); 
+}
+/*}}}1*/
+/*FUNCTION Riftfront::CreateKMatrix {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::CreateKMatrix"
+void  Riftfront::CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
+	/*do nothing: */
+}
+/*}}}1*/
+/*FUNCTION Riftfront::CreatePVector {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::CreatePVector"
+void  Riftfront::CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
+	/*do nothing: */
+}
+/*}}}1*/
+/*FUNCTION Riftfront::DeepEcho {{{1*/
+void Riftfront::DeepEcho(void){
+
+	int i;
+
+	printf("Riftfront:\n");
+	printf("   type: %s\n",type);
+	printf("   id: %i\n",id);
+
+	printf("   node_ids: ");
+	for(i=0;i<MAX_RIFTFRONT_GRIDS;i++)printf("%i ",node_ids[i]);
+	for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){
+		if (nodes[i])nodes[i]->Echo();
+	}
+	printf("\n");
+	
+	printf("   mparid: %i\n",mparid);
+	if(matpar)matpar->Echo();
+
+	printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]);
+	printf("fill: %i friction %g fraction %g fractionincrement %g \n",fill,friction,fraction,fractionincrement);
+	printf("penalty_offset %g\n",penalty_offset);
+	printf("penalty_lock %i\n",penalty_lock);
+	printf("active %i\n",active);
+	printf("counter %i\n",counter);
+	printf("prestable %i\n",prestable);
+	printf("material_converged %i\n",material_converged);
+	printf("shelf %i\n",shelf);
+	
+}		
+/*}}}1*/
+/*FUNCTION Riftfront::Echo {{{1*/
+void Riftfront::Echo(void){
+
+	int i;
+	
+	printf("Riftfront:\n");
+	printf("   type: %s\n",type);
+	printf("   id: %i\n",id);
+	printf("   mparid: %i\n",mparid);
+
+	printf("   node_ids: ");
+	for(i=0;i<MAX_RIFTFRONT_GRIDS;i++)printf("%i ",node_ids[i]);
+	printf("\n");
+
+	printf("normal [%g,%g], length %g\n",normal[0],normal[1],normal[2]);
+	printf("fill: %i friction %g fraction %g fractionincrement %g \n",fill,friction,fraction,fractionincrement);
+	printf("penalty_offset %g\n",penalty_offset);
+	printf("penalty_lock %i\n",penalty_lock);
+	printf("active %i\n",active);
+	printf("counter %i\n",counter);
+	printf("prestable %i\n",prestable);
+	printf("material_converged %i\n",material_converged);
+	printf("shelf %i\n",shelf);
+}
+/*}}}1*/
+/*FUNCTION Riftfront::Enum {{{1*/
+int Riftfront::Enum(void){
+
+	return RiftfrontEnum();
+
+}
+/*}}}1*/
+/*FUNCTION Riftfront::GetDofList {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Riftfront::GetDofList"
@@ -311,5 +381,96 @@
 	*pnumberofdofspernode=numberofdofspernode;
 }
-
+/*}}}1*/
+/*FUNCTION Riftfront::GetId {{{1*/
+int    Riftfront::GetId(void){ return id; }
+/*}}}1*/
+/*FUNCTION Riftfront::GetName {{{1*/
+char* Riftfront::GetName(void){
+	return "riftfront";
+}
+/*}}}1*/
+/*FUNCTION Riftfront::IsMaterialStable {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::IsMaterialStable"
+int   Riftfront::IsMaterialStable(void* vinputs, int analysis_type){
+
+	int found=0;
+	ParameterInputs* inputs=NULL;
+	double converged=0;
+
+	inputs=(ParameterInputs*)vinputs;
+
+	found=inputs->Recover("converged",&converged);
+	if(!found)throw ErrorException(__FUNCT__," could not find converged flag  in inputs!");
+
+	if(converged){
+		/*ok, material non-linearity has converged. If that was already the case, we keep 
+		 * constraining the rift front. If it was not, and this is the first time the material 
+		 * has converged, we start constraining now!: */
+		this->material_converged=1;
+	}
+
+	return this->material_converged;
+}
+/*}}}1*/
+/*FUNCTION Riftfront::MaxPenetration {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::MaxPenetration"
+int   Riftfront::MaxPenetration(double* ppenetration, void* vinputs, int analysis_type){
+
+	const int     numgrids=2;
+	int           dofs[2]={0,1};
+	double        vxvy_list[2][2]; //velocities for all grids 
+	double        max_penetration;
+	double        penetration=0;
+	int           found;
+
+	ParameterInputs* inputs=NULL;
+
+	inputs=(ParameterInputs*)vinputs;
+
+	//initialize: 
+	penetration=-1;
+
+	found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
+	if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!");
+
+	/*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */
+	penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];
+
+	/*Now, we return penetration only if we are active!: */
+	if(this->active==0)penetration=-1;
+
+	/*If we are zigzag locked, same thing: */
+	if(this->counter>this->penalty_lock)penetration=-1;
+	
+	/*assign output pointer: */
+	*ppenetration=penetration;
+
+}
+/*}}}1*/
+/*FUNCTION Riftfront::MyRank {{{1*/
+int    Riftfront::MyRank(void){ 
+	extern int my_rank;
+	return my_rank; 
+}
+/*}}}1*/
+/*FUNCTION Riftfront::OutputProperties {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::OutputProperties"
+void  Riftfront::OutputProperties(Vec riftproperties){
+
+	int row_id=0;
+	double value;
+
+	/*recover id of penalty: */
+	row_id=this->GetId()-1; //c indexing, ids were matlab indexed
+	value=(double)this->fraction;
+
+	/*Plug id and fraction  into riftproperties matrix: */
+	VecSetValues(riftproperties,1,&row_id,&value,INSERT_VALUES);
+}
+/*}}}1*/
+/*FUNCTION Riftfront::PenaltyCreateKMatrix {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Riftfront::PenaltyCreateKMatrix"
@@ -409,5 +570,6 @@
 
 }
-		
+/*}}}1*/
+/*FUNCTION Riftfront::PenaltyCreatePVector {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Riftfront::PenaltyCreatePVector"
@@ -515,144 +677,6 @@
 	}
 }
-
-Object* Riftfront::copy() {
-	return new Riftfront(*this); 
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::CreateKMatrix"
-void  Riftfront::CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type){
-	/*do nothing: */
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::CreatePVector"
-void  Riftfront::CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type){
-	/*do nothing: */
-}
-
-bool  Riftfront::PreStable(){
-	return prestable;
-}
-
-void Riftfront::SetPreStable(){
-	prestable=1;
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::PreConstrain"
-int   Riftfront::PreConstrain(int* punstable, void* vinputs, int analysis_type){
-
-	const int     numgrids=2;
-	int           dofs[2]={0,1};
-	double        vxvy_list[2][2]; //velocities for all grids 
-	double        penetration;
-	int           unstable;
-	ParameterInputs* inputs=NULL;
-	int           found;
-
-	inputs=(ParameterInputs*)vinputs;
-
-	/*First recover velocity: */
-	found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
-	if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!");
-	
-	/*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */
-	penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];
-
-	/*Ok, we are preconstraining here. Ie, anything that penetrates is constrained until stability of the entire set 
-	 * of constraints is reached.: */
-	if(penetration<0){
-		if (!this->active){
-			/*This is the first time penetration happens: */
-			this->active=1;
-			unstable=1;
-		}
-		else{
-			/*This constraint was already active: */
-			this->active=1;
-			unstable=0;
-		}
-	}
-	else{
-		/*No penetration happening. : */
-		if (!this->active){
-			/*This penalty was not active, and no penetration happening. Do nonthing: */
-			this->active=0;
-			unstable=0; 
-		}
-		else{
-			/*Ok, this penalty wants to get released. But not now, this is preconstraint, not constraint: */
-			this->active=1;
-			unstable=0;
-		}
-	}
-
-	/*assign output pointer: */
-	*punstable=unstable;
-}
-
-
-#define _ZIGZAGCOUNTER_
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::Constrain"
-int   Riftfront::Constrain(int* punstable, void* vinputs, int analysis_type){
-
-	const int     numgrids=2;
-	int           dofs[2]={0,1};
-	double        vxvy_list[2][2]; //velocities for all grids 
-	double        max_penetration;
-	double        penetration;
-	int           activate;
-	int           found;
-	int           unstable;
-
-	ParameterInputs* inputs=NULL;
-
-	inputs=(ParameterInputs*)vinputs;
-
-
-	/*First recover parameter inputs: */
-	found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
-	if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!");
-
-
-	/*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */
-	penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];
-
-	/*activation: */
-	if(penetration<0)activate=1;
-	else  activate=0;
-
-	/*Here, we try to avoid zigzaging. When a penalty activates and deactivates for more than penalty_lock times, 
-	 * we increase the fraction of melange:*/
-	if(this->counter>this->penalty_lock){
-		/*reset counter: */
-		this->counter=0;
-		/*increase melange fraction: */
-		this->fraction+=this->fractionincrement;
-		if (this->fraction>1)this->fraction=(double)1.0;
-		//printf("riftfront %i fraction: %g\n",this->GetId(),this->fraction);
-	}
-
-	//Figure out stability of this penalty
-	if(this->active==activate){
-		unstable=0;
-	}
-	else{
-		unstable=1;
-		this->counter++;
-	}
-
-	//Set penalty flag
-	this->active=activate;
-
-	//if ((penetration>0) & (this->active==1))printf("Riftfront %i wants to be released\n",GetId());
-
-	/*assign output pointer: */
-	*punstable=unstable;
-}
-
+/*}}}1*/
+/*FUNCTION Riftfront::Penetration {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Riftfront::Penetration"
@@ -684,40 +708,6 @@
 
 }
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::MaxPenetration"
-int   Riftfront::MaxPenetration(double* ppenetration, void* vinputs, int analysis_type){
-
-	const int     numgrids=2;
-	int           dofs[2]={0,1};
-	double        vxvy_list[2][2]; //velocities for all grids 
-	double        max_penetration;
-	double        penetration=0;
-	int           found;
-
-	ParameterInputs* inputs=NULL;
-
-	inputs=(ParameterInputs*)vinputs;
-
-	//initialize: 
-	penetration=-1;
-
-	found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
-	if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!");
-
-	/*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */
-	penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];
-
-	/*Now, we return penetration only if we are active!: */
-	if(this->active==0)penetration=-1;
-
-	/*If we are zigzag locked, same thing: */
-	if(this->counter>this->penalty_lock)penetration=-1;
-	
-	/*assign output pointer: */
-	*ppenetration=penetration;
-
-}
-
+/*}}}1*/
+/*FUNCTION Riftfront::PotentialUnstableConstraint {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Riftfront::PotentialUnstableConstraint"
@@ -760,41 +750,83 @@
 	*punstable=unstable;
 }
-
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::IsMaterialStable"
-int   Riftfront::IsMaterialStable(void* vinputs, int analysis_type){
-
-	int found=0;
+/*}}}1*/
+/*FUNCTION Riftfront::PreConstrain {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::PreConstrain"
+int   Riftfront::PreConstrain(int* punstable, void* vinputs, int analysis_type){
+
+	const int     numgrids=2;
+	int           dofs[2]={0,1};
+	double        vxvy_list[2][2]; //velocities for all grids 
+	double        penetration;
+	int           unstable;
 	ParameterInputs* inputs=NULL;
-	double converged=0;
+	int           found;
 
 	inputs=(ParameterInputs*)vinputs;
 
-	found=inputs->Recover("converged",&converged);
-	if(!found)throw ErrorException(__FUNCT__," could not find converged flag  in inputs!");
-
-	if(converged){
-		/*ok, material non-linearity has converged. If that was already the case, we keep 
-		 * constraining the rift front. If it was not, and this is the first time the material 
-		 * has converged, we start constraining now!: */
-		this->material_converged=1;
-	}
-
-	return this->material_converged;
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Riftfront::OutputProperties"
-void  Riftfront::OutputProperties(Vec riftproperties){
-
-	int row_id=0;
-	double value;
-
-	/*recover id of penalty: */
-	row_id=this->GetId()-1; //c indexing, ids were matlab indexed
-	value=(double)this->fraction;
-
-	/*Plug id and fraction  into riftproperties matrix: */
-	VecSetValues(riftproperties,1,&row_id,&value,INSERT_VALUES);
-}
+	/*First recover velocity: */
+	found=inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);
+	if(!found)throw ErrorException(__FUNCT__," could not find velocity in inputs!");
+	
+	/*Grid 1 faces grid2, compute penetration of 2 into 1 (V2-V1).N (with N normal vector, and V velocity vector: */
+	penetration=(vxvy_list[1][0]-vxvy_list[0][0])*normal[0]+(vxvy_list[1][1]-vxvy_list[0][1])*normal[1];
+
+	/*Ok, we are preconstraining here. Ie, anything that penetrates is constrained until stability of the entire set 
+	 * of constraints is reached.: */
+	if(penetration<0){
+		if (!this->active){
+			/*This is the first time penetration happens: */
+			this->active=1;
+			unstable=1;
+		}
+		else{
+			/*This constraint was already active: */
+			this->active=1;
+			unstable=0;
+		}
+	}
+	else{
+		/*No penetration happening. : */
+		if (!this->active){
+			/*This penalty was not active, and no penetration happening. Do nonthing: */
+			this->active=0;
+			unstable=0; 
+		}
+		else{
+			/*Ok, this penalty wants to get released. But not now, this is preconstraint, not constraint: */
+			this->active=1;
+			unstable=0;
+		}
+	}
+
+	/*assign output pointer: */
+	*punstable=unstable;
+}
+/*}}}1*/
+/*FUNCTION Riftfront::PreStable {{{1*/
+bool  Riftfront::PreStable(){
+	return prestable;
+}
+/*}}}1*/
+/*FUNCTION Riftfront::SetPreStable {{{1*/
+void Riftfront::SetPreStable(){
+	prestable=1;
+}
+/*}}}1*/
+/*FUNCTION Riftfront::UpdateFromInputs {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Riftfront::UpdateFromInputs"
+void  Riftfront::UpdateFromInputs(void* vinputs){
+
+	int  dofs[1]={0};
+	ParameterInputs* inputs=NULL;	
+	
+	inputs=(ParameterInputs*)vinputs;
+
+	inputs->Recover("thickness",&h[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);
+	inputs->Recover("bed",&b[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);
+	inputs->Recover("surface",&s[0],1,dofs,MAX_RIFTFRONT_GRIDS,(void**)nodes);
+
+}
+/*}}}1*/
Index: /issm/trunk/src/c/objects/Sing.cpp
===================================================================
--- /issm/trunk/src/c/objects/Sing.cpp	(revision 2907)
+++ /issm/trunk/src/c/objects/Sing.cpp	(revision 2908)
@@ -18,12 +18,16 @@
 
 
+/*Object constructors and destructor*/
+/*FUNCTION Sing::constructor {{{1*/
 Sing::Sing(){
 	return;
 }
-
+/*}}}*/
+/*FUNCTION Sing::destructor {{{1*/
 Sing::~Sing(){
 	return;
 }
-		
+/*}}}*/
+/*FUNCTION Sing::creation {{{1*/
 Sing::Sing(int sing_id, int sing_mid, int sing_mparid, int sing_numparid,int sing_g, double sing_h, double sing_k){
 
@@ -53,49 +57,8 @@
 	return;
 }
-
-#undef __FUNCT__
-#define __FUNCT__ "Sing::Echo"
-
-void Sing::Echo(void){
-
-	printf("Sing:\n");
-	printf("   id: %i\n",id);
-	printf("   mid: %i\n",mid);
-	printf("   mparid: %i\n",mparid);
-	printf("   node_id=[%i]\n",node_id);
-	printf("   node_offset=[%i]\n",node_offset);
-	printf("   matice_offset=%i\n",matice_offset);
-	printf("   matpar_offset=%i\n",matpar_offset);
-	printf("   h=[%g]\n",h);
-	printf("   k=[%g]\n",h);
-	printf("   node: \n");
-	if(node)node->Echo();
-	if(matice)matice->Echo();
-	if(matpar)matpar->Echo();
-
-	return;
-}
-
-#undef __FUNCT__
-#define __FUNCT__ "Sing::DeepEcho"
-void Sing::DeepEcho(void){
-
-	printf("Sing:\n");
-	printf("   id: %i\n",id);
-	printf("   mid: %i\n",mid);
-	printf("   mparid: %i\n",mparid);
-	printf("   node_id=[%i]\n",node_id);
-	printf("   node_offset=[%i]\n",node_offset);
-	printf("   matice_offset=%i\n",matice_offset);
-	printf("   matpar_offset=%i\n",matpar_offset);
-	printf("   h=[%g]\n",h);
-	printf("   k=[%g]\n",h);
-	printf("   node: \n");
-	if(node)node->Echo();
-	if(matice)matice->Echo();
-	if(matpar)matpar->Echo();
-
-	return;
-}
+/*}}}*/
+
+/*Object marshall*/
+/*FUNCTION Sing::Marshall {{{1*/
 void  Sing::Marshall(char** pmarshalled_dataset){
 
@@ -132,5 +95,6 @@
 	return;
 }
-		
+/*}}}*/
+/*FUNCTION Sing::MashallSize {{{1*/
 int   Sing::MarshallSize(){
 	return sizeof(id)
@@ -151,9 +115,6 @@
 		+sizeof(int); //sizeof(int) for enum type
 }
-
-char* Sing::GetName(void){
-	return "sing";
-}
-
+/*}}}*/
+/*FUNCTION Sing::Demarshall {{{1*/
 void  Sing::Demarshall(char** pmarshalled_dataset){
 
@@ -193,17 +154,32 @@
 	return;
 }
-int Sing::Enum(void){
-
-	return SingEnum();
-
-}
-int    Sing::GetId(void){ return id; }
-
-int    Sing::MyRank(void){ 
-	extern int my_rank;
-	return my_rank; 
-}
-
-
+/*}}}*/
+		
+/*Object functions*/
+/*FUNCTION Sing::ComputePressure {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::ComputePressure"
+void  Sing::ComputePressure(Vec p_g){
+
+	int i;
+	const int numgrids=1;
+	int doflist[numgrids];
+	double pressure[numgrids];
+	double rho_ice,g;
+
+	/*Get dof list on which we will plug the pressure values: */
+	GetDofList1(&doflist[0]);
+
+	/*pressure is lithostatic: */
+	rho_ice=matpar->GetRhoIce();
+	g=matpar->GetG();
+	pressure[0]=rho_ice*g*h;
+	
+	/*plug local pressure values into global pressure vector: */
+	VecSetValues(p_g,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
+
+}
+/*}}}*/
+/*FUNCTION Sing::Configure {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Sing::Configure"
@@ -232,5 +208,13 @@
 
 }
-
+/*}}}*/
+/*FUNCTION Sing::copy {{{1*/
+Object* Sing::copy() {
+	
+	return new Sing(*this); 
+
+}
+/*}}}*/
+/*FUNCTION Sing::CreateKMatrix {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Sing::CreateKMatrix"
@@ -249,6 +233,6 @@
 
 }
-
-
+/*}}}*/
+/*FUNCTION Sing::CreateKMatrixDiagnosticHutter {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Sing::CreateKMatrixDiagnosticHutter"
@@ -273,6 +257,6 @@
 
 }
-
-	
+/*}}}*/
+/*FUNCTION Sing::CreatePVector {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Sing::CreatePVector"
@@ -290,7 +274,6 @@
 
 }
-
-
-
+/*}}}*/
+/*FUNCTION Sing::CreatePVectorDiagnosticHutter {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Sing::CreatePVectorDiagnosticHutter"
@@ -347,6 +330,200 @@
 
 }
-
-
+/*}}}*/
+/*FUNCTION Sing::DeepEcho {{{1*/
+#undef __FUNCT__
+#define __FUNCT__ "Sing::DeepEcho"
+void Sing::DeepEcho(void){
+
+	printf("Sing:\n");
+	printf("   id: %i\n",id);
+	printf("   mid: %i\n",mid);
+	printf("   mparid: %i\n",mparid);
+	printf("   node_id=[%i]\n",node_id);
+	printf("   node_offset=[%i]\n",node_offset);
+	printf("   matice_offset=%i\n",matice_offset);
+	printf("   matpar_offset=%i\n",matpar_offset);
+	printf("   h=[%g]\n",h);
+	printf("   k=[%g]\n",h);
+	printf("   node: \n");
+	if(node)node->Echo();
+	if(matice)matice->Echo();
+	if(matpar)matpar->Echo();
+
+	return;
+}
+/*}}}*/
+/*FUNCTION Sing::Du {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::Du"
+void  Sing::Du(_p_Vec*,void*,int,int){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::Echo{{{1*/
+#undef __FUNCT__
+#define __FUNCT__ "Sing::Echo"
+
+void Sing::Echo(void){
+
+	printf("Sing:\n");
+	printf("   id: %i\n",id);
+	printf("   mid: %i\n",mid);
+	printf("   mparid: %i\n",mparid);
+	printf("   node_id=[%i]\n",node_id);
+	printf("   node_offset=[%i]\n",node_offset);
+	printf("   matice_offset=%i\n",matice_offset);
+	printf("   matpar_offset=%i\n",matpar_offset);
+	printf("   h=[%g]\n",h);
+	printf("   k=[%g]\n",h);
+	printf("   node: \n");
+	if(node)node->Echo();
+	if(matice)matice->Echo();
+	if(matpar)matpar->Echo();
+
+	return;
+}
+/*}}}*/
+/*FUNCTION Sing::Enum {{{1*/
+int Sing::Enum(void){
+
+	return SingEnum();
+
+}
+/*}}}*/
+/*FUNCTION Sing::GetBedList {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::GetBedList"
+void  Sing::GetBedList(double*){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::GetDofList {{{1*/
+void  Sing::GetDofList(int* doflist,int* pnumberofdofspernode){
+
+	int i;
+	int doflist_per_node[MAXDOFSPERNODE];
+	int numberofdofspernode;
+	
+	node->GetDofList(&doflist_per_node[0],&numberofdofspernode);
+	for(i=0;i<numberofdofspernode;i++){
+		doflist[i]=doflist_per_node[i];
+	}
+
+	/*Assign output pointers:*/
+	*pnumberofdofspernode=numberofdofspernode;
+
+}
+/*}}}*/
+/*FUNCTION Sing::GetDofList1 {{{1*/
+void  Sing::GetDofList1(int* doflist){
+
+	int i;
+	doflist[0]=node->GetDofList1();
+
+}
+/*}}}*/
+/*FUNCTION Sing::GetId {{{1*/
+int    Sing::GetId(void){ return id; }
+/*}}}*/
+/*FUNCTION Sing::GetMatPar {{{1*/
+void* Sing::GetMatPar(){
+	return matpar;
+}
+/*}}}*/
+/*FUNCTION Sing::GetName {{{1*/
+char* Sing::GetName(void){
+	return "sing";
+}
+/*}}}*/
+/*FUNCTION Sing::GetNodes {{{1*/
+void  Sing::GetNodes(void** vpnodes){
+	
+	Node** pnodes=(Node**)vpnodes;
+
+	pnodes[0]=node;
+}
+/*}}}*/
+/*FUNCTION Sing::GetOnBed {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::GetOnBed"
+int   Sing::GetOnBed(){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::GetShelf {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::GetShelf"
+int   Sing::GetShelf(){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::GetThicknessList {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::GetThicknessList"
+void  Sing::GetThicknessList(double* thickness_list){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::Gradj {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::Gradj"
+void  Sing::Gradj(_p_Vec*, void*, int, int ,char*){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::GradB {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::GradjB"
+void  Sing::GradjB(_p_Vec*, void*, int,int){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::GradjDrag {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::GradjDrag"
+void  Sing::GradjDrag(_p_Vec*, void*, int,int){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::MassFlux {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::MassFlux"
+double Sing::MassFlux( double* segment,double* ug){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::MaticeConfiguration {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::MaticeConfiguration"
+void  Sing::MaticeConfiguration(Matice* sing_matice,int sing_matice_offset){
+	matice=sing_matice;
+	matice_offset=sing_matice_offset;
+}
+/*}}}*/
+/*FUNCTION Sing::MatparConfiguration {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::MatparConfiguration"
+void  Sing::MatparConfiguration(Matpar* sing_matpar,int sing_matpar_offset){
+
+	matpar=sing_matpar;
+	matpar_offset=sing_matpar_offset;
+
+}
+/*}}}*/
+/*FUNCTION Sing::Misfit {{{1*/
+#undef __FUNCT__ 
+#define __FUNCT__ "Sing::Misfit"
+double Sing::Misfit(void*, int,int){
+	throw ErrorException(__FUNCT__," not supported yet!");
+}
+/*}}}*/
+/*FUNCTION Sing::MyRank {{{1*/
+int    Sing::MyRank(void){ 
+	extern int my_rank;
+	return my_rank; 
+}
+/*}}}*/
+/*FUNCTION Sing::UpdateFromInputs {{{1*/
 #undef __FUNCT__ 
 #define __FUNCT__ "Sing::UpdateFromInputs"
@@ -381,151 +558,3 @@
 
 }
-		
-void  Sing::GetDofList(int* doflist,int* pnumberofdofspernode){
-
-	int i;
-	int doflist_per_node[MAXDOFSPERNODE];
-	int numberofdofspernode;
-	
-	node->GetDofList(&doflist_per_node[0],&numberofdofspernode);
-	for(i=0;i<numberofdofspernode;i++){
-		doflist[i]=doflist_per_node[i];
-	}
-
-	/*Assign output pointers:*/
-	*pnumberofdofspernode=numberofdofspernode;
-
-}
-
-void  Sing::GetDofList1(int* doflist){
-
-	int i;
-	doflist[0]=node->GetDofList1();
-
-}
-
-
-void* Sing::GetMatPar(){
-	return matpar;
-}
-
-		
-void  Sing::GetNodes(void** vpnodes){
-	
-	Node** pnodes=(Node**)vpnodes;
-
-	pnodes[0]=node;
-}
-		
-
-Object* Sing::copy() {
-	
-	return new Sing(*this); 
-
-}
-
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::NodeConfiguration"
-void  Sing::NodeConfiguration(int sing_node_id,Node* sing_node,int sing_node_offset){
-
-	node_id=sing_node_id;
-	node=sing_node;
-	node_offset=sing_node_offset;
-
-}
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::MaticeConfiguration"
-void  Sing::MaticeConfiguration(Matice* sing_matice,int sing_matice_offset){
-	matice=sing_matice;
-	matice_offset=sing_matice_offset;
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::MatparConfiguration"
-void  Sing::MatparConfiguration(Matpar* sing_matpar,int sing_matpar_offset){
-
-	matpar=sing_matpar;
-	matpar_offset=sing_matpar_offset;
-
-}
-
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::GetShelf"
-int   Sing::GetShelf(){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::GetOnBed"
-int   Sing::GetOnBed(){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::GetBedList"
-void  Sing::GetBedList(double*){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::Du"
-void  Sing::Du(_p_Vec*,void*,int,int){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::Gradj"
-void  Sing::Gradj(_p_Vec*, void*, int, int ,char*){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::GradjDrag"
-void  Sing::GradjDrag(_p_Vec*, void*, int,int){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::GradjB"
-void  Sing::GradjB(_p_Vec*, void*, int,int){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::Misfit"
-double Sing::Misfit(void*, int,int){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::GetThicknessList"
-void  Sing::GetThicknessList(double* thickness_list){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::ComputePressure"
-void  Sing::ComputePressure(Vec p_g){
-
-	int i;
-	const int numgrids=1;
-	int doflist[numgrids];
-	double pressure[numgrids];
-	double rho_ice,g;
-
-	/*Get dof list on which we will plug the pressure values: */
-	GetDofList1(&doflist[0]);
-
-	/*pressure is lithostatic: */
-	rho_ice=matpar->GetRhoIce();
-	g=matpar->GetG();
-	pressure[0]=rho_ice*g*h;
-	
-	/*plug local pressure values into global pressure vector: */
-	VecSetValues(p_g,numgrids,doflist,(const double*)pressure,INSERT_VALUES);
-
-}
-
-#undef __FUNCT__ 
-#define __FUNCT__ "Sing::MassFlux"
-double Sing::MassFlux( double* segment,double* ug){
-	throw ErrorException(__FUNCT__," not supported yet!");
-}
+/*}}}*/
Index: /issm/trunk/src/c/objects/Spc.cpp
===================================================================
--- /issm/trunk/src/c/objects/Spc.cpp	(revision 2907)
+++ /issm/trunk/src/c/objects/Spc.cpp	(revision 2908)
@@ -17,7 +17,11 @@
 
 		
+/*Object constructors and destructor*/
+/*FUNCTION Spc::constructor {{{1*/
 Spc::Spc(){
 	return;
 }
+/*}}}1*/
+/*FUNCTION Spc::creation {{{1*/
 Spc::Spc(int spc_sid,int spc_nodeid, int spc_dof,double spc_value){
 
@@ -29,28 +33,13 @@
 	return;
 }
-
+/*}}}1*/
+/*FUNCTION Spc::destructor {{{1*/
 Spc::~Spc(){
 	return;
 }
+/*}}}1*/
 		
-void Spc::Echo(void){
-
-	printf("Spc:\n");
-	printf("   sid: %i\n",sid);
-	printf("   nodeid: %i\n",nodeid);
-	printf("   dof: %i\n",dof);
-	printf("   value: %g\n",value);
-	return;
-}
-
-void Spc::DeepEcho(void){
-
-	printf("Spc:\n");
-	printf("   sid: %i\n",sid);
-	printf("   nodeid: %i\n",nodeid);
-	printf("   dof: %i\n",dof);
-	printf("   value: %g\n",value);
-	return;
-}		
+/*Object marshall*/
+/*FUNCTION Spc::Marshall {{{1*/
 void  Spc::Marshall(char** pmarshalled_dataset){
 
@@ -76,15 +65,12 @@
 	return;
 }
-		
+/*}}}1*/
+/*FUNCTION Spc::MarshallSize {{{1*/
 int   Spc::MarshallSize(){
 
 	return sizeof(sid)+sizeof(nodeid)+sizeof(dof)+sizeof(value)+sizeof(int); //sizeof(int) for enum type
 }
-
-char* Spc::GetName(void){
-	return "spc";
-}
-		
-
+/*}}}1*/
+/*FUNCTION Spc::Demarshall {{{1*/
 void  Spc::Demarshall(char** pmarshalled_dataset){
 
@@ -106,4 +92,38 @@
 	return;
 }
+/*}}}1*/
+
+/*Object functions*/
+/*FUNCTION Spc::copy {{{1*/
+Object* Spc::copy() {
+	return new Spc(*this); 
+}
+/*}}}1*/
+/*FUNCTION Spc::DeepEcho {{{1*/
+void Spc::DeepEcho(void){
+
+	printf("Spc:\n");
+	printf("   sid: %i\n",sid);
+	printf("   nodeid: %i\n",nodeid);
+	printf("   dof: %i\n",dof);
+	printf("   value: %g\n",value);
+	return;
+}		
+/*}}}1*/
+/*FUNCTION Spc::DistributeNumDofs {{{1*/
+void  Spc::DistributeNumDofs(int* numdofspernode,int analysis_type){return;}
+/*}}}1*/
+/*FUNCTION Spc::Echo {{{1*/
+void Spc::Echo(void){
+
+	printf("Spc:\n");
+	printf("   sid: %i\n",sid);
+	printf("   nodeid: %i\n",nodeid);
+	printf("   dof: %i\n",dof);
+	printf("   value: %g\n",value);
+	return;
+}
+/*}}}1*/
+/*FUNCTION Spc::Enum {{{1*/
 int Spc::Enum(void){
 
@@ -111,27 +131,33 @@
 
 }
+/*}}}1*/
+/*FUNCTION Spc::GetDof {{{1*/
+int Spc::GetDof(){
+	return dof;
+}
+/*}}}1*/
+/*FUNCTION Spc::GetId {{{1*/
 int    Spc::GetId(void){ return sid; }
-
+/*}}}1*/
+/*FUNCTION Spc::GetName {{{1*/
+char* Spc::GetName(void){
+	return "spc";
+}
+/*}}}1*/
+/*FUNCTION Spc::GetNodeId {{{1*/
+int   Spc::GetNodeId(){
+	
+	return nodeid;
+}
+/*}}}1*/
+/*FUNCTION Spc::GetValue {{{1*/
+double Spc::GetValue(){
+	return value;
+}
+/*}}}1*/
+/*FUNCTION Spc::MyRank {{{1*/
 int    Spc::MyRank(void){ 
 	extern int my_rank;
 	return my_rank; 
 }
-void  Spc::DistributeNumDofs(int* numdofspernode,int analysis_type){return;}
-		
-int   Spc::GetNodeId(){
-	
-	return nodeid;
-}
-
-int Spc::GetDof(){
-	return dof;
-}
-
-double Spc::GetValue(){
-	return value;
-}
-
-Object* Spc::copy() {
-	return new Spc(*this); 
-}
-
+/*}}}1*/
