Index: XIOS/dev/branch_yushan_merged/extern/remap/src/clipper.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/clipper.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/clipper.cpp	(revision 1205)
@@ -1047,5 +1047,5 @@
 
   //create a new edge array ...
-  TEdge *edges = new TEdge[highI+1];
+  TEdge *edges = new TEdge [highI +1];
 
   bool IsFlat = true;
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/gridRemap.hpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/gridRemap.hpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/gridRemap.hpp	(revision 1205)
@@ -14,5 +14,6 @@
 Coord readPole(std::istream&);
 
-
+extern CRemapGrid srcGrid;
+extern CRemapGrid tgtGrid;
 
 }
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/intersect.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/intersect.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/intersect.cpp	(revision 1205)
@@ -17,10 +17,4 @@
 using namespace std;
 
-extern CRemapGrid srcGrid;
-#pragma omp threadprivate(srcGrid)
-
-extern CRemapGrid tgtGrid;
-#pragma omp threadprivate(tgtGrid)
-
 /** returns index of edge of a that is shared with b,
     or NOT_FOUND if a and b do not share an edge */
@@ -62,21 +56,7 @@
     for (int j = 0; j < b.n; j++)
     {
-      // share a full edge ? be carefull at the orientation
-      
-      //if(squaredist(a.vertex[i], b.vertex[j]) > 1e-10*1e-10 ||
-      //   squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10 )
-      //{      
-        //printf("A : squaredist(a.vertex[%d], b.vertex[%d]) = %.10e  %d\n", 
-        //        i, j, squaredist(a.vertex[i], b.vertex[j]), 
-        //        squaredist(a.vertex[i], b.vertex[j]) > 1e-10*1e-10 ? true : false);
-        //printf("B : squaredist(a.vertex[%d], b.vertex[%d]) = %.10e  %d\n", 
-        //        (i+1)%a.n, (j+1)%b.n, squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]),
-        //        squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10 ? true : false);
-
-        assert(squaredist(a.vertex[ i       ], b.vertex[ j       ]) > 1e-10*1e-10 ||
-               squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10);
-        
-      //}
-
+// share a full edge ? be carefull at the orientation
+      assert(squaredist(a.vertex[ i       ], b.vertex[ j       ]) > 1e-10*1e-10 ||
+             squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+1)%b.n]) > 1e-10*1e-10);
       if (   squaredist(a.vertex[ i       ], b.vertex[ j           ]) < 1e-10*1e-10 &&
              squaredist(a.vertex[(i+1)%a.n], b.vertex[(j+b.n-1)%b.n]) < 1e-10*1e-10)
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/intersection_ym.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/intersection_ym.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/intersection_ym.cpp	(revision 1205)
@@ -16,10 +16,4 @@
 using namespace std;
 using namespace ClipperLib ;
-
-extern CRemapGrid srcGrid;
-#pragma omp threadprivate(srcGrid)
-
-extern CRemapGrid tgtGrid;
-#pragma omp threadprivate(tgtGrid)
 
 double intersect_ym(Elt *a, Elt *b)
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/libmapper.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/libmapper.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/libmapper.cpp	(revision 1205)
@@ -14,16 +14,7 @@
 #include "mapper.hpp"
 #include "cputime.hpp" // cputime
-#include "gridRemap.hpp"
-
 #include <stdio.h>
 
 using namespace sphereRemap ;
-
-//extern CRemapGrid srcGrid;
-//#pragma omp threadprivate(srcGrid)
-
-//extern CRemapGrid tgtGrid;
-//#pragma omp threadprivate(tgtGrid)
-
 
 /* mapper is a ponter to a global class instance whoes members are allocated in the first step (finding the sizes of the weight arrays)
@@ -42,5 +33,4 @@
                      int order, int* n_weights)
 {
-  printf("libmapper callded : remap_get_num_weights\n");
   assert(src_bounds_lon);
   assert(src_bounds_lat);
@@ -125,5 +115,4 @@
                      double* centre_lon, double* centre_lat, double* areas)
 {
-  printf("libmapper callded : remap_get_barycentres_and_areas\n");
 	for (int i = 0; i < n_cell; i++)
 	{
@@ -149,5 +138,4 @@
 extern "C" void remap_get_weights(double* weights, int* src_indices, int* dst_indices)
 {
-  printf("libmapper callded : remap_get_weights\n");
 	memcpy(weights, mapper->remapMatrix, mapper->nWeights*sizeof(double));
 	memcpy(src_indices, mapper->srcAddress, mapper->nWeights*sizeof(int));
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/mapper.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/mapper.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/mapper.cpp	(revision 1205)
@@ -15,10 +15,4 @@
 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
    can be represented by the length of the N arrays
@@ -275,8 +269,7 @@
 
     MPI_Status *status = new MPI_Status[4*mpiSize];
-    
+
+    MPI_Waitall(nbSendRequest, sendRequest, status);
     MPI_Waitall(nbRecvRequest, recvRequest, status);
-    MPI_Waitall(nbSendRequest, sendRequest, status);
-    
 
     /* for all indices that have been received from requesting ranks: pack values and gradients, then send */
