Index: XIOS/dev/branch_openmp/extern/remap/src/gridRemap.hpp
===================================================================
--- XIOS/dev/branch_openmp/extern/remap/src/gridRemap.hpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/remap/src/gridRemap.hpp	(revision 1220)
@@ -14,6 +14,5 @@
 Coord readPole(std::istream&);
 
-extern CRemapGrid srcGrid;
-extern CRemapGrid tgtGrid;
+
 
 }
Index: XIOS/dev/branch_openmp/extern/remap/src/intersect.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/remap/src/intersect.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/remap/src/intersect.cpp	(revision 1220)
@@ -15,4 +15,10 @@
 namespace sphereRemap {
 
+extern CRemapGrid srcGrid;
+#pragma omp threadprivate(srcGrid)
+
+extern CRemapGrid tgtGrid;
+#pragma omp threadprivate(tgtGrid)
+
 using namespace std;
 
@@ -21,18 +27,18 @@
 int neighbour_idx(const Elt& a, const Elt& b)
 {
-	for (int i = 0; i < a.n; i++)
-	{
-		for (int j = 0; j < b.n; j++)
-		{
-			assert(squaredist(a.vertex[ i       ], b.vertex[ j       ]) > EPS*EPS ||
-			       squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > EPS*EPS);
-			if (   squaredist(a.vertex[ i       ], b.vertex[ j           ]) < 1e-13*1e-13 &&
-			       squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+b.n-1)%b.n]) < 1e-13*1e-13)
-			{
-				return i;
-			}
-		}
-	}
-	return NOT_FOUND;
+  for (int i = 0; i < a.n; i++)
+  {
+    for (int j = 0; j < b.n; j++)
+    {
+      assert(squaredist(a.vertex[ i       ], b.vertex[ j       ]) > EPS*EPS ||
+             squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > EPS*EPS);
+      if (   squaredist(a.vertex[ i       ], b.vertex[ j           ]) < 1e-13*1e-13 &&
+             squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+b.n-1)%b.n]) < 1e-13*1e-13)
+      {
+        return i;
+      }
+    }
+  }
+  return NOT_FOUND;
 }
 
@@ -205,5 +211,5 @@
 bool isNeighbour(Elt& a, const Elt& b)
 {
-	// return neighbour_idx(a, b) != NOT_FOUND;
+  // return neighbour_idx(a, b) != NOT_FOUND;
   return insertNeighbour(a,b,false) ;
 }
