From 89720a42662cdfa13fe766d0b6976019fc3b7af7 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 11 Jul 2013 13:02:42 +0000 Subject: [PATCH] behaviour modification MEDCouplingMesh::getDistributionOfTypes -> -1 in values 3*i+2 --- src/MEDCoupling/MEDCoupling1GTUMesh.cxx | 4 ++-- src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 2 +- src/MEDCoupling/MEDCouplingUMesh.cxx | 4 ++-- src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx | 4 +--- src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx | 4 ++-- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 11 ++++------- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 002298a14..76f5a73d0 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -120,13 +120,13 @@ std::set MEDCoupling1GTUMesh::getAllGeoTypes( * This method returns in the same format as code (see MEDCouplingUMesh::checkTypeConsistencyAndContig or MEDCouplingUMesh::splitProfilePerType) how * \a this is composed in cell types. * The returned array is of size 3*n where n is the number of different types present in \a this. - * For every k in [0,n] ret[3*k+2]==0 because it has no sense here. + * For every k in [0,n] ret[3*k+2]==-1 because it has no sense here. * This parameter is kept only for compatibility with other methode listed above. */ std::vector MEDCoupling1GTUMesh::getDistributionOfTypes() const throw(INTERP_KERNEL::Exception) { std::vector ret(3); - ret[0]=(int)getCellModelEnum(); ret[1]=getNumberOfCells(); ret[2]=0; + ret[0]=(int)getCellModelEnum(); ret[1]=getNumberOfCells(); ret[2]=-1; return ret; } diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index efb9cddf3..842b3e3e0 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -156,7 +156,7 @@ std::vector MEDCouplingStructuredMesh::getDistributionOfTypes() const throw std::vector ret(3); ret[0]=getTypeOfCell(0); ret[1]=getNumberOfCells(); - ret[2]=0; //ret[3*k+2]==0 because it has no sense here + ret[2]=-1; //ret[3*k+2]==-1 because it has no sense here return ret; } diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index f99bcc0d2..01b9c156f 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -6208,7 +6208,7 @@ namespace ParaMEDMEMImpl * This method returns in the same format as code (see MEDCouplingUMesh::checkTypeConsistencyAndContig or MEDCouplingUMesh::splitProfilePerType) how * \a this is composed in cell types. * The returned array is of size 3*n where n is the number of different types present in \a this. - * For every k in [0,n] ret[3*k+2]==0 because it has no sense here. + * For every k in [0,n] ret[3*k+2]==-1 because it has no sense here. * This parameter is kept only for compatibility with other methode listed above. */ std::vector MEDCouplingUMesh::getDistributionOfTypes() const throw(INTERP_KERNEL::Exception) @@ -6219,7 +6219,7 @@ std::vector MEDCouplingUMesh::getDistributionOfTypes() const throw(INTERP_K const int *work=connI; int nbOfCells=getNumberOfCells(); std::size_t n=getAllTypes().size(); - std::vector ret(3*n,0); //ret[3*k+2]==0 because it has no sense here + std::vector ret(3*n,-1); //ret[3*k+2]==-1 because it has no sense here std::set types; for(std::size_t i=0;work!=connI+nbOfCells;i++) { diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 563774066..6fa8ba4cd 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -2458,11 +2458,9 @@ void MEDCouplingBasicsTest1::testCMesh2() CPPUNIT_ASSERT_EQUAL(3,(int) dis.size()); CPPUNIT_ASSERT_EQUAL((int) INTERP_KERNEL::NORM_HEXA8,dis[0]); CPPUNIT_ASSERT_EQUAL(27,dis[1]); - CPPUNIT_ASSERT_EQUAL(0,dis[2]); + CPPUNIT_ASSERT_EQUAL(-1,dis[2]); std::vector idsPerType; - CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception); - dis[2]=-1; CPPUNIT_ASSERT(!(mesh1->checkTypeConsistencyAndContig(dis, idsPerType))); dis[0]=(int) INTERP_KERNEL::NORM_QUAD4; CPPUNIT_ASSERT_THROW(mesh1->checkTypeConsistencyAndContig(dis, idsPerType),INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index cba01a300..9e88f8e27 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -1529,10 +1529,10 @@ void MEDCouplingBasicsTest4::testGetDistributionOfTypes1() CPPUNIT_ASSERT_EQUAL(6,(int)code.size()); CPPUNIT_ASSERT_EQUAL(3,code[0]); CPPUNIT_ASSERT_EQUAL(2,code[1]); - CPPUNIT_ASSERT_EQUAL(0,code[2]); + CPPUNIT_ASSERT_EQUAL(-1,code[2]); CPPUNIT_ASSERT_EQUAL(4,code[3]); CPPUNIT_ASSERT_EQUAL(3,code[4]); - CPPUNIT_ASSERT_EQUAL(0,code[5]); + CPPUNIT_ASSERT_EQUAL(-1,code[5]); m->decrRef(); } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 118a6547c..0f7e74cf0 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -1832,11 +1832,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(1, len(dis)); self.assertEqual(NORM_HEXA8, dis[0][0]); self.assertEqual(27, dis[0][1]); - self.assertEqual(0, dis[0][2]); + self.assertEqual(-1, dis[0][2]); - idsPerType=[] - self.assertRaises(InterpKernelException, mesh1.checkTypeConsistencyAndContig, dis, idsPerType); - dis[0][2]=-1; idsPerType=[] self.assertTrue(not mesh1.checkTypeConsistencyAndContig(dis, idsPerType)); dis[0][0]=NORM_QUAD4; @@ -7885,10 +7882,10 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(2,len(code)); self.assertEqual(3,code[0][0]); self.assertEqual(2,code[0][1]); - self.assertEqual(0,code[0][2]); + self.assertEqual(-1,code[0][2]); self.assertEqual(4,code[1][0]); self.assertEqual(3,code[1][1]); - self.assertEqual(0,code[1][2]); + self.assertEqual(-1,code[1][2]); pass def testNorm2_1(self): @@ -13044,7 +13041,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(m.getTypeOfCell(3),NORM_QUAD4) self.assertRaises(InterpKernelException,m.getTypeOfCell,5) self.assertEqual(m.getAllGeoTypes(),[NORM_QUAD4]) - self.assertEqual(m.getDistributionOfTypes(),[[NORM_QUAD4,5,0]]) + self.assertEqual(m.getDistributionOfTypes(),[[NORM_QUAD4,5,-1]]) ## pfl1=DataArrayInt([1,3,4]) a,b,c=m.splitProfilePerType(pfl1) -- 2.39.2