Salome HOME
Fix: getCellsContainingPoints() in case of polyhedron with a face containing colinear...
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingRemapperTest.py
index 5ff24cd86d147141fe78149e47ae5405309e19f5..241058fc8459302c553cfb2ae2c7da5d3a8056d0 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+# Copyright (C) 2007-2024  CEA, EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -30,13 +30,13 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         remapper=MEDCouplingRemapper()
         remapper.setPrecision(1e-12);
         remapper.setIntersectionType(Triangulation);
-        self.failUnless(remapper.prepare(sourceMesh,targetMesh,"P0P0")==1);
+        self.assertTrue(remapper.prepare(sourceMesh,targetMesh,"P0P0")==1);
         srcField=MEDCouplingFieldDouble.New(ON_CELLS);
         srcField.setNature(IntensiveMaximum);
         srcField.setMesh(sourceMesh);
         array=DataArrayDouble.New();
         ptr=sourceMesh.getNumberOfCells()*[None]
-        for i in xrange(sourceMesh.getNumberOfCells()):
+        for i in range(sourceMesh.getNumberOfCells()):
             ptr[i]=float(i+7)
             pass
         array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
@@ -52,10 +52,10 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(c,10)
         values=trgfield.getArray().getValues();
         valuesExpected=[7.5 ,7. ,7.,8.,7.5];
-        for i in xrange(targetMesh.getNumberOfCells()):
-            self.failUnless(abs(values[i]-valuesExpected[i])<1e-12);
+        for i in range(targetMesh.getNumberOfCells()):
+            self.assertTrue(abs(values[i]-valuesExpected[i])<1e-12);
             pass
-        self.failUnless(1==trgfield.getArray().getNumberOfComponents());
+        self.assertTrue(1==trgfield.getArray().getNumberOfComponents());
         pass
 
     def testPrepareEx1(self):
@@ -75,7 +75,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         srcField.setMesh(sourceMesh);
         array=DataArrayDouble.New();
         ptr=sourceMesh.getNumberOfCells()*[None]
-        for i in xrange(sourceMesh.getNumberOfCells()):
+        for i in range(sourceMesh.getNumberOfCells()):
             ptr[i]=float(i+7);
             pass
         array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
@@ -85,7 +85,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         valuesExpected=[7.75, 7.0625, 4.220173,8.0]
         self.assertEqual(4,trgfield.getArray().getNumberOfTuples());
         self.assertEqual(1,trgfield.getArray().getNumberOfComponents());
-        for i0 in xrange(4):
+        for i0 in range(4):
             self.assertAlmostEqual(valuesExpected[i0],values[i0],12);
             pass
         pass
@@ -107,7 +107,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         srcField.setMesh(sourceMesh);
         array=DataArrayDouble.New();
         ptr=sourceMesh.getNumberOfCells()*[None]
-        for i in xrange(sourceMesh.getNumberOfCells()):
+        for i in range(sourceMesh.getNumberOfCells()):
             ptr[i]=float(i+7);
             pass
         array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
@@ -117,7 +117,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         trgfield.setMesh(targetMesh);
         array=DataArrayDouble.New();
         ptr=targetMesh.getNumberOfCells()*[None]
-        for i in xrange(targetMesh.getNumberOfCells()):
+        for i in range(targetMesh.getNumberOfCells()):
             ptr[i]=4.220173;
             pass
         array.setValues(ptr,targetMesh.getNumberOfCells(),1);
@@ -127,7 +127,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         valuesExpected=[7.75, 7.0625, 4.220173,8.0]
         self.assertEqual(4,trgfield.getArray().getNumberOfTuples());
         self.assertEqual(1,trgfield.getArray().getNumberOfComponents());
-        for i0 in xrange(4):
+        for i0 in range(4):
             self.assertAlmostEqual(valuesExpected[i0],values[i0],12);
             pass
         pass
@@ -308,7 +308,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         rem2=MEDCouplingRemapper() ; rem2.setSplittingPolicy(PLANAR_FACE_5) ; rem2.prepare(src1,trg,"P0P0")
         mat1=rem1.getCrudeMatrix() ; mat2=rem2.getCrudeMatrix()
         self.assertEqual(1,len(mat1)) ; self.assertEqual(1,len(mat2))
-        self.assertEqual(mat1[0].keys(),mat2[0].keys()) ; self.assertEqual([0,1],mat1[0].keys())
+        self.assertEqual(list(mat1[0].keys()),list(mat2[0].keys())) ; self.assertEqual([0,1],list(mat1[0].keys()))
         self.assertAlmostEqual(1.25884108122e-06,mat1[0][0],16) ; self.assertAlmostEqual(1.25884108122e-06,mat2[0][0],16)
         self.assertAlmostEqual(1.25884086663e-06,mat1[0][1],16) ; self.assertAlmostEqual(1.25884086663e-06,mat2[0][1],16)
         #
@@ -570,7 +570,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(aRemapper.prepare(s,t,'P1P1'),1)
         m=aRemapper.getCrudeMatrix()
         self.assertEqual(len(m),28)
-        for i in xrange(28):
+        for i in range(28):
             if i not in [5,6]:
                 self.assertEqual(len(m[i]),0)
                 pass
@@ -727,7 +727,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         rem=MEDCouplingRemapper()
         rem.prepare(src,trg,"P0P0")
         # Internal crude sparse matrix computed. Let's manipulate it using CSR matrix in scipy.
-        for i in xrange(10):
+        for i in range(10):
             m=rem.getCrudeCSRMatrix()
             pass
         m2=rem.getCrudeCSRMatrix()
@@ -776,7 +776,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         a.allocateCells()
         conna=[0,1,3,2,1,4,5,3,4,6,7,5,6,8,9,7,8,10,11,9,10,12,13,11,12,14,15,13,14,16,17,15,16,18,19,17,18,20,21,19,20,22,23,21,22,24,25,23,24,26,27,25]
         a.setCoords(DataArrayDouble([1.54,0,-0.01,1.54,0.02,-0.01,1.54,0,0.01,1.54,0.02,0.01,1.54,0.04,-0.01,1.54,0.04,0.01,1.54,0.06,-0.01,1.54,0.06,0.01,1.54,0.08,-0.01,1.54,0.08,0.01,1.54,0.1,-0.01,1.54,0.1,0.01,1.54,0.12,-0.01,1.54,0.12,0.01,1.54,0.14,-0.01,1.54,0.14,0.01,1.54,0.16,-0.01,1.54,0.16,0.01,1.54,0.18,-0.01,1.54,0.18,0.01,1.54,0.2,-0.01,1.54,0.2,0.01,1.54,0.22,-0.01,1.54,0.22,0.01,1.54,0.24,-0.01,1.54,0.24,0.01,1.54,0.26,-0.01,1.54,0.26,0.01],28,3))