@@ -213,33 +219,33 @@
 void intersect(Elt *a, Elt *b)
 {
-	int na = a->n; /* vertices of a */
-	int nb = b->n; /* vertices of b */
-	Coord *c   = new Coord[na+nb];
-	Coord *c2  = new Coord[na+nb];
-	Coord *xc  = new Coord[na+nb];
-	Coord *xc2 = new Coord[na+nb];
-	Coord gc, gc2;
-	double *d = new double[na+nb];
-	double *d2 = new double[na+nb];
-	double are, are2;
-	Ipt ipt[NMAX*NMAX];
-	Ipt ipt2[NMAX*NMAX];
-	ptsec(a, b, ipt);
-	/* make ipt2 transpose of ipt */
-	for (int ii = 0; ii < na; ii++)
-		for (int jj = 0; jj < nb; jj++)
-			ipt2[jj*na+ii] = ipt[ii*nb+jj];
-	list<Sgm> iscot;
-	recense(a, b, ipt, iscot, 0);
-	recense(b, a, ipt2, iscot, 1);
-
-	int nseg = iscot.size();
-	int nc = 0;
-	int nc2 = 0;
-	while (iscot.size() && nc < 2)
-		nc = assemble(iscot, c, d, xc);
-	while (iscot.size() && nc2 < 2)
-		nc2 = assemble(iscot, c2, d2, xc2);
-//	assert(nseg == nc + nc2 || nseg == 1); // unused segment
+  int na = a->n; /* vertices of a */
+  int nb = b->n; /* vertices of b */
+  Coord *c   = new Coord[na+nb];
+  Coord *c2  = new Coord[na+nb];
+  Coord *xc  = new Coord[na+nb];
+  Coord *xc2 = new Coord[na+nb];
+  Coord gc, gc2;
+  double *d = new double[na+nb];
+  double *d2 = new double[na+nb];
+  double are, are2;
+  Ipt ipt[NMAX*NMAX];
+  Ipt ipt2[NMAX*NMAX];
+  ptsec(a, b, ipt);
+  /* make ipt2 transpose of ipt */
+  for (int ii = 0; ii < na; ii++)
+    for (int jj = 0; jj < nb; jj++)
+      ipt2[jj*na+ii] = ipt[ii*nb+jj];
+  list<Sgm> iscot;
+  recense(a, b, ipt, iscot, 0);
+  recense(b, a, ipt2, iscot, 1);
+
+  int nseg = iscot.size();
+  int nc = 0;
+  int nc2 = 0;
+  while (iscot.size() && nc < 2)
+    nc = assemble(iscot, c, d, xc);
+  while (iscot.size() && nc2 < 2)
+    nc2 = assemble(iscot, c2, d2, xc2);
+//  assert(nseg == nc + nc2 || nseg == 1); // unused segment
 
         if (!(nseg == nc + nc2 || nseg == 1))
@@ -260,53 +266,53 @@
 
 //    intersect_ym(a,b) ;
-	if (nc == 1) nc = 0;
-	if (nc2 == 1) nc2 = 0;
-	gc = barycentre(xc, nc);
-	gc2 = barycentre(xc2, nc2);
-	orient(nc, xc, c, d, gc);
-
-	Coord pole = srcGrid.pole;
-	if (pole == ORIGIN) pole = tgtGrid.pole;
-	const double MINBASE = 1e-11;
-	if (nc == 2) /* nc is the number of vertices of super mesh element */
-	{
-		double base = arcdist(xc[0], xc[1]);
+  if (nc == 1) nc = 0;
+  if (nc2 == 1) nc2 = 0;
+  gc = barycentre(xc, nc);
+  gc2 = barycentre(xc2, nc2);
+  orient(nc, xc, c, d, gc);
+
+  Coord pole = srcGrid.pole;
+  if (pole == ORIGIN) pole = tgtGrid.pole;
+  const double MINBASE = 1e-11;
+  if (nc == 2) /* nc is the number of vertices of super mesh element */
+  {
+    double base = arcdist(xc[0], xc[1]);
 cerr << "DID ARRIVE " << base << xc[0] << xc[1] << endl;
-		gc = midpoint(gc, midpointSC(xc[0], xc[1]));
-		/* intersection area `are` must be zero here unless we have one great and one small circle */
-		are = alun(base, fabs(scalarprod(xc[0], pole)));
-	}
-	else
-	{
-		are = airbar(nc, xc, c, d, pole, gc);
-	}
-	if (nc2 == 2)
-	{
-		double base = arcdist(xc2[0], xc2[1]);
+    gc = midpoint(gc, midpointSC(xc[0], xc[1]));
+    /* intersection area `are` must be zero here unless we have one great and one small circle */
+    are = alun(base, fabs(scalarprod(xc[0], pole)));
+  }
+  else
+  {
+    are = airbar(nc, xc, c, d, pole, gc);
+  }
+  if (nc2 == 2)
+  {
+    double base = arcdist(xc2[0], xc2[1]);
 cerr << "DID ARRIVE " << base << xc2[0] << xc2[1] << endl;
-		assert(base > MINBASE);
-		gc2 = midpoint(gc2, midpointSC(xc2[0], xc2[1]));
-		are2 = alun(base, fabs(scalarprod(xc2[0], pole))); // 0
-	}
-	else
-	{
-		are2 = airbar(nc2, xc2, c2, d2, pole, gc2);
-	}
+    assert(base > MINBASE);
+    gc2 = midpoint(gc2, midpointSC(xc2[0], xc2[1]));
+    are2 = alun(base, fabs(scalarprod(xc2[0], pole))); // 0
+  }
+  else
+  {
+    are2 = airbar(nc2, xc2, c2, d2, pole, gc2);
+  }
 
 //  double ym_area=intersect_ym(a,b) ;
 
   if (nc > 1)
-	{
-		/* create one super mesh polygon that src and dest point to */
-		Polyg *is = new Polyg;
-		is->x = gc;
-		is->area = are;
-		is->id = b->id;
-		is->src_id = b->src_id;
-		is->n = nc;
-		(a->is).push_back(is);
-		(b->is).push_back(is);
+  {
+    /* create one super mesh polygon that src and dest point to */
+    Polyg *is = new Polyg;
+    is->x = gc;
+    is->area = are;
+    is->id = b->id;
+    is->src_id = b->src_id;
+    is->n = nc;
+    (a->is).push_back(is);
+    (b->is).push_back(is);
 /*
- 	  if (	2*fabs(are-ym_area)/(are+ym_area) > 1.1 && ym_area>1e-8)
+    if (  2*fabs(are-ym_area)/(are+ym_area) > 1.1 && ym_area>1e-8)
     {
       cout<<"Big area difference : "<<are<<"  "<<ym_area<<endl ;
@@ -314,18 +320,18 @@
     }
 */
-//		cout<<"intersection : "<<are<<" "<< ym_area<<"  diff : "<<fabs(are-ym_area)<<"  ratio : "<<fabs(are-ym_area)/(0.5*(are+ym_area))<<endl ;
-	}
-	if (nc2 > 1)
-	{
-		Polyg *is = new Polyg;
-		is->x = gc2;
-		is->area = are2;
-		is->id = b->id; /* intersection holds id of corresponding source element (see Elt class definition for details about id) */
-		is->src_id = b->src_id;
-		is->n = nc2;
-		(a->is).push_back(is);
-		(b->is).push_back(is);
+//    cout<<"intersection : "<<are<<" "<< ym_area<<"  diff : "<<fabs(are-ym_area)<<"  ratio : "<<fabs(are-ym_area)/(0.5*(are+ym_area))<<endl ;
+  }
+  if (nc2 > 1)
+  {
+    Polyg *is = new Polyg;
+    is->x = gc2;
+    is->area = are2;
+    is->id = b->id; /* intersection holds id of corresponding source element (see Elt class definition for details about id) */
+    is->src_id = b->src_id;
+    is->n = nc2;
+    (a->is).push_back(is);
+    (b->is).push_back(is);
 /*
-    if (	2*fabs(are-ym_area)/(are+ym_area) > 1.1 && ym_area>1e-8 )
+    if (  2*fabs(are-ym_area)/(are+ym_area) > 1.1 && ym_area>1e-8 )
     {
       cout<<"Big area difference : "<<are<<"  "<<ym_area<<endl ;
@@ -333,6 +339,6 @@
     }
 */
-//		cout<<"intersection : "<<are2<<" "<< ym_area<<"  diff : "<<fabs(are-ym_area)<<"  ratio : "<<fabs(are-ym_area)/(0.5*(are+ym_area))<<endl ;
-	}
+//    cout<<"intersection : "<<are2<<" "<< ym_area<<"  diff : "<<fabs(are-ym_area)<<"  ratio : "<<fabs(are-ym_area)/(0.5*(are+ym_area))<<endl ;
+  }
 /*
   if (nc<=1 && nc2<=1)
@@ -344,11 +350,11 @@
   }
 */
-	delete [] c;
-	delete [] c2;
-	delete [] xc;
-	delete [] xc2;
-	delete [] d;
-	delete [] d2;
-}
-
-}
+  delete [] c;
+  delete [] c2;
+  delete [] xc;
+  delete [] xc2;
+  delete [] d;
+  delete [] d2;
+}
+
+}
Index: XIOS/dev/branch_openmp/extern/remap/src/intersection_ym.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/remap/src/intersection_ym.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/remap/src/intersection_ym.cpp	(revision 1220)
@@ -13,4 +13,11 @@
 
 namespace sphereRemap {
+
+extern CRemapGrid srcGrid;
+#pragma omp threadprivate(srcGrid)
+
+extern CRemapGrid tgtGrid;
+#pragma omp threadprivate(tgtGrid)
+
 
 using namespace std;
Index: XIOS/dev/branch_openmp/extern/remap/src/mapper.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/remap/src/mapper.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/remap/src/mapper.cpp	(revision 1220)
@@ -14,4 +14,11 @@
 
 namespace sphereRemap {
+
+extern CRemapGrid srcGrid;
+#pragma omp threadprivate(srcGrid)
+
+extern CRemapGrid tgtGrid;
+#pragma omp threadprivate(tgtGrid)
+
 
 /* A subdivition of an array into N sub-arays
Index: XIOS/dev/branch_openmp/extern/remap/src/parallel_tree.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/remap/src/parallel_tree.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/remap/src/parallel_tree.cpp	(revision 1220)
@@ -14,4 +14,10 @@
 
 namespace sphereRemap {
+
+extern CRemapGrid srcGrid;
+#pragma omp threadprivate(srcGrid)
+
+extern CRemapGrid tgtGrid;
+#pragma omp threadprivate(tgtGrid)
 
 static const int assignLevel = 2;
Index: XIOS/dev/branch_openmp/extern/remap/src/polyg.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/remap/src/polyg.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/remap/src/polyg.cpp	(revision 1220)
@@ -7,4 +7,5 @@
 
 #include "polyg.hpp"
+#include <stdio.h>
 
 namespace sphereRemap {
@@ -45,13 +46,16 @@
 Coord barycentre(const Coord *x, int n)
 {
+
 	if (n == 0) return ORIGIN;
 	Coord bc = ORIGIN;
 	for (int i = 0; i < n; i++)
+	{
 		bc = bc + x[i];
+	}	
 	/* both distances can be equal down to roundoff when norm(bc) < mashineepsilon 
 	   which can occur when weighted with tiny area */
-
-	assert(squaredist(bc, proj(bc)) <= squaredist(bc, proj(bc * (-1.0))));
-	//if (squaredist(bc, proj(bc)) > squaredist(bc, proj(bc * (-1.0)))) return proj(bc * (-1.0));
+  
+	
+  //assert(squaredist(bc, proj(bc)) <= squaredist(bc, proj(bc * (-1.0))));	
 
 	return proj(bc);
@@ -173,7 +177,8 @@
 		t[1] = x[i];
 		t[2] = x[ii];
-                double sc=scalarprod(crossprod(t[1] - t[0], t[2] - t[0]), t[0]) ;
+    double sc=scalarprod(crossprod(t[1] - t[0], t[2] - t[0]), t[0]) ;
 		assert(sc >= -1e-10); // Error: tri a l'env (wrong orientation)
 		double area_gc = triarea(t[0], t[1], t[2]);
+		if(area_gc<=0) printf("area_gc = %e\n", area_gc);
 		double area_sc_gc_moon = 0;
 		if (d[i]) /* handle small circle case */
@@ -183,8 +188,10 @@
 			char sgl = (mext > 0) ? -1 : 1;
 			area_sc_gc_moon = sgl * alun(arcdist(t[1], t[2]), fabs(scalarprod(t[1], pole)));
+			//if(area_sc_gc_moon<=0) printf("area_sc_gc_moon = %e\n", area_sc_gc_moon);
 			gg_exact = gg_exact + sc_gc_moon_normalintegral(t[1], t[2], pole);
 		}
 		area += area_gc + area_sc_gc_moon; /* for "spherical circle segment" sum triangular part (at) and "small moon" and => account for small circle */
 		g[i] = barycentre(t, 3) * (area_gc + area_sc_gc_moon);
+		//printf("g[%d] = (%e,%e,%e) * (%e+%e) = (%e,%e,%e) norm = %e\n", i, barycentre(t, 3).x, barycentre(t, 3).y, barycentre(t, 3).z, area_gc,  area_sc_gc_moon, g[i].x, g[i].y, g[i].z, norm(g[i]));
 	}
 	gg = barycentre(g, N);
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_lib.cpp	(revision 1220)
@@ -7,5 +7,5 @@
 using namespace std;
 
