Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.cpp	(revision 13915)
@@ -271,4 +271,51 @@
 }
 /*}}}*/
+/*FUNCTION Icefront::GetNodesSidList{{{*/
+void Icefront::GetNodesSidList(int* sidlist){
+
+	int type;
+	inputs->GetInputValue(&type,TypeEnum);
+	_assert_(sidlist);
+	_assert_(nodes);
+
+	switch(type){
+		case MacAyeal2dIceFrontEnum:
+		case MacAyeal3dIceFrontEnum:
+			for(int i=0;i<NUMVERTICESSEG;i++) sidlist[i]=nodes[i]->Sid();
+			return;
+#ifdef _HAVE_3D_
+		case PattynIceFrontEnum:
+		case StokesIceFrontEnum:
+			for(int i=0;i<NUMVERTICESQUA;i++) sidlist[i]=nodes[i]->Sid();
+			return;
+#endif
+		default:
+			_error_("Icefront type " << EnumToStringx(type) << " not supported yet");
+	}
+}
+/*}}}*/
+/*FUNCTION Icefront::GetNumberOfNodes{{{*/
+int Icefront::GetNumberOfNodes(void){
+
+	int type;
+	inputs->GetInputValue(&type,TypeEnum);
+
+	switch(type){
+		case MacAyeal2dIceFrontEnum:
+			return NUMVERTICESSEG;
+#ifdef _HAVE_3D_
+		case MacAyeal3dIceFrontEnum:
+			return NUMVERTICESSEG;
+		case PattynIceFrontEnum:
+			return NUMVERTICESQUA;
+		case StokesIceFrontEnum:
+			return NUMVERTICESQUA;
+#endif
+		default:
+			_error_("Icefront type " << EnumToStringx(type) << " not supported yet");
+	}
+
+}
+/*}}}*/
 /*FUNCTION Icefront::PenaltyCreateKMatrix {{{*/
 void  Icefront::PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs, IssmDouble kmax){
@@ -286,4 +333,55 @@
 void  Icefront::PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){
 	this->PenaltyCreateKMatrix(Jff,NULL,kmax);
+}
+/*}}}*/
+/*FUNCTION Icefront::SetwiseNodeConnectivity{{{*/
+void Icefront::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int set1_enum,int set2_enum){
+
+	/*Output */
+	int d_nz = 0;
+	int o_nz = 0;
+
+	/*Loop over all nodes*/
+	for(int i=0;i<this->GetNumberOfNodes();i++){
+
+		if(!flags[this->nodes[i]->Sid()]){
+
+			/*flag current node so that no other element processes it*/
+			flags[this->nodes[i]->Sid()]=true;
+
+			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+			switch(set2_enum){
+				case FsetEnum:
+					if(nodes[i]->indexing.fsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case GsetEnum:
+					if(nodes[i]->indexing.gsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case SsetEnum:
+					if(nodes[i]->indexing.ssize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				default: _error_("not supported");
+			}
+		}
+	}
+
+	/*Assign output pointers: */
+	*pd_nz=d_nz;
+	*po_nz=o_nz;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Icefront.h	(revision 13915)
@@ -71,7 +71,10 @@
 		void  CreatePVector(Vector<IssmDouble>* pf);
 		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+		int   GetNumberOfNodes(void);
+		void  GetNodesSidList(int* sidlist);
 		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
 		void  PenaltyCreatePVector(Vector<IssmDouble>*  pf, IssmDouble kmax);
 		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax);
+		void  SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Load.h	(revision 13915)
@@ -25,4 +25,6 @@
 		virtual       ~Load(){};
 		virtual void  Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
+		virtual int   GetNumberOfNodes(void)=0;
+		virtual void  GetNodesSidList(int* sidlist)=0;
 		virtual void  SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0;
 		virtual void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs)=0;
@@ -33,4 +35,5 @@
 		virtual void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax)=0;
 		virtual bool  InAnalysis(int analysis_type)=0;
+		virtual void  SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum)=0;
 };
 #endif
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.cpp	(revision 13915)
@@ -34,5 +34,5 @@
 }
 /*}}}*/
-/*}}}*//*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel, int analysis_type) {{{*/
+/*FUNCTION Numericalflux::Numericalflux(int id, int i, IoModel* iomodel, int analysis_type) {{{*/
 Numericalflux::Numericalflux(int numericalflux_id,int i, IoModel* iomodel, int in_analysis_type){
 
@@ -305,4 +305,41 @@
 }
 /*}}}*/