@@ -629,5 +622,5 @@
     MPI_Waitall(nbRecvRequest, recvRequest, status);
     MPI_Waitall(nbSendRequest, sendRequest, status);
- 
+
     int nbNeighbourNodes = 0;
     for (int rank = 0; rank < mpiSize; rank++)
@@ -699,11 +692,4 @@
         }
 
-        /*
-           for (int i = 0; i < elt->n; i++)
-           {
-           if (elt->neighbour[i] == NOT_FOUND)
-           error_exit("neighbour not found");
-           }
-           */
     }
 }
@@ -810,9 +796,8 @@
         }
     }
- 
+
     MPI_Waitall(nbRecvRequest, recvRequest, status);
     MPI_Waitall(nbSendRequest, sendRequest, status);
-    
-    
+
     char **sendBuffer2 = new char*[mpiSize];
     char **recvBuffer2 = new char*[mpiSize];
@@ -838,8 +823,7 @@
                     Elt *elt2 = (Elt *) ((*it)->data);
                     /* recvElt is target, elt2 is source */
-                    //					intersect(&recvElt[j], elt2);
-                    intersect_ym(&recvElt[j], elt2);
+                    intersect(&recvElt[j], elt2);
+                    //intersect_ym(&recvElt[j], elt2);
                 }
-
                 if (recvElt[j].is.size() > 0) sentMessageSize[rank] += packIntersectionSize(recvElt[j]);
 
@@ -860,5 +844,4 @@
             }
             delete [] recvElt;
-
         }
     }
@@ -898,6 +881,4 @@
     MPI_Waitall(nbRecvRequest, recvRequest, status);
     MPI_Waitall(nbSendRequest, sendRequest, status);
-   
-   
 
     delete [] sendRequest;
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/node.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/node.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/node.cpp	(revision 1205)
@@ -472,10 +472,5 @@
 	q->child.resize(MAX_NODE_SZ/2 + 1);
 	assert(thIs->child.size() == MAX_NODE_SZ+1);
-        if(thIs->closest(thIs->child, FARTHEST) == 0) 
-          thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre
-          
-        thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre
-        
-          
+	thIs->tree->ref = thIs->closest(thIs->child, FARTHEST); // farthest from centre
 	std::sort(thIs->child.begin(), thIs->child.end(), compareDist);
 	for (int i = 0; i < MAX_NODE_SZ+1; i++)
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/parallel_tree.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/parallel_tree.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/parallel_tree.cpp	(revision 1205)
@@ -16,10 +16,4 @@
 
 static const int assignLevel = 2;
-
-extern CRemapGrid srcGrid;
-#pragma omp threadprivate(srcGrid)
-
-extern CRemapGrid tgtGrid;
-#pragma omp threadprivate(tgtGrid)
 
 // only the circle is packed, rest of node will be initialized on unpacking
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/polyg.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/polyg.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/polyg.cpp	(revision 1205)
@@ -3,5 +3,4 @@
 #include <cassert>
 #include <iostream>
-#include <stdio.h>
 #include "elt.hpp"
 #include "errhandle.hpp"
@@ -175,13 +174,5 @@
 		t[2] = x[ii];
                 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)
-                if(sc < -1e-10)
-                {
-                  printf("N=%d, sc = %f, t[0]=(%f,%f,%f), t[1]=(%f,%f,%f), t[2]=(%f,%f,%f)\n", N, sc,
-                                                                                         t[0].x, t[0].y, t[0].z, 
-                                                                                         t[1].x, t[1].y, t[1].z,
-                                                                                         t[2].x, t[2].y, t[2].z);
-                  assert(sc >= -1e-10);
-                }
+		assert(sc >= -1e-10); // Error: tri a l'env (wrong orientation)
 		double area_gc = triarea(t[0], t[1], t[2]);
 		double area_sc_gc_moon = 0;
Index: XIOS/dev/branch_yushan_merged/extern/remap/src/triple.cpp
===================================================================
--- XIOS/dev/branch_yushan_merged/extern/remap/src/triple.cpp	(revision 1203)
+++ XIOS/dev/branch_yushan_merged/extern/remap/src/triple.cpp	(revision 1205)
@@ -3,5 +3,5 @@
 namespace sphereRemap {
 
-const Coord ORIGIN(0.0, 0.0, 0.0);
+extern const Coord ORIGIN(0.0, 0.0, 0.0);
 
 std::ostream& operator<<(std::ostream& os, const Coord& c) {
