Index: /issm/trunk/src/c/DataSet/DataSet.cpp
===================================================================
--- /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 3462)
+++ /issm/trunk/src/c/DataSet/DataSet.cpp	(revision 3463)
@@ -947,38 +947,30 @@
 /*}}}*/
 /*FUNCTION DataSet::DistributeDofs{{{1*/
-void  DataSet::DistributeDofs(int numberofnodes,int numdofspernode){
-
-	int  dofcount=0;
-	int  dofcount1=0;
-	int* alldofcount=NULL;
-	int* alldofcount1=NULL;
-	int* borderdofs=NULL;
-	int* borderdofs1=NULL;
-	int* allborderdofs=NULL;
-	int* allborderdofs1=NULL;
-	int  i;
-	vector<Object*>::iterator object;
-	Node* node=NULL;
+void  DataSet::DistributeDofs(int numberofobjects,int numberofdofsperobject){
 
 	extern int num_procs;
 	extern int my_rank;
 
-	dofcount=0;
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Check this is a node: */
-		if((*object)->Enum()==NodeEnum()){
-
-			node=(Node*)(*object);
-
-			/*Ok, this object is a node, ask it to distribute dofs, and update the dofcount: */
-			node->DistributeDofs(&dofcount,&dofcount1);
-
-		}
-	}
-
-	/*Ok, now every node has distributed dofs, but locally, and with a dof count starting from 
+	int  i;
+	
+	int  dofcount=0;
+	int* alldofcount=NULL;
+	int* truedofs=NULL;
+	int* alltruedofs=NULL;
+	vector<Object*>::iterator object;
+	DofObject* dofobject=NULL;
+
+	/*Go through objects, and distribute dofs locally, from 0 to numberofdofsperobject: */
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		dofobject=(DofObject*)(*object);
+		dofobject->DistributeDofs(&dofcount);
+
+	
+	}
+
+	/*Ok, now every object has distributed dofs, but locally, and with a dof count starting from 
 	 *0. This means the dofs between all the cpus are not synchronized! We need to synchronize all 
-	 *dof on all cpus, and use those to update the dofs of every node: */
+	 *dof on all cpus, and use those to update the dofs of every object: */
 
 	alldofcount=(int*)xmalloc(num_procs*sizeof(int));
@@ -986,20 +978,13 @@
 	MPI_Bcast(alldofcount,num_procs,MPI_INT,0,MPI_COMM_WORLD);
 
-	alldofcount1=(int*)xmalloc(num_procs*sizeof(int));
-	MPI_Gather(&dofcount1,1,MPI_INT,alldofcount1,1,MPI_INT,0,MPI_COMM_WORLD);
-	MPI_Bcast(alldofcount1,num_procs,MPI_INT,0,MPI_COMM_WORLD);
-
 	/*Ok, now every cpu should start its own dof count at the end of the dofcount 
 	 * from cpu-1. : */
 	dofcount=0;
-	dofcount1=0;
 	if(my_rank==0){
 		dofcount=0;
-		dofcount1=0;
 	}
 	else{
 		for(i=0;i<my_rank;i++){
 			dofcount+=alldofcount[i];
-			dofcount1+=alldofcount1[i];
 		}
 	}
@@ -1009,61 +994,36 @@
 	for ( object=objects.begin() ; object < objects.end(); object++ ){
 
-		/*Check this is a node: */
-		if((*object)->Enum()==NodeEnum()){
-
-			node=(Node*)(*object);
-
-			/*Ok, this object is a node, ask it to update his dofs: */
-			node->UpdateDofs(dofcount,dofcount1);
-
-		}
-	}
-
-	/*Finally, remember that cpus may have skipped some nodes, when these nodes were 
-	 * clones: */
-	borderdofs=(int*)xcalloc(numberofnodes*numdofspernode,sizeof(int));
-	allborderdofs=(int*)xcalloc(numberofnodes*numdofspernode,sizeof(int));
-	borderdofs1=(int*)xcalloc(numberofnodes*3,sizeof(int));
-	allborderdofs1=(int*)xcalloc(numberofnodes*3,sizeof(int));
-
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Check this is a node: */
-		if((*object)->Enum()==NodeEnum()){
-
-			node=(Node*)(*object);
-
-			/*Ok, let this object show its border dofs, if is is a border dof: */
-			node->ShowBorderDofs(borderdofs,borderdofs1);
-
-		}
-	}
-	MPI_Allreduce ( (void*)borderdofs,(void*)allborderdofs,numberofnodes*numdofspernode,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
-	MPI_Allreduce ( (void*)borderdofs1,(void*)allborderdofs1,numberofnodes*3,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
-
-	/*Ok, now every cpu knows everyone else's border node dofs, update the border dofs accordingly: */
-	for ( object=objects.begin() ; object < objects.end(); object++ ){
-
-		/*Check this is a node: */
-		if((*object)->Enum()==NodeEnum()){
-
-			node=(Node*)(*object);
-
-			/*Ok, this object is a node, ask it to update his dofs: */
-			node->UpdateBorderDofs(allborderdofs,allborderdofs1);
-
-		}
-	}
-
+		dofobject=(DofObject*)(*object);
+		dofobject->OffsetDofs(dofcount);
+	
+	}
+
+	/*Finally, remember that cpus may have skipped some objects, because they were clones. For every 
+	 * object that is not a clone, tell them to show their dofs, so that later on, they can get picked 
+	 * up by their clones: */
+	truedofs=(int*)xcalloc(numberofobjects*numberofdofsperobject,sizeof(int));
+	alltruedofs=(int*)xcalloc(numberofobjects*numberofdofsperobject,sizeof(int));
+
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+			
+		/*Ok, let this object show its true dofs, if is is a true dof: */
+		dofobject=(DofObject*)(*object);
+		dofobject->ShowTrueDofs(truedofs);
+	}
+	
+	MPI_Allreduce ( (void*)truedofs,(void*)alltruedofs,numberofobjects*numberofdofsperobject,MPI_INT,MPI_MAX,MPI_COMM_WORLD);
+
+	/*Ok, now every cpu knows the true dofs of everyone else that is not a clone. Let the clones recover those true dofs: */
+	for ( object=objects.begin() ; object < objects.end(); object++ ){
+
+		dofobject=(DofObject*)(*object);
+		dofobject->UpdateCloneDofs(alltruedofs);
+
+	}
 
 	/* Free ressources: */
 	xfree((void**)&alldofcount);
