From 584bab5f7596b65a3a87a34b63e54d2bd1ff8894 Mon Sep 17 00:00:00 2001 From: bruneton Date: Wed, 4 Sep 2013 12:35:52 +0000 Subject: [PATCH] Bug fix: CellModel - POLYL cell model was buggy (missing 'break' in a switch()) --- src/INTERP_KERNEL/CellModel.cxx | 1 + src/MEDCoupling/MEDCouplingUMesh.cxx | 2 +- .../Test/MEDCouplingBasicsTest5.cxx | 22 +++++++++++++++++++ .../Test/MEDCouplingBasicsTest5.hxx | 2 ++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index 853e99e24..44523f8bc 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -414,6 +414,7 @@ namespace INTERP_KERNEL { _nb_of_pts=0; _nb_of_sons=0; _dim=1; _dyn=true; _extruded_type=NORM_POLYGON; _is_simplex=false; } + break; case NORM_ERROR: { _nb_of_pts=std::numeric_limits::max(); _nb_of_sons=std::numeric_limits::max(); _dim=std::numeric_limits::max(); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 7d65c7ba5..bd2f9b5dc 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -5207,7 +5207,7 @@ void MEDCouplingUMesh::tessellate2DCurve(double eps) newConnIPtr[1]=newConnIPtr[0]+3; } } - if(addCoo.empty() && ((int)newConn.size())==_nodal_connec->getNumberOfTuples())//nothing happens during tasselation : no update needed + if(addCoo.empty() && ((int)newConn.size())==_nodal_connec->getNumberOfTuples())//nothing happens during tessellation : no update needed return ; _types=types; DataArrayInt::SetArrayIn(newConnI,_nodal_connec_index); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index 09854dfc7..ea3d7126d 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -84,6 +84,28 @@ void MEDCouplingBasicsTest5::testUMeshTessellate2D1() m1->decrRef(); } +void MEDCouplingBasicsTest5::testUMeshTessellate2DCurve1() +{ + // A quarter of circle: + double mcoords[6] = {0.4,0.0, 0.0,-0.4, 0.283,-0.283}; + int mconnec[3] = {0,1,2}; + + MEDCouplingUMesh *m1 = MEDCouplingUMesh::New(); + m1->setMeshDimension(1); + m1->allocateCells(1); + m1->insertNextCell(INTERP_KERNEL::NORM_SEG3, 3, mconnec); + + DataArrayDouble *myCoords = DataArrayDouble::New(); + myCoords->alloc(3,2); + std::copy(mcoords,mcoords+6,myCoords->getPointer()); + m1->setCoords(myCoords); + myCoords->decrRef(); + + MEDCouplingUMesh *m2 = static_cast(m1->deepCpy()); + m2->tessellate2DCurve(0.1); + CPPUNIT_ASSERT_NO_THROW(m2->checkCoherency1(0.0)); // eps param not used +} + /*! * idem MEDCouplingBasicsTest4::testIntersect2DMeshesTmp3 except that m1 and m2 are permuted on call to MEDCouplingUMesh::Intersect2DMeshes */ diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx index d38cccdd0..9df6e65fb 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx @@ -37,6 +37,7 @@ namespace ParaMEDMEM { CPPUNIT_TEST_SUITE(MEDCouplingBasicsTest5); CPPUNIT_TEST( testUMeshTessellate2D1 ); + CPPUNIT_TEST( testUMeshTessellate2DCurve1 ); CPPUNIT_TEST( testIntersect2DMeshesTmp4 ); CPPUNIT_TEST( testGetCellIdsCrossingPlane1 ); CPPUNIT_TEST( testBuildSlice3D1 ); @@ -77,6 +78,7 @@ namespace ParaMEDMEM CPPUNIT_TEST_SUITE_END(); public: void testUMeshTessellate2D1(); + void testUMeshTessellate2DCurve1(); void testIntersect2DMeshesTmp4(); void testGetCellIdsCrossingPlane1(); void testBuildSlice3D1(); -- 2.39.2