From a3c7bb1e8d61fdf5b990c5c029628e1aa39ab271 Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 1 Dec 2010 08:25:26 +0000 Subject: [PATCH] *** empty log message *** --- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 45 +++++++++++++++++++ src/MEDCoupling_Swig/libMEDCoupling_Swig.i | 1 + 2 files changed, 46 insertions(+) diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 7a07eeacf..97bd6c5c5 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -4960,6 +4960,51 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(7,dt); self.assertEqual(6,it); pass + + def testExtrudedMesh5(self): + coo1=[0.,1.,2.,3.5] + a=DataArrayDouble.New(); + a.setValues(coo1,4,1); + b=MEDCouplingCMesh.New(); + b.setCoordsAt(0,a); + c=b.buildUnstructured(); + self.assertEqual(1,c.getSpaceDimension()); + c.changeSpaceDimension(2); + # + d=DataArrayDouble.New(); + d.alloc(13,1); + d.iota(); + e=MEDCouplingCMesh.New(); + e.setCoordsAt(0,d); + f=e.buildUnstructured(); + g=f.getCoords().applyFunc(2,"3.5*IVec+x/6*3.14159265359*JVec"); + h=g.fromPolarToCart(); + f.setCoords(h); + i=c.buildExtrudedMeshFromThis(f,1); + self.assertEqual(52,i.getNumberOfNodes()); + tmp,tmp2,tmp3=i.mergeNodes(1e-9); + self.assertTrue(tmp2); + self.assertEqual(37,tmp3); + i.convertDegeneratedCells(); + i.checkCoherency(); + self.assertEqual(36,i.getNumberOfCells()); + self.assertEqual(37,i.getNumberOfNodes()); + self.assertEqual(12,i.getNumberOfCellsWithType(NORM_TRI3)); + self.assertEqual(24,i.getNumberOfCellsWithType(NORM_QUAD4)); + expected1=[0.25,0.75,2.0625] + j=i.getMeasureField(True); + for ii in xrange(12): + for k in xrange(3): + self.assertAlmostEqual(expected1[k],j.getIJ(0,ii*3+k),10); + pass + pass + expected2=[0.62200846792814113, 0.16666666666681595, 1.4513530918323276, 0.38888888888923495, 2.6293994326053212, 0.7045454545460802, 0.45534180126145435, 0.45534180126150181, 1.0624642029433926, 1.0624642029435025, 1.9248539780597826, 1.9248539780599816, 0.16666666666661334, 0.62200846792815856, 0.38888888888876294, 1.4513530918323678, 0.70454545454522521, 2.629399432605394, -0.16666666666674007, 0.62200846792812436, -0.38888888888906142, 1.4513530918322881, -0.70454545454576778, 2.6293994326052488, -0.45534180126154766, 0.45534180126140844, -1.0624642029436118, 1.0624642029432834, -1.9248539780601803, 1.9248539780595841, -0.62200846792817499, 0.1666666666665495, -1.451353091832408, 0.388888888888613, -2.6293994326054668, 0.70454545454495332, -0.62200846792810593, -0.16666666666680507, -1.451353091832247, -0.38888888888921297, -2.6293994326051746, -0.70454545454604123, -0.45534180126135926, -0.45534180126159562, -1.0624642029431723, -1.0624642029437235, -1.9248539780593836, -1.9248539780603811, -0.1666666666664828, -0.62200846792819242, -0.38888888888846079, -1.4513530918324489, -0.70454545454467987, -2.6293994326055397, 0.16666666666687083, -0.62200846792808862, 0.38888888888936374, -1.4513530918322073, 0.70454545454631357, -2.6293994326051022, 0.45534180126164348, -0.45534180126131207, 1.0624642029438327, -1.0624642029430627, 1.9248539780605791, -1.9248539780591853, 0.62200846792821063, -0.16666666666641802, 1.4513530918324888, -0.38888888888831086, 2.6293994326056125, -0.70454545454440853] + m=i.getBarycenterAndOwner(); + for i in xrange(72): + self.assertAlmostEqual(expected2[i],m.getIJ(0,i),10); + pass + # + pass def setUp(self): pass diff --git a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i index 4fea0666e..13d52eb7b 100644 --- a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i +++ b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i @@ -237,6 +237,7 @@ namespace ParaMEDMEM virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception) = 0; virtual DataArrayDouble *getCoordinatesAndOwner() const = 0; virtual DataArrayDouble *getBarycenterAndOwner() const = 0; + virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0; virtual std::string simpleRepr() const = 0; virtual std::string advancedRepr() const = 0; -- 2.39.2