-	xfree((void**)&borderdofs);
-	xfree((void**)&allborderdofs);
-	xfree((void**)&alldofcount1);
-	xfree((void**)&borderdofs1);
-	xfree((void**)&allborderdofs1);
-
-	return;
+	xfree((void**)&truedofs);
+	xfree((void**)&alltruedofs);
 
 }
@@ -1157,4 +1117,5 @@
 
 	vector<Object*>::iterator object;
+	DofObject* dofobject=NULL;
 
 	/*Allocate ranks: */
@@ -1188,11 +1149,7 @@
 	for ( object=objects.begin() ; object < objects.end(); object++ ){
 
-		/*Check this is a vertex: */
-		if((*object)->Enum()==NodeEnum()){
-			
-			/*For this object, decide whether it is a clone: */
-			(*object)->SetClone(minranks);
-
-		}
+		/*For this object, decide whether it is a clone: */
+		dofobject=(DofObject*)(*object);
+		dofobject->SetClone(minranks);
 	}
 
Index: /issm/trunk/src/c/Dofx/Dofx.cpp
===================================================================
--- /issm/trunk/src/c/Dofx/Dofx.cpp	(revision 3462)
+++ /issm/trunk/src/c/Dofx/Dofx.cpp	(revision 3463)
@@ -48,7 +48,8 @@
 	nodes->FlagClones(numberofnodes);
 
-	/*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 
+	/*Go through all vertices and nodes, and build degree of freedom lists. Each vertex/node gets a fixed number of dofs. When 
+	 *a  vertex/node has already been distributed dofs on one cpu, all other cpus with the same vertex/node cannot distribute it 
 	 *anymore. Use clone field to be sure of that: */
+	vertices->DistributeDofs(numberofvertices,1); //only 1 dof per vertex.
 	nodes->DistributeDofs(numberofnodes,numberofdofspernode);
 
Index: /issm/trunk/src/c/objects/DofIndexing.cpp
===================================================================
--- /issm/trunk/src/c/objects/DofIndexing.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/DofIndexing.cpp	(revision 3463)
@@ -24,6 +24,5 @@
 	int i;
 	this->numberofdofs=UNDEF;
