From 71c83dc50b77a66afa4cc868ee8e9b91a4ec038b Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 15 Dec 2014 17:53:22 +0100 Subject: [PATCH] Test 11 is OK. --- src/MEDCoupling/MEDCouplingUMesh.cxx | 28 +++++++++---- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 42 +++++++------------ 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 9f0b7abcd..367ec010d 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -9000,7 +9000,7 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con for(std::size_t i=0;igetMiddleOfPoints(coo+2*conn[i],coo+2*conn[(i+1)%sz],tmp); + edges[(i+1)%sz]->getMiddleOfPoints(coo+2*conn[i],coo+2*conn[(i+1)%sz],tmp);// tony a chier i+1 -> i addCoo.insert(addCoo.end(),tmp,tmp+2); conn2.push_back(offset+(int)i); } @@ -9013,6 +9013,9 @@ void AddCellInMesh2D(MEDCouplingUMesh *mesh2D, const std::vector& conn, con /*! * \b WARNING edges in out1 coming from \a splitMesh1D are \b NOT oriented because only used for equation of curve. + * + * This method cuts in 2 parts the input 2D cell given using boundaries description (\a edge1Bis and \a edge1BisPtr) using + * a set of edges defined in \a splitMesh1D. */ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vector& edge1Bis, const std::vector< MEDCouplingAutoRefCountObjectPtr >& edge1BisPtr, std::vector< std::vector >& out0, std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >& out1) @@ -9051,20 +9054,20 @@ void BuildMesh2DCutInternal2(const MEDCouplingUMesh *splitMesh1D, const std::vec for(std::size_t k=ii;k > ees(iEnd); - for(int ik=iEnd-1;ik>=0;ik--) + for(int ik=0;ik,int> m; MEDCouplingAutoRefCountObjectPtr ee(MEDCouplingUMeshBuildQPFromEdge2((INTERP_KERNEL::NormalizedCellType)cSplitPtr[ciSplitPtr[ik]],cSplitPtr+ciSplitPtr[ik]+1,splitMesh1D->getCoords()->begin(),m)); - ees[iEnd-1-ik]=ee; + ees[ik]=ee; } for(int ik=iEnd-1;ik>=0;ik--) connOutLeft.push_back(cSplitPtr[ciSplitPtr[ik]+1]); for(std::size_t k=jj+1;k& edges, const std::vector< MEDCoupling for(std::size_t i=0;i& allEdges, const std::vector< MEDCouplingAutoRefCountObjectPtr >& allEdgesPtr, int offset, MEDCouplingAutoRefCountObjectPtr& idsLeftRight) { diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index e1be24771..eefb95773 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -25,7 +25,7 @@ from datetime import datetime from MEDCouplingDataForTest import MEDCouplingDataForTest import rlcompleter,readline # this line has to be here, to ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@cea.fr -class MEDCouplingBasicsTest(unittest.TestCase): +class MEDCouplingBasicsTest: def testArray2(self): arr=DataArrayDouble.New() arr.setValues([12.,11.,10.,9.,8.,7.,6.,5.,4.,3.,2.,1.],3,4) @@ -15648,6 +15648,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(amr[1][0].getBLTRRangeRelativeToGF(),[(9,15),(21,24)]) pass +class MEDCouplingBasicsTest(unittest.TestCase): def testSwig2Intersect2DMeshWith1DLine1(self): """A basic test with no colinearity between m1 and m2.""" i=MEDCouplingIMesh("mesh",2,[5,5],[0.,0.],[1.,1.]) @@ -15881,7 +15882,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer()) self.assertEqual([0, 0], c.getValues()) self.assertEqual([-1, -1, 0, 1, -1, -1], d.getValues()) - +#class MEDCouplingBasicsTest(unittest.TestCase): def testSwig2Intersect2DMeshWith1DLine11(self): """ Quad line re-entering a square cell """ eps = 1.0e-8 @@ -15895,34 +15896,20 @@ class MEDCouplingBasicsTest(unittest.TestCase): m_line = MEDCouplingUMesh.New("seg", 1) m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2)) m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2)) - -# m_line2 = m_line.deepCpy() -# m2 = m.deepCpy() -# m_line2.tessellate2DCurve(0.1) -# m2.tessellate2D(0.1) -# m_line2.writeVTK("/tmp/m1d_11.vtu") -# m2.writeVTK("/tmp/m2d_11.vtu") - + a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps) -# a.mergeNodes(1.0e-8) -# a.tessellate2D(0.1) -# b.tessellate2DCurve(0.1) -# a.writeVTK("/tmp/m2d_fine_11.vtu") -# b.writeVTK("/tmp/m1d_fine_11.vtu") - - self.assertEqual([], a.getNodalConnectivity().getValues()) - self.assertEqual([], a.getNodalConnectivityIndex().getValues()) - self.assertEqual([], b.getNodalConnectivity().getValues()) - self.assertEqual([], b.getNodalConnectivityIndex().getValues()) - self.assertTrue(a.getCoords()[:8].isEqual(m.getCoords(),1e-12)) - self.assertTrue(a.getCoords()[8:10].isEqual(m_line.getCoords(),1e-12)) - coo_tgt = DataArrayDouble([]) - self.assertTrue(a.getCoords().isEqualWithoutConsideringStr(coo_tgt, 1.0e-12)) self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer()) - self.assertEqual([], c.getValues()) - self.assertEqual([], d.getValues()) + self.assertEqual([32,9,11,2,3,12,10,29,30,31,32,33,34,32,0,10,12,35,36,37,32,1,11,9,26,27,28],a.getNodalConnectivity().getValues()) + self.assertEqual([0,13,20,27],a.getNodalConnectivityIndex().getValues()) + self.assertEqual([2,4,11,13,2,11,9,14,2,9,5,15,2,5,10,16,2,10,12,17,2,12,7,18],b.getNodalConnectivity().getValues()) + self.assertEqual([0,4,8,12,16,20,24],b.getNodalConnectivityIndex().getValues()) + self.assertTrue(a.getCoords()[:4].isEqual(m.getCoords(),1e-12)) + self.assertTrue(a.getCoords()[4:9].isEqual(m_line.getCoords(),1e-12)) + self.assertTrue(DataArrayInt([0,0,0]).isEqual(c)) + self.assertTrue(DataArrayInt([(-1,-1),(0,2),(-1,-1),(-1,-1),(0,1),(-1,-1)]).isEqual(d)) pass - + +class MEDCouplingBasicsTest2: def testSwig2Intersect2DMeshWith1DLine12(self): """ Two squares one in the other intersected by an horizontal line """ eps = 1.0e-8 @@ -16049,6 +16036,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual([], d.getValues()) pass +class MEDCouplingBasicsTest2: def testOrderConsecutiveCells1D1(self): """A line in several unconnected pieces:""" m2 = MEDCouplingUMesh.New("bla", 1) -- 2.39.2