From: ageay Date: Tue, 24 Apr 2012 09:53:32 +0000 (+0000) Subject: Protection against invalid inputs in MergeUMeshes and MergeUMeshesOnSameCoords X-Git-Tag: TRIPOLI_323~33 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eb6b42e22777ee3d56e56ab0d9783459790eba0d;p=tools%2Fmedcoupling.git Protection against invalid inputs in MergeUMeshes and MergeUMeshesOnSameCoords --- diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 847b22a71..54b1f8464 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -4827,7 +4827,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(const MEDCouplingUMesh *mesh1, /*! * This method returns in case of success a mesh constitued from union of all meshes in 'a'. - * There should be \b no presence of null pointer into 'a'. + * There should be \b no presence of null pointer into 'a'. If any an INTERP_KERNEL::Exception will be thrown. * The returned mesh will contain aggregation of nodes in 'a' (in the same order) and aggregation of * cells in meshes in 'a' (in the same order too). */ @@ -4836,17 +4836,18 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshes(std::vector > bb(sz); std::vector< const MEDCouplingUMesh * > aa(sz); int spaceDim=-3; for(std::size_t i=0;igetCoords(); if(coo) spaceDim=coo->getNumberOfComponents(); @@ -4943,6 +4944,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vectorgetCoords(); int meshDim=meshes.front()->getMeshDimension(); std::vector::const_iterator iter=meshes.begin(); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index e6deb421e..1df73b78f 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -6941,6 +6941,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): # ms=[m1,m2_2,m3_2]; # + self.assertRaises(InterpKernelException,MEDCouplingUMesh.MergeUMeshes,ms+[None]); + self.assertRaises(InterpKernelException,MEDCouplingUMesh.MergeUMeshes,ms+[3.4]) m4=MEDCouplingUMesh.MergeUMeshes(ms); m4.checkCoherency(); self.assertEqual(10,m4.getNumberOfCells());