-	this->partitionborder=UNDEF;
-	this->clone=UNDEF;
+	this->clone=0;
 
 	for (i=0;i<MAXDOFSPERNODE;i++){
@@ -38,16 +37,14 @@
 /*}}}*/
 /*FUNCTION DofIndexing constructor {{{1*/
-DofIndexing::DofIndexing(int in_numberofdofs, int in_partitionborder){
-
-	this->Init(in_numberofdofs,in_partitionborder);
+DofIndexing::DofIndexing(int in_numberofdofs){
+	this->Init(in_numberofdofs);
 }
 /*}}}*/
 /*FUNCTION DofIndexing Init: used by constructor {{{1*/
-void DofIndexing::Init(int in_numberofdofs, int in_partitionborder){
+void DofIndexing::Init(int in_numberofdofs){
 
 	int i;
 	this->numberofdofs=in_numberofdofs;
-	this->partitionborder=in_partitionborder;
-	this->clone=UNDEF;
+	this->clone=0;
 
 	for (i=0;i<MAXDOFSPERNODE;i++){
@@ -66,5 +63,4 @@
 	int i;
 	this->numberofdofs=in->numberofdofs;
-	this->partitionborder=in->partitionborder;
 	this->clone=in->clone;
 
@@ -101,5 +97,4 @@
 	/*marshall DofIndexing data: */
 	memcpy(marshalled_dataset,&numberofdofs,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs);
-	memcpy(marshalled_dataset,&partitionborder,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
 	memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone);
 	memcpy(marshalled_dataset,&m_set,sizeof(m_set));marshalled_dataset+=sizeof(m_set);
@@ -117,5 +112,4 @@
 
 	return sizeof(numberofdofs)+
-		sizeof(partitionborder)+
 		sizeof(clone)+
 		sizeof(m_set)+
@@ -139,5 +133,4 @@
 
 	memcpy(&numberofdofs,marshalled_dataset,sizeof(numberofdofs));marshalled_dataset+=sizeof(numberofdofs);
-	memcpy(&partitionborder,marshalled_dataset,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
 	memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone);
 	memcpy(&m_set,marshalled_dataset,sizeof(m_set));marshalled_dataset+=sizeof(m_set);
@@ -159,5 +152,4 @@
 	printf("DofIndexing:\n");
 	printf("   numberofdofs: %i\n",numberofdofs);
-	printf("   partitionborder: %i\n",partitionborder);
 	printf("   clone: %i\n",clone);
 }
@@ -170,5 +162,4 @@
 	printf("DofIndexing:\n");
 	printf("   numberofdofs: %i\n",numberofdofs);
-	printf("   partitionborder: %i\n",partitionborder);
 	printf("   clone: %i\n",clone);
 	
Index: /issm/trunk/src/c/objects/DofIndexing.h
===================================================================
--- /issm/trunk/src/c/objects/DofIndexing.h	(revision 3462)
+++ /issm/trunk/src/c/objects/DofIndexing.h	(revision 3463)
@@ -15,6 +15,5 @@
 
 		/*partitioning: */
-		int     partitionborder; /*! during parallel partitioning, does this grid belong to a partition border?*/
-		int     clone;  /*!this nodes is one the partition border, and is cloned*/
+		int     clone;   //this node is replicated from another one 
 
 		/*boundary conditions sets: */
@@ -28,6 +27,6 @@
 
 		DofIndexing();
-		DofIndexing(int numberofdofs, int partitionborder);
-		void Init(int numberofdofs, int partitionborder);
+		DofIndexing(int numberofdofs);
+		void Init(int numberofdofs);
 		DofIndexing(DofIndexing* properties);
 		~DofIndexing();
Index: /issm/trunk/src/c/objects/DofObject.h
===================================================================
--- /issm/trunk/src/c/objects/DofObject.h	(revision 3463)
+++ /issm/trunk/src/c/objects/DofObject.h	(revision 3463)
@@ -0,0 +1,22 @@
+/*!\file:  DofObject.h
+ * \brief abstract class for any object that owns dofs
+ */ 
+
+
+#ifndef _DOFOBJECT_H_
+#define _DOFOBJECT_H_
+
+#include "./Object.h"
+#include "../toolkits/toolkits.h"
+
+class DofObject{
+
+	public: 
+		virtual void  DistributeDofs(int* pdofcount)=0;
+		virtual void  OffsetDofs(int dofcount)=0;
+		virtual void  ShowTrueDofs(int* borderdofs)=0;
+		virtual void  UpdateCloneDofs(int* allborderdofs)=0;
+		virtual void  SetClone(int* minranks)=0;
+
+};
+#endif
Index: /issm/trunk/src/c/objects/DofVec.cpp
===================================================================
--- /issm/trunk/src/c/objects/DofVec.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/DofVec.cpp	(revision 3463)
@@ -418,8 +418,2 @@
 	return vector;
 }
-/*FUNCTION DofVec::SetClone {{{1*/
-void  DofVec::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/DofVec.h
===================================================================
--- /issm/trunk/src/c/objects/DofVec.h	(revision 3462)
+++ /issm/trunk/src/c/objects/DofVec.h	(revision 3463)
@@ -45,5 +45,4 @@
 		int   MyRank();
 		int   Size();
-		void  SetClone(int* minranks);
 	
 
Index: /issm/trunk/src/c/objects/Element.h
===================================================================
--- /issm/trunk/src/c/objects/Element.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Element.h	(revision 3463)
@@ -21,5 +21,4 @@
 		virtual int    MyRank()=0;
 		virtual void   Marshall(char** pmarshalled_dataset)=0;
-		virtual void   SetClone(int* minranks)=0;
 		virtual int    MarshallSize()=0;
 		virtual char*  GetName()=0;
Index: /issm/trunk/src/c/objects/FemModel.cpp
===================================================================
--- /issm/trunk/src/c/objects/FemModel.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/FemModel.cpp	(revision 3463)
@@ -225,8 +225,2 @@
 Mat                 FemModel::get_Gmn(void){return Gmn;}
 /*}}}*/
-/*FUNCTION FemModel::FemModel {{{1*/
-void  FemModel::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/FemModel.h
===================================================================
--- /issm/trunk/src/c/objects/FemModel.h	(revision 3462)
+++ /issm/trunk/src/c/objects/FemModel.h	(revision 3463)
@@ -55,5 +55,4 @@
 		int   Enum();
 		Object* copy();
-		void  SetClone(int* minranks);
 		
 		int FindParam(double* pscalar,char* name);
Index: /issm/trunk/src/c/objects/Icefront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Icefront.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Icefront.cpp	(revision 3463)
@@ -1478,10 +1478,4 @@
 }
 /*}}}*/
-/*FUNCTION Icefront::SetClone {{{1*/
-void  Icefront::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
 /*FUNCTION Icefront UpdateFromInputs {{{1*/
 void  Icefront::UpdateFromInputs(void* vinputs){
Index: /issm/trunk/src/c/objects/Icefront.h
===================================================================
--- /issm/trunk/src/c/objects/Icefront.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Icefront.h	(revision 3463)
@@ -69,5 +69,4 @@
 		int   MarshallSize();
 		int   MyRank();
-		void   SetClone(int* minranks);
 
 		/*}}}*/
Index: /issm/trunk/src/c/objects/Input.cpp
===================================================================
--- /issm/trunk/src/c/objects/Input.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Input.cpp	(revision 3463)
@@ -301,8 +301,2 @@
 }
 /*}}}*/
-/*FUNCTION Input::SetClone {{{1*/
-void  Input::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Input.h
===================================================================
--- /issm/trunk/src/c/objects/Input.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Input.h	(revision 3463)
@@ -39,5 +39,4 @@
 		
 		Object* copy();
-		void  SetClone(int* minranks);
 
 		/*fill virtual routines: */
Index: /issm/trunk/src/c/objects/Load.h
===================================================================
--- /issm/trunk/src/c/objects/Load.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Load.h	(revision 3463)
@@ -32,5 +32,4 @@
 		virtual void  PenaltyCreateKMatrix(Mat Kgg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0;
 		virtual void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type)=0;
-		virtual void  SetClone(int* minranks)=0;
 
 		int           Enum();
Index: /issm/trunk/src/c/objects/Material.h
===================================================================
--- /issm/trunk/src/c/objects/Material.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Material.h	(revision 3463)
@@ -21,5 +21,4 @@
 		virtual int   MyRank()=0;
 		virtual void  Marshall(char** pmarshalled_dataset)=0;
-		virtual void  SetClone(int* minranks)=0;
 		virtual int   MarshallSize()=0;
 		virtual char* GetName()=0;
Index: /issm/trunk/src/c/objects/Matice.cpp
===================================================================
--- /issm/trunk/src/c/objects/Matice.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Matice.cpp	(revision 3463)
@@ -441,9 +441,2 @@
 }
 /*}}}*/
-//*FUNCTION Matice::SetClone {{{1*/
-void  Matice::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
-
Index: /issm/trunk/src/c/objects/Matice.h
===================================================================
--- /issm/trunk/src/c/objects/Matice.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Matice.h	(revision 3463)
@@ -44,5 +44,4 @@
 		double GetB();
 		double GetN();
-		void   SetClone(int* minranks);
 
 };
Index: /issm/trunk/src/c/objects/Matpar.cpp
===================================================================
--- /issm/trunk/src/c/objects/Matpar.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Matpar.cpp	(revision 3463)
@@ -289,8 +289,2 @@
 }
 /*}}}1*/
-/*FUNCTION Matpar::SetClone {{{1*/
-void  Matpar::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Matpar.h
===================================================================
--- /issm/trunk/src/c/objects/Matpar.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Matpar.h	(revision 3463)
@@ -57,5 +57,4 @@
 		double GetMeltingPoint();
 		Object* copy();
-		void   SetClone(int* minranks);
 
 };
Index: /issm/trunk/src/c/objects/Node.cpp
===================================================================
--- /issm/trunk/src/c/objects/Node.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Node.cpp	(revision 3463)
@@ -29,6 +29,6 @@
 /*}}}*/
 /*FUNCTION Node constructor {{{2*/
-Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_partitionborder,int node_numdofs, NodeProperties* node_properties):
-	indexing(node_numdofs,node_partitionborder),
+Node::Node(int node_id,int node_vertex_id, int node_upper_node_id, int node_numdofs, NodeProperties* node_properties):
+	indexing(node_numdofs),
 	properties(node_properties),
     hvertex(&node_vertex_id,1),
@@ -58,5 +58,4 @@
 	
 	int numdofs;
-	int partitionborder;
 	int vertex_id;
 	int upper_node_id;
@@ -67,7 +66,6 @@
 	/*indexing:*/
 	DistributeNumDofs(&numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node
-	if(iomodel->my_bordervertices[i]) partitionborder=1; else partitionborder=0;//is this node on a partition border?
-
-	this->indexing.Init(numdofs,partitionborder);
+
+	this->indexing.Init(numdofs);
 
 	/*properties: */
@@ -163,5 +161,4 @@
 
 	int numdofs;
-	int partitionborder;
 	int vertex_id;
 	int upper_node_id;
@@ -172,7 +169,6 @@
 	/*indexing:*/
 	DistributeNumDofs(&numdofs,iomodel->analysis_type,iomodel->sub_analysis_type); //number of dofs per node
-	if(iomodel->my_bordervertices[i])partitionborder=1; else partitionborder=0;//is this node on a partition border?
-
-	this->indexing.Init(numdofs,partitionborder);
+
+	this->indexing.Init(numdofs);
 
 	/*properties (come from vertex number i): */
@@ -459,36 +455,4 @@
 
 
-}
-/*}}}*/
-/*FUNCTION Node DistributeDofs{{{2*/
-void  Node::DistributeDofs(int* pdofcount,int* pdofcount1){
-
-	int i;
-	extern int my_rank;
-	int dofcount;
-	int dofcount1;
-
-	dofcount=*pdofcount;
-	dofcount1=*pdofcount1;
-	
-	if(indexing.clone){
-		/*This node is a clone! Don't distribute dofs, it will get them from another cpu!*/
-		return;
-	}
-
-	/*This node should distribute dofs, go ahead: */
-	for(i=0;i<this->indexing.numberofdofs;i++){
-		indexing.doflist[i]=dofcount+i;
-	}
-	dofcount+=this->indexing.numberofdofs;
-
-	SetVertexDof(dofcount1);
-	dofcount1+=1;
-
-	/*Assign output pointers: */
-	*pdofcount=dofcount;
-	*pdofcount1=dofcount1;
-
-	return; 
 }
 /*}}}*/
@@ -851,4 +815,87 @@
 }
 /*}}}*/
+/*FUNCTION Node UpdateFromInputs {{{2*/
+void  Node::UpdateFromInputs(void* vinputs){
+
+	ISSMERROR("not used yet!");
+	
+}
+/*}}}*/
+/*}}}*/
+/* DofObject routines: {{{1*
+/*FUNCTION Node DistributeDofs{{{2*/
+void  Node::DistributeDofs(int* pdofcount){
+
+	int i;
+	extern int my_rank;
+	int dofcount;
+
+	dofcount=*pdofcount;
+	
+	if(indexing.clone){
+		/*This node is a clone! Don't distribute dofs, it will get them from another cpu!*/
+		return;
+	}
+
+	/*This node should distribute dofs, go ahead: */
+	for(i=0;i<this->indexing.numberofdofs;i++){
+		indexing.doflist[i]=dofcount+i;
+	}
+	dofcount+=this->indexing.numberofdofs;
+
+	/*Assign output pointers: */
+	*pdofcount=dofcount;
+
+}
+/*}}}*/
+/*FUNCTION Node OffsetDofs{{{2*/
+void  Node::OffsetDofs(int dofcount){
+	
+	int i;
+	extern int my_rank;
+	
+	if(indexing.clone){
+		/*This node is a clone, don't offset the dofs!: */
+		return;
+	}
+
+	/*This node should offset the dofs, go ahead: */
+	for(i=0;i<this->indexing.numberofdofs;i++){
+		indexing.doflist[i]+=dofcount;
+	}
+}
+/*}}}*/
+/*FUNCTION Node ShowTrueDofs{{{2*/
+void  Node::ShowTrueDofs(int* truedofs){
+
+	int j;
+	extern int my_rank;
+	
+	/*Are we a clone? : */
+	if(indexing.clone)return;
+
+	/*Ok, we are not a clone, just plug our dofs into truedofs: */
+	for(j=0;j<this->indexing.numberofdofs;j++){
+		*(truedofs+this->indexing.numberofdofs*(id-1)+j)=indexing.doflist[j];
+	}
+
+}
+/*}}}*/
+/*FUNCTION Node UpdateCloneDofs{{{2*/
+void  Node::UpdateCloneDofs(int* alltruedofs){
+
+	int j;
+	extern int my_rank;
+	
+	/*If we are not a clone, don't update, we already have dofs!: */
+	if(indexing.clone==0)return;
+
+	/*Ok, we are a clone node, but we did not create the dofs for this node. 
+	 * Therefore, our doflist is garbage right now. Go pick it up in the alltruedofs: */
+	for(j=0;j<this->indexing.numberofdofs;j++){
+		indexing.doflist[j]=*(alltruedofs+this->indexing.numberofdofs*(id-1)+j);
+	}
+}
+/*}}}*/
 /*FUNCTION Node SetClone {{{2*/
 void  Node::SetClone(int* minranks){
@@ -867,74 +914,3 @@
 }
 /*}}}*/
