Index: /issm/trunk-jpl/src/c/classes/Node.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Node.cpp	(revision 15860)
+++ /issm/trunk-jpl/src/c/classes/Node.cpp	(revision 15861)
@@ -39,4 +39,5 @@
 
 	/*indexing:*/
+	this->indexingupdate = true;
 	DistributeNumDofs(&this->indexing,analysis_type,in_approximation); //number of dofs per node
 	gsize=this->indexing.gsize;
@@ -127,4 +128,5 @@
 	_printf_("   analysis_type: " << EnumToStringx(analysis_type) << "\n");
 	_printf_("   approximation: " << EnumToStringx(approximation) << "\n");
+	_printf_("   indexingupdate: " << indexingupdate << "\n");
 	indexing.Echo();
 	_printf_("   inputs: " << inputs << "\n");
@@ -139,4 +141,6 @@
 	_printf_("   sid: " << sid << "\n");
 	_printf_("   analysis_type: " << EnumToStringx(analysis_type) << "\n");
+	_printf_("   approximation: " << EnumToStringx(approximation) << "\n");
+	_printf_("   indexingupdate: " << indexingupdate << "\n");
 	indexing.DeepEcho();
 	_printf_("   inputs\n");
@@ -159,4 +163,5 @@
 int   Node::GetDof(int dofindex,int setenum){
 
+	_assert_(!this->indexingupdate);
 	if(setenum==GsetEnum){
 		_assert_(dofindex>=0 && dofindex<indexing.gsize);
@@ -179,4 +184,6 @@
 	int count=0;
 	int count2=0;
+
+	_assert_(!this->indexingupdate);
 
 	if(approximation_enum==NoneApproximationEnum){
@@ -242,4 +249,6 @@
 	int count2=0;
 
+	_assert_(!this->indexingupdate);
+
 	if(approximation_enum==NoneApproximationEnum){
 		if(setenum==GsetEnum)for(i=0;i<this->indexing.gsize;i++) outdoflist[i]=i;
@@ -365,4 +374,18 @@
 }
 /*}}}*/
+/*FUNCTION Node::RequiresDofReindexing{{{*/
+bool Node::RequiresDofReindexing(void){
+
+	return this->indexingupdate;
+
+}
+/*}}}*/
+/*FUNCTION Node::ReindexingDone{{{*/
+void Node::ReindexingDone(void){
+
+	this->indexingupdate = false;
+
+}
+/*}}}*/
 /*FUNCTION Node::RelaxConstraint{{{*/
 void  Node::RelaxConstraint(int dof){
@@ -376,10 +399,8 @@
 void  Node::CreateVecSets(Vector<IssmDouble>* pv_g,Vector<IssmDouble>* pv_f,Vector<IssmDouble>* pv_s){
 
-	IssmDouble gvalue=1.0; //all nodes are in the g set;
+	IssmDouble gvalue=1.; //all nodes are in the g set;
 	IssmDouble value;
 
-	int i;
-
-	for(i=0;i<this->indexing.gsize;i++){
+	for(int i=0;i<this->indexing.gsize;i++){
 
 		/*g set: */
@@ -457,5 +478,8 @@
 void  Node::Deactivate(void){
 
-	indexing.Deactivate();
+	if(IsActive()){
+		this->indexingupdate = true;
+		indexing.Deactivate();
+	}
 
 }
@@ -464,5 +488,8 @@
 void  Node::Activate(void){
 
-	indexing.Activate();
+	if(!IsActive()){
+		this->indexingupdate = true;
+		indexing.Activate();
+	}
 
 }
@@ -491,5 +518,5 @@
 
 	if(approximation_enum==NoneApproximationEnum){
-		if (setenum==GsetEnum) numdofs=this->indexing.gsize;
+		if      (setenum==GsetEnum) numdofs=this->indexing.gsize;
 		else if (setenum==FsetEnum) numdofs=this->indexing.fsize;
 		else if (setenum==SsetEnum) numdofs=this->indexing.ssize;
@@ -621,9 +648,6 @@
 void   Node::UpdateSpcs(IssmDouble* ys){
 
-	int     count=0;
-	int     i;
-
-	count=0;
-	for(i=0;i<this->indexing.gsize;i++){
+	int count = 0;
+	for(int i=0;i<this->indexing.gsize;i++){
 		if(this->indexing.s_set[i]){
 			this->indexing.svalues[i]=ys[this->indexing.sdoflist[count]];
@@ -634,10 +658,10 @@
 /*}}}*/
 /*FUNCTION Node::VecMerge {{{*/
-void   Node::VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum){
-
-	IssmDouble* values=NULL;
-	int*    indices=NULL;
-	int     count=0;
-	int     i;
+void Node::VecMerge(Vector<IssmDouble>* ug, IssmDouble* vector_serial,int setenum){
+
+	IssmDouble *values  = NULL;
+	int        *indices = NULL;
+	int         count   = 0;
+	int         i;
 
 	if(setenum==FsetEnum){
Index: /issm/trunk-jpl/src/c/classes/Node.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Node.h	(revision 15860)
+++ /issm/trunk-jpl/src/c/classes/Node.h	(revision 15861)
@@ -33,4 +33,5 @@
 		int sid;   //"serial" id (rank of this node if the dataset was serial on 1 cpu)
 
+		bool         indexingupdate;
 		DofIndexing  indexing;
 		Inputs      *inputs;               //properties of this node
@@ -88,4 +89,6 @@
 		void  Deactivate(void);
 		void  UpdateSpcs(IssmDouble* ys);
+		void  ReindexingDone(void);
+		bool  RequiresDofReindexing(void);
 		int   IsFloating();
 		int   IsGrounded();
Index: /issm/trunk-jpl/src/c/classes/Nodes.cpp
===================================================================
--- /issm/trunk-jpl/src/c/classes/Nodes.cpp	(revision 15860)
+++ /issm/trunk-jpl/src/c/classes/Nodes.cpp	(revision 15861)
@@ -51,9 +51,9 @@
 
 	/*Go through objects, and distribute dofs locally, from 0 to numberofdofsperobject*/
-	for (i=0;i<this->Size();i++){
-		Node* node=dynamic_cast<Node*>(this->GetObjectByOffset(i));
-
-		/*Check that this node corresponds to our analysis currently being carried out: */
-		if (node->InAnalysis(analysis_type)){
+	for(i=0;i<this->Size();i++){
+		Node* node=dynamic_cast<Node*>(this->GetObjectByOffset(i));
+
+		/*Check that this node corresponds to our analysis currently being carried out: */
+		if(node->InAnalysis(analysis_type)){
 			node->DistributeDofs(&dofcount,setenum);
 		}
@@ -73,5 +73,5 @@
 		dofcount+=alldofcount[i];
 	}
-	for (i=0;i<this->Size();i++){
+	for(i=0;i<this->Size();i++){
 		/*Check that this node corresponds to our analysis currently being carried out: */
 		Node* node=dynamic_cast<Node*>(this->GetObjectByOffset(i));
@@ -91,5 +91,5 @@
 	}
 
-	for (i=0;i<this->Size();i++){
+	for(i=0;i<this->Size();i++){
 		Node* node=dynamic_cast<Node*>(this->GetObjectByOffset(i));
 		if (node->InAnalysis(analysis_type)){
@@ -101,8 +101,16 @@
 
 	/* Now every cpu knows the true dofs of everyone else that is not a clone*/
-	for (i=0;i<this->Size();i++){
+	for(i=0;i<this->Size();i++){
 		Node* node=dynamic_cast<Node*>(this->GetObjectByOffset(i));
 		if (node->InAnalysis(analysis_type)){
 			node->UpdateCloneDofs(alltruedofs,maxdofspernode,setenum);
+		}
+	}
+
+	/*Update indexingupdateflag*/
+	for(i=0;i<this->Size();i++){
+		Node* node=dynamic_cast<Node*>(this->GetObjectByOffset(i));
+		if (node->InAnalysis(analysis_type)){
+			node->ReindexingDone();
 		}
 	}
@@ -330,2 +338,33 @@
 }
 /*}}}*/
+/*FUNCTION Nodes::RequiresDofReindexing{{{*/
+bool Nodes::RequiresDofReindexing(int analysis_type){
+
+	int flag = 0;
+	int allflag;
+
+	/*Now go through all nodes, and get how many dofs they own, unless they are clone nodes: */
+	for(int i=0;i<this->Size();i++){
+
+		Node* node=dynamic_cast<Node*>(this->GetObjectByOffset(i));
+
+		/*Check that this node corresponds to our analysis currently being carried out: */
+		if(node->InAnalysis(analysis_type)){
+			if(node->RequiresDofReindexing()){
+				flag = 1;
+				break;
+			}
+		}
+	}
+
+	/*Grab max of all cpus: */
+	ISSM_MPI_Allreduce((void*)&flag,(void*)&allflag,1,ISSM_MPI_INT,ISSM_MPI_MAX,IssmComm::GetComm());
+
+	if(allflag){
+		return true;
+	}
+	else{
+		return false;
+	}
+}
+/*}}}*/
Index: /issm/trunk-jpl/src/c/classes/Nodes.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/Nodes.h	(revision 15860)
+++ /issm/trunk-jpl/src/c/classes/Nodes.h	(revision 15861)
@@ -27,4 +27,5 @@
 		void  DistributeDofs(int analysis_type,int SETENUM);
 		void  FlagClones(int analysis_type);
+		bool  RequiresDofReindexing(int analysis_type);
 		int   MaxNumDofs(int analysis_type,int setenum);
 		int   MaximumId(void);
Index: /issm/trunk-jpl/src/c/modules/NodesDofx/NodesDofx.cpp
===================================================================
--- /issm/trunk-jpl/src/c/modules/NodesDofx/NodesDofx.cpp	(revision 15860)
+++ /issm/trunk-jpl/src/c/modules/NodesDofx/NodesDofx.cpp	(revision 15861)
@@ -10,21 +10,22 @@
 void NodesDofx(Nodes* nodes, Parameters* parameters,int configuration_type){
 
-	int noerr=1;
-	int found=0;
+	/*Do we have any nodes for this analysis type? :*/
+	if(!nodes->NumberOfNodes(configuration_type)) return;
 
-	/*Do we have any nodes for this analysis type? :*/
-	if(nodes->NumberOfNodes(configuration_type)){ 
+	/*Do we really need to update dof indexings*/
+	if(!nodes->RequiresDofReindexing(configuration_type)) return;
 
-		/*Ensure that only for each cpu, the partition border nodes only will be taken into account once 
-		 * across the cluster. To do so, we flag all the clone nodes: */
-		nodes->FlagClones(configuration_type);
+	if(VerboseModule()) _printf0_("   Renumbering degrees of freedom\n");
 
-		/*Go through all nodes, and build degree of freedom lists. Each node gets a fixed number of dofs. When 
-		 *a  node has already been distributed dofs on one cpu, all other cpus with the same node cannot distribute it 
-		 *anymore. Use clone field to be sure of that: */
-		nodes->DistributeDofs(configuration_type,GsetEnum);
-		nodes->DistributeDofs(configuration_type,FsetEnum);
-		nodes->DistributeDofs(configuration_type,SsetEnum);
-	}
+	/*Ensure that only for each cpu, the partition border nodes only will be taken into account once 
+	 * across the cluster. To do so, we flag all the clone nodes: */
+	nodes->FlagClones(configuration_type);
+
+	/*Go through all nodes, and build degree of freedom lists. Each node gets a fixed number of dofs. When 
+	 *a  node has already been distributed dofs on one cpu, all other cpus with the same node cannot distribute it 
+	 *anymore. Use clone field to be sure of that: */
+	nodes->DistributeDofs(configuration_type,GsetEnum);
+	nodes->DistributeDofs(configuration_type,FsetEnum);
+	nodes->DistributeDofs(configuration_type,SsetEnum);
 
 }