-        for i in xrange(13):
+        for i in range(13):
             a.insertNextCell(NORM_QUAD4,conna[4*i:4*(i+1)])
             pass
         a.finishInsertingCells() ; a.simplexize(0)
@@ -784,7 +784,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         connb=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,0,2,39,3,5,40,6,8,41,9,11,42,12,14,43,15,17,44,18,20,45,21,23,46,24,26,47,27,29,48,30,32,49,33,35,50,36,38,51,52,2,39,53,5,40,54,8,41,55,11,42,56,14,43,57,17,44,58,20,45,59,23,46,60,26,47,61,29,48,62,32,49,63,35,50,64,38,51,52,2,65,53,5,66,54,8,67,55,11,68,56,14,69,57,17,70,58,20,71,59,23,72,60,26,73,61,29,74,62,32,75,63,35,76,64,38,77,53,2,65,54,5,66,55,8,67,56,11,68,57,14,69,58,17,70,59,20,71,60,23,72,61,26,73,62,29,74,63,32,75,64,35,76,78,38,77,53,2,40,54,5,41,55,8,42,56,11,43,57,14,44,58,17,45,59,20,46,60,23,47,61,26,48,62,29,49,63,32,50,64,35,51,78,38,79,3,2,40,6,5,41,9,8,42,12,11,43,15,14,44,18,17,45,21,20,46,24,23,47,27,26,48,30,29,49,33,32,50,36,35,51,80,38,79,3,2,1,6,5,4,9,8,7,12,11,10,15,14,13,18,17,16,21,20,19,24,23,22,27,26,25,30,29,28,33,32,31,36,35,34,80,38,37]
         b=MEDCouplingUMesh("b",2)
         b.allocateCells()
-        for i in xrange(104):
+        for i in range(104):
             b.insertNextCell(NORM_TRI3,connb[3*i:3*(i+1)])
             pass
         b.setCoords(DataArrayDouble([1.54,0,-0.01,1.54,0.01,-0.01,1.54,0.01,0,1.54,0.02,-0.01,1.54,0.03,-0.01,1.54,0.03,0,1.54,0.04,-0.01,1.54,0.05,-0.01,1.54,0.05,0,1.54,0.06,-0.01,1.54,0.07,-0.01,1.54,0.07,0,1.54,0.08,-0.01,1.54,0.09,-0.01,1.54,0.09,0,1.54,0.1,-0.01,1.54,0.11,-0.01,1.54,0.11,0,1.54,0.12,-0.01,1.54,0.13,-0.01,1.54,0.13,0,1.54,0.14,-0.01,1.54,0.15,-0.01,1.54,0.15,0,1.54,0.16,-0.01,1.54,0.17,-0.01,1.54,0.17,0,1.54,0.18,-0.01,1.54,0.19,-0.01,1.54,0.19,0,1.54,0.2,-0.01,1.54,0.21,-0.01,1.54,0.21,0,1.54,0.22,-0.01,1.54,0.23,-0.01,1.54,0.23,0,1.54,0.24,-0.01,1.54,0.25,-0.01,1.54,0.25,0,1.54,0,0,1.54,0.02,0,1.54,0.04,0,1.54,0.06,0,1.54,0.08,0,1.54,0.1,0,1.54,0.12,0,1.54,0.14,0,1.54,0.16,0,1.54,0.18,0,1.54,0.2,0,1.54,0.22,0,1.54,0.24,0,1.54,0,0.01,1.54,0.02,0.01,1.54,0.04,0.01,1.54,0.06,0.01,1.54,0.08,0.01,1.54,0.1,0.01,1.54,0.12,0.01,1.54,0.14,0.01,1.54,0.16,0.01,1.54,0.18,0.01,1.54,0.2,0.01,1.54,0.22,0.01,1.54,0.24,0.01,1.54,0.01,0.01,1.54,0.03,0.01,1.54,0.05,0.01,1.54,0.07,0.01,1.54,0.09,0.01,1.54,0.11,0.01,1.54,0.13,0.01,1.54,0.15,0.01,1.54,0.17,0.01,1.54,0.19,0.01,1.54,0.21,0.01,1.54,0.23,0.01,1.54,0.25,0.01,1.54,0.26,0.01,1.54,0.26,0,1.54,0.26,-0.01],81,3))
@@ -806,8 +806,8 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         vals*=1e-5
         eps0=DataArrayDouble(m0.data)-vals ; eps0.abs()
         self.assertTrue(eps0.findIdsInRange(1e-17,1e300).empty())
-        self.assertTrue(DataArrayInt(m0.indices).isEqual(DataArrayInt([0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27])))
-        self.assertTrue(DataArrayInt(m0.indptr).isEqual(DataArrayInt([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312])))
+        self.assertTrue(DataArrayInt32(m0.indices).isEqual(DataArrayInt32([0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,2,3,1,3,5,4,5,7,6,7,9,8,9,11,10,11,13,12,13,15,14,15,17,16,17,19,18,19,21,20,21,23,22,23,25,24,25,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27,0,1,3,1,4,5,4,6,7,6,8,9,8,10,11,10,12,13,12,14,15,14,16,17,16,18,19,18,20,21,20,22,23,22,24,25,24,26,27])))
+        self.assertTrue(DataArrayInt32(m0.indptr).isEqual(DataArrayInt32([0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87,90,93,96,99,102,105,108,111,114,117,120,123,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255,258,261,264,267,270,273,276,279,282,285,288,291,294,297,300,303,306,309,312])))
         #
         rem2=MEDCouplingRemapper() ; rem2.setIntersectionType(Barycentric)
         rem2.prepare(b,a,"P0P1")
@@ -839,7 +839,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         rem.setMinDotBtwPlane3DSurfIntersect(0.99)# this line is important it is to tell to remapper to select only cells with very close orientation
         rem.prepare(skinAndNonConformCells,skinAndNonConformCells,"P0P0")
         mat=rem.getCrudeCSRMatrix()
-        indptr=DataArrayInt(mat.indptr)
+        indptr=DataArrayInt32(mat.indptr) #not depend on MEDCouplingUse64BitIDs()
         indptr2=indptr.deltaShiftIndex()
         cellIdsOfNonConformCells=indptr2.findIdsNotEqual(1)
         cellIdsOfSkin=indptr2.findIdsEqual(1)
@@ -860,7 +860,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         source=MEDCoupling1SGTUMesh("SourcePrimaire",NORM_SEG2)
         source.setCoords(sourceCoo)
         source.allocateCells()
-        for i in xrange(len(sourceCoo)-1):
+        for i in range(len(sourceCoo) - 1):
             source.insertNextCell([i,i+1])
             pass
         source=source.buildUnstructured()
