From 3567980cd75ceaee7a18ef3638310804c0e09e7c Mon Sep 17 00:00:00 2001 From: abn Date: Mon, 8 Dec 2014 10:59:00 +0100 Subject: [PATCH] CheckDeepEquivalWith should also return OK with two empty meshes. --- src/MEDCoupling/MEDCouplingPointSet.cxx | 2 +- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 92870db59..e3cbda93f 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -1459,7 +1459,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int int oldNbOfNodes=getNumberOfNodes(); MEDCouplingAutoRefCountObjectPtr da=m->buildPermArrayForMergeNode(prec,oldNbOfNodes,areNodesMerged,newNbOfNodes); //mergeNodes - if(!areNodesMerged) + if(!areNodesMerged && oldNbOfNodes != 0) throw INTERP_KERNEL::Exception("checkDeepEquivalWith : Nodes are incompatible ! "); const int *pt=std::find_if(da->getConstPointer()+oldNbOfNodes,da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater(),oldNbOfNodes-1)); if(pt!=da->getConstPointer()+da->getNbOfElems()) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 96ae8c4b9..37ac35f00 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -2783,6 +2783,15 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertRaises(InterpKernelException, m.checkDeepEquivalWith, m2, 2, eps) pass + def testSwig2CheckDeepEquivalWith2(self): + eps = 1.0e-8 + m = MEDCouplingUMesh("tst", 2) + m.setCoords(DataArrayDouble([], 0,2)) + m.setConnectivity(DataArrayInt([]), DataArrayInt([0])) + m2 = m.deepCpy() + m.checkDeepEquivalWith(m2, 0, eps) # Should not raise! + pass + def testCopyTinyStringsFromOnFields(self): m=MEDCouplingDataForTest.build3DSurfTargetMesh_1(); nbOfCells=m.getNumberOfCells(); -- 2.39.2