From: ageay Date: Tue, 17 Apr 2012 07:32:52 +0000 (+0000) Subject: Check coherency between the spacedim and the input array in translate. X-Git-Tag: TRIPOLI_323~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=32754f948b0f4278e49b900d762c40b6caeae5cc;p=tools%2Fmedcoupling.git Check coherency between the spacedim and the input array in translate. --- diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index 72cd6feb5..8fd8bbfd9 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -631,6 +631,12 @@ namespace ParaMEDMEM { int sz; INTERP_KERNEL::AutoPtr v=convertPyToNewDblArr2(vector,&sz); + if(sz!=self->getSpaceDimension()) + { + std::ostringstream oss; oss << "Python wrap of MEDCouplingPointSet::translate : the space dimension is " << self->getSpaceDimension() << " and the input array size is " << sz; + oss << " ! The size of the input list or tuple must be equal to " << self->getSpaceDimension() << " !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } self->translate(v); } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 4f297fcaf..6d3345e77 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -5509,7 +5509,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(tmp2); self.assertEqual(37,tmp3); i.convertDegeneratedCells(); - vec1=[10.,0.,0.] + vec1=[10.,0] i.translate(vec1); g2=h.applyFunc(3,"13.5/3.5*x*IVec+0*JVec+13.5/3.5*y*KVec"); f.setCoords(g2);