@@ -955,7 +955,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         m=rem.getCrudeCSRMatrix()
         row=array([1,1,2,2,3,3])
         col=array([0,1,1,2,5,6])
-        data=array([0.9,0.1,0.3,0.7,0.5,0.5])
+        data=array([1.8,0.2,0.6,1.4,1.0,1.0])
         mExp2=csr_matrix((data,(row,col)),shape=(5,11))
         diff=abs(m-mExp2)
         self.assertAlmostEqual(diff.sum(),0.,14)
@@ -998,8 +998,10 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(rem.getCrudeMatrix(),[{0: 1.0}, {1: 1.0}])
         rem2=MEDCouplingRemapper()
         rem2.setIntersectionType(PointLocator)
-        rem2.prepare(mt,ms,"P0P0") # reverse mt<->ms
-        self.assertEqual(rem2.getCrudeMatrix(),[{0: 1.0}, {1: 1.0}])
+        ##
+        # 2D to 3D with point locator does not make sense:
+        ##
+        self.assertRaises(InterpKernelException, rem2.prepare,mt,ms,"P0P0")
         pass
 
     def test2D1Dand1D2DPointLocator1(self):
@@ -1082,6 +1084,52 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(ftrg.isEqual(ftrg2,1e-12,1e-12))
         pass
 
+    def testPointLocator2D2DNonConvexPolygons(self):
+        """ PointLocator remapper now correclty support non-convex polygons
+        """
+        src = MEDCouplingUMesh('src', 2)
+        coo = DataArrayDouble([(6,1),(6,2),(4,2),(4,3),(3,3),(3,4),(2,4),(2,6),(1,6),(1,8),(2,8),(2,9),(3,9),(3,8),(4,8),(4,9),(5,9),(5,8),
+          (6,8),(6,9),(7,9),(7,8),(8,8),(8,9),(9,9),(9,8),(10,8),(10,9),(11,9),(11,8),(12,8),(12,9),(13,9),(13,8),
+          (14,8),(14,9),(15,9),(15,8),(16,8),(16,6),(15,6),(15,4),(14,4),(14,3),(13,3),(13,2),(11,2),(11,1),(16,11),
+          (15,11),(15,13),(14,13),(14,14),(13,14),(13,15),(11,15),(11,16),(6,16),(6,15),(4,15),(4,14),(3,14),(3,13),(2,13),
+          (2,11),(1,11)])
+        src.setCoords(coo)
+        c = DataArrayInt([5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+         31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+         21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+         60, 61, 62, 63, 64, 65])
+        cI = DataArrayInt([0, 49, 98])
+        src.setConnectivity(c, cI)
+        src.checkConsistency()
+        tgt = MEDCouplingCMesh('tgt')
+        da = DataArrayDouble(18, 1); da.iota();
+        tgt.setCoords(da, da)
+        tgt = tgt.buildUnstructured()
+        srcF = MEDCouplingFieldDouble(ON_CELLS, ONE_TIME)
+        srcF.setArray(DataArrayDouble([25.,50.]))
+        srcF.setMesh(src)
+        srcF.setNature(IntensiveConservation)
+        remap = MEDCouplingRemapper()
+        remap.setIntersectionType(PointLocator)
+        remap.prepare(src, tgt, "P0P0")
+        tgtF = remap.transferField(srcF, 0.0)
+        ids1 = [137, 139, 141, 143, 145, 147, 149, 151, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 171, 172,
+        173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
+        201, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 242,
+        243, 244, 245, 246, 247, 248, 249, 250, 261, 262, 263, 264, 265]
+        ids2 = [23, 24, 25, 26, 27, 38, 39, 40, 41, 42, 43, 44, 45, 46, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 70, 71, 72, 73, 74, 75, 76,
+           77, 78, 79, 80, 81, 82, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
+           114, 115, 116, 117, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 138, 140, 142, 144, 146, 148, 150]
+        ids3 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 47, 48,
+                49, 50, 51, 52, 53, 65, 66, 67, 68, 69, 83, 84, 85, 86, 100, 101, 102, 118, 119, 135, 136, 152, 153, 169, 170, 186, 187, 188, 202, 203,
+                204, 205, 219, 220, 221, 222, 223, 235, 236, 237, 238, 239, 240, 241, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 266, 267, 268,
+                269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288]
+        a = tgtF.getArray()
+        self.assertTrue(a[ids1].isUniform(50.0, 1e-12))
+        self.assertTrue(a[ids2].isUniform(25.0, 1e-12))
+        self.assertTrue(a[ids3].isUniform(0.0, 1e-12))
+        pass
+
     def testExtrudedOnDiffZLev1(self):
         """Non regression bug : This test is base on P0P0 ExtrudedExtruded. This test checks that if the input meshes are not based on a same plane // OXY the interpolation works"""
         arrX=DataArrayDouble([0,1]) ; arrY=DataArrayDouble([0,1]) ; arrZ=DataArrayDouble([0,1,2])
@@ -1108,7 +1156,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         pass
 
     def testP0P0WithHEXGP12(self):
-        """ Test that HEXGP12 are correclty remapped (elements with polygonal faces were not properly handled) """
+        """ Test that HEXGP12 are correctly remapped (elements with polygonal faces were not properly handled) """
         # From Astrid, two disjoint hexagonal prisms:
         coo1 = [-4.991193077144312, 8.644999999999998, 0.0, -9.982386154288623, 6.112246755425186e-16, 0.0, -4.991193077144315, -8.644999999999998, 0.0, 4.991193077144309, -8.645000000000005, 0.0, 9.982386154288626, 1.1651321638577316e-15, 0.0, 4.991193077144314, 8.645, 0.0, -4.991193077144312, 8.644999999999998, 7.561799999999991, -9.982386154288623, 6.112246755425186e-16, 7.561799999999991, -4.991193077144315, -8.644999999999998, 7.561799999999991, 4.991193077144309, -8.645000000000005, 7.561799999999991, 9.982386154288626, 1.1651321638577316e-15, 7.561799999999991, 4.991193077144314, 8.645, 7.561799999999991]
         coo2 = [-4.991193077144313, -8.645, 0.0, -9.982386154288626, -1.3992140779350848e-15, 0.0, -19.964772308577256, 0.0, 0.0, -24.95596538572157, -8.644999999999998, 0.0, -19.96477230857726, -17.289999999999996, 0.0, -9.982386154288626, -17.289999999999996, 0.0, -4.991193077144313, -8.645, 5.041200000000004, -9.982386154288626, -1.3992140779350848e-15, 5.041200000000004, -19.964772308577256, 0.0, 5.041200000000004, -24.95596538572157, -8.644999999999998, 5.041200000000004, -19.96477230857726, -17.289999999999996, 5.041200000000004, -9.982386154288626, -17.289999999999996, 5.041200000000004]
