From 7879c5f24fadb8092c146d5e9882581366445405 Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 18 Mar 2013 15:30:21 +0000 Subject: [PATCH] addition of checkDeepEquivalWith and checkDeepEquivalOnSameNodesWith in python API --- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 6 ++++++ src/MEDCoupling_Swig/MEDCouplingCommon.i | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index e29fa484d..183b034d4 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -2669,6 +2669,12 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(nodeCor==None); cellCor=0; self.assertTrue(nodeCor==None); + a,b=mesh1.checkDeepEquivalWith(mesh2,0,1e-12); + self.assertEqual(renum,list(a.getValues())) + self.assertTrue(b==None); + mesh2.setCoords(mesh1.getCoords()) + a=mesh1.checkDeepEquivalOnSameNodesWith(mesh2,0,1e-12); + self.assertEqual(renum,list(a.getValues())) #4th test : cell and node permutation by keeping the first the middle and the last as it is. mesh2=MEDCouplingDataForTest.build2DTargetMesh_3(); renum2=[0,2,1,3,4,5,6,8,7,9,10] diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 513a3822d..1b549df73 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -285,6 +285,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::DataArrayDouble::__rdiv__; %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble; %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy; +%newobject ParaMEDMEM::MEDCouplingMesh::checkDeepEquivalOnSameNodesWith; %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig; %newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell; %newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType; @@ -704,6 +705,24 @@ namespace ParaMEDMEM PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 )); return res; } + + PyObject *checkDeepEquivalWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception) + { + DataArrayInt *cellCor=0,*nodeCor=0; + self->checkDeepEquivalWith(other,cellCompPol,prec,cellCor,nodeCor); + PyObject *res = PyList_New(2); + PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(cellCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, cellCor?SWIG_POINTER_OWN | 0:0 )); + PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(nodeCor),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, nodeCor?SWIG_POINTER_OWN | 0:0 )); + return res; + } + + DataArrayInt *checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec) const throw(INTERP_KERNEL::Exception) + { + DataArrayInt *cellCor=0; + self->checkDeepEquivalOnSameNodesWith(other,cellCompPol,prec,cellCor); + return cellCor; + } + DataArrayInt *getCellIdsFullyIncludedInNodeIds(PyObject *li) const throw(INTERP_KERNEL::Exception) { void *da=0; -- 2.39.2