+/*FUNCTION Numericalflux::GetNodesSidList{{{*/
+void Numericalflux::GetNodesSidList(int* sidlist){
+
+	int type;
+	inputs->GetInputValue(&type,TypeEnum);
+	_assert_(sidlist);
+	_assert_(nodes);
+
+	switch(type){
+		case InternalEnum:
+			for(int i=0;i<NUMVERTICES_INTERNAL;i++) sidlist[i]=nodes[i]->Sid();
+			return;
+		case BoundaryEnum:
+			for(int i=0;i<NUMVERTICES_BOUNDARY;i++) sidlist[i]=nodes[i]->Sid();
+			return;
+		default:
+			_error_("Numericalflux type " << EnumToStringx(type) << " not supported yet");
+	}
+}
+/*}}}*/
+/*FUNCTION Numericalflux::GetNumberOfNodes{{{*/
+int Numericalflux::GetNumberOfNodes(void){
+
+	int type;
+	inputs->GetInputValue(&type,TypeEnum);
+
+	switch(type){
+		case InternalEnum:
+			return NUMVERTICES_INTERNAL;
+		case BoundaryEnum:
+			return NUMVERTICES_BOUNDARY;
+		default:
+			_error_("Numericalflux type " << EnumToStringx(type) << " not supported yet");
+	}
+
+}
+/*}}}*/
 /*FUNCTION Numericalflux::PenaltyCreateKMatrix {{{*/
 void  Numericalflux::PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs,IssmDouble kmax){
@@ -325,4 +362,55 @@
 	if (in_analysis_type==this->analysis_type) return true;
 	else return false;
+}
+/*}}}*/
+/*FUNCTION Numericalflux::SetwiseNodeConnectivity{{{*/
+void Numericalflux::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int set1_enum,int set2_enum){
+
+	/*Output */
+	int d_nz = 0;
+	int o_nz = 0;
+
+	/*Loop over all nodes*/
+	for(int i=0;i<this->GetNumberOfNodes();i++){
+
+		if(!flags[this->nodes[i]->Sid()]){
+
+			/*flag current node so that no other element processes it*/
+			flags[this->nodes[i]->Sid()]=true;
+
+			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+			switch(set2_enum){
+				case FsetEnum:
+					if(nodes[i]->indexing.fsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case GsetEnum:
+					if(nodes[i]->indexing.gsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case SsetEnum:
+					if(nodes[i]->indexing.ssize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				default: _error_("not supported");
+			}
+		}
+	}
+
+	/*Assign output pointers: */
+	*pd_nz=d_nz;
+	*po_nz=o_nz;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.h	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Numericalflux.h	(revision 13915)
@@ -64,8 +64,11 @@
 		void  CreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* Kfs);
 		void  CreatePVector(Vector<IssmDouble>* pf);
+		void  GetNodesSidList(int* sidlist);
+		int   GetNumberOfNodes(void);
 		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
 		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
 		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
 		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
+		void  SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.cpp	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.cpp	(revision 13915)
@@ -207,4 +207,19 @@
 	return;
 
+}
+/*}}}*/
+/*FUNCTION Pengrid::GetNodesSidList{{{*/
+void Pengrid::GetNodesSidList(int* sidlist){
+
+	_assert_(sidlist);
+	_assert_(node);
+
+	sidlist[0]=node->Sid();
+}
+/*}}}*/
+/*FUNCTION Pengrid::GetNumberOfNodes{{{*/
+int Pengrid::GetNumberOfNodes(void){
+
+	return NUMVERTICES;
 }
 /*}}}*/
@@ -280,4 +295,51 @@
 }
 /*}}}*/
+/*FUNCTION Pengrid::SetwiseNodeConnectivity{{{*/
+void Pengrid::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int set1_enum,int set2_enum){
+
+	/*Output */
+	int d_nz = 0;
+	int o_nz = 0;
+
+	if(!flags[this->node->Sid()]){
+
+		/*flag current node so that no other element processes it*/
+		flags[this->node->Sid()]=true;
+
+		/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+		switch(set2_enum){
+			case FsetEnum:
+				if(node->indexing.fsize){
+					if(this->node->IsClone())
+					 o_nz += 1;
+					else
+					 d_nz += 1;
+				}
+				break;
+			case GsetEnum:
+				if(node->indexing.gsize){
+					if(this->node->IsClone())
+					 o_nz += 1;
+					else
+					 d_nz += 1;
+				}
+				break;
+			case SsetEnum:
+				if(node->indexing.ssize){
+					if(this->node->IsClone())
+					 o_nz += 1;
+					else
+					 d_nz += 1;
+				}
+				break;
+			default: _error_("not supported");
+		}
+	}
+
+	/*Assign output pointers: */
+	*pd_nz=d_nz;
+	*po_nz=o_nz;
+}
+/*}}}*/
 
 /*Update virtual functions definitions:*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.h	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Pengrid.h	(revision 13915)
@@ -72,7 +72,10 @@
 		void  CreatePVector(Vector<IssmDouble>* pf);
 		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
+		void  GetNodesSidList(int* sidlist);
+		int   GetNumberOfNodes(void);
 		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
 		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
 		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
+		void  SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.cpp	(revision 13915)
@@ -146,4 +146,19 @@
 void  Penpair::CreateJacobianMatrix(Matrix<IssmDouble>* Jff){
 	this->CreateKMatrix(Jff,NULL);
+}
+/*}}}*/
+/*FUNCTION Penpair::GetNodesSidList{{{*/
+void Penpair::GetNodesSidList(int* sidlist){
+
+	_assert_(sidlist);
+	_assert_(nodes);
+
+	for(int i=0;i<NUMVERTICES;i++) sidlist[i]=nodes[i]->Sid();
+}
+/*}}}*/
+/*FUNCTION Penpair::GetNumberOfNodes{{{*/
+int Penpair::GetNumberOfNodes(void){
+
+	return NUMVERTICES;
 }
 /*}}}*/
