From a87bea6b1c48fe0fca7b475f28f57055d5e09e9f Mon Sep 17 00:00:00 2001 From: geay Date: Mon, 24 Feb 2014 14:38:59 +0100 Subject: [PATCH] A little test to use remapper to find non conform cells --- .../MEDCouplingRemapperTest.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py index 90ac69ffb..c65f85d99 100644 --- a/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingRemapperTest.py @@ -695,6 +695,33 @@ class MEDCouplingBasicsTest(unittest.TestCase): delta=m0-m1t self.assertTrue(DataArrayDouble(delta.data).isUniform(0.,1e-17)) pass + + @unittest.skipUnless(MEDCouplingHasNumPyBindings() and MEDCouplingHasSciPyBindings(),"requires numpy AND scipy") + def testNonConformWithRemapper_1(self): + coo=DataArrayDouble([-0.396700000780411,-0.134843245350081,-0.0361311386958691,-0.407550009429364,-0.13484324535008,-0.0361311386958923,-0.396700000780411,-0.132191446077668,-0.0448729493559049,-0.407550009429364,-0.132191446077666,-0.0448729493559254,-0.396700000780411,-0.128973582738749,-0.0534226071577727,-0.407550009429364,-0.128973582738747,-0.0534226071577904,-0.396700000780411,-0.128348829636458,-0.0346583696473619,-0.407550009429364,-0.128348829636457,-0.0346583696473822,-0.396700000780411,-0.125874740261886,-0.0430683597970123,-0.407550009429364,-0.125874740261885,-0.0430683597970302,-0.396700000780411,-0.122905344829122,-0.051310216195766,-0.407550009429364,-0.12290534482912,-0.0513102161957814],12,3) + conn=DataArrayInt([2,9,3,11,2,3,5,11,2,8,9,11,2,10,8,11,2,5,4,11,2,4,10,11,3,0,1,6,3,1,7,6,3,2,0,6,3,8,2,6,3,7,9,6,3,9,8,6]) + m=MEDCoupling1SGTUMesh("mesh",NORM_TETRA4) + m.setNodalConnectivity(conn) + m.setCoords(coo) + # m is ready + m1,d,di,rd,rdi=m.buildUnstructured().buildDescendingConnectivity() + rdi2=rdi.deltaShiftIndex() + cellIds=rdi2.getIdsEqual(1) + skinAndNonConformCells=m1[cellIds] + skinAndNonConformCells.zipCoords() # at this point skinAndNonConformCells contains non conform cells and skin cells. Now trying to split them in two parts. + # + rem=MEDCouplingRemapper() + rem.setMaxDistance3DSurfIntersect(1e-12) + rem.setMinDotBtwPlane3DSurfIntersect(0.99)# this line is important it is to tell to remapper to select only cells with very close orientation + rem.prepare(skinAndNonConformCells,skinAndNonConformCells,"P0P0") + mat=rem.getCrudeCSRMatrix() + indptr=DataArrayInt(mat.indptr) + indptr2=indptr.deltaShiftIndex() + cellIdsOfNonConformCells=indptr2.getIdsNotEqual(1) + cellIdsOfSkin=indptr2.getIdsEqual(1) + self.assertTrue(cellIdsOfSkin.isEqual(DataArrayInt([1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,19,20,21,23]))) + self.assertTrue(cellIdsOfNonConformCells.isEqual(DataArrayInt([0,4,18,22]))) + pass def build2DSourceMesh_1(self): sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7] -- 2.39.2