-std::list< ep_lib::MPI_Request* > ** EP_PendingRequests = 0;
+std::list< ep_lib::MPI_Request* > * EP_PendingRequests = 0;
 #pragma omp threadprivate(EP_PendingRequests)
 
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_message.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_message.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_message.cpp	(revision 1220)
@@ -53,18 +53,6 @@
       }
       #elif _intelmpi
-      //#pragma omp critical (_mpi_call)
-      //::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status); 
-      #pragma omp critical (_mpi_call)
-      {
-        ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &status);
-        if(flag)
-        {
-          Debug("find message in mpi comm \n");
-          mpi_source = status.MPI_SOURCE;
-          int tag = status.MPI_TAG;
-          ::MPI_Mprobe(mpi_source, tag, mpi_comm, &message, &status);
-
-        }
-      }
+      #pragma omp critical (_mpi_call)
+      ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status); 
       #endif
       
@@ -72,15 +60,14 @@
       {
 
-        MPI_Message *msg_block = new MPI_Message; //printf("myRank = %d, new ok\n", myRank);
-        msg_block->mpi_message = message;  //printf("myRank = %d, msg_block->mpi_message = %d\n", myRank, msg_block->mpi_message);
-        msg_block->ep_tag = bitset<15>(status.MPI_TAG >> 16).to_ulong();  //printf("myRank = %d, msg_block->ep_tag = %d\n", myRank, msg_block->ep_tag);
-        int src_loc       = bitset<8> (status.MPI_TAG >> 8) .to_ulong();  //printf("myRank = %d, src_loc = %d\n",           myRank, src_loc);
-        int dest_loc      = bitset<8> (status.MPI_TAG)	    .to_ulong();  //printf("myRank = %d, dest_loc = %d\n",          myRank, dest_loc);
-        int src_mpi       = status.MPI_SOURCE;                            //printf("myRank = %d, src_mpi = %d\n",           myRank, src_mpi);
+        MPI_Message *msg_block = new MPI_Message; 
+        msg_block->mpi_message = message;  
+        msg_block->ep_tag = bitset<15>(status.MPI_TAG >> 16).to_ulong(); 
+        int src_loc       = bitset<8> (status.MPI_TAG >> 8) .to_ulong(); 
+        int dest_loc      = bitset<8> (status.MPI_TAG)	    .to_ulong();
+        int src_mpi       = status.MPI_SOURCE;
              
-        msg_block->ep_src  = get_ep_rank(comm, src_loc,  src_mpi);        //printf("myRank = %d, msg_block->ep_src = %d\n",  myRank, msg_block->ep_src);
+        msg_block->ep_src  = get_ep_rank(comm, src_loc,  src_mpi);       
         int dest_mpi = comm.ep_comm_ptr->size_rank_info[2].first;
         int ep_dest = get_ep_rank(comm, dest_loc, dest_mpi);
-        //printf("myRank = %d, probed one message, ep_src = %d, ep_dest = %d, tag = %d, message = %d\n", myRank, msg_block->ep_src, ep_dest, msg_block->ep_tag, msg_block->mpi_message);
         msg_block->mpi_status = new ::MPI_Status(status);
 
@@ -93,15 +80,9 @@
           #pragma omp flush
           ptr_comm_target->ep_comm_ptr->message_queue->push_back(*msg_block);  
-          //printf("myRank = %d, push_back OK, ep_src = %d, ep_tag = %d, dest = %d(%d)\n", myRank, 
-          //                                                                                   ptr_comm_target->ep_comm_ptr->message_queue->back().ep_src,
-          //                                                                                   ptr_comm_target->ep_comm_ptr->message_queue->back().ep_tag,
-          //                                                                                   ep_dest, dest_loc);
     
           #pragma omp flush
         }
         
