From: ageay Date: Mon, 30 Jan 2012 09:41:21 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V6_main_FINAL~896 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb84b2d8a050adeb7f37bb03d5a1f8ae87d90abc;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index 0b4a504b3..7cbbf2a8f 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -1942,3 +1942,42 @@ void MEDCouplingBasicsTest4::testGetNodeIdsInUse1() m1->decrRef(); m0->decrRef(); } + +void MEDCouplingBasicsTest4::testBuildDescendingConnec2() +{ + MEDCouplingUMesh *mesh=build2DTargetMesh_1(); + DataArrayInt *desc=DataArrayInt::New(); + DataArrayInt *descIndx=DataArrayInt::New(); + DataArrayInt *revDesc=DataArrayInt::New(); + DataArrayInt *revDescIndx=DataArrayInt::New(); + // + MEDCouplingUMesh *mesh2=mesh->buildDescendingConnectivity2(desc,descIndx,revDesc,revDescIndx); + mesh2->checkCoherency(); + CPPUNIT_ASSERT_EQUAL(1,mesh2->getMeshDimension()); + CPPUNIT_ASSERT_EQUAL(13,mesh2->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(14,revDescIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(6,descIndx->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(6,descIndx->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(18,desc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,desc->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(18,revDesc->getNbOfElems()); CPPUNIT_ASSERT_EQUAL(18,revDesc->getNumberOfTuples()); + const int expected1[18]={1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10}; + CPPUNIT_ASSERT(std::equal(expected1,expected1+18,desc->getConstPointer())); + const int expected2[6]={0,4,7,10,14,18}; + CPPUNIT_ASSERT(std::equal(expected2,expected2+6,descIndx->getConstPointer())); + const int expected3[14]={0,1,3,5,6,8,9,11,12,13,15,16,17,18}; + CPPUNIT_ASSERT(std::equal(expected3,expected3+14,revDescIndx->getConstPointer())); + const int expected4[18]={0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4}; + CPPUNIT_ASSERT(std::equal(expected4,expected4+18,revDesc->getConstPointer())); + DataArrayInt *conn=mesh2->getNodalConnectivity(); + DataArrayInt *connIndex=mesh2->getNodalConnectivityIndex(); + const int expected5[14]={0,3,6,9,12,15,18,21,24,27,30,33,36,39}; + CPPUNIT_ASSERT(std::equal(expected5,expected5+14,connIndex->getConstPointer())); + const int expected6[39]={1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5}; + CPPUNIT_ASSERT(std::equal(expected6,expected6+39,conn->getConstPointer())); + // + desc->decrRef(); + descIndx->decrRef(); + revDesc->decrRef(); + revDescIndx->decrRef(); + mesh2->decrRef(); + mesh->decrRef(); +} diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx index e42a0018e..667f52d02 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx @@ -87,6 +87,7 @@ namespace ParaMEDMEM CPPUNIT_TEST( testDAIBuildOld2NewArrayFromSurjectiveFormat2 ); CPPUNIT_TEST( testDADIReverse1 ); CPPUNIT_TEST( testGetNodeIdsInUse1 ); + CPPUNIT_TEST( testBuildDescendingConnec2 ); CPPUNIT_TEST_SUITE_END(); public: void testDescriptionInMeshTimeUnit1(); @@ -143,6 +144,7 @@ namespace ParaMEDMEM void testDAIBuildOld2NewArrayFromSurjectiveFormat2(); void testDADIReverse1(); void testGetNodeIdsInUse1(); + void testBuildDescendingConnec2(); }; } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 8f407d303..f42672e9f 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -8065,6 +8065,33 @@ class MEDCouplingBasicsTest(unittest.TestCase): expected2=[1,2,4,5] self.assertEqual(expected2,arr2.getValues()); pass + + def testBuildDescendingConnec2(self): + mesh=MEDCouplingDataForTest.build2DTargetMesh_1(); + # + mesh2,desc,descIndx,revDesc,revDescIndx=mesh.buildDescendingConnectivity2(); + mesh2.checkCoherency(); + self.assertEqual(1,mesh2.getMeshDimension()); + self.assertEqual(13,mesh2.getNumberOfCells()); + self.assertEqual(14,revDescIndx.getNbOfElems()); self.assertEqual(14,revDescIndx.getNumberOfTuples()); + self.assertEqual(6,descIndx.getNbOfElems()); self.assertEqual(6,descIndx.getNumberOfTuples()); + self.assertEqual(18,desc.getNbOfElems()); self.assertEqual(18,desc.getNumberOfTuples()); + self.assertEqual(18,revDesc.getNbOfElems()); self.assertEqual(18,revDesc.getNumberOfTuples()); + expected1=[1,2,3,4,-3,5,6, 7,8,-5,9,10,-2,11, 12,13,-7,-10] + self.assertEqual(expected1,desc.getValues()); + expected2=[0,4,7,10,14,18] + self.assertEqual(expected2,descIndx.getValues()); + expected3=[0,1,3,5,6,8,9,11,12,13,15,16,17,18] + self.assertEqual(expected3,revDescIndx.getValues()); + expected4=[0, 0,3, 0,1, 0, 1,2, 1, 2,4, 2, 3, 3,4, 3, 4, 4] + self.assertEqual(expected4,revDesc.getValues()); + conn=mesh2.getNodalConnectivity(); + connIndex=mesh2.getNodalConnectivityIndex(); + expected5=[0,3,6,9,12,15,18,21,24,27,30,33,36,39] + self.assertEqual(expected5,connIndex.getValues()); + expected6=[1, 0, 3, 1, 3, 4, 1, 4, 1, 1, 1, 0, 1, 4, 2, 1, 2, 1, 1, 4, 5, 1, 5, 2, 1, 6, 7, 1, 7, 4, 1, 3, 6, 1, 7, 8, 1, 8, 5] + self.assertEqual(expected6,conn.getValues()); + pass def setUp(self): pass