@@ -189,4 +204,55 @@
 	if (in_analysis_type==this->analysis_type)return true;
 	else return false;
+}
+/*}}}*/
+/*FUNCTION Penpair::SetwiseNodeConnectivity{{{*/
+void Penpair::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int set1_enum,int set2_enum){
+
+	/*Output */
+	int d_nz = 0;
+	int o_nz = 0;
+
+	/*Loop over all nodes*/
+	for(int i=0;i<NUMVERTICES;i++){
+
+		if(!flags[this->nodes[i]->Sid()]){
+
+			/*flag current node so that no other element processes it*/
+			flags[this->nodes[i]->Sid()]=true;
+
+			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+			switch(set2_enum){
+				case FsetEnum:
+					if(nodes[i]->indexing.fsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case GsetEnum:
+					if(nodes[i]->indexing.gsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case SsetEnum:
+					if(nodes[i]->indexing.ssize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				default: _error_("not supported");
+			}
+		}
+	}
+
+	/*Assign output pointers: */
+	*pd_nz=d_nz;
+	*po_nz=o_nz;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.h	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Penpair.h	(revision 13915)
@@ -57,7 +57,10 @@
 		void  CreatePVector(Vector<IssmDouble>* pf);
 		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff);
+		void  GetNodesSidList(int* sidlist);
+		int   GetNumberOfNodes(void);
 		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff,Matrix<IssmDouble>* Kfs,IssmDouble kmax);
 		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
 		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax);
+		void  SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.cpp	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.cpp	(revision 13915)
@@ -364,8 +364,74 @@
 }
 /*}}}*/
+/*FUNCTION Riftfront::GetNodesSidList{{{*/
+void Riftfront::GetNodesSidList(int* sidlist){
+
+	_assert_(sidlist);
+	_assert_(nodes);
+
+	for(int i=0;i<NUMVERTICES;i++) sidlist[i]=nodes[i]->Sid();
+}
+/*}}}*/
+/*FUNCTION Riftfront::GetNumberOfNodes{{{*/
+int Riftfront::GetNumberOfNodes(void){
+
+	return NUMVERTICES;
+}
+/*}}}*/
 /*FUNCTION Riftfront::InAnalysis{{{*/
 bool Riftfront::InAnalysis(int in_analysis_type){
 	if (in_analysis_type==this->analysis_type) return true;
 	else return false;
+}
+/*}}}*/
+/*FUNCTION Riftfront::SetwiseNodeConnectivity{{{*/
+void Riftfront::SetwiseNodeConnectivity(int* pd_nz,int* po_nz,Node* node,bool* flags,int set1_enum,int set2_enum){
+
+	/*Output */
+	int d_nz = 0;
+	int o_nz = 0;
+
+	/*Loop over all nodes*/
+	for(int i=0;i<NUMVERTICES;i++){
+
+		if(!flags[this->nodes[i]->Sid()]){
+
+			/*flag current node so that no other element processes it*/
+			flags[this->nodes[i]->Sid()]=true;
+
+			/*if node is clone, we have an off-diagonal non-zero, else it is a diagonal non-zero*/
+			switch(set2_enum){
+				case FsetEnum:
+					if(nodes[i]->indexing.fsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case GsetEnum:
+					if(nodes[i]->indexing.gsize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				case SsetEnum:
+					if(nodes[i]->indexing.ssize){
+						if(this->nodes[i]->IsClone())
+						 o_nz += 1;
+						else
+						 d_nz += 1;
+					}
+					break;
+				default: _error_("not supported");
+			}
+		}
+	}
+
+	/*Assign output pointers: */
+	*pd_nz=d_nz;
+	*po_nz=o_nz;
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.h	(revision 13914)
+++ /issm/trunk-jpl/src/c/classes/objects/Loads/Riftfront.h	(revision 13915)
@@ -78,7 +78,10 @@
 		void  CreatePVector(Vector<IssmDouble>* pf);
 		void  CreateJacobianMatrix(Matrix<IssmDouble>* Jff){_error_("Not implemented yet");};
+		void  GetNodesSidList(int* sidlist);
+		int   GetNumberOfNodes(void);
 		void  PenaltyCreateJacobianMatrix(Matrix<IssmDouble>* Jff,IssmDouble kmax){_error_("Not implemented yet");};
 		void  PenaltyCreateKMatrix(Matrix<IssmDouble>* Kff, Matrix<IssmDouble>* kfs, IssmDouble kmax);
 		void  PenaltyCreatePVector(Vector<IssmDouble>* pf, IssmDouble kmax);
+		void  SetwiseNodeConnectivity(int* d_nz,int* o_nz,Node* node,bool* flags,int set1_enum,int set2_enum);
 		bool  InAnalysis(int analysis_type);
 		/*}}}*/
