]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Ajouts des tests
authorAnthony Geay <anthony.geay@edf.fr>
Wed, 29 Aug 2018 08:31:00 +0000 (10:31 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 29 Aug 2018 08:31:00 +0000 (10:31 +0200)
1  2 
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest6.py
src/MEDCoupling_Swig/MEDCouplingCommon.i

Simple merge
Simple merge
index 978cfd221c772dfee51315c8ecaf1481ee73ff99,e7cc79e23ed4bc78ba83964c5c37417d8338457e..76fbfb6672f3956dee17cdd06c4e3370a9b2ed0b
@@@ -211,63 -211,27 +211,85 @@@ class MEDCouplingBasicsTest6(unittest.T
          self.assertTrue(m.getCoords()[ptsExpToBeModified].isEqual(ptsPosExp,1e-12))
          pass
  
 +    def testRenumberNodesInConnOpt(self):
 +        """ Test of MEDCouplingPointSet.renumberNodesInConn with map as input coming from DataArrayInt.invertArrayN2O2O2NOptimized
 +        """
 +        m=MEDCouplingUMesh("mesh",2)
 +        m.allocateCells()
 +        m.insertNextCell(NORM_QUAD4,[10000,10002,10001,10003])
 +        coo=DataArrayDouble([(0,0),(1,1),(1,0),(0,1)])
 +        m.setCoords(coo)
 +        m.checkConsistencyLight()
 +        #
 +        d=DataArrayInt([10000,10001,10002,10003])
 +        myMap=d.invertArrayN2O2O2NOptimized()
 +        myMap2=d.giveN2OOptimized()
 +        m.checkConsistencyLight()
 +        #
 +        m.renumberNodesInConn(myMap) # <- test is here for UMesh
 +        self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([4,0,2,1,3])))
 +        m.renumberNodesInConn(myMap2) # <- test is here for UMesh
 +        self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([4,10000,10002,10001,10003])))
 +        #
 +        m=MEDCoupling1SGTUMesh("mesh",NORM_QUAD4)
 +        m.setNodalConnectivity(DataArrayInt([10000,10002,10001,10003]))
 +        m.setCoords(coo)
 +        m.checkConsistencyLight()
 +        m.renumberNodesInConn(myMap) # <- test is here for 1SGTUMesh
 +        self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([0,2,1,3])))
 +        #
 +        m=MEDCoupling1DGTUMesh("mesh",NORM_POLYGON)
 +        m.setCoords(coo)
 +        m.setNodalConnectivity(DataArrayInt([10000,10002,10001,10003]),DataArrayInt([0,4]))
 +        m.checkConsistencyLight()
 +        m.renumberNodesInConn(myMap) # <- test is here for 1DGTUMesh
 +        self.assertTrue(m.getNodalConnectivity().isEqual(DataArrayInt([0,2,1,3])))
 +        self.assertTrue(m.getNodalConnectivityIndex().isEqual(DataArrayInt([0,4])))
 +        pass
 +
 +    def testSeg2bGP(self):
 +        """Test of Gauss points on SEG2 using SEG2B style as ref coords
 +        """
 +        coo=DataArrayDouble([[0.,0.,0.],[1.,1.,1.]])
 +        m=MEDCouplingUMesh("mesh",1) ; m.setCoords(coo)
 +        m.allocateCells()
 +        # the cell description is exactly those described in the description of HEXA27 in MED file 3.0.7 documentation
 +        m.insertNextCell(NORM_SEG2,[0,1])
 +        refCoo=[0.,1.]
 +        weights=[0.8,0.1,0.1]
 +        gCoords=[0.2,0.5,0.9]
 +        fGauss=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fGauss.setName("fGauss")
 +        fGauss.setMesh(m)
 +        fGauss.setGaussLocalizationOnType(NORM_SEG2,refCoo,gCoords,weights)
 +        arr=DataArrayDouble(fGauss.getNumberOfTuplesExpected()) ; arr.iota()
 +        fGauss.setArray(arr)
 +        fGauss.checkConsistencyLight()
 +        arrOfDisc=fGauss.getLocalizationOfDiscr()
 +        self.assertTrue(arrOfDisc.isEqual(DataArrayDouble([0.2,0.2,0.2,0.5,0.5,0.5,0.9,0.9,0.9],3,3),1e-12))
 +        pass
 +    
+     def testUMeshGetCellsContainingPtOn2DNonDynQuadraticCells(self):
+         """getCellsContainingPoint is now dealing curves of quadratic 2D elements.
+ This test is a mesh containing 2 QUAD8 cells. The input point is located at a special loc.
+ If true geometry (with curve as edges) is considered the result of getCellsContainingPoint is not the same as if only linear part of cells is considered."""
+         coords=DataArrayDouble([-0.9428090415820631,0.9428090415820631,-1.06066017177982,1.06066017177982,-1.1785113019775801,1.1785113019775801,-1.2963624321753402,1.2963624321753402,-1.4142135623731,1.41421356237309,-0.7653668647301801,1.8477590650225701,-0.6378057206084831,1.53979922085214,-0.510244576486786,1.23183937668172,-0.701586292669331,1.6937791429373599,-0.574025148547635,1.38581929876693,-0.9259503883660041,1.38578268717091,-0.740760310692803,1.10862614973673,-1.1111404660392,1.66293922460509],13,2)
+         m=MEDCouplingUMesh("mesh",2)
+         m.setCoords(coords)
+         m.allocateCells()
+         m.insertNextCell(NORM_QUAD8,[4,2,6,5,3,10,8,12])
+         m.insertNextCell(NORM_QUAD8,[2,0,7,6,1,11,9,10])
+         #
+         zePt=DataArrayDouble([-0.85863751450784975,1.4203162316045934],1,2)
+         a,b=m.getCellsContainingPoints(zePt,1e-12)
+         self.assertTrue(b.isEqual(DataArrayInt([0,1])))
+         self.assertTrue(a.isEqual(DataArrayInt([1]))) # <- test is here. 0 if only linear parts are considered.
+         #
+         a,b=m.getCellsContainingPointsLinearPartOnlyOnNonDynType(zePt,1e-12)
+         self.assertTrue(b.isEqual(DataArrayInt([0,1])))
+         self.assertTrue(a.isEqual(DataArrayInt([0]))) # <- like before
+         pass
+     
++
      pass
  
  if __name__ == '__main__':