self.assertEqual(rem.getCrudeMatrix(), [{}, {}])
pass
+ def testPointLocator3DTo2D(self):
+ """Target mesh has spaceDim==3 and meshDim==2. Source has spaceDim==3 and meshDim==3. Here we are on pointlocator alg.
+ The test evaluates on each nodes of target mesh the bary coor into source mesh."""
+ src=MEDCouplingCMesh()
+ arr=DataArrayDouble([0,1,2])
+ src.setCoords(arr,arr,arr)
+ src=src.buildUnstructured()
+ src.simplexize(PLANAR_FACE_5)
+ fsrc=MEDCouplingFieldDouble(ON_NODES) ; fsrc.setMesh(src)
+ fsrc.setArray(DataArrayDouble([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))
+ #
+ trg=MEDCouplingCMesh()
+ arr=DataArrayDouble([0,1])
+ trg.setCoords(arr,arr)
+ trg=trg.buildUnstructured()
+ trg.changeSpaceDimension(3,0.)
+ trg.translate([0.5,0.5,0.5])
+ #
+ arrTrg=fsrc.getValueOnMulti(trg.getCoords())
+ ftrg=MEDCouplingFieldDouble(ON_NODES)
+ ftrg.setMesh(trg)
+ ftrg.setArray(arrTrg)
+ ftrg.checkConsistencyLight()
+ ftrg.setNature(IntensiveMaximum)
+ #
+ fsrc.setNature(IntensiveMaximum)
+ remap=MEDCouplingRemapper()
+ remap.setIntersectionType(PointLocator)
+ self.assertEqual(remap.prepare(src,trg,"P1P1"),1)
+ ftrg2=remap.transferField(fsrc,1e300)
+ self.assertTrue(ftrg.isEqual(ftrg2,1e-12,1e-12))
+ pass
+
def testExtrudedOnDiffZLev1(self):
"""Non regression bug : This test is base on P0P0 ExtrudedExtruded. This test checks that if the input meshes are not based on a same plane // OXY the interpolation works"""
arrX=DataArrayDouble([0,1]) ; arrY=DataArrayDouble([0,1]) ; arrZ=DataArrayDouble([0,1,2])
self.checkMatrix(rem2.getCrudeMatrix(),[{0:0.125,1:0.25}],src.getNumberOfCells(),1e-12)
pass
+ def testP0P0WithHEXGP12(self):
+ """ Test that HEXGP12 are correclty remapped (elements with polygonal faces were not properly handled) """
+ # From Astrid, two disjoint hexagonal prisms:
+ coo1 = [-4.991193077144312, 8.644999999999998, 0.0, -9.982386154288623, 6.112246755425186e-16, 0.0, -4.991193077144315, -8.644999999999998, 0.0, 4.991193077144309, -8.645000000000005, 0.0, 9.982386154288626, 1.1651321638577316e-15, 0.0, 4.991193077144314, 8.645, 0.0, -4.991193077144312, 8.644999999999998, 7.561799999999991, -9.982386154288623, 6.112246755425186e-16, 7.561799999999991, -4.991193077144315, -8.644999999999998, 7.561799999999991, 4.991193077144309, -8.645000000000005, 7.561799999999991, 9.982386154288626, 1.1651321638577316e-15, 7.561799999999991, 4.991193077144314, 8.645, 7.561799999999991]
+ coo2 = [-4.991193077144313, -8.645, 0.0, -9.982386154288626, -1.3992140779350848e-15, 0.0, -19.964772308577256, 0.0, 0.0, -24.95596538572157, -8.644999999999998, 0.0, -19.96477230857726, -17.289999999999996, 0.0, -9.982386154288626, -17.289999999999996, 0.0, -4.991193077144313, -8.645, 5.041200000000004, -9.982386154288626, -1.3992140779350848e-15, 5.041200000000004, -19.964772308577256, 0.0, 5.041200000000004, -24.95596538572157, -8.644999999999998, 5.041200000000004, -19.96477230857726, -17.289999999999996, 5.041200000000004, -9.982386154288626, -17.289999999999996, 5.041200000000004]
+ conn1 = [31, 0, 5, 4, 3, 2, 1, -1, 11, 6, 7, 8, 9, 10, -1, 1, 7, 6, 0, -1, 2, 8, 7, 1, -1, 3, 9, 8, 2, -1, 4, 10, 9, 3, -1, 5, 11, 10, 4, -1, 0, 6, 11, 5]
+ cI1 = [0, 44]
+ conn2 = [31, 0, 5, 4, 3, 2, 1, -1, 6, 7, 8, 9, 10, 11, -1, 0, 1, 7, 6, -1, 1, 2, 8, 7, -1, 2, 3, 9, 8, -1, 3, 4, 10, 9, -1, 4, 5, 11, 10, -1, 5, 0, 6, 11]
+ cI2 = [0, 44]
+ mTgt = MEDCouplingUMesh("target", 3)
+ mSrc = MEDCouplingUMesh("src", 3)
+ mTgt.setCoords(DataArrayDouble(coo1, len(coo1)/3, 3))
+ mSrc.setCoords(DataArrayDouble(coo2, len(coo2)/3, 3))
+ mTgt.setConnectivity(DataArrayInt(conn1), DataArrayInt(cI1))
+ mSrc.setConnectivity(DataArrayInt(conn2), DataArrayInt(cI2))
+
+ # Recognize the HEXGP12:
+ mTgt.unPolyze()
+ mSrc.unPolyze()
+
+ rmp = MEDCouplingRemapper()
+ rmp.setIntersectionType(Triangulation)
+ rmp.prepare(mSrc, mTgt, "P0P0")
+ mat = rmp.getCrudeMatrix()
+ self.assertEqual(len(mat[0]), 0)
+ self.assertEqual(len(mat), 1)
+ pass
+
def checkMatrix(self,mat1,mat2,nbCols,eps):
self.assertEqual(len(mat1),len(mat2))
for i in xrange(len(mat1)):