Salome HOME
Thank you to Yutaka Nishizawa for having report this bug (SALOME forum).
[tools/medcoupling.git] / src / MEDCoupling_Swig / MEDCouplingMemArray.i
index d7a5df027012fafbfa051a658ca88f0eb76cae5b..ce219c7749ecc698cdec2ba48a863a2a0eed7a90 100644 (file)
@@ -93,6 +93,7 @@
 %newobject MEDCoupling::DataArrayInt::findIdsEqualList;
 %newobject MEDCoupling::DataArrayInt::findIdsNotEqualList;
 %newobject MEDCoupling::DataArrayInt::findIdsEqualTuple;
+%newobject MEDCoupling::DataArrayInt::findIdForEach;
 %newobject MEDCoupling::DataArrayInt::sumPerTuple;
 %newobject MEDCoupling::DataArrayInt::negate;
 %newobject MEDCoupling::DataArrayInt::computeAbs;
@@ -916,9 +917,8 @@ namespace MEDCoupling
     void checkNoNullValues() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const throw(INTERP_KERNEL::Exception);
     void recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::Exception);
-    double getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
     double getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
-    double getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
+    double getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
     double getMinValueInArray() const throw(INTERP_KERNEL::Exception);
     int count(double value, double eps) const throw(INTERP_KERNEL::Exception);
     double getAverageValue() const throw(INTERP_KERNEL::Exception);
@@ -1293,6 +1293,16 @@ namespace MEDCoupling
         return ret;
       }
 
+         PyObject *getMaxAbsValue() const throw(INTERP_KERNEL::Exception)
+      {
+        std::size_t tmp;
+        double r1=self->getMaxAbsValue(tmp);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,PyFloat_FromDouble(r1));
+        PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+        return ret;
+      }
+
       PyObject *getMaxValue2() const throw(INTERP_KERNEL::Exception)
       {
         DataArrayInt *tmp;
@@ -2313,9 +2323,8 @@ namespace MEDCoupling
     bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
     int count(int value) const throw(INTERP_KERNEL::Exception);
     int accumulate(int compId) const throw(INTERP_KERNEL::Exception);
-    int getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
     int getMaxValueInArray() const throw(INTERP_KERNEL::Exception);
-    int getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception);
+    int getMaxAbsValueInArray() const throw(INTERP_KERNEL::Exception);
     int getMinValueInArray() const throw(INTERP_KERNEL::Exception);
     void abs() throw(INTERP_KERNEL::Exception);
     DataArrayInt *computeAbs() const throw(INTERP_KERNEL::Exception);
@@ -2534,6 +2543,15 @@ namespace MEDCoupling
         return self->findIdsEqualTuple(bg,bg+sz);
       }
 
+      DataArrayInt *findIdForEach(PyObject *vals) const throw(INTERP_KERNEL::Exception)
+      {
+        int sw,sz,val;
+        std::vector<int> val2;
+        const int *bg(convertIntStarLikePyObjToCppIntStar(vals,sw,sz,val,val2));
+        MCAuto<DataArrayInt> ret(self->findIdForEach(bg,bg+sz));
+        return ret.retn();
+      }
+
       PyObject *splitInBalancedSlices(int nbOfSlices) const throw(INTERP_KERNEL::Exception)
       {
         std::vector< std::pair<int,int> > slcs(self->splitInBalancedSlices(nbOfSlices));
@@ -2962,6 +2980,16 @@ namespace MEDCoupling
         PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
         return ret;
       }
+    
+      PyObject *getMaxAbsValue(std::size_t& tupleId) const throw(INTERP_KERNEL::Exception)
+      {
+       std::size_t tmp;
+        int r1=self->getMaxAbsValue(tmp);
+        PyObject *ret=PyTuple_New(2);
+        PyTuple_SetItem(ret,0,PyInt_FromLong(r1));
+        PyTuple_SetItem(ret,1,PyInt_FromLong(tmp));
+        return ret;
+      }
 
       PyObject *getMinValue() const throw(INTERP_KERNEL::Exception)
       {