-/*FUNCTION Node ShowBorderDofs{{{2*/
-void  Node::ShowBorderDofs(int* borderdofs,int* borderdofs1){
-
-	int j;
-	extern int my_rank;
-	
-	/*Is this node on the partition border? */
-	if(!indexing.partitionborder)return;
-
-	/*Are we the cpu that created this node's dof list? */
-	if(indexing.clone)return;
-
-	/*Ok, we are on the partition border, and we did create the 
-	 * dofs for this node, plug the doflist into borderdofs: */
-	for(j=0;j<this->indexing.numberofdofs;j++){
-		*(borderdofs+this->indexing.numberofdofs*(id-1)+j)=indexing.doflist[j];
-	}
-	*(borderdofs1+(id-1)+0)=this->GetVertexDof();
-
-	return;
-}
-/*}}}*/
-/*FUNCTION Node UpdateBorderDofs{{{2*/
-void  Node::UpdateBorderDofs(int* allborderdofs,int* allborderdofs1){ 
-
-	int j;
-	extern int my_rank;
-	
-	/*Is this node on the partition border? */
-	if(!indexing.partitionborder)return;
-	
-	/*Are we the cpu that created this node's dof list? */
-	if(indexing.clone==0)return;
-
-	/*Ok, we are on the partition border, but we did not create 
-	 * the dofs for this node. Therefore, our doflist is garbage right 
-	 * now. Go pick it up in the allborderdofs: */
-	for(j=0;j<this->indexing.numberofdofs;j++){
-		indexing.doflist[j]=*(allborderdofs+this->indexing.numberofdofs*(id-1)+j);
-	}
-	this->SetVertexDof(*(allborderdofs1+(id-1)+0));
-	return; 
-}
-/*}}}*/
-/*FUNCTION Node UpdateDofs{{{2*/
-void  Node::UpdateDofs(int dofcount,int dofcount1){
-	
-	int i;
-	extern int my_rank;
-	
-	if(indexing.clone){
-		/*This node is a clone, don't update the dofs!: */
-		return;
-	}
-
-	/*This node should update the dofs, go ahead: */
-	for(i=0;i<this->indexing.numberofdofs;i++){
-		indexing.doflist[i]+=dofcount;
-	}
-	this->SetVertexDof(this->GetVertexDof()+dofcount1);
-
-	return; 
-}
-/*}}}*/
-/*FUNCTION Node UpdateFromInputs {{{2*/
-void  Node::UpdateFromInputs(void* vinputs){
-
-	ISSMERROR("not used yet!");
-	
-}
-/*}}}*/
-/*}}}*/
+/*}}}*/
Index: /issm/trunk/src/c/objects/Node.h
===================================================================
--- /issm/trunk/src/c/objects/Node.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Node.h	(revision 3463)
@@ -14,6 +14,8 @@
 class NodeProperties;
 class Node;
+class DofObject;
 
 #include "./Object.h"
+#include "./DofObject.h"
 #include "../DataSet/DataSet.h"
 #include "./Hook.h"
@@ -24,5 +26,5 @@
 #include "../ModelProcessorx/IoModel.h"
 
-class Node: public Object{
+class Node: public Object,public DofObject{
 
 	private: 
@@ -40,5 +42,5 @@
 		/*FUNCTION constructors, destructors {{{1*/
 		Node();
-		Node(int id,int vertex_id, int upper_node_id, int partitionborder,int numberofdofs, NodeProperties* node_properties);
+		Node(int id,int vertex_id, int upper_node_id, int numberofdofs, NodeProperties* node_properties);
 		Node(int id,DofIndexing* indexing, NodeProperties* properties, Hook* vertex, Hook* upper_node);
 		Node(int i, IoModel* iomodel);
@@ -61,10 +63,5 @@
 		/*}}}*/
 		/*FUNCTION numerical routines {{{1*/
-		void  DistributeDofs(int* pdofcount,int* pdofcount1);
-		void  UpdateDofs(int dofcount,int dofcount1);
-		void  ShowBorderDofs(int* borderdofs,int* borderdofs1);
-		void  UpdateBorderDofs(int* allborderdofs,int* allborderdofs1);
 		void  CreatePartition(Vec partition);
-		void  SetClone(int* minranks);
 		int   GetNumberOfDofs();
 		int   IsClone();
@@ -93,4 +90,11 @@
 		void  FieldExtrude(Vec field,double* field_serial,char* field_name);
 		/*}}}*/
+		/*FUNCTION DofObject routines {{{1*/
+		void  DistributeDofs(int* pdofcount);
+		void  OffsetDofs(int dofcount);
+		void  ShowTrueDofs(int* borderdofs);
+		void  UpdateCloneDofs(int* allborderdofs);
+		void  SetClone(int* minranks);
+		/*}}}*/
 };
 
Index: /issm/trunk/src/c/objects/Numericalflux.cpp
===================================================================
--- /issm/trunk/src/c/objects/Numericalflux.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Numericalflux.cpp	(revision 3463)
@@ -751,8 +751,2 @@
 }
 /*}}}*/
-/*FUNCTION Numericalflux::SetClone {{{1*/
-void  Numericalflux::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Numericalflux.h
===================================================================
--- /issm/trunk/src/c/objects/Numericalflux.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Numericalflux.h	(revision 3463)
@@ -48,5 +48,4 @@
 		int   Enum();
 		int   GetId(); 
-		void   SetClone(int* minranks);
 		void  GetJacobianDeterminant(double* pJdet,double xyz_list[4][3], double gauss_coord);
 		void  GetNodalFunctions(double* l1l4, double gauss_coord);
Index: /issm/trunk/src/c/objects/Numpar.cpp
===================================================================
--- /issm/trunk/src/c/objects/Numpar.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Numpar.cpp	(revision 3463)
@@ -245,8 +245,2 @@
 }
 /*}}}*/
-/*FUNCTION Numpar::SetClone {{{1*/
-void  Numpar::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Numpar.h
===================================================================
--- /issm/trunk/src/c/objects/Numpar.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Numpar.h	(revision 3463)
@@ -43,5 +43,4 @@
 		int   Enum();
 		Object* copy();
-		void  SetClone(int* minranks);
 
 		void  Configure(void* pparametersin);
Index: /issm/trunk/src/c/objects/Object.h
===================================================================
--- /issm/trunk/src/c/objects/Object.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Object.h	(revision 3463)
@@ -25,7 +25,7 @@
 		virtual void  Demarshall(char** pmarshalled_dataset)=0;
 		virtual int   Enum()=0;
-		virtual void  SetClone(int* minranks)=0;
 		virtual Object* copy()=0;
-
+		
+	
 };
 #endif
Index: /issm/trunk/src/c/objects/Param.cpp
===================================================================
--- /issm/trunk/src/c/objects/Param.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Param.cpp	(revision 3463)
@@ -724,8 +724,2 @@
 }
 /*}}}*/