-        delete msg_block;
-        //printf("myRank = %d, delete msg_block, queue size = %lu\n", myRank, ptr_comm_target->ep_comm_ptr->message_queue->size());
-        
+        delete msg_block;        
       }
 
@@ -146,16 +127,5 @@
       #elif _intelmpi
       #pragma omp critical (_mpi_call)
-      {
-        ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &status);
-        if(flag)
-        {
-          Debug("find message in mpi comm \n");
-          mpi_source = status.MPI_SOURCE;
-          int tag = status.MPI_TAG;
-          ::MPI_Mprobe(mpi_source, tag, mpi_comm, &message, &status);
-
-        }
-      }
-      //::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);       
+      ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);       
       #endif
 
@@ -213,16 +183,5 @@
       #elif _intelmpi
       #pragma omp critical (_mpi_call)
-      {
-        ::MPI_Iprobe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &status);
-        if(flag)
-        {
-          Debug("find message in mpi comm \n");
-          mpi_source = status.MPI_SOURCE;
-          int tag = status.MPI_TAG;
-          ::MPI_Mprobe(mpi_source, tag, mpi_comm, &message, &status);
-
-        }
-      }
-      //::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);       
+      ::MPI_Improbe(MPI_ANY_SOURCE, MPI_ANY_TAG, mpi_comm, &flag, &message, &status);       
       #endif
 
@@ -251,5 +210,4 @@
           #pragma omp flush
           ptr_comm_target->ep_comm_ptr->message_queue->push_back(*msg_block);
-          //printf("probed one message, ep_src = %d, tag = %d, mpi_status = %p (%p), message = %d\n", msg_block->ep_src, msg_block->ep_tag, msg_block->mpi_status, &status, msg_block->mpi_message);
           #pragma omp flush
         }
@@ -286,5 +244,4 @@
         MPI_Imrecv((*it)->buf, recv_count, (*it)->ep_datatype, &message, *it);
         (*it)->type = 3;
-        //printf("request add = %p, mpi_request=%d\n", *it, (*it)->mpi_request);
         EP_PendingRequests->erase(it);
         it = EP_PendingRequests->begin();
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_probe.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_probe.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_probe.cpp	(revision 1220)
@@ -30,9 +30,4 @@
     #pragma omp flush
 
