]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Bug fix for P0P0 interpolation of a tetrahedron on itself.
authorabn <adrien.bruneton@cea.fr>
Thu, 9 Mar 2017 12:15:44 +0000 (13:15 +0100)
committerabn <adrien.bruneton@cea.fr>
Thu, 9 Mar 2017 12:15:44 +0000 (13:15 +0100)
src/INTERP_KERNEL/TransformedTriangleMath.cxx
src/MEDCoupling_Swig/MEDCouplingRemapperTest.py

index 3fa61fc9453589b7e1d10bd65cd8aa78b44a495e..641e4c3236a37e822867e3a3b58babcc23e1e9cc 100644 (file)
@@ -79,7 +79,7 @@ namespace INTERP_KERNEL
   void TransformedTriangle::resetNearZeroCoordinates()
   {
     for (int i=0; i<15; i++)
-      if (fabs(_coords[i])<TransformedTriangle::MACH_EPS*20.0) _coords[i]=0.0;
+      if (fabs(_coords[i])<TransformedTriangle::MACH_EPS*40.0) _coords[i]=0.0;
   }
   
   // ----------------------------------------------------------------------------------
index 9293976d45b190864fbf07d0d2e454b6f44e1670..5ff24cd86d147141fe78149e47ae5405309e19f5 100644 (file)
@@ -1135,6 +1135,26 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(len(mat), 1)
         pass
 
+    def testP0P0KillerTet(self):
+        """ The killer tetrahedron detected by LMEC!"""
+        mesh = MEDCouplingUMesh('SupportOf_ECHIA1_Tin', 3)
+#         # was OK:
+#         coo = DataArrayDouble([(-4.50135,1.95352,4.59608),(-4.50409,1.86642,4.54551), (-4.55175,1.92167,4.64844),(-4.58813,1.94795,4.5283)])
+        # was KO:
+        coo = DataArrayDouble([(-4.501352938826142847,1.953517433537110159,4.596082552008083688),(-4.504092113061189728,1.866415526007169978,4.545507396150389567),(-4.551750368181751050,1.921669328035479962,4.648439577911889664),(-4.588131417812300050,1.947948377683889953,4.528298931319220344)])
+        mesh.setCoords(coo)
+        c = DataArrayInt([14, 2, 0, 3, 1]); cI = DataArrayInt([0, 5])
+        mesh.setConnectivity(c, cI)
+        mesh_src, mesh_tgt = mesh.deepCopy(), mesh.deepCopy()
+        field_src = mesh_src.fillFromAnalytic(ON_CELLS, 1, "1")
+        field_src.setNature(IntensiveMaximum)
+        rmp = MEDCouplingRemapper()
+        rmp.setIntersectionType(Triangulation)
+        rmp.prepare(mesh_src, mesh_tgt, "P0P0")
+        self.assertEqual(1, len(rmp.getCrudeMatrix()))
+        self.assertEqual(1, len(rmp.getCrudeMatrix()[0]))
+        pass
+
     def checkMatrix(self,mat1,mat2,nbCols,eps):
         self.assertEqual(len(mat1),len(mat2))
         for i in xrange(len(mat1)):