-/*FUNCTION Param::SetClone {{{1*/
-void  Param::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Param.h
===================================================================
--- /issm/trunk/src/c/objects/Param.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Param.h	(revision 3463)
@@ -45,5 +45,4 @@
 		void  Demarshall(char** pmarshalled_dataset);
 		int   Enum();
-		void  SetClone(int* minranks);
 		
 		void  SetDouble(double value);
Index: /issm/trunk/src/c/objects/Pengrid.cpp
===================================================================
--- /issm/trunk/src/c/objects/Pengrid.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Pengrid.cpp	(revision 3463)
@@ -636,10 +636,4 @@
 }
 /*}}}1*/
-/*FUNCTION Pengrid::SetClone {{{1*/
-void  Pengrid::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
 /*FUNCTION Pengrid::UpdateFromInputs {{{1*/
 void  Pengrid::UpdateFromInputs(void* inputs){
Index: /issm/trunk/src/c/objects/Pengrid.h
===================================================================
--- /issm/trunk/src/c/objects/Pengrid.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Pengrid.h	(revision 3463)
@@ -65,5 +65,4 @@
 		void  PenaltyConstrain(int* punstable,void* inputs,int analysis_type,int sub_analysis_type);
 		void  PenaltyConstrainThermal(int* punstable,void* inputs,int analysis_type,int sub_analysis_type);
-		void   SetClone(int* minranks);
 
 };
Index: /issm/trunk/src/c/objects/Penpair.cpp
===================================================================
--- /issm/trunk/src/c/objects/Penpair.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Penpair.cpp	(revision 3463)
@@ -234,8 +234,2 @@
 }
 /*}}}1*/
-/*FUNCTION Penpair::SetClone {{{1*/
-void  Penpair::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Penpair.h
===================================================================
--- /issm/trunk/src/c/objects/Penpair.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Penpair.h	(revision 3463)
@@ -48,5 +48,4 @@
 		void  PenaltyCreatePVector(Vec pg,void* inputs,double kmax,int analysis_type,int sub_analysis_type);
 		Object* copy();
-		void   SetClone(int* minranks);
 
 };
Index: /issm/trunk/src/c/objects/Result.cpp
===================================================================
--- /issm/trunk/src/c/objects/Result.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Result.cpp	(revision 3463)
@@ -291,8 +291,2 @@
 }
 /*}}}1*/
-/*FUNCTION Result::SetClone {{{1*/
-void  Result::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Result.h
===================================================================
--- /issm/trunk/src/c/objects/Result.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Result.h	(revision 3463)
@@ -41,5 +41,4 @@
 		int   Enum();
 		Object* copy();
-		void  SetClone(int* minranks);
 
 		double GetTime();
Index: /issm/trunk/src/c/objects/Rgb.cpp
===================================================================
--- /issm/trunk/src/c/objects/Rgb.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Rgb.cpp	(revision 3463)
@@ -165,8 +165,2 @@
 }
 /*}}}1*/
-/*FUNCTION Rgb::SetClone {{{1*/
-void  Rgb::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Rgb.h
===================================================================
--- /issm/trunk/src/c/objects/Rgb.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Rgb.h	(revision 3463)
@@ -32,5 +32,4 @@
 		int    GetId(); 
 		int    MyRank();
-		void  SetClone(int* minranks);
 
 		/*non virtual: */
Index: /issm/trunk/src/c/objects/Riftfront.cpp
===================================================================
--- /issm/trunk/src/c/objects/Riftfront.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Riftfront.cpp	(revision 3463)
@@ -909,10 +909,4 @@
 }
 /*}}}1*/
-/*FUNCTION Riftfront::SetClone {{{1*/
-void  Riftfront::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
 /*FUNCTION Riftfront::UpdateFromInputs {{{1*/
 void  Riftfront::UpdateFromInputs(void* vinputs){
Index: /issm/trunk/src/c/objects/Riftfront.h
===================================================================
--- /issm/trunk/src/c/objects/Riftfront.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Riftfront.h	(revision 3463)
@@ -77,5 +77,4 @@
 		int   MarshallSize();
 		int   MyRank();
-		void   SetClone(int* minranks);
 
 		/*}}}*/
Index: /issm/trunk/src/c/objects/SolPar.h
===================================================================
--- /issm/trunk/src/c/objects/SolPar.h	(revision 3462)
+++ /issm/trunk/src/c/objects/SolPar.h	(revision 3463)
@@ -37,5 +37,4 @@
 		int   Enum();
 		Object* copy();
-		void  SetClone(int* minranks);
 
 		/*functionality: */
Index: /issm/trunk/src/c/objects/Spc.cpp
===================================================================
--- /issm/trunk/src/c/objects/Spc.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Spc.cpp	(revision 3463)
@@ -164,8 +164,2 @@
 }
 /*}}}1*/
-/*FUNCTION Spc::SetClone {{{1*/
-void  Spc::SetClone(int* minranks){
-
-	ISSMERROR("not implemented yet");
-}
-/*}}}1*/
Index: /issm/trunk/src/c/objects/Spc.h
===================================================================
--- /issm/trunk/src/c/objects/Spc.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Spc.h	(revision 3463)
@@ -37,5 +37,4 @@
 		double GetValue();
 		Object* copy();
-		void  SetClone(int* minranks);
 
 };
Index: /issm/trunk/src/c/objects/Vertex.cpp
===================================================================
--- /issm/trunk/src/c/objects/Vertex.cpp	(revision 3462)
+++ /issm/trunk/src/c/objects/Vertex.cpp	(revision 3463)
@@ -20,17 +20,17 @@
 /*}}}*/
 
-/*Object constructors and destructor*/
-/*FUNCTION Vertex default constructor {{{1*/
+/*Object constructors and destructor{{{1*/
+/*FUNCTION Vertex default constructor {{{2*/
 Vertex::Vertex(){
 	return;
 }
 /*}}}*/
