]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Bug fix: CellModel - POLYL cell model was buggy (missing 'break' in a switch())
authorbruneton <bruneton>
Wed, 4 Sep 2013 12:35:52 +0000 (12:35 +0000)
committerbruneton <bruneton>
Wed, 4 Sep 2013 12:35:52 +0000 (12:35 +0000)
src/INTERP_KERNEL/CellModel.cxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx

index 853e99e2493f53438a6b1dc2235ae85f2ed7105f..44523f8bcee5c997a261b315c620adfb2b6ebcf0 100644 (file)
@@ -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<unsigned>::max(); _nb_of_sons=std::numeric_limits<unsigned>::max(); _dim=std::numeric_limits<unsigned>::max();
index 7d65c7ba5bcf4a6fb64b276c3e83609ce18c430e..bd2f9b5dc8d71f86b280c3c23e85254012d6519e 100644 (file)
@@ -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);
index 09854dfc7ef718a5a20dcf26b3e0fb78a88f9a76..ea3d7126d8bf73a05f9ef48dd267669067ac49c4 100644 (file)
@@ -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<MEDCouplingUMesh *>(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
  */
index d38cccdd0fa147b44e7e162326ca7c9b6622f2b0..9df6e65fb0ea743e8a9a4ad7c0ddcaed09085b59 100644 (file)
@@ -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();