From: Adrien Bruneton Date: Tue, 18 Feb 2014 10:33:22 +0000 (+0100) Subject: Bug fix - are2DCellsCorrectlyOriented - added C++ tests as well (valgrind 0) X-Git-Tag: V7_4_0a1~41^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc3db8f7b959898291418e01562f40d1b0053334;p=tools%2Fmedcoupling.git Bug fix - are2DCellsCorrectlyOriented - added C++ tests as well (valgrind 0) --- diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 79b232f4a..365cea85a 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -261,6 +261,38 @@ void MEDCouplingBasicsTest2::testCellOrientation2() m2->decrRef(); } +void MEDCouplingBasicsTest2::testCellOrientation3() +{ + MEDCouplingUMesh *m = MEDCouplingUMesh::New("circle", 2); + + double coords[8]={ 0.,0., 0.,0., 0.,0., 0.,0.}; + coords[0] = cos(-M_PI/4.0); coords[1] = sin(-M_PI/4.0); + coords[2] = cos(3*M_PI/4.0); coords[3] = sin(3*M_PI/4.0); + coords[4] = cos(5*M_PI/4.0); coords[5] = sin(5*M_PI/4.0); + coords[6] = cos(M_PI/4.0); coords[7] = sin(M_PI/4.0); + + int conn[4]= { 0,1,2,3 }; + double vec[3]={0.,0.,-1.}; + m->allocateCells(1); + m->insertNextCell(INTERP_KERNEL::NORM_QPOLYG,4,conn); + m->finishInsertingCells(); + DataArrayDouble *myCoords=DataArrayDouble::New(); + myCoords->alloc(4,2); + std::copy(coords,coords+8,myCoords->getPointer()); + m->setCoords(myCoords); + myCoords->decrRef(); + m->changeSpaceDimension(3); + + std::vector res1; + m->are2DCellsNotCorrectlyOriented(vec,false,res1); + CPPUNIT_ASSERT(res1.empty()); + vec[2] = 1.0; + res1.clear(); + m->are2DCellsNotCorrectlyOriented(vec,false,res1); + CPPUNIT_ASSERT_EQUAL(1,(int)res1.size()); + m->decrRef(); +} + /*! * This test check polyhedron true barycenter computation. */ diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx index 2ca46e688..5247e3c6b 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.hxx @@ -40,6 +40,7 @@ namespace ParaMEDMEM CPPUNIT_TEST( testGaussPointNEField1 ); CPPUNIT_TEST( testCellOrientation1 ); CPPUNIT_TEST( testCellOrientation2 ); + CPPUNIT_TEST( testCellOrientation3 ); CPPUNIT_TEST( testPolyhedronBarycenter ); CPPUNIT_TEST( testNormL12Integ1D ); CPPUNIT_TEST( testAreaBary2D ); @@ -83,6 +84,7 @@ namespace ParaMEDMEM void testGaussPointNEField1(); void testCellOrientation1(); void testCellOrientation2(); + void testCellOrientation3(); void testPolyhedronBarycenter(); void testNormL12Integ1D(); void testAreaBary2D();