-    
-    //printf("iprobe, message queue size = %lu, queue = %p\n", comm.ep_comm_ptr->message_queue->size(), comm.ep_comm_ptr->message_queue);
-
-    #pragma omp flush
-
     #pragma omp critical (_query)
     if(!comm.ep_comm_ptr->message_queue->empty())
@@ -46,6 +41,4 @@
         {
           Debug("find message\n");
-          // printf("iprobe, find in local message queue %p, src = %d, tag = %d\n", comm.ep_comm_ptr->message_queue, it->ep_src, it->ep_tag);
-
           *flag = true;
 
@@ -131,5 +124,4 @@
           #pragma omp critical (_query2)
           {              
-            //printf("local message erased. src = %d, dest = %d, tag = %d\n", it->ep_src, it->ep_dest, it->ep_tag);     
             delete it->mpi_status;
             comm.ep_comm_ptr->message_queue->erase(it);
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_recv.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_recv.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_recv.cpp	(revision 1220)
@@ -88,5 +88,4 @@
     {
       EP_PendingRequests = new std::list< MPI_Request* >;
-      //printf("proc %d(%d) : EP_PendingRequests allocated, add = %p\n", dest_rank, world_rank, EP_PendingRequests);  
     }
 
@@ -95,41 +94,5 @@
 
     Request_Check();
-    //printf("proc %d(%d) : EP_PendingRequests insert one request, src = %d(%d), tag = %d(%d), size = %d; request add = %p\n", 
-    //        dest_rank, world_rank, EP_PendingRequests->back()->ep_src, request->ep_src, 
-    //        EP_PendingRequests->back()->ep_tag, request->ep_tag, 
-    //        EP_PendingRequests->size(), request);
-    
-    // check all EP_PendingRequests      
-    //for(std::list<MPI_Request* >::iterator it = EP_PendingRequests->begin(); it!=EP_PendingRequests->end(); )
-    //{
-    //if((*it)->type == 3) 
-    //{
-    //    EP_PendingRequests->erase(it);
-   //     it = EP_PendingRequests->begin();
-    //    continue;
-     // }
-        
-      //int probed = false;
-      //MPI_Message pending_message;
-      //MPI_Status pending_status;
-    
-      //MPI_Improbe((*it)->ep_src, (*it)->ep_tag, (*it)->comm, &probed, &pending_message, &pending_status);
-    
-      //if(probed) 
-      //{ 
-        //int count;
-        //MPI_Get_count(&pending_status, (*it)->ep_datatype, &count);
-        //MPI_Imrecv((*it)->buf, count, (*it)->ep_datatype, &pending_message, *it);
 
-        //EP_PendingRequests->erase(it);
-        //if(EP_PendingRequests->empty()) return 0;
-        
-        //it = EP_PendingRequests->begin();
-        //continue;
-     // }
-
-      //it++;
-   // }
-    
     return 0;
   }
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_test.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_test.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_test.cpp	(revision 1220)
@@ -41,18 +41,8 @@
     if(request->type == 2)   // irecv message not probed
     {
-      Message_Check(request->comm);
+      Request_Check();
+      
       #pragma omp flush
-      MPI_Message message;
-      MPI_Improbe(request->ep_src, request->ep_tag, request->comm, flag, &message, status);
-      if(*flag)
-      {
-        
-        int count;
-        MPI_Get_count(status, request->ep_datatype, &count);
-        MPI_Imrecv(request->buf, count, request->ep_datatype, &message, request);
-        printf("in ep_test, found message src = %d, tag = %d, type = %d\n", request->ep_src, request->ep_tag, request->type);
-        MPI_Test(request, flag, status);
-      }
-      return 0;
+      
     }
 
@@ -62,15 +52,6 @@
       ::MPI_Status mpi_status;
       
-      ::MPI_Errhandler_set(MPI_COMM_WORLD_STD, MPI_ERRORS_RETURN);
-      int error_code = ::MPI_Test(mpi_request, flag, &mpi_status);
-      if (error_code != MPI_SUCCESS) {
+      ::MPI_Test(mpi_request, flag, &mpi_status);
       
-         char error_string[BUFSIZ];
-         int length_of_error_string, error_class;
-      
-         ::MPI_Error_class(error_code, &error_class);
-         ::MPI_Error_string(error_class, error_string, &length_of_error_string);
-         printf("%s\n", error_string);
-      }
       
       if(*flag)
@@ -83,11 +64,5 @@
         //MPI_Get_count(status, request->ep_datatype, &count);
         //check_sum_recv(request->buf, count, request->ep_datatype, request->ep_src, request->ep_tag, request->comm, 2);
-      }
-
-      status->ep_src = request->ep_src;
-      status->ep_tag = request->ep_tag;
-      status->ep_datatype = request->ep_datatype;
-
-      
+      }  
 
       return 0;
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_type.hpp	(revision 1220)
@@ -174,19 +174,4 @@
     }
 
-    // ep_intercomm(ep_intercomm &ref)
-    // {
-    //   printf("calling copy Constructor of ep_intercomm\n");
-    //   ep_intercomm return_intercomm;
-
-    //   return_intercomm.mpi_inter_comm = ref.mpi_inter_comm;
-    //   return_intercomm.intercomm_rank_map = ref.intercomm_rank_map;
-    //   return_intercomm.local_rank_map = ref.local_rank_map;
-    //   return_intercomm.remote_rank_map = ref.remote_rank_map;
-    //   return_intercomm.size_rank_info[0] = ref.size_rank_info[0];
-    //   return_intercomm.size_rank_info[1] = ref.size_rank_info[1];
-    //   return_intercomm.size_rank_info[2] = ref.size_rank_info[2];
-    //   return_intercomm.local_comm = ref.local_comm;
-    //   return_intercomm.intercomm_tag = ref.intercomm_tag;
-    // }
 
     bool operator == (ep_intercomm right)