-/*FUNCTION Vertex constructor {{{1*/
-Vertex::Vertex(int tria_id, double tria_x, double tria_y, double tria_z, double tria_sigma, int partitionborder){
-	this->Init(tria_id, tria_x, tria_y, tria_z, tria_sigma, partitionborder);
-}
-/*}}}*/
-/*FUNCTION Vertex init, used by constructor {{{1*/
-void Vertex::Init(int tria_id, double tria_x, double tria_y, double tria_z, double tria_sigma, int partitionborder){
+/*FUNCTION Vertex constructor {{{2*/
+Vertex::Vertex(int tria_id, double tria_x, double tria_y, double tria_z, double tria_sigma){
+	this->Init(tria_id, tria_x, tria_y, tria_z, tria_sigma);
+}
+/*}}}*/
+/*FUNCTION Vertex init, used by constructor {{{2*/
+void Vertex::Init(int tria_id, double tria_x, double tria_y, double tria_z, double tria_sigma){
 
 	/*all the initialization has been done by the initializer, just fill in the id: */
@@ -45,25 +45,19 @@
 }
 /*}}}*/
-/*FUNCTION Vertex constructor  from iomodel{{{1*/
+/*FUNCTION Vertex constructor  from iomodel{{{2*/
 Vertex::Vertex(int i, IoModel* iomodel){
 
-	int partitionborder;
-
-	/*is this vertex on a partition border? */
-	if(iomodel->my_bordervertices[i])partitionborder=1;
-	else partitionborder=0;
-
-	this->Init(i+1, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]),partitionborder);
-
-}
-/*}}}*/
-/*FUNCTION Vertex destructor {{{1*/
+	this->Init(i+1, iomodel->x[i],iomodel->y[i],iomodel->z[i],(iomodel->z[i]-iomodel->bed[i])/(iomodel->thickness[i]));
+
+}
+/*}}}*/
+/*FUNCTION Vertex destructor {{{2*/
 Vertex::~Vertex(){
 	return;
 }
 /*}}}*/
-
-/*Object management*/
-/*FUNCTION copy {{{1*/
+/*}}}*/
+/*Object management {{{1*/
+/*FUNCTION copy {{{2*/
 Object* Vertex::copy() {
 
@@ -72,5 +66,5 @@
 }
 /*}}}*/
-/*FUNCTION DeepEcho{{{1*/
+/*FUNCTION DeepEcho{{{2*/
 
 void Vertex::DeepEcho(void){
@@ -78,5 +72,5 @@
 }
 /*}}}*/
