From 5bb61540ff5127b35cb13eb1f44d791c04c82556 Mon Sep 17 00:00:00 2001 From: ageay Date: Fri, 17 Feb 2012 16:34:48 +0000 Subject: [PATCH] getCellIdsCrossingPlane implementation. --- .../Test/MEDCouplingBasicsTest5.cxx | 22 +++++++++++++++++++ .../Test/MEDCouplingBasicsTest5.hxx | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index d581165a0..3a8656e3d 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -150,3 +150,25 @@ void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp4() m1->decrRef(); m2->decrRef(); } + +void MEDCouplingBasicsTest5::testGetCellIdsCrossingPlane1() +{ + MEDCouplingUMesh *mesh2D=0; + MEDCouplingUMesh *mesh3D=build3DExtrudedUMesh_1(mesh2D); + const double vec[3]={-0.07,1.,0.07}; + const double origin[3]={1.524,1.4552,1.74768}; + DataArrayInt *ids1=mesh3D->getCellIdsCrossingPlane(origin,vec,1e-10); + CPPUNIT_ASSERT_EQUAL(9,ids1->getNumberOfTuples()); + const int expected1[9]={1,3,4,7,9,10,13,15,16}; + CPPUNIT_ASSERT(std::equal(expected1,expected1+9,ids1->getConstPointer())); + const double vec2[3]={0.,0.,1.}; + DataArrayInt *ids2=mesh3D->getCellIdsCrossingPlane(origin,vec2,1e-10); + const int expected2[6]={6,7,8,9,10,11}; + CPPUNIT_ASSERT_EQUAL(6,ids2->getNumberOfTuples()); + CPPUNIT_ASSERT(std::equal(expected2,expected2+6,ids2->getConstPointer())); + ids1->decrRef(); + ids2->decrRef(); + mesh3D->decrRef(); + mesh2D->decrRef(); +} + diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx index 85d229fcd..6ee46d0c6 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx @@ -37,10 +37,12 @@ namespace ParaMEDMEM CPPUNIT_TEST_SUITE(MEDCouplingBasicsTest5); CPPUNIT_TEST( testUMeshTessellate2D1 ); CPPUNIT_TEST( testIntersect2DMeshesTmp4 ); + CPPUNIT_TEST( testGetCellIdsCrossingPlane1 ); CPPUNIT_TEST_SUITE_END(); public: void testUMeshTessellate2D1(); void testIntersect2DMeshesTmp4(); + void testGetCellIdsCrossingPlane1(); }; } -- 2.39.2