From: ageay Date: Fri, 15 Mar 2013 13:26:24 +0000 (+0000) Subject: Some tests of minimalDistanceTo and findClosestTuple X-Git-Tag: V6_main_FINAL~275 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f90da25e83efcf177c31693bd2872e52896cf048;p=tools%2Fmedcoupling.git Some tests of minimalDistanceTo and findClosestTuple --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 06111e164..9d2b09aa6 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -11445,6 +11445,52 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertAlmostEqual(res6[1],4.*integExp1,11) pass + def testSwig2SlowDADFindClosestTupleId(self): + nbPts=[10,] + for nbPt in nbPts: + d=DataArrayDouble(nbPt) ; d.iota() ; d*=1./(nbPt-1) + c=MEDCouplingCMesh() ; c.setCoords(d,d) ; m=c.buildUnstructured() ; pts=m.getCoords() ; del m + # + d0=DataArrayDouble((nbPt-1)*(nbPt-1)) ; d0.iota() ; d0*=(3./((nbPt-1)*(nbPt-1))) ; d0=d0.applyFunc("exp(x)-1") + d1=DataArrayDouble((nbPt-1)*(nbPt-1)) ; d1.iota() + d2=DataArrayDouble.Meld(d0,d1) ; d2=d2.fromPolarToCart() ; d2+=[0.32,0.73] + ids=pts.findClosestTupleId(d2) + #print "Start of costly computation" + idsExpected=DataArrayInt(len(d2)) + tmp=1e300 + for i,elt in enumerate(d2): + l,m=(pts-elt).magnitude().getMinValue() + idsExpected.setIJSilent(i,0,m) + if l