@@ -212,19 +197,5 @@
     }
 
-    // ep_intercomm operator = (ep_intercomm ref)
-    // {
-    //   printf("calling = operator of ep_intercomm\n");
-    //   ep_intercomm return_intercomm;
-
-    //   return_intercomm.mpi_inter_comm = ref.mpi_inter_comm;
-    //   return_intercomm.intercomm_rank_map = ref.intercomm_rank_map;
-    //   return_intercomm.local_rank_map = ref.local_rank_map;
-    //   return_intercomm.remote_rank_map = ref.remote_rank_map;
-    //   return_intercomm.size_rank_info[0] = ref.size_rank_info[0];
-    //   return_intercomm.size_rank_info[1] = ref.size_rank_info[1];
-    //   return_intercomm.size_rank_info[2] = ref.size_rank_info[2];
-    //   return_intercomm.local_comm = ref.local_comm;
-    //   return_intercomm.intercomm_tag = ref.intercomm_tag;
-    // }
+
   };
 
@@ -271,17 +242,4 @@
     }
 
-    // ep_communicator operator = (ep_communicator ref)
-    // {
-    //   printf("calling = operator of ep_communicator\n");
-    //   ep_communicator return_ep;
-
-    //   return_ep.intercomm = ref.intercomm;
-    //   return_ep.comm_label = ref.comm_label;
-    //   return_ep.message_queue = ref.message_queue;
-    //   return_ep.comm_list = ref.comm_list;
-    //   return_ep.size_rank_info[0] = ref.size_rank_info[0];
-    //   return_ep.size_rank_info[1] = ref.size_rank_info[1];
-    //   return_ep.size_rank_info[2] = ref.size_rank_info[2];
-    // }
   };
 
@@ -387,17 +345,4 @@
     }
 
-    // MPI_Comm operator = (MPI_Comm ref)
-    // {
-    //   printf("calling = operator of MPI_Comm\n");
-    //   MPI_Comm return_comm;
-
-    //   return_comm.mpi_comm = ref.mpi_comm;
-    //   return_comm.is_ep = ref.is_ep;
-    //   return_comm.is_intercomm = ref.is_intercomm;
-    //   return_comm.my_buffer = ref.my_buffer;
-    //   return_comm.ep_barrier = ref.ep_barrier;
-    //   return_comm.rank_map = ref.rank_map;
-    //   return_comm.ep_comm_ptr = ref.ep_comm_ptr;
-    // }
   };
 
@@ -502,5 +447,4 @@
             //    <MPI_Fint,thread_num>   EP_Comm
 
-  //static std::list<MPI_Request * > *EP_PendingRequests = 0; 
 }
 
Index: XIOS/dev/branch_openmp/extern/src_ep_dev/ep_wait.cpp
===================================================================
--- XIOS/dev/branch_openmp/extern/src_ep_dev/ep_wait.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/extern/src_ep_dev/ep_wait.cpp	(revision 1220)
@@ -59,6 +59,4 @@
     ::MPI_Status* mpi_status = new ::MPI_Status[count];
 
