]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Check coherency between the spacedim and the input array in translate.
authorageay <ageay>
Tue, 17 Apr 2012 07:32:52 +0000 (07:32 +0000)
committerageay <ageay>
Tue, 17 Apr 2012 07:32:52 +0000 (07:32 +0000)
src/MEDCoupling_Swig/MEDCoupling.i
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py

index 72cd6feb5df565a29414e000ee7e1e4afe51f019..8fd8bbfd98ad21d9a922a942f4229b2e00905900 100644 (file)
@@ -631,6 +631,12 @@ namespace ParaMEDMEM
          {
            int sz;
            INTERP_KERNEL::AutoPtr<double> 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);
          }
 
index 4f297fcaf2c71ab1ddea564deb4dc5978baf379a..6d3345e77b32278b1b5d7b9ae71bf4a92a814469 100644 (file)
@@ -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);