Index: /issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h	(revision 14730)
+++ /issm/trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h	(revision 14731)
@@ -59,9 +59,4 @@
 		}
 		/*}}}*/
-		/*FUNCTION IssmMpiVec(int m,int M){{{*/
-		/*IssmMpiVec(int min,int Min){
-			this->Init(Min,false);
-		}*/
-		/*}}}*/
 		/*FUNCTION IssmMpiVec(int M,bool fromlocalsize){{{*/
 		IssmMpiVec(int Min, bool fromlocalsize){
@@ -75,5 +70,5 @@
 
 			if(this->M){
-				this->vector=xNew<doubletype>(Min);
+				this->vector=xNew<doubletype>(this->m);
 				xMemCpy<doubletype>(this->vector,buffer,this->m);
 			}
@@ -130,5 +125,6 @@
 		/*FUNCTION Assemble{{{*/
 		void Assemble(void){
-			_error_("not implemented yet!");
+			printf("not imlemented yet!");
+			exit(1);
 		}
 		/*}}}*/
@@ -159,5 +155,4 @@
 		void GetValue(doubletype* pvalue,int dof){
 			_error_("Get value on a MpiVec vector not implemented yet!");
-
 		}
 		/*}}}*/
@@ -193,22 +188,19 @@
 		/*FUNCTION AXPY{{{*/
 		void AXPY(IssmAbsVec<doubletype>* Xin, doubletype a){
-			_error_("not implemented yet!");
+			printf("AXPY not implemented yet!");
+			exit(1);
 		}
 		/*}}}*/
 		/*FUNCTION AYPX{{{*/
 		void AYPX(IssmAbsVec<doubletype>* Xin, doubletype a){
-			_error_("not implemented yet!");
+			printf("AYPX not implemented yet!");
+			exit(1);
 		}
 		/*}}}*/
 		/*FUNCTION ToMPISerial{{{*/
 		doubletype* ToMPISerial(void){
-
-			doubletype* buffer=NULL;
-
-			if(this->M){
-				buffer=xNew<doubletype>(this->M);
-				xMemCpy<doubletype>(buffer,this->vector,this->M);
-			}
-			return buffer;
+			
+			printf("IssmMpiVec ToMPISerial not implemented yet!");
+			exit(1);
 
 		}
@@ -225,5 +217,5 @@
 
 			to->M=this->M;
-			for(i=0;i<this->M;i++)to->vector[i]=this->vector[i];
+			for(i=0;i<this->m;i++)to->vector[i]=this->vector[i];
 
 		}
@@ -232,21 +224,6 @@
 		doubletype Norm(NormMode mode){
 
-			doubletype norm;
-			int i;
-
-			switch(mode){
-				case NORM_INF:
-					norm=0; for(i=0;i<this->M;i++)norm=max(norm,fabs(this->vector[i]));
-					return norm;
-					break;
-				case NORM_TWO:
-					norm=0; 
-					for(i=0;i<this->M;i++)norm+=pow(this->vector[i],2);
-					return sqrt(norm);
-					break;
-				default:
-					_error_("unknown norm !");
-					break;
-			}
+			printf("IssmMpiVec Norm not implemented yet!");
+			exit(1);
 		}
 		/*}}}*/
@@ -259,8 +236,10 @@
 		}
 		/*}}}*/
-		/*FU		/*FUNCTION Dot{{{*/
+		/*FUNCTION Dot{{{*/
 		doubletype Dot(IssmAbsVec<doubletype>* inputin){
 
 			int i;
+			doubletype local_dot=0;
+			doubletype dot=0;
 
 			/*Assume inputin is of the correct type, and downcast: */
@@ -269,9 +248,13 @@
 			input=(IssmMpiVec<doubletype>*)inputin;
 
-
-			doubletype dot=0;
-			for(i=0;i<this->M;i++)dot+=this->vector[i]*input->vector[i];
+			for(i=0;i<this->m;i++)local_dot+=this->vector[i]*input->vector[i];
+
+			#ifdef _HAVE_MPI_
+			/*MPI_SUM all the dots across the cluster: */
+			MPI_Reduce(&local_dot, &dot, 1, MPI_DOUBLE, MPI_SUM, 0, IssmComm::GetComm());
+			MPI_Bcast(&dot,1,MPI_DOUBLE,0,IssmComm::GetComm());
+			#endif
+
 			return dot;
-
 		}
 		/*}}}*/
@@ -290,5 +273,5 @@
 
 			/*pointwise w=x/y where this->vector is w: */
-			for(i=0;i<this->M;i++)this->vector[i]=x->vector[i]/y->vector[i];
+			for(i=0;i<this->m;i++)this->vector[i]=x->vector[i]/y->vector[i];
 		}
 		/*}}}*/