-/*FUNCTION Demarshall {{{1*/
+/*FUNCTION Demarshall {{{2*/
 void  Vertex::Demarshall(char** pmarshalled_dataset){
 
@@ -96,5 +90,4 @@
 	memcpy(&sigma,marshalled_dataset,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
 	memcpy(&dof,marshalled_dataset,sizeof(dof));marshalled_dataset+=sizeof(dof);
-	memcpy(&partitionborder,marshalled_dataset,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
 	memcpy(&clone,marshalled_dataset,sizeof(clone));marshalled_dataset+=sizeof(clone);
 
@@ -104,5 +97,5 @@
 }
 /*}}}*/
-/*FUNCTION Echo{{{1*/
+/*FUNCTION Echo{{{2*/
 
 void Vertex::Echo(void){
@@ -115,5 +108,4 @@
 	printf("   sigma: %g\n",sigma);
 	printf("   dof: %g\n",dof);
-	printf("   partitionborder: %g\n",partitionborder);
 	printf("   clone: %g\n",clone);
 
@@ -121,5 +113,5 @@
 }
 /*}}}*/
-/*FUNCTION Enum {{{1*/
+/*FUNCTION Enum {{{2*/
 int Vertex::Enum(void){
 
@@ -128,13 +120,13 @@
 }
 /*}}}*/
-/*FUNCTION GetId{{{1*/
+/*FUNCTION GetId{{{2*/
 int    Vertex::GetId(void){ return id; }
 /*}}}*/
-/*FUNCTION GetName{{{1*/
+/*FUNCTION GetName{{{2*/
 char* Vertex::GetName(void){
 	return "node";
 }
 /*}}}*/
-/*FUNCTION Marshall {{{1*/
+/*FUNCTION Marshall {{{2*/
 void  Vertex::Marshall(char** pmarshalled_dataset){
 
@@ -158,5 +150,4 @@
 	memcpy(marshalled_dataset,&sigma,sizeof(sigma));marshalled_dataset+=sizeof(sigma);
 	memcpy(marshalled_dataset,&dof,sizeof(dof));marshalled_dataset+=sizeof(dof);
-	memcpy(marshalled_dataset,&partitionborder,sizeof(partitionborder));marshalled_dataset+=sizeof(partitionborder);
 	memcpy(marshalled_dataset,&clone,sizeof(clone));marshalled_dataset+=sizeof(clone);
 
@@ -165,5 +156,5 @@
 }
 /*}}}*/
-/*FUNCTION MarshallSize {{{1*/
+/*FUNCTION MarshallSize {{{2*/
 int   Vertex::MarshallSize(){
 	
@@ -174,10 +165,9 @@
 		sizeof(sigma)+
 		sizeof(dof)+
-		sizeof(partitionborder)+
 		sizeof(clone)+
 		+sizeof(int); //sizeof(int) for enum type
 }
 /*}}}*/
-/*FUNCTION MyRank {{{1*/
+/*FUNCTION MyRank {{{2*/
 int    Vertex::MyRank(void){ 
 	extern int my_rank;
@@ -185,5 +175,112 @@
 }
 /*}}}*/
-/*FUNCTION SetClone {{{1*/
+/*FUNCTION UpdateFromDakota {{{2*/
+void  Vertex::UpdateFromDakota(void* vinputs){
+
+	ISSMERROR("not supported yet!");
+	
+}
+/*}}}*/
+/*FUNCTION UpdateFromInputs {{{2*/
+void  Vertex::UpdateFromInputs(void* vinputs){
+	
+	ParameterInputs* inputs=NULL;
+	Vertex* vertex=NULL;
+	int dof[1]={0};
+	double coord[3];
+
+	vertex=this;
+
+	coord[0]=this->x; coord[1]=this->y; coord[2]=this->z;
+
+	/*Recover parameter inputs: */
+	inputs=(ParameterInputs*)vinputs;
+
+	/*Update internal data if inputs holds new values: */
+	inputs->Recover("x",&coord[0],1,dof,1,(void**)&vertex);
+	inputs->Recover("y",&coord[1],1,dof,1,(void**)&vertex);
+	inputs->Recover("z",&coord[2],1,dof,1,(void**)&vertex);
+	
+	ISSMERROR("not supported yet!");
+	
+}
+/*}}}*/
+/*FUNCTION UpdateVertexPosition {{{2*/
+void  Vertex::UpdatePosition(double* thickness,double* bed){
+
+	/*sigma remains constant. z=bed+sigma*thickness*/
+	this->z=bed[dof]+sigma*thickness[this->dof];
+
+}
+/*}}}*/
+/*}}}*/
+/* DofObject routines: {{{1*
+/*FUNCTION Vertex DistributeDofs{{{2*/
+void  Vertex::DistributeDofs(int* pdofcount){
+
+	int i;
+	extern int my_rank;
+	int dofcount;
+
+	dofcount=*pdofcount;
+	
+	if(this->clone){
+		/*This vertex is a clone! Don't distribute dofs, it will get them from another cpu!*/
+		return;
+	}
+
+	/*This vertex should distribute his dof, go ahead: */
+	this->dof=dofcount;
+	dofcount++;
+
+	/*Assign output pointers: */
+	*pdofcount=dofcount;
+
+}
+/*}}}*/
+/*FUNCTION Vertex OffsetDofs{{{2*/
+void  Vertex::OffsetDofs(int dofcount){
+	
+	int i;
+	extern int my_rank;
+	
+	if(this->clone){
+		/*This vertex is a clone, don't offset the dofs!: */
+		return;
+	}
+
+	/*This vertex should offset his dof, go ahead: */
+	this->dof+=dofcount;
+}
+/*}}}*/
+/*FUNCTION Vertex ShowTrueDofs{{{2*/
+void  Vertex::ShowTrueDofs(int* truedofs){
+
+	int j;
+	extern int my_rank;
+	
+	/*Are we a clone? : */
+	if(this->clone)return;
+
+	/*Ok, we are not a clone, just plug our dof into truedofs: */
+	truedofs[this->id-1]=this->dof;
+
+}
+/*}}}*/
+/*FUNCTION Vertex UpdateCloneDofs{{{2*/
+void  Vertex::UpdateCloneDofs(int* alltruedofs){
+
+	int j;
+	extern int my_rank;
+	
+	/*If we are not a clone, don't update, we already have dofs!: */
+	if(this->clone==0)return;
+
+	/*Ok, we are a clone node, but we did not create the dof for this vertex 
+	 * Therefore, our dof is garbage right now. Go pick it up in the alltruedofs: */
+	this->dof=alltruedofs[id-1];
+}
+/*}}}*/
+/*FUNCTION Vertex SetClone {{{2*/
 void  Vertex::SetClone(int* minranks){
 
@@ -194,5 +291,5 @@
 	}
 	else{
-		/*!there is a cpu with lower rank that has the same node, 
+		/*!there is a cpu with lower rank that has the same vertex, 
 		therefore, I am a clone*/
 		this->clone=1; 	
@@ -201,41 +298,3 @@
 }
 /*}}}*/
-/*FUNCTION UpdateFromDakota {{{1*/
-void  Vertex::UpdateFromDakota(void* vinputs){
-
-	ISSMERROR("not supported yet!");
-	
-}
-/*}}}*/
-/*FUNCTION UpdateFromInputs {{{1*/
-void  Vertex::UpdateFromInputs(void* vinputs){
-	
-	ParameterInputs* inputs=NULL;
-	Vertex* vertex=NULL;
-	int dof[1]={0};
-	double coord[3];
-
-	vertex=this;
-
-	coord[0]=this->x; coord[1]=this->y; coord[2]=this->z;
-
-	/*Recover parameter inputs: */
-	inputs=(ParameterInputs*)vinputs;
-
-	/*Update internal data if inputs holds new values: */
-	inputs->Recover("x",&coord[0],1,dof,1,(void**)&vertex);
-	inputs->Recover("y",&coord[1],1,dof,1,(void**)&vertex);
-	inputs->Recover("z",&coord[2],1,dof,1,(void**)&vertex);
-	
-	ISSMERROR("not supported yet!");
-	
-}
-/*}}}*/
-/*FUNCTION UpdateVertexPosition {{{1*/
-void  Vertex::UpdatePosition(double* thickness,double* bed){
-
-	/*sigma remains constant. z=bed+sigma*thickness*/
-	this->z=bed[dof]+sigma*thickness[this->dof];
-
-}
-/*}}}*/
+/*}}}*/
Index: /issm/trunk/src/c/objects/Vertex.h
===================================================================
--- /issm/trunk/src/c/objects/Vertex.h	(revision 3462)
+++ /issm/trunk/src/c/objects/Vertex.h	(revision 3463)
@@ -6,8 +6,12 @@
 #define _VERTEX_H_
 
+class Object;
+class DofObject;
+
 #include "../ModelProcessorx/IoModel.h"
 #include "./Object.h"
+#include "./DofObject.h"
 
-class Vertex: public Object{
+class Vertex: public Object,public DofObject{
 
 	public: 
@@ -20,5 +24,4 @@
 
 		/*dof management: */
-		int    partitionborder;
 		int    clone;
 		int    dof; //dof to recover values in a vertex indexed vector
@@ -26,6 +29,6 @@
 		/*FUNCTION constructors, destructors {{{1*/
 		Vertex();
-		Vertex(int id, double x, double y, double z, double sigma,int partitionborder); 
-		void Init(int id, double x, double y, double z, double sigma,int partitionborder);
+		Vertex(int id, double x, double y, double z, double sigma); 
+		void Init(int id, double x, double y, double z, double sigma);
 		Vertex(int i, IoModel* iomodel);
 		~Vertex();
@@ -42,5 +45,4 @@
 		int   MarshallSize();
 		int   MyRank();
-		void  SetClone(int* minranks);
 		void  UpdateFromDakota(void* vinputs);
 		void  UpdateFromInputs(void* vinputs);
@@ -49,4 +51,11 @@
 
 		/*}}}*/
+		/*FUNCTION DofObject routines {{{1*/
+		void  DistributeDofs(int* pdofcount);
+		void  OffsetDofs(int dofcount);
+		void  ShowTrueDofs(int* borderdofs);
+		void  UpdateCloneDofs(int* allborderdofs);
+		void  SetClone(int* minranks);
+		/*}}}*/
 
 };