@@ -1118,8 +1166,8 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         cI2 = [0, 44]
         mTgt = MEDCouplingUMesh("target", 3)
         mSrc = MEDCouplingUMesh("src", 3)
-        mTgt.setCoords(DataArrayDouble(coo1, len(coo1)/3, 3))
-        mSrc.setCoords(DataArrayDouble(coo2, len(coo2)/3, 3))
+        mTgt.setCoords(DataArrayDouble(coo1, len(coo1) // 3, 3))
+        mSrc.setCoords(DataArrayDouble(coo2, len(coo2) // 3, 3))
         mTgt.setConnectivity(DataArrayInt(conn1), DataArrayInt(cI1))
         mSrc.setConnectivity(DataArrayInt(conn2), DataArrayInt(cI2))
 
@@ -1155,13 +1203,494 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(1, len(rmp.getCrudeMatrix()[0]))
         pass
 
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings() and MEDCouplingHasSciPyBindings(),"requires numpy AND scipy AND C++11")
+    def testP1P1PL3DSpaceFrom1DTo0D(self):
+        from scipy.sparse import csr_matrix
+        from numpy import array
+
+        def generateTrg(eps):
+            trgArr=DataArrayDouble([(0.5,0.5,0.5),(0.2,0.2,0.2),(0.9,0.9,0.9),(0.7+eps*sqrt(3),0.7-eps*sqrt(3),0.7)])
+            trg=MEDCouplingUMesh("trg",0) ; trg.setCoords(trgArr)
+            trg.allocateCells()
+            RenumTrg=[2,3,0,1]
+            for rt in RenumTrg:
+                trg.insertNextCell(NORM_POINT1,[rt])
+            return trg
+
+        srcArr=DataArrayDouble([(0.,0.,1.),(0.,0.,0.),(1.,1.,1.)])
+        src=MEDCouplingUMesh("src",1) ; src.setCoords(srcArr)
+        src.allocateCells()
+        src.insertNextCell(NORM_SEG2,[1,2])
+        #
+        trg=generateTrg(1e-7)# trg point 3 of trg cell 1 is NOT closer enough to source edge #1 -> not intercepted
+        #
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        self.assertEqual(rem.prepare(src,trg,"P1P1"),1)
+        mat=rem.getCrudeCSRMatrix()
+        row=array([2,2, 0,0, 1,1]) # here no ref to point 3 !
+        col=array([1,2, 1,2, 1,2])
+        data=array([0.1,0.9, 0.5,0.5, 0.8,0.2])
+        mExp=csr_matrix((data,(row,col)),shape=(4,3))
+        delta=abs(mExp-mat)
+        self.assertAlmostEqual(delta.sum(),0.,14)
+        #
+        trg=generateTrg(1e-14) # trg point 3 of trg cell 1 is closer enough to source edge #1 -> intercepted
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        self.assertEqual(rem.prepare(src,trg,"P1P1"),1)
+        mat=rem.getCrudeCSRMatrix()
+        row=array([2,2, 3,3, 0,0, 1,1]) # here ref to target point 3
+        col=array([1,2, 1,2, 1,2, 1,2])
+        data=array([0.1,0.9, 0.3,0.7, 0.5,0.5, 0.8,0.2])
+        mExp2=csr_matrix((data,(row,col)),shape=(4,3))
+        delta2=abs(mExp2-mat)
+        self.assertAlmostEqual(delta2.sum(),0.,14)
+        pass
+
+    def testSetMatrix1(self):
+        """ Remapper has now setCrudeMatrix method to reload matrix to skip prepare phase """
+        cooS=DataArrayDouble([1,1, 7,1, 7,2, 1,2],4,2)
+        cooT=DataArrayDouble([0,0, 3,0, 3,3, 0,3, 6,0, 12,0, 12,3, 6,3],8,2)
+        ms=MEDCouplingUMesh("source",2) ; ms.allocateCells(1) ; ms.insertNextCell(NORM_QUAD4,[0,1,2,3]) ; ms.setCoords(cooS)
+        mt=MEDCouplingUMesh("target",2) ; mt.allocateCells(2) ; mt.insertNextCell(NORM_QUAD4,[0,1,2,3]) ; mt.insertNextCell(NORM_QUAD4,[4,5,6,7]) ; mt.setCoords(cooT)
+        rem=MEDCouplingRemapper()
+        self.assertEqual(rem.prepare(ms,mt,"P0P0"),1) # [{0: 2.0}, {0: 1.0}]
+        fs=MEDCouplingFieldDouble(ON_CELLS)
+        fs.setMesh(ms)
+        fs.setArray(DataArrayDouble([10]))
+        fs.checkConsistencyLight()
+        #
+        fs.setNature(ExtensiveConservation)
+        self.assertTrue(rem.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([20./3,10./3.]),1e-12))# sum is equal to 10. First value is twice than second value
+        #
+        fs.setNature(ExtensiveMaximum)
+        self.assertTrue(rem.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([20./6.,10./6.]),1e-12))#sum is equal to 5 (10/2. because only half part on input cell is intercepted by the target cells). First value is twice than second value
+        #
+        fs.setNature(IntensiveConservation)
+        self.assertTrue(rem.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([2./9.*10.,1./18.*10.]),1e-12))#
+        #
+        fs.setNature(IntensiveMaximum)
+        self.assertTrue(rem.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([10.,10.]),1e-12))#
+        ####
+        rem2=MEDCouplingRemapper()
+        rem2.setCrudeMatrix(ms,mt,"P0P0",rem.getCrudeMatrix())
+        fs.setNature(ExtensiveConservation)
+        self.assertTrue(rem2.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([20./3,10./3.]),1e-12))
+        #
+        fs.setNature(ExtensiveMaximum)
+        self.assertTrue(rem2.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([20./6.,10./6.]),1e-12))
+        #
+        fs.setNature(IntensiveConservation)
+        self.assertTrue(rem2.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([2./9.*10.,1./18.*10.]),1e-12))
+        #
+        fs.setNature(IntensiveMaximum)
+        self.assertTrue(rem2.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([10.,10.]),1e-12))
+        #
+        srcFt=MEDCouplingFieldTemplate.New(ON_CELLS);
+        trgFt=MEDCouplingFieldTemplate.New(ON_CELLS);
+        srcFt.setMesh(ms);
+        trgFt.setMesh(mt);
+        rem3=MEDCouplingRemapper()
+        rem3.setCrudeMatrixEx(srcFt,trgFt,rem.getCrudeMatrix())
+        fs.setNature(ExtensiveConservation)
+        self.assertTrue(rem3.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([20./3,10./3.]),1e-12))
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings() and MEDCouplingHasSciPyBindings(),"requires numpy AND scipy")
+    def testSetMatrix2(self):
+        """ Remapper has now setCrudeMatrix method to reload matrix to skip prepare phase. Same as testSetMatrix1 but with CSR scipy matrix """
+        arrx_s=DataArrayDouble(6) ; arrx_s.iota()
+        arry_s=DataArrayDouble(6) ; arry_s.iota()
+        ms=MEDCouplingCMesh() ; ms.setCoords(arrx_s,arry_s)
+        ms=ms.buildUnstructured()
+        #
+        arrx_t=DataArrayDouble([2.5,4.5,5.5])
+        arry_t=DataArrayDouble([2.5,3.5,5.5])
+        mt=MEDCouplingCMesh() ; mt.setCoords(arrx_t,arry_t)
+        mt=mt.buildUnstructured()
+        #
+        rem=MEDCouplingRemapper()
+        self.assertEqual(rem.prepare(ms,mt,"P0P0"),1)
+        #
+        fs=MEDCouplingFieldDouble(ON_CELLS)
+        fs.setMesh(ms)
+        arr=DataArrayDouble(25) ; arr.iota()
+        fs.setArray(arr)
+        fs.checkConsistencyLight()
+        #
+        fs.setNature(ExtensiveConservation)
+        self.assertTrue(rem.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([54.25,11.75,79.25,16.75]),1e-12))
+        mat=rem.getCrudeCSRMatrix()
+        rem2=MEDCouplingRemapper()
+        rem2.setCrudeMatrix(ms,mt,"P0P0",mat)
+        self.assertTrue(rem2.transferField(fs,1e300).getArray().isEqual(DataArrayDouble([54.25,11.75,79.25,16.75]),1e-12))
+        pass
+
+    def testSmallTetraCell(self):
+        """This test is a non regression test. When using tetra/tetra P0P0 interpolation on very small cells the
+        3x3 matrix in the TetraAffine contains very small values and so the determinant is small (cubic).
+        So the tetra was detected as flat. Now the infinite norm of matrix is considered to establish if matrix is inversible or not."""
+        coords = [(-0.019866666666666668, 0.02, 0.002), (-0.020000073463967143, 0.019999926535763005, 0.0018666666666666673), (-0.020000073463967143, 0.019999926535763005, 0.002), (-0.020000072974206463, 0.019866593202430387, 0.002)]
+        m=MEDCouplingUMesh("mesh",3)
+        m.allocateCells()
+        m.insertNextCell(NORM_TETRA4,[0,1,2,3])
+        m.setCoords(DataArrayDouble(coords))
+        rem=MEDCouplingRemapper()
+        rem.setPrecision(1e-12)
+        rem.prepare(m,m,"P0P0")
+        mat=rem.getCrudeMatrix()
+        self.assertTrue(len(mat)==1)
+        self.assertTrue(len(mat[0])==1)
+        self.assertTrue(list(mat[0].keys())==[0])
+        res=list(mat[0].values())[0]
+        ref=float(m.getMeasureField(True).getArray())
+        self.assertTrue(abs(res-ref)/ref<1e-12)
+        pass
+
+    def test3D0DPointLocator(self):
+        """
+        For pointlocator fans, Remapper support following intersection
+        IntersectionType == PointLocator
+        - source == 3D
+        - target == 0D
+        """
+        src = MEDCouplingUMesh("src",3)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([(0,0,0),(1,0,0),(0,1,0),(0,0,1)]) )
+        src.insertNextCell(NORM_TETRA4,[0,1,2,3])
+        trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([(0.4,0.3,0.07)]) )
+        # P1P1
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.23,1:0.4,2:0.3,3:0.07}],src.getNumberOfNodes(),1e-12)
+        # P1P0
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P0")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.23,1:0.4,2:0.3,3:0.07}],src.getNumberOfNodes(),1e-12)
+        # P0P1
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P0P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:1.0}],src.getNumberOfCells(),1e-12)
+        # P0P0
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P0P0")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:1.0}],src.getNumberOfCells(),1e-12)
+        pass
+
+    def test2D0DPointLocator(self):
+        """
+        For pointlocator fans, Remapper support following intersection
+        IntersectionType == PointLocator
+        - source == 2D
+        - target == 0D
+        """
+        src = MEDCouplingUMesh("src",2)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([(0,0),(1,0),(0,1)]) )
+        src.insertNextCell(NORM_TRI3,[0,1,2])
+        trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([(0.4,0.3)]) )
+        # P1P1
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.3,1:0.4,2:0.3}],src.getNumberOfNodes(),1e-12)
+        # P1P0
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P0")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.3,1:0.4,2:0.3}],src.getNumberOfNodes(),1e-12)
+        # P0P1
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P0P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:1.0}],src.getNumberOfNodes(),1e-12)
+        # P0P0
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P0P0")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:1.0}],src.getNumberOfNodes(),1e-12)
+        pass
+
+    def test1D0DPointLocator(self):
+        """
+        For pointlocator fans, Remapper support following intersection
+        IntersectionType == PointLocator
+        - source == 1D
+        - target == 0D
+        """
+        # P1P1 - 0
+        src = MEDCouplingUMesh("src",1)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([0,1]) )
+        src.insertNextCell(NORM_SEG2,[0,1])
+        trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([0.4]) )
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.6,1:0.4}],src.getNumberOfNodes(),1e-12)
+        # P1P1 - 1
+        src = MEDCouplingUMesh("src",1)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([0,1]) )
+        src.insertNextCell(NORM_SEG2,[1,0]) # permutation
+        trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([0.4]) )
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.6,1:0.4}],src.getNumberOfNodes(),1e-12)
+        # P1P1 - 2
+        src = MEDCouplingUMesh("src",1)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([1,0]) )
+        src.insertNextCell(NORM_SEG2,[0,1])
+        trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([0.4]) )
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.4,1:0.6}],src.getNumberOfNodes(),1e-12)
+        # P1P1 - 3 - 2DCurve
+        src = MEDCouplingUMesh("src",1)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([0,1]) )
+        src.insertNextCell(NORM_SEG2,[0,1])
+        trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([0.4]) )
+        src.changeSpaceDimension(2) ; trg.changeSpaceDimension(2)
+        src.rotate([-1.,-1.],1.2)
+        trg.rotate([-1.,-1.],1.2)
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.6,1:0.4}],src.getNumberOfNodes(),1e-12)
+        # P1P1 - 4
+        src = MEDCouplingUMesh("src",1)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([1.1,7.6,2.3,5.4]) )
+        src.insertNextCell(NORM_SEG2,[0,2])
+        src.insertNextCell(NORM_SEG2,[2,3])
+        src.insertNextCell(NORM_SEG2,[3,1])
+        for eps in [0,1e-13,-1e-13]:
+            trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([0.4,2.3+eps,4.,7.]) )
+            rem=MEDCouplingRemapper()
+            rem.setIntersectionType(PointLocator)
+            rem.prepare(src,trg,"P1P1")
+            rem.nullifiedTinyCoeffInCrudeMatrixAbs(1e-12)
+            self.checkMatrix(rem.getCrudeMatrix(),[{}, {2: 2.0}, {2: 0.4516129032258065, 3: 0.5483870967741935}, {1: 0.7272727272727273, 3: 0.27272727272727265}],src.getNumberOfNodes(),1e-12)
+        # P1P1 - 5 - descending order of coords in source mesh
+        src = MEDCouplingUMesh("src",1)
+        src.allocateCells()
+        src.setCoords( DataArrayDouble([3.,1.]) )
+        src.insertNextCell(NORM_SEG2,[0,1])
+        trg = MEDCouplingUMesh.Build0DMeshFromCoords( DataArrayDouble([2.3]) )
+        rem=MEDCouplingRemapper()
+        rem.setIntersectionType(PointLocator)
+        rem.prepare(src,trg,"P1P1")
+        self.checkMatrix(rem.getCrudeMatrix(),[{0:0.65,1:0.35}],src.getNumberOfNodes(),1e-12)
+        pass
+
+    @unittest.skipUnless(MEDCouplingHasNumPyBindings() and MEDCouplingHasSciPyBindings(),"requires numpy AND scipy")
+    def testRemToCSRMatrix(self):
+        import scipy
+        mPy = [{0:1.0,1:3.0,3:7.0,6:10.},{1:12.0,2:23.0}]
+        m = MEDCouplingRemapper.ToCSRMatrix(mPy,8)
+        self.assertTrue(isinstance(m,scipy.sparse.csr.csr_matrix))
+        self.assertEqual(m.getnnz(),6)
+        self.assertAlmostEqual(m[0,0],1.0,12)
+        self.assertAlmostEqual(m[0,1],3.0,12)
+        self.assertAlmostEqual(m[0,3],7.0,12)
+        self.assertAlmostEqual(m[0,6],10.0,12)
+        self.assertAlmostEqual(m[1,1],12.0,12)
+        self.assertAlmostEqual(m[1,2],23.0,12)
+        self.assertEqual(m.shape,(2,8))
+
+    def test_Interpolation2D3D_bbox_adjustment_1(self):
+        """ Interpolation 2D <-> 3D was not using bounding box adjustment.
+        In case of a 2D mesh perfectly aligned with the axis, the bounding box intersection was not working properly (flat bounding box).
+        """
+        ## Source
+        meshS = MEDCouplingUMesh('SupportOf_TEMPERATURE_OUT', 2)
+        coo = cooS = DataArrayDouble([(-0.00074999999999877595,0.00000000000000000000,0.00032540000000000005),
+                (-0.00049999999999755579,0.00025000000000140708,0.00032540000000000005),(-0.00049999999999755600,0.00000000000000000000,0.00032540000000000005),
+                (-0.00100000000000000002,0.00000000000000000000,0.00032540000000000005),(-0.00100000000000000002,0.00025000000000000543,0.00032540000000000005),
+                (-0.00075651925565617829,0.00034416831541328637,0.00032540000000000005)])  # the extra 5e-20 on Z is the true culprit :-)
+        meshS.setCoords(coo)
+        c = DataArrayInt([3, 0, 1, 2, 3, 0, 3, 4, 3, 5, 0, 4, 3, 5, 1, 0])
+        cI = DataArrayInt([0, 4, 8, 12, 16])
+        meshS.setConnectivity(c, cI)
+        meshS.checkConsistency()
+        ## Target
+        meshT = MEDCouplingUMesh('IJK_mesh', 3)
+        coo = DataArrayDouble([(-0.001,0,0.000303602),(-0.0009,0,0.000303602),(-0.0008,0,0.000303602),(-0.0007,0,0.000303602),(-0.0006,0,0.000303602),
+            (-0.0005,0,0.000303602),(-0.001,0.0005,0.000303602),(-0.0009,0.0005,0.000303602),(-0.0008,0.0005,0.000303602),(-0.0007,0.0005,0.000303602),
+            (-0.0006,0.0005,0.000303602),(-0.0005,0.0005,0.000303602),(-0.001,0,0.0003254),(-0.0009,0,0.0003254),(-0.0008,0,0.0003254),(-0.0007,0,0.0003254),
+            (-0.0006,0,0.0003254),(-0.0005,0,0.0003254),(-0.001,0.0005,0.0003254),(-0.0009,0.0005,0.0003254),(-0.0008,0.0005,0.0003254),(-0.0007,0.0005,0.0003254),
+            (-0.0006,0.0005,0.0003254),(-0.0005,0.0005,0.0003254)])
+        meshT.setCoords(coo)
+        c = DataArrayInt([18, 1, 0, 6, 7, 13, 12, 18, 19, 18, 2, 1, 7, 8, 14, 13, 19, 20, 18, 3, 2, 8, 9, 15, 14, 20, 21, 18, 4, 3, 9, 10, 16, 15, 21, 22,
+                             18, 5, 4, 10, 11, 17, 16, 22, 23])
+        cI = DataArrayInt([0, 9, 18, 27, 36, 45])
+        meshT.setConnectivity(c, cI)
+        meshT.checkConsistency()
+        ## Dummy field
+        fldSrc = MEDCouplingFieldDouble(ON_CELLS, ONE_TIME)
+        fldSrc.setMesh(meshS)
+        da = DataArrayDouble(meshS.getNumberOfCells())
+        da[:] = 50.0
+        fldSrc.setArray(da)
+        remap = MEDCouplingRemapper()
+        # remap.setBoundingBoxAdjustmentAbs(1.0e-5)  # was not taken into account for 2D/3D - but we don't even need it! Default value is OK.
+        remap.prepare(meshS, meshT, "P0P0")
+        fldSrc.setNature(IntensiveMaximum)
+        fldTgt = remap.transferField(fldSrc, -1.0)
+        self.assertTrue(fldTgt.getArray().isUniform(50.0, 1e-12))
+
+    def testGrandyBug1(self):
+        """
+        Non regression test relative to test tuleap26461
+        """
+        rem = MEDCouplingRemapper()
+        src_final = MEDCouplingUMesh("src_final",3)
+        src_final.setCoords( DataArrayDouble([0.74763179385813627,2.0528797000000716,0.42830000000000013,0.77426950622837643,2.0528797000000001,0.40000000000000036,0.77426950622837643,2.0528797000000001,0.42830000000000013,0.77426950622830537,2.0262419876297604,0.42830000000000013],4,3) )
+        src_final.allocateCells()
+        src_final.insertNextCell(NORM_TETRA4,[0,3,2,1])
+        trg_final = MEDCouplingUMesh("trg_final",3)
+        trg_final.setCoords( DataArrayDouble([0.81034725000000007,1.9988565499999984,0.40000000000000002,0.75632410000000005,2.0528796999999983,0.40000000000000002,0.75632410000000005,1.9988565499999984,0.41800000000000004,0.81034725000000007,2.0528796999999983,0.41800000000000004],4,3) )
+        trg_final.allocateCells()
+        trg_final.insertNextCell(NORM_TETRA4,[0,2,1,3])
+
+        ref_values = [# ref values coming from geom2medcoupling.py
+            (0.0,   1.671615506097834e-08),
+            (1e-12, 1.671615506712106e-08),
+            (1e-11, 1.671615512239666e-08),
+            (1e-10, 1.6716155675164925e-08),
+            (1e-9,  1.671616120285316e-08),
+            (1e-8,  1.6716216479802182e-08),
+            (1e-7,  1.671676925650806e-08),
+            (1e-6,  1.672014459316238e-08),
+            (1e-5,  1.6805275475457618e-08),
+            (1e-4,  1.7608769838220544e-08),
+            (1e-3,  2.5791583779126835e-08)
+        ]
+
+        for ty,ref_value in ref_values:
+            trg_final2 = trg_final.deepCopy()
+            trg_final2.translate([0,ty,0])
+            rem.setPrecision(1e-12)
+            rem.prepare(src_final,trg_final2,"P0P0")
+            mat_mc = rem.getCrudeMatrix()
+            csr_new = MEDCouplingRemapper.ToCSRMatrix(mat_mc,src_final.getNumberOfCells())
+            delta = abs(csr_new[0,0]-ref_value)/ref_value
+            self.assertTrue(delta < 1e-3)
+
+    def testFEFE_0(self):
+        """
+        Test to stress localisation of target points into a source mesh using standard reference FE elements.
+        """
+        gt = NORM_HEXA27
+        nbPtsInCell = MEDCouplingUMesh.GetNumberOfNodesOfGeometricType( gt )
+        coo = DataArrayDouble([(9.0, 18.0, 27.0), (9.0, 22.0, 27.0), (11.0, 22.0, 27.0), (11.0, 18.0, 27.0), (9.0, 18.0, 33.0), (9.0, 22.0, 33.0), (11.0, 22.0, 33.0), (11.0, 18.0, 33.0), (8.8, 20.0, 26.4), (10.0, 21.6, 27.6), (11.2, 20.0, 26.4), (10.0, 18.4, 27.6), (8.8, 20.0, 33.6), (10.0, 21.6, 32.4), (11.2, 20.0, 33.6), (10.0, 18.4, 32.4), (8.8, 17.6, 30.0), (9.2, 21.6, 30.0), (11.2, 22.4, 30.0), (10.8, 18.4, 30.0), (10.0, 20.0, 26.4), (9.2, 20.0, 30.0), (10.0, 22.4, 30.0), (10.8, 20.0, 30.0), (10.0, 17.6, 30.0), (10.0, 20.0, 32.4), (10.0, 20.0, 30.0)])
+        m = MEDCouplingUMesh("mesh",3)
+        m.setCoords(coo)
+        m.allocateCells()
+        m.insertNextCell(gt,list(range(nbPtsInCell)))
+
+        inPts = DataArrayDouble( [(9.1, 18.2, 27.3), (9.1, 21.8, 27.3), (10.9, 21.8, 27.3), (10.9, 18.2, 27.3), (9.1, 18.2, 32.7), (9.1, 21.8, 32.7), (10.9, 21.8, 32.7), (10.9, 18.2, 32.7), (8.9, 20.0, 26.7), (10.0, 21.4, 27.9), (11.1, 20.0, 26.7), (10.0, 18.6, 27.9), (8.9, 20.0, 33.3), (10.0, 21.4, 32.1), (11.1, 20.0, 33.3), (10.0, 18.6, 32.1), (8.9, 17.8, 30.0), (9.3, 21.4, 30.0), (11.1, 22.2, 30.0), (10.7, 18.6, 30.0), (10.0, 20.0, 26.7), (9.3, 20.0, 30.0), (10.0, 22.2, 30.0), (10.7, 20.0, 30.0), (10.0, 17.8, 30.0), (10.0, 20.0, 32.1), (10.0, 20.0, 30.0)] )
+
+        outPts = DataArrayDouble( [(8.9, 17.8, 26.7), (8.9, 22.2, 26.7), (11.1, 22.2, 26.7), (11.1, 17.8, 26.7), (8.9, 17.8, 33.3), (8.9, 22.2, 33.3), (11.1, 22.2, 33.3), (11.1, 17.8, 33.3), (8.7, 20.0, 26.1), (10.0, 21.8, 27.3), (11.3, 20.0, 26.1), (10.0, 18.2, 27.3), (8.7, 20.0, 33.9), (10.0, 21.8, 32.7), (11.3, 20.0, 33.9), (10.0, 18.2, 32.7), (8.7, 17.4, 30.0), (9.1, 21.8, 30.0), (11.3, 22.6, 30.0), (10.9, 18.2, 30.0), (10.0, 20.0, 26.1), (9.1, 20.0, 30.0), (10.0, 22.6, 30.0), (10.9, 20.0, 30.0), (10.0, 17.4, 30.0), (10.0, 20.0, 32.7), (14.0, 20.0, 30.0)] )
+
+        srcField = MEDCouplingFieldDouble(ON_NODES_FE)
+        srcField.setMesh(m)
+        arr = DataArrayDouble(nbPtsInCell)
+        arr.iota()
+        srcField.setArray(arr)
+
+        ref_val0 = DataArrayDouble( [6.5782430384766535, 5.505760346014328, 7.80996256527073, 7.643290943690746, 9.758765408487054, 9.06408508454036, 11.003779543627997, 11.205026363340515, 10.56416007071563, 18.44359561721225, 12.499588353132655, 19.85351355074463, 14.186041573114885, 19.339743214851023, 16.084629460041207, 20.892007336402663, 17.269258227200577, 19.549962126638338, 19.039562190136063, 21.648928068870756, 20.667409503475078, 22.062499999998867, 22.562500000009678, 23.812499999505995, 24.395833333387696, 25.62468592706991, 26.] )
+
+        eps = 1e-8
+
+        for i in range(nbPtsInCell):
+            self.assertTrue( abs( srcField.getValueOn( inPts[i] )[0]-ref_val0[i] ) < eps )
+
+        self.assertTrue( srcField.getValueOnMulti( inPts ).isEqual(ref_val0,eps) )
+
+        srcFt=MEDCouplingFieldTemplate(srcField)
+        trgFt=MEDCouplingFieldTemplate(ON_NODES_FE)
+        trgMesh = MEDCouplingUMesh.Build0DMeshFromCoords( inPts )
+        trgFt.setMesh(trgMesh)
+        rem = MEDCouplingRemapper()
+        rem.setIntersectionType( PointLocator )
+        rem.prepareEx(srcFt,trgFt)
+        # scan content of matrix computed by remapper
+        mat = rem.getCrudeMatrix()
+        self.assertEqual( len(mat) , nbPtsInCell )
+        for irow,row in enumerate(mat):
+            self.assertTrue( abs( sum([y for x,y in row.items()]) - 1.0) < eps )
+            self.assertEqual( irow , [x for x,y in row.items() if y == max([y for x,y in row.items()])][0] ) # check that max coeff is for irow elt (due to construction of inPts )
+
+        # ask for MEDCouplingFieldDiscretizationOnNodesFE instance to compute coordination into ref element
+        sd = srcField.getDiscretization()
+        coosInRefElemFoundByNewton = sd.getCooInRefElement(srcField.getMesh(),inPts)
+
+        for zePt,cooInRefElemFoundByNewton in zip(inPts,coosInRefElemFoundByNewton):
+            # now check by performing refCoo -> realCoo
+            ftest = MEDCouplingFieldDouble(ON_GAUSS_PT)
+            ftest.setMesh(srcField.getMesh())
+            ftest.setGaussLocalizationOnType(gt,sum([list(elt) for elt in MEDCouplingGaussLocalization.GetDefaultReferenceCoordinatesOf(gt).getValuesAsTuple()],[]),list(cooInRefElemFoundByNewton),[1])
+            self.assertTrue ( float( (ftest.getLocalizationOfDiscr()-zePt).magnitude() ) < 1e-4 )
+
+        # testing with outside point
+        for zePt in outPts:
+            #safer than
+            #self.assertRaises(InterpKernelException,sd.getCooInRefElement,srcField.getMesh(),zePt.buildDADouble())
+            try:
+                sd.getCooInRefElement(srcField.getMesh(),zePt.buildDADouble())
+            except InterpKernelException as e:
+                self.assertTrue("fail to locate point" in e.what())
+            else:
+                self.assertTrue(false,"")
+
+    def testP1P0OnHexa_1(self):
+        """
+        See EDF27859 : This test focuses on P1P0 interpolation with source containing HEXA. So P1P0 intersector is going to split into tetras
+        the source cell.
+        """
+        trgMesh = MEDCouplingUMesh("mesh",3)
+        trgMesh.setCoords( DataArrayDouble([18500.0, 0.0, 0.0, 18544.0, 0.0, 0.0, 18544.0, 0.0, 200.0, 18500.0, 0.0, 200.0, 18497.96424104365, 274.44295777156043, 0.0, 18541.959399238567, 275.0956869684225, 0.0, 18541.959399238567, 275.0956869684225, 200.0, 18497.96424104365, 274.44295777156043, 200.0],8,3) )
+        firstPts = DataArrayDouble(3*10) ; firstPts[:] = 0. ; firstPts.rearrange(3)
+        trgMesh.setCoords( DataArrayDouble.Aggregate(firstPts,trgMesh.getCoords()) ) # this line is important to check that correct ids are taken into account
+        trgMesh.allocateCells(1)
+        trgMesh.insertNextCell(NORM_HEXA8,[10,11,12,13,14,15,16,17])
+        trgMesh.writeVTK("trgMeshNonReg.vtu")
+
+        srcMesh = trgMesh.deepCopy()
+        cc = trgMesh.computeCellCenterOfMass()[0]
+        trgMesh.scale(cc,1.01) # This line is to workaround the EDF28414 bug inside 3D intersector
+
+        expectedMatrix0 = [{10: 503624.09065889206, 11: 100868.41855508549, 12: 503863.42469772906, 13: 100629.0845162416, 14: 100629.08451623631, 15: 503863.4246977626, 16: 100868.418555101, 17: 503624.0906588909}]
+        expectedMatrix1 = [{10: 604492.509213978, 11: 201736.8371101737, 12: 201736.83711016813, 13: 201497.50307132734, 14: 201258.16903247262, 15: 201497.50307133005, 16: 604492.5092140044, 17: 201258.16903247265}]
+        expectedMatrix2 = [{10: 302066.754077835, 11: 302425.7551361466, 12: 302425.7551361466, 13: 302066.754077835, 14: 302066.7540778395, 15: 302425.7551361595, 16: 302425.7551361595, 17: 302066.75407783955}]
+        for sp,expectedMatrix in [ (PLANAR_FACE_5,expectedMatrix0),(PLANAR_FACE_6,expectedMatrix1),(GENERAL_24,expectedMatrix2)]:
+            remap = MEDCouplingRemapper()
+            remap.setSplittingPolicy( sp )
+            remap.prepare(srcMesh,trgMesh,"P1P0")
+            mat = remap.getCrudeMatrix()
+            self.checkMatrix(expectedMatrix,mat,18,1.0)
+
     def checkMatrix(self,mat1,mat2,nbCols,eps):
         self.assertEqual(len(mat1),len(mat2))
