]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Swig of DataArray*::pushBackValsSilent
authorageay <ageay>
Wed, 6 Mar 2013 15:40:42 +0000 (15:40 +0000)
committerageay <ageay>
Wed, 6 Mar 2013 15:40:42 +0000 (15:40 +0000)
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDCoupling_Swig/MEDCouplingTypemaps.i

index 179790356fca3d420a7f21a0588184f95f897f2a..920bcbb069c09f9c78cceeb84b915121cc87112b 100644 (file)
@@ -903,6 +903,14 @@ namespace ParaMEDMEM
 
 %extend ParaMEDMEM::DataArrayInt
 {
+  void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
+  {
+    int szArr,sw,iTypppArr;
+    std::vector<int> stdvecTyyppArr;
+    const int *tmp=convertObjToPossibleCpp1_Safe(li,sw,szArr,iTypppArr,stdvecTyyppArr);
+    self->pushBackValsSilent(tmp,tmp+szArr);
+  }
+
   PyObject *getDifferentValues() const throw(INTERP_KERNEL::Exception)
   {
     std::set<int> ret=self->getDifferentValues();
@@ -2954,6 +2962,18 @@ namespace ParaMEDMEM
      return ParaMEDMEM_DataArrayDouble_New__SWIG_1(elt0,nbOfTuples,elt2);
    }
 
+   void pushBackValsSilent(PyObject *li) throw(INTERP_KERNEL::Exception)
+   {
+     double val;
+     DataArrayDouble *a;
+     DataArrayDoubleTuple *aa;
+     std::vector<double> bb;
+     int sw,nbTuples=-1;
+     const char msg[]="Python wrap of DataArrayDouble::pushBackValsSilent : ";
+     const double *tmp=convertObjToPossibleCpp5_Safe2(li,sw,val,a,aa,bb,msg,1,true,nbTuples);
+     self->pushBackValsSilent(tmp,tmp+nbTuples);
+   }
+
    std::string __str__() const
    {
      return self->repr();
index faac758321c176b8785116a543f60447d3088d2f..9aad039d671413ecfa617d1242de19677e833daf 100644 (file)
@@ -1454,7 +1454,7 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
               throw INTERP_KERNEL::Exception(oss.str().c_str());
             }
           else
-            return 0;
+            { nbTuples=0; return 0; }
         }
     }
   status=SWIG_ConvertPtr(value,&argp,SWIGTYPE_p_ParaMEDMEM__DataArrayDoubleTuple,0|0);
@@ -1462,15 +1462,28 @@ static const double *convertObjToPossibleCpp5_Safe2(PyObject *value, int& sw, do
     {  
       e=reinterpret_cast< ParaMEDMEM::DataArrayDoubleTuple * >(argp);
       sw=3;
-      if(e->getNumberOfCompo()==nbCompExpected)
+      if(e)
         {
-          nbTuples=1;
-          return e->getConstPointer();
+          if(e->getNumberOfCompo()==nbCompExpected)
+            {
+              nbTuples=1;
+              return e->getConstPointer();
+            }
+          else
+            {
+              std::ostringstream oss; oss << msg << "nb of components expected to be " <<  nbCompExpected << " , and input DataArrayDoubleTuple has " << e->getNumberOfCompo() << " components !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
         }
       else
         {
-          std::ostringstream oss; oss << msg << "nb of components expected to be " <<  nbCompExpected << " , and input DataArrayDoubleTuple has " << e->getNumberOfCompo() << " components !";
-          throw INTERP_KERNEL::Exception(oss.str().c_str());
+          if(throwIfNullPt)
+            {
+              std::ostringstream oss; oss << msg << " null pointer not accepted!";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+          else
+            { nbTuples=0; return 0; }
         }
     }
   throw INTERP_KERNEL::Exception("4 types accepted : integer, double, DataArrayDouble, DataArrayDoubleTuple");