From: Anthony Geay Date: Mon, 8 Aug 2016 14:27:09 +0000 (+0200) Subject: DGTUMesh with no cells can be now converted into umesh X-Git-Tag: V8_1_0b1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7c09bf68f1093d873ae9be62c2b1bd14edb7ecc5;p=tools%2Fmedcoupling.git DGTUMesh with no cells can be now converted into umesh --- diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index 3a41929d7..e702119f7 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -2357,7 +2357,7 @@ void MEDCoupling1DGTUMesh::checkConsistencyOfConnectivity() const if(c1->getInfoOnComponent(0)!="") throw INTERP_KERNEL::Exception("Nodal connectivity index array is expected to have no info on its single component !"); int f=c1->front(),ll=c1->back(); - if(f<0 || f>=sz2) + if(f<0 || (sz2>0 && f>=sz2)) { std::ostringstream oss; oss << "Nodal connectivity index array first value (" << f << ") is expected to be exactly in [0," << sz2 << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 68144cd98..e41149f6b 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -6693,7 +6693,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::computeDiameterField() const } /*! - * This method aggregate the bbox of each cell and put it into bbox parameter. + * This method aggregate the bbox of each cell and put it into bbox parameter (xmin,xmax,ymin,ymax,zmin,zmax). * * \param [in] arcDetEps - a parameter specifying in case of 2D quadratic polygon cell the detection limit between linear and arc circle. (By default 1e-12) * For all other cases this input parameter is ignored. diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index a0821c1bf..5722fee79 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -4301,6 +4301,13 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(a,3.2,12) pass + def testNoThrowOn1DGTU2UOnNullCells(self): + """ Non regression test : no throw when trying to convert 1DGTUMesh to UMesh on an empty mesh""" + m=MEDCoupling1DGTUMesh("",NORM_POLYGON) ; m.setCoords(DataArrayDouble([],0,3)) + m.setNodalConnectivity(DataArrayInt([]),DataArrayInt([0])) + m=m.buildUnstructured() + pass + pass if __name__ == '__main__':