-        for i in xrange(len(mat1)):
-            self.assertTrue(max(mat2[i].keys())<nbCols)
-            self.assertTrue(max(mat1[i].keys())<nbCols)
-            self.assertTrue(min(mat2[i].keys())>=0)
-            self.assertTrue(min(mat1[i].keys())>=0)
+        for i in range(len(mat1)):
+            if len(mat2[i].keys())>0:
+                self.assertTrue(max(mat2[i].keys())<nbCols)
+            if len(mat1[i].keys())>0:
+                self.assertTrue(max(mat1[i].keys())<nbCols)
+            if len(mat2[i].keys())>0:
+                self.assertTrue(min(mat2[i].keys())>=0)
+            if len(mat1[i].keys())>0:
+                self.assertTrue(min(mat1[i].keys())>=0)
             s1=set(mat1[i].keys()) ; s2=set(mat2[i].keys())
             for elt in s1.intersection(s2):
                 self.assertTrue(abs(mat1[i][elt]-mat2[i][elt])<eps)
@@ -1211,7 +1740,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         targetMesh=MEDCouplingUMesh.New();
         targetMesh.setMeshDimension(2);
         targetMesh.allocateCells(4);
-        for i in xrange(4):
+        for i in range(4):
             targetMesh.insertNextCell(NORM_QUAD4,4,targetConn[4*i:4*(i+1)])
             pass
         targetMesh.finishInsertingCells();