-    //if(EP_PendingRequests != 0) printf("pending size = %d, add = %p\n", EP_PendingRequests->size(), EP_PendingRequests);
-
     while(std::accumulate(finished.begin(), finished.end(), 0) < count)
     {
Index: XIOS/dev/branch_openmp/inputs/REMAP/iodef.xml
===================================================================
--- XIOS/dev/branch_openmp/inputs/REMAP/iodef.xml	(revision 1218)
+++ XIOS/dev/branch_openmp/inputs/REMAP/iodef.xml	(revision 1220)
@@ -36,14 +36,14 @@
       
       <file_group id="read_then_write_files" enabled=".TRUE.">
-       <file id="output_regular_pole" name="output_dst_regular" enabled=".FALSE."  >
-          <field field_ref="tmp_field_0" name="field_regular_0" enabled=".FALSE."/>
-          <field field_ref="dst_field_regular" name="field_regular" enabled=".FALSE."/>
+       <file id="output_regular_pole" name="output_dst_regular" enabled=".TRUE."  >
+          <field field_ref="tmp_field_0" name="field_regular_0" enabled=".TRUE."/>
+          <field field_ref="dst_field_regular" name="field_regular" enabled=".TRUE."/>
           <field field_ref="dst_field_regular_pole_0" name="field_regular_pole_0" enabled=".FALSE." />
           <field field_ref="dst_field_regular_pole_1" name="field_regular_pole_1" enabled=".FALSE." />
        </file>
-       <file id="output_dst_curvilinear" name="output_dst_curvilinear" enabled=".FALSE." >
+       <file id="output_dst_curvilinear" name="output_dst_curvilinear" enabled=".TRUE." >
           <field field_ref="tmp_field_1" operation="instant"/>
        </file>
-       <file id="output_dst_unstructured" name="output_dst_unstructured" enabled=".FALSE." >
+       <file id="output_dst_unstructured" name="output_dst_unstructured" enabled=".TRUE." >
           <field field_ref="tmp_field_2" operation="instant"/>
        </file>
@@ -52,24 +52,24 @@
       <file_group id="write_files" >
         <file id="output_2D" name="output_2D" enabled=".TRUE.">
-          <field field_ref="src_field_2D" name="field_src" enabled=".FALSE."/>
-          <field field_ref="src_field_2D_clone" name="field_src_clone" default_value="100000" enabled=".FALSE."/>
-          <field field_ref="src_field_2D" name="field_dst_regular_0"  domain_ref="dst_domain_regular_pole" enabled=".FALSE."/>
+          <field field_ref="src_field_2D" name="field_src" enabled=".TRUE."/>
+          <field field_ref="src_field_2D_clone" name="field_src_clone" default_value="100000" enabled=".TRUE."/>
+          <field field_ref="src_field_2D" name="field_dst_regular_0"  domain_ref="dst_domain_regular_pole" enabled=".TRUE."/>
           <field field_ref="dst_field_2D" name="field_dst_regular_1" enabled=".TRUE." />
-          <field field_ref="dst_field_2D_regular_pole" name="field_dst_regular_2" enabled=".FALSE."/>
-          <field field_ref="dst_field_2D_clone" name="field_dst_regular_3" detect_missing_value=".false." default_value="100000" enabled=".FALSE."/>
-          <field field_ref="dst_field_2D_extract" name="field_dst_regular_4" enabled=".FALSE."/>
+          <field field_ref="dst_field_2D_regular_pole" name="field_dst_regular_2" enabled=".TRUE."/>
+          <field field_ref="dst_field_2D_clone" name="field_dst_regular_3" detect_missing_value=".false." default_value="100000" enabled=".TRUE."/>
+          <field field_ref="dst_field_2D_extract" name="field_dst_regular_4" enabled=".TRUE."/>
         </file> 
-       <file id="output_3D" name="output_3D" enabled=".FALSE.">
+       <file id="output_3D" name="output_3D" enabled=".TRUE.">
           <field field_ref="src_field_3D" name="field_src" />
           <field field_ref="src_field_3D_pression" name="field" />
           <field field_ref="dst_field_3D_interp" name="field_dst_interp_domain" />
-          <field field_ref="dst_field_3D_interp" name="field_dst_interp_domain_axis" domain_ref="dst_domain_regular_pole" enabled=".FALSE."/>  
-       </file>
-       <file id="output_4D" name="output_4D" enabled=".FALSE.">
+          <field field_ref="dst_field_3D_interp" name="field_dst_interp_domain_axis" domain_ref="dst_domain_regular_pole" enabled=".TRUE."/>  
+       </file>
+       <file id="output_4D" name="output_4D" enabled=".TRUE.">
           <field field_ref="src_field_4D" name="field_4D" />
-          <field field_ref="dst_field_4D_extract" name="field_4D_extract" enabled=".FALSE."/>
+          <field field_ref="dst_field_4D_extract" name="field_4D_extract" enabled=".TRUE."/>
         </file>
      </file_group>
-     <file_group id="read_files" enabled=".FALSE." >
+     <file_group id="read_files" enabled=".TRUE." >
        <file id="output_src_regular" name="output_src_regular" mode="read" >
           <field id="src_field_regular" name="field" grid_ref="src_grid_regular_read" operation="instant"/>
@@ -212,3 +212,2 @@
 
 </simulation>
-
Index: XIOS/dev/branch_openmp/inputs/Unstruct/iodef.xml
===================================================================
--- XIOS/dev/branch_openmp/inputs/Unstruct/iodef.xml	(revision 1218)
+++ XIOS/dev/branch_openmp/inputs/Unstruct/iodef.xml	(revision 1220)
@@ -53,5 +53,5 @@
        <generate_rectilinear_domain id="domain_regular_pole3"/>
        <interpolate_domain write_weight="false" order="1" renormalize="true"/>       
-       <zoom_domain ibegin="0" ni="70" jbegin="0" nj="70" /> 
+       <zoom_domain ibegin="0" ni="40" jbegin="0" nj="40" /> 
      </domain>
 
Index: XIOS/dev/branch_openmp/src/client_server_mapping.cpp
===================================================================
--- XIOS/dev/branch_openmp/src/client_server_mapping.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/src/client_server_mapping.cpp	(revision 1220)
@@ -64,4 +64,8 @@
   MPI_Allgather(&nbConnectedServer,1,MPI_INT,recvCount,1,MPI_INT,clientIntraComm) ;
 
+  
+  for(int i=0; i<nbClient; i++)
+    printf("MPI_Allgather : recvCount[%d] = %d\n", i, recvCount[i]);
+
   displ[0]=0 ;
   for(int n=1;n<nbClient;n++) displ[n]=displ[n-1]+recvCount[n-1] ;
@@ -71,4 +75,9 @@
 
   MPI_Allgatherv(sendBuff,nbConnectedServer,MPI_INT,recvBuff,recvCount,displ,MPI_INT,clientIntraComm) ;
+
+  for(int i=0; i<recvSize; i++)
+    printf("MPI_Allgatherv : recvBuff[%d] = %d\n", i, recvBuff[i]);
+
+
   for(int n=0;n<recvSize;n++) clientRes[recvBuff[n]]++ ;
 
Index: XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.cpp
===================================================================
--- XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.cpp	(revision 1218)
+++ XIOS/dev/branch_openmp/src/filter/spatial_transform_filter.cpp	(revision 1220)
@@ -53,4 +53,5 @@
     CSpatialTransformFilterEngine* spaceFilter = static_cast<CSpatialTransformFilterEngine*>(engine);
     CDataPacketPtr outputPacket = spaceFilter->applyFilter(data, outputDefaultValue);
+    printf("spalceFilter applied\n");
     if (outputPacket)
       onOutputReady(outputPacket);
@@ -122,5 +123,7 @@
     double defaultValue = std::numeric_limits<double>::quiet_NaN();
     if (0 != dataDest.numElements()) ignoreMissingValue = NumTraits<double>::isnan(dataDest(0));
-
+    
+    const std::list<CGridTransformation::SendingIndexGridSourceMap> *listLocalIndexSend_ptr = & (gridTransformation->getLocalIndexToSendFromGridSource());
+    
     const std::list<CGridTransformation::SendingIndexGridSourceMap>& listLocalIndexSend = gridTransformation->getLocalIndexToSendFromGridSource();
     const std::list<CGridTransformation::RecvIndexGridDestinationMap>& listLocalIndexToReceive = gridTransformation->getLocalIndexToReceiveOnGridDest();
@@ -131,6 +134,6 @@
     CArray<double,1> dataCurrentDest(dataSrc.copy());
 
-    std::list<CGridTransformation::SendingIndexGridSourceMap>::const_iterator itListSend  = listLocalIndexSend.begin(),
-                                                                              iteListSend = listLocalIndexSend.end();
+    std::list<CGridTransformation::SendingIndexGridSourceMap>::const_iterator itListSend  = listLocalIndexSend_ptr->begin(),
+                                                                              iteListSend = listLocalIndexSend_ptr->end();
     std::list<CGridTransformation::RecvIndexGridDestinationMap>::const_iterator itListRecv = listLocalIndexToReceive.begin();
     std::list<size_t>::const_iterator itNbListRecv = listNbLocalIndexToReceive.begin();
@@ -186,5 +189,4 @@
         int srcRank = itRecv->first;
         int countSize = itRecv->second.size();
-        
         MPI_Irecv(recvBuff + currentBuff, countSize, MPI_DOUBLE, srcRank, 12, client->intraComm, &sendRecvRequest[position]);
         position++;
Index: XIOS/dev/branch_openmp/src/test/test_remap_omp.f90
===================================================================
--- XIOS/dev/branch_openmp/src/test/test_remap_omp.f90	(revision 1218)
+++ XIOS/dev/branch_openmp/src/test/test_remap_omp.f90	(revision 1220)
@@ -222,17 +222,17 @@
   CALL xios_close_context_definition()
 
-!  CALL xios_get_domain_attr("src_domain_regular_read", ni=src_tmp_ni, nj=src_tmp_nj)
-!  ALLOCATE(tmp_field_0(src_tmp_ni*src_tmp_nj))
-
-!  CALL xios_get_axis_attr("src_axis_curvilinear_read", n=src_tmp_n)
-!  CALL xios_get_domain_attr("src_domain_curvilinear_read", ni=src_tmp_ni, nj=src_tmp_nj)
-!  ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n))
-
-!  CALL xios_get_domain_attr("src_domain_unstructured_read", ni=src_tmp_ni, nj=src_tmp_nj)
-!  ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj))
-  
-!  CALL xios_recv_field("src_field_regular", tmp_field_0)
-!  CALL xios_recv_field("src_field_curvilinear", tmp_field_1)
-!  CALL xios_recv_field("src_field_unstructured", tmp_field_2)
+  CALL xios_get_domain_attr("src_domain_regular_read", ni=src_tmp_ni, nj=src_tmp_nj)
+  ALLOCATE(tmp_field_0(src_tmp_ni*src_tmp_nj))
+
+  CALL xios_get_axis_attr("src_axis_curvilinear_read", n=src_tmp_n)
+  CALL xios_get_domain_attr("src_domain_curvilinear_read", ni=src_tmp_ni, nj=src_tmp_nj)
+  ALLOCATE(tmp_field_1(src_tmp_ni*src_tmp_nj*src_tmp_n))
+
+  CALL xios_get_domain_attr("src_domain_unstructured_read", ni=src_tmp_ni, nj=src_tmp_nj)
+  ALLOCATE(tmp_field_2(src_tmp_ni*src_tmp_nj))
+  
+  CALL xios_recv_field("src_field_regular", tmp_field_0)
+  CALL xios_recv_field("src_field_curvilinear", tmp_field_1)
+  CALL xios_recv_field("src_field_unstructured", tmp_field_2)
 
   DO ts=1,10
@@ -252,7 +252,7 @@
     CALL xios_send_field("src_field_4D",src_field_4D)
     CALL xios_send_field("src_field_3D_pression",src_field_pression)
- !   CALL xios_send_field("tmp_field_0",tmp_field_0)
- !   CALL xios_send_field("tmp_field_1",tmp_field_1)
- !   CALL xios_send_field("tmp_field_2",tmp_field_2)
+    CALL xios_send_field("tmp_field_0",tmp_field_0)
+    CALL xios_send_field("tmp_field_1",tmp_field_1)
+    CALL xios_send_field("tmp_field_2",tmp_field_2)
     CALL wait_us(5000) ;
    ENDDO
@@ -262,5 +262,5 @@
   DEALLOCATE(src_lon, src_lat, src_boundslon,src_boundslat, src_field_2D)
   DEALLOCATE(dst_lon, dst_lat, dst_boundslon,dst_boundslat)
-  !DEALLOCATE(tmp_field_0, tmp_field_1, tmp_field_2)
+  DEALLOCATE(tmp_field_0, tmp_field_1, tmp_field_2)
   
   CALL xios_finalize()
@@ -293,3 +293,2 @@
 
 
-
