]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
CheckDeepEquivalWith should also return OK with two empty meshes. abn/checkDeepEquival
authorabn <adrien.bruneton@cea.fr>
Mon, 8 Dec 2014 09:59:00 +0000 (10:59 +0100)
committerabn <adrien.bruneton@cea.fr>
Mon, 8 Dec 2014 09:59:00 +0000 (10:59 +0100)
src/MEDCoupling/MEDCouplingPointSet.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py

index 92870db593529baf53ffc1b5dbf45841c6da7fad..e3cbda93fe3d8da4024bb09b91a14b6ee5005042 100644 (file)
@@ -1459,7 +1459,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int
   int oldNbOfNodes=getNumberOfNodes();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> 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<int>(),oldNbOfNodes-1));
   if(pt!=da->getConstPointer()+da->getNbOfElems())
index 96ae8c4b91fe2516108d4b3827d245f132447122..37ac35f00e9ae6511e19e03a3f024bac64898dac 100644 (file)
@@ -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();