From: abn Date: Mon, 8 Dec 2014 09:59:00 +0000 (+0100) Subject: CheckDeepEquivalWith should also return OK with two empty meshes. X-Git-Tag: V7_5_1b1~1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fabn%2FcheckDeepEquival;p=modules%2Fmed.git CheckDeepEquivalWith should also return OK with two empty meshes. --- 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();