From: ageay Date: Mon, 30 Jan 2012 07:34:10 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V6_main_FINAL~898 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=97d12dc8223fb3aa4e17bbaed64a3b0f0e79a193;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index f65d6f564..0b4a504b3 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -1921,3 +1921,24 @@ void MEDCouplingBasicsTest4::testDADIReverse1() CPPUNIT_ASSERT_DOUBLES_EQUAL(arr2[4-i],b->getIJ(i,0),1e-14); b->decrRef(); } + +void MEDCouplingBasicsTest4::testGetNodeIdsInUse1() +{ + MEDCouplingUMesh *m0=build2DTargetMesh_1(); + const int CellIds[2]={1,2}; + MEDCouplingUMesh *m1=static_cast(m0->buildPartOfMySelf(CellIds,CellIds+2,true)); + int newNbOfNodes=-1; + DataArrayInt *arr=m1->getNodeIdsInUse(newNbOfNodes); + const int expected[9]={-1,0,1,-1,2,3,-1,-1,-1}; + CPPUNIT_ASSERT_EQUAL(4,newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(9,arr->getNbOfElems()); + CPPUNIT_ASSERT(std::equal(expected,expected+9,arr->getConstPointer())); + DataArrayInt *arr2=arr->invertArrayO2N2N2O(newNbOfNodes); + CPPUNIT_ASSERT_EQUAL(4,arr2->getNbOfElems()); + const int expected2[4]={1,2,4,5}; + CPPUNIT_ASSERT(std::equal(expected2,expected2+4,arr2->getConstPointer())); + arr2->decrRef(); + arr->decrRef(); + m1->decrRef(); + m0->decrRef(); +} diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx index c88dfd400..e42a0018e 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.hxx @@ -86,6 +86,7 @@ namespace ParaMEDMEM CPPUNIT_TEST( testDADGetDifferentValues1 ); CPPUNIT_TEST( testDAIBuildOld2NewArrayFromSurjectiveFormat2 ); CPPUNIT_TEST( testDADIReverse1 ); + CPPUNIT_TEST( testGetNodeIdsInUse1 ); CPPUNIT_TEST_SUITE_END(); public: void testDescriptionInMeshTimeUnit1(); @@ -141,6 +142,7 @@ namespace ParaMEDMEM void testDADGetDifferentValues1(); void testDAIBuildOld2NewArrayFromSurjectiveFormat2(); void testDADIReverse1(); + void testGetNodeIdsInUse1(); }; } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index ea61321fa..8f407d303 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -8050,6 +8050,21 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertAlmostEqual(arr2[4-i],b.getIJ(i,0),14); pass pass + + def testGetNodeIdsInUse1(self): + m0=MEDCouplingDataForTest.build2DTargetMesh_1(); + CellIds=[1,2] + m1=m0.buildPartOfMySelf(CellIds,True); + arr,newNbOfNodes=m1.getNodeIdsInUse(); + expected=[-1,0,1,-1,2,3,-1,-1,-1] + self.assertEqual(4,newNbOfNodes); + self.assertEqual(9,arr.getNbOfElems()); + self.assertEqual(expected,arr.getValues()); + arr2=arr.invertArrayO2N2N2O(newNbOfNodes); + self.assertEqual(4,arr2.getNbOfElems()); + expected2=[1,2,4,5] + self.assertEqual(expected2,arr2.getValues()); + pass def setUp(self): pass