]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Some imp for MEDCalculator.
authorageay <ageay>
Tue, 16 Nov 2010 10:13:02 +0000 (10:13 +0000)
committerageay <ageay>
Tue, 16 Nov 2010 10:13:02 +0000 (10:13 +0000)
13 files changed:
src/MEDCoupling/MEDCouplingFieldDouble.cxx
src/MEDCoupling/MEDCouplingFieldDouble.hxx
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingMemArray.hxx
src/MEDCoupling/MEDCouplingTimeDiscretization.cxx
src/MEDCoupling/MEDCouplingTimeDiscretization.hxx
src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx
src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py
src/MEDCoupling_Swig/libMEDCoupling_Swig.i
src/MEDLoader/MEDLoader.cxx
src/MEDLoader/MEDLoader.hxx
src/MEDLoader/Swig/libMEDLoader_Swig.i

index eecbba9784f0b4dcd5924388e7c311a1928af0eb..2c62b3f44913fe14dcf21b0d64354380a9295011 100644 (file)
@@ -715,7 +715,7 @@ MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator=(double value) throw(IN
   if(!_mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::operator= : no mesh defined !");
   int nbOfTuple=_type->getNumberOfTuples(_mesh);
-  _time_discr->setUniformValue(nbOfTuple,value);
+  _time_discr->setUniformValue(nbOfTuple,1,value);
   return *this;
 }
 
@@ -754,6 +754,18 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, FunctionToEvaluate func)
   _time_discr->applyFunc(nbOfComp,func);
 }
 
+/*!
+ * This method is a specialization of other overloaded methods. When 'nbOfComp' equals 1 this method is equivalent to
+ * ParaMEDMEM::MEDCouplingFieldDouble::operator=.
+ */
+void MEDCouplingFieldDouble::applyFunc(int nbOfComp, double val)
+{
+  if(!_mesh)
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::applyFunc : no mesh defined !");
+  int nbOfTuple=_type->getNumberOfTuples(_mesh);
+  _time_discr->setUniformValue(nbOfTuple,nbOfComp,val);
+}
+
 /*!
  * Applyies the function specified by the string repr 'func' on each tuples on all arrays contained in _time_discr.
  * If '*func' fails in evaluation during one evaluation an exception will be thrown.
@@ -1157,6 +1169,21 @@ void MEDCouplingFieldDouble::changeNbOfComponents(int newNbOfComp, double dftVal
   _time_discr->changeNbOfComponents(newNbOfComp,dftValue);
 }
 
+MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds);
+  td->copyTinyAttrFrom(*_time_discr);
+  MEDCouplingFieldDouble *ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
+  ret->setName(getName());
+  ret->setMesh(getMesh());
+  return ret;
+}
+
+void MEDCouplingFieldDouble::setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception)
+{
+  _time_discr->setSelectedComponents(f->_time_discr,compoIds);
+}
+
 void MEDCouplingFieldDouble::sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception)
 {
   _time_discr->sortPerTuple(asc);
index bcdb5861d5c31bed6e15ecf973be43057a1a18d6..48c0bace0db8b96f447ecb9cfeeff11d272d6bc8 100644 (file)
@@ -89,6 +89,7 @@ namespace ParaMEDMEM
     void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func) throw(INTERP_KERNEL::Exception);
     void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
     void applyFunc(int nbOfComp, FunctionToEvaluate func);
+    void applyFunc(int nbOfComp, double val);
     void applyFunc(int nbOfComp, const char *func);
     void applyFunc(const char *func);
     void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
@@ -120,6 +121,8 @@ namespace ParaMEDMEM
     MEDCouplingFieldDouble *magnitude() const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *maxPerTuple() const throw(INTERP_KERNEL::Exception);
     void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+    void setSelectedComponents(const MEDCouplingFieldDouble *f, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
     void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
     static MEDCouplingFieldDouble *mergeFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
     static MEDCouplingFieldDouble *dotFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
index c40c4dd928c25fa3f2c757b9c7838427047e997e..5365cb97c1b0d61a762e6551b8d4add3a9cfa499 100644 (file)
@@ -18,6 +18,7 @@
 //
 
 #include "MEDCouplingMemArray.txx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
 
 #include "GenMathFormulae.hxx"
 #include "InterpKernelExprParser.hxx"
@@ -44,6 +45,36 @@ void DataArray::copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::
   _info_on_compo=other._info_on_compo;
 }
 
+void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception)
+{
+  int nbOfCompoOth=other.getNumberOfComponents();
+  int newNbOfCompo=compoIds.size();
+  for(int i=0;i<newNbOfCompo;i++)
+    if(compoIds[i]>=nbOfCompoOth)
+      {
+        std::ostringstream oss; oss << "Specified component ids is to high (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompoOth << ")";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+  for(int i=0;i<newNbOfCompo;i++)
+    setInfoOnComponent(i,other.getInfoOnComponent(compoIds[i]).c_str());
+}
+
+void DataArray::copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception)
+{
+  int nbOfCompo=getNumberOfComponents();
+  int partOfCompoToSet=compoIds.size();
+  if(partOfCompoToSet!=other.getNumberOfComponents())
+    throw INTERP_KERNEL::Exception("Given compoIds has not the same size as number of components of given array !");
+  for(int i=0;i<partOfCompoToSet;i++)
+    if(compoIds[i]>=nbOfCompo)
+      {
+        std::ostringstream oss; oss << "Specified component ids is to high (" << compoIds[i] << ") compared with nb of actual components (" << nbOfCompo << ")";
+        throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+  for(int i=0;i<partOfCompoToSet;i++)
+    setInfoOnComponent(compoIds[i],other.getInfoOnComponent(i).c_str());
+}
+
 bool DataArray::areInfoEquals(const DataArray& other) const
 {
   if(_nb_of_tuples!=other._nb_of_tuples)
@@ -368,6 +399,36 @@ DataArrayDouble *DataArrayDouble::changeNbOfComponents(int newNbOfComp, double d
   return ret;
 }
 
+DataArrayDouble *DataArrayDouble::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+  int newNbOfCompo=compoIds.size();
+  int oldNbOfCompo=getNumberOfComponents();
+  int nbOfTuples=getNumberOfTuples();
+  ret->alloc(nbOfTuples,newNbOfCompo);
+  ret->copyPartOfStringInfoFrom(*this,compoIds);
+  const double *oldc=getConstPointer();
+  double *nc=ret->getPointer();
+  for(int i=0;i<nbOfTuples;i++)
+    for(int j=0;j<newNbOfCompo;j++,nc++)
+      *nc=oldc[i*oldNbOfCompo+compoIds[j]];
+  ret->incrRef();
+  return ret;
+}
+
+void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception)
+{
+  copyPartOfStringInfoFrom2(compoIds,*a);
+  int partOfCompoSz=compoIds.size();
+  int nbOfCompo=getNumberOfComponents();
+  int nbOfTuples=getNumberOfTuples();
+  const double *ac=a->getConstPointer();
+  double *nc=getPointer();
+  for(int i=0;i<nbOfTuples;i++)
+    for(int j=0;j<partOfCompoSz;j++,ac++)
+      nc[nbOfCompo*i+compoIds[j]]=*ac;
+}
+
 void DataArrayDouble::setArrayIn(DataArrayDouble *newArray, DataArrayDouble* &arrayToSet)
 {
   if(newArray!=arrayToSet)
@@ -1433,6 +1494,36 @@ void DataArrayInt::reAlloc(int nbOfTuples)
   declareAsNew();
 }
 
+DataArrayInt *DataArrayInt::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New());
+  int newNbOfCompo=compoIds.size();
+  int oldNbOfCompo=getNumberOfComponents();
+  int nbOfTuples=getNumberOfTuples();
+  ret->alloc(nbOfTuples,newNbOfCompo);
+  ret->copyPartOfStringInfoFrom(*this,compoIds);
+  const int *oldc=getConstPointer();
+  int *nc=ret->getPointer();
+  for(int i=0;i<nbOfTuples;i++)
+    for(int j=0;j<newNbOfCompo;j++,nc++)
+      *nc=oldc[i*oldNbOfCompo+compoIds[j]];
+  ret->incrRef();
+  return ret;
+}
+
+void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception)
+{
+  copyPartOfStringInfoFrom2(compoIds,*a);
+  int partOfCompoSz=compoIds.size();
+  int nbOfCompo=getNumberOfComponents();
+  int nbOfTuples=getNumberOfTuples();
+  const int *ac=a->getConstPointer();
+  int *nc=getPointer();
+  for(int i=0;i<nbOfTuples;i++)
+    for(int j=0;j<partOfCompoSz;j++,ac++)
+      nc[nbOfCompo*i+compoIds[j]]=*ac;
+}
+
 void DataArrayInt::setArrayIn(DataArrayInt *newArray, DataArrayInt* &arrayToSet)
 {
   if(newArray!=arrayToSet)
index c866a80b3053136f6359319a3b3ce7e27d3d4822..0f5d600d9de142b7fa7b61bea548bf5afe22d6c7 100644 (file)
@@ -84,6 +84,8 @@ namespace ParaMEDMEM
   public:
     MEDCOUPLING_EXPORT void setName(const char *name);
     MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const;
     MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT std::string getName() const { return _name; }
@@ -135,6 +137,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const;
     MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void getTuple(int tupleId, double *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
     MEDCOUPLING_EXPORT double getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
     MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, double newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; declareAsNew(); }
@@ -221,6 +225,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT bool isIdentity() const;
     MEDCOUPLING_EXPORT DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayInt *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void getTuple(int tupleId, int *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); }
     MEDCOUPLING_EXPORT int getIJ(int tupleId, int compoId) const { return _mem[tupleId*_info_on_compo.size()+compoId]; }
     MEDCOUPLING_EXPORT void setIJ(int tupleId, int compoId, int newVal) { _mem[tupleId*_info_on_compo.size()+compoId]=newVal; }
index a98a75f580187c0226a25e097eb400c88ceae476..a150a9cd4e15c2585651a1bc16986efa76c3fccf 100644 (file)
@@ -306,7 +306,6 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::doublyContractedPr
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::determinant() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -320,13 +319,13 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::determinant() cons
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenValues() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -340,13 +339,13 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenValues() cons
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenVectors() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -360,13 +359,13 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::eigenVectors() con
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::inverse() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -380,13 +379,13 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::inverse() const th
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::trace() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -400,13 +399,13 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::trace() const thro
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::deviator() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -420,13 +419,13 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::deviator() const t
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::magnitude() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -440,13 +439,13 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::magnitude() const
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
 MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
@@ -460,10 +459,47 @@ MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::maxPerTuple() cons
   std::vector<DataArrayDouble *> arrays3(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
     arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
+  ret->setArrays(arrays3,0);
+  return ret;
+}
+
+MEDCouplingTimeDiscretization *MEDCouplingTimeDiscretization::keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception)
+{
+  std::vector<DataArrayDouble *> arrays;
+  getArrays(arrays);
+  std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > arrays2(arrays.size());
+  for(int j=0;j<(int)arrays.size();j++)
+    {
+      if(arrays[j])
+        arrays2[j]=arrays[j]->keepSelectedComponents(compoIds);
+      else
+        arrays2[j]=0;
+    }
+  std::vector<DataArrayDouble *> arrays3(arrays.size());
+  for(int j=0;j<(int)arrays.size();j++)
+    arrays3[j]=arrays2[j];
+  MEDCouplingTimeDiscretization *ret=MEDCouplingTimeDiscretization::New(getEnum());
   ret->setArrays(arrays3,0);
   return ret;
 }
 
+void MEDCouplingTimeDiscretization::setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception)
+{
+  std::vector<DataArrayDouble *> arrays1,arrays2;
+  getArrays(arrays1);
+  other->getArrays(arrays2);
+  if(arrays1.size()!=arrays2.size())
+    throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : number of arrays mismatch !");
+  for(unsigned int i=0;i<arrays1.size();i++)
+    {
+      if(arrays1[i]!=0 && arrays2[i]!=0)
+        arrays1[i]->setSelectedComponents(arrays2[i],compoIds);
+      else if(arrays1[i]!=0 || arrays2[i]!=0)
+        throw INTERP_KERNEL::Exception("TimeDiscretization::setSelectedComponents : some time array in correspondance are not defined symetrically !");
+    }
+}
+
 void MEDCouplingTimeDiscretization::changeNbOfComponents(int newNbOfComp, double dftValue) throw(INTERP_KERNEL::Exception)
 {
   std::vector<DataArrayDouble *> arrays;
@@ -493,7 +529,7 @@ void MEDCouplingTimeDiscretization::sortPerTuple(bool asc) throw(INTERP_KERNEL::
     }
 }
 
-void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, double value)
+void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, int nbOfCompo, double value)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -509,7 +545,7 @@ void MEDCouplingTimeDiscretization::setUniformValue(int nbOfTuple, double value)
       else
         {
           DataArrayDouble *tmp=DataArrayDouble::New();
-          tmp->alloc(nbOfTuple,1);
+          tmp->alloc(nbOfTuple,nbOfCompo);
           tmp->fillWithValue(value);
           arrays2[j]=tmp;
         }
@@ -551,7 +587,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate f
 
 void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
 {
- std::vector<DataArrayDouble *> arrays;
 std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
   std::vector<DataArrayDouble *> arrays2(arrays.size());
   for(int j=0;j<(int)arrays.size();j++)
@@ -693,9 +729,9 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::aggregate(const MEDCoupli
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::aggregation on mismatched time discretization !");
+  DataArrayDouble *arr=DataArrayDouble::aggregate(getArray(),other->getArray());
   MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setTimeTolerance(getTimeTolerance());
-  DataArrayDouble *arr=DataArrayDouble::aggregate(getArray(),other->getArray());
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -706,8 +742,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::dot(const MEDCouplingTime
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::dot on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::dot(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -718,8 +754,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::crossProduct(const MEDCou
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::crossProduct on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::crossProduct(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -730,8 +766,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::max(const MEDCouplingTime
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::max(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -742,8 +778,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::min(const MEDCouplingTime
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::max on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::min(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -754,8 +790,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::add(const MEDCouplingTime
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::add on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::add(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -774,8 +810,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::substract(const MEDCoupli
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::substract on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::substract(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -794,8 +830,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::multiply(const MEDCouplin
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("NoTimeLabel::multiply on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::multiply(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -814,8 +850,8 @@ MEDCouplingTimeDiscretization *MEDCouplingNoTimeLabel::divide(const MEDCouplingT
   const MEDCouplingNoTimeLabel *otherC=dynamic_cast<const MEDCouplingNoTimeLabel *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
-  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   DataArrayDouble *arr=DataArrayDouble::divide(getArray(),other->getArray());
+  MEDCouplingNoTimeLabel *ret=new MEDCouplingNoTimeLabel;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -992,9 +1028,9 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::aggregate(const MEDCoupl
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::aggregation on mismatched time discretization !");
+  DataArrayDouble *arr=DataArrayDouble::aggregate(getArray(),other->getArray());
   MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setTimeTolerance(getTimeTolerance());
-  DataArrayDouble *arr=DataArrayDouble::aggregate(getArray(),other->getArray());
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1020,8 +1056,8 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::crossProduct(const MEDCo
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::crossProduct on mismatched time discretization !");
-  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   DataArrayDouble *arr=DataArrayDouble::crossProduct(getArray(),other->getArray());
+  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -1032,8 +1068,8 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::max(const MEDCouplingTim
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::max on mismatched time discretization !");
-  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   DataArrayDouble *arr=DataArrayDouble::max(getArray(),other->getArray());
+  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -1044,8 +1080,8 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::min(const MEDCouplingTim
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::min on mismatched time discretization !");
-  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   DataArrayDouble *arr=DataArrayDouble::min(getArray(),other->getArray());
+  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -1056,8 +1092,8 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::add(const MEDCouplingTim
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::add on mismatched time discretization !");
-  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   DataArrayDouble *arr=DataArrayDouble::add(getArray(),other->getArray());
+  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1079,8 +1115,8 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::substract(const MEDCoupl
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::substract on mismatched time discretization !");
-  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   DataArrayDouble *arr=DataArrayDouble::substract(getArray(),other->getArray());
+  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1102,8 +1138,8 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::multiply(const MEDCoupli
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::multiply on mismatched time discretization !");
-  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   DataArrayDouble *arr=DataArrayDouble::multiply(getArray(),other->getArray());
+  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1125,8 +1161,8 @@ MEDCouplingTimeDiscretization *MEDCouplingWithTimeStep::divide(const MEDCoupling
   const MEDCouplingWithTimeStep *otherC=dynamic_cast<const MEDCouplingWithTimeStep *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("WithTimeStep::divide on mismatched time discretization !");
-  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   DataArrayDouble *arr=DataArrayDouble::divide(getArray(),other->getArray());
+  MEDCouplingWithTimeStep *ret=new MEDCouplingWithTimeStep;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1388,9 +1424,9 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::aggregate(const M
    const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("ConstOnTimeInterval::aggregation on mismatched time discretization !");
+  DataArrayDouble *arr=DataArrayDouble::aggregate(getArray(),other->getArray());
   MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setTimeTolerance(getTimeTolerance());
-  DataArrayDouble *arr=DataArrayDouble::aggregate(getArray(),other->getArray());
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1406,8 +1442,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::dot(const MEDCoup
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("ConstOnTimeInterval::dot on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::dot(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -1418,8 +1454,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::crossProduct(cons
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("ConstOnTimeInterval::crossProduct on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::crossProduct(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -1430,8 +1466,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::max(const MEDCoup
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("ConstOnTimeInterval::max on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::max(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -1442,8 +1478,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::min(const MEDCoup
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("ConstOnTimeInterval::min on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::min(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   return ret;
@@ -1454,8 +1490,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::add(const MEDCoup
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("ConstOnTimeInterval::add on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::add(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1479,8 +1515,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::substract(const M
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("ConstOnTimeInterval::substract on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::substract(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1504,8 +1540,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::multiply(const ME
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("multiply on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::multiply(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1529,8 +1565,8 @@ MEDCouplingTimeDiscretization *MEDCouplingConstOnTimeInterval::divide(const MEDC
   const MEDCouplingConstOnTimeInterval *otherC=dynamic_cast<const MEDCouplingConstOnTimeInterval *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("divide on mismatched time discretization !");
-  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   DataArrayDouble *arr=DataArrayDouble::divide(getArray(),other->getArray());
+  MEDCouplingConstOnTimeInterval *ret=new MEDCouplingConstOnTimeInterval;
   ret->setArray(arr,0);
   arr->decrRef();
   int tmp1,tmp2;
@@ -1899,12 +1935,12 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::aggregate(const MEDCouplin
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::aggregation on mismatched time discretization !");
+  DataArrayDouble *arr1=DataArrayDouble::aggregate(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::aggregate(getEndArray(),other->getEndArray());
   MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setTimeTolerance(getTimeTolerance());
-  DataArrayDouble *arr1=DataArrayDouble::aggregate(getArray(),other->getArray());
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::aggregate(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
@@ -1915,11 +1951,11 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::dot(const MEDCouplingTimeD
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::dot on mismatched time discretization !");
-  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   DataArrayDouble *arr1=DataArrayDouble::dot(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::dot(getEndArray(),other->getEndArray());
+  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::dot(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
@@ -1930,11 +1966,11 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::crossProduct(const MEDCoup
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::crossProduct on mismatched time discretization !");
-  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   DataArrayDouble *arr1=DataArrayDouble::crossProduct(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::crossProduct(getEndArray(),other->getEndArray());
+  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::crossProduct(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
@@ -1960,11 +1996,11 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::min(const MEDCouplingTimeD
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::min on mismatched time discretization !");
-  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   DataArrayDouble *arr1=DataArrayDouble::min(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::min(getEndArray(),other->getEndArray());
+  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::min(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
@@ -1975,11 +2011,11 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::add(const MEDCouplingTimeD
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::add on mismatched time discretization !");
-  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   DataArrayDouble *arr1=DataArrayDouble::add(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::add(getEndArray(),other->getEndArray());
+  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::add(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
@@ -1999,11 +2035,11 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::substract(const MEDCouplin
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::substract on mismatched time discretization !");
-  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   DataArrayDouble *arr1=DataArrayDouble::substract(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::substract(getEndArray(),other->getEndArray());
+  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::substract(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
@@ -2023,11 +2059,11 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::multiply(const MEDCoupling
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::multiply on mismatched time discretization !");
-  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   DataArrayDouble *arr1=DataArrayDouble::multiply(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::multiply(getEndArray(),other->getEndArray());
+  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::multiply(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
@@ -2047,11 +2083,11 @@ MEDCouplingTimeDiscretization *MEDCouplingLinearTime::divide(const MEDCouplingTi
   const MEDCouplingLinearTime *otherC=dynamic_cast<const MEDCouplingLinearTime *>(other);
   if(!otherC)
     throw INTERP_KERNEL::Exception("LinearTime::divide on mismatched time discretization !");
-  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   DataArrayDouble *arr1=DataArrayDouble::divide(getArray(),other->getArray());
+  DataArrayDouble *arr2=DataArrayDouble::divide(getEndArray(),other->getEndArray());
+  MEDCouplingLinearTime *ret=new MEDCouplingLinearTime;
   ret->setArray(arr1,0);
   arr1->decrRef();
-  DataArrayDouble *arr2=DataArrayDouble::divide(getEndArray(),other->getEndArray());
   ret->setEndArray(arr2,0);
   arr2->decrRef();
   return ret;
index f3e80dd9bb000cd013d83f9f1eefd246ac679eff..e826e12ced90714acd1fe1f42f579d4ce4080243 100644 (file)
@@ -103,9 +103,11 @@ namespace ParaMEDMEM
     virtual MEDCouplingTimeDiscretization *deviator() const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingTimeDiscretization *magnitude() const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingTimeDiscretization *maxPerTuple() const throw(INTERP_KERNEL::Exception);
+    virtual MEDCouplingTimeDiscretization *keepSelectedComponents(const std::vector<int>& compoIds) const throw(INTERP_KERNEL::Exception);
+    virtual void setSelectedComponents(const MEDCouplingTimeDiscretization *other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
     virtual void changeNbOfComponents(int newNbOfComp, double dftValue) throw(INTERP_KERNEL::Exception);
     virtual void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
-    virtual void setUniformValue(int nbOfTuple, double value);
+    virtual void setUniformValue(int nbOfTuple, int nbOfCompo, double value);
     virtual void applyLin(double a, double b, int compoId);
     virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
     virtual void applyFunc(int nbOfComp, const char *func);
index 0e8cf3e7fba34728477d5bd92f568fc0548d0bbe..569560584be281df96e24bb42f92de136ea06917 100644 (file)
@@ -141,6 +141,8 @@ namespace ParaMEDMEM
     CPPUNIT_TEST( testFieldDoubleGetMinMaxValues2 );
     CPPUNIT_TEST( testBuildUnstructuredCMesh1 );
     CPPUNIT_TEST( testDataArrayIntInvertO2NNO21 );
+    CPPUNIT_TEST( testKeepSetSelectedComponent1 );
+    CPPUNIT_TEST( testKeepSetSelectedComponent2 );
     //MEDCouplingBasicsTestInterp.cxx
     CPPUNIT_TEST( test2DInterpP0P0_1 );
     CPPUNIT_TEST( test2DInterpP0P0PL_1 );
@@ -310,6 +312,8 @@ namespace ParaMEDMEM
     void testFieldDoubleGetMinMaxValues2();
     void testBuildUnstructuredCMesh1();
     void testDataArrayIntInvertO2NNO21();
+    void testKeepSetSelectedComponent1();
+    void testKeepSetSelectedComponent2();
     //MEDCouplingBasicsTestInterp.cxx
     void test2DInterpP0P0_1();
     void test2DInterpP0P0PL_1();
index 174d0935c4dcc8363ab7b7ee04fb67a26c9a49f2..0c36bdbad96163ac3618e6a8d92c71934d5a37cd 100644 (file)
@@ -2842,3 +2842,166 @@ void MEDCouplingBasicsTest::testDataArrayIntInvertO2NNO21()
   da2->decrRef();
   da->decrRef();
 }
+
+void MEDCouplingBasicsTest::testKeepSetSelectedComponent1()
+{
+  const double arr1[20]={1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.};
+  DataArrayDouble *a1=DataArrayDouble::New();
+  a1->alloc(5,4);
+  std::copy(arr1,arr1+20,a1->getPointer());
+  a1->setInfoOnComponent(0,"aaaa");
+  a1->setInfoOnComponent(1,"bbbb");
+  a1->setInfoOnComponent(2,"cccc");
+  a1->setInfoOnComponent(3,"dddd");
+  const int arr2[6]={1,2,1,2,0,0};
+  std::vector<int> arr2V(arr2,arr2+6);
+  DataArrayDouble *a2=a1->keepSelectedComponents(arr2V);
+  CPPUNIT_ASSERT_EQUAL(6,a2->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(5,a2->getNumberOfTuples());
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(1))=="cccc");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(2))=="bbbb");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(3))=="cccc");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(4))=="aaaa");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(5))=="aaaa");
+  const double expected1[30]={2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.};
+  for(int i=0;i<30;i++)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],a2->getIJ(0,i),1e-14);
+  DataArrayInt *a3=a1->convertToIntArr();
+  DataArrayInt *a4=a3->keepSelectedComponents(arr2V);
+  CPPUNIT_ASSERT_EQUAL(6,a4->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(5,a4->getNumberOfTuples());
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(1))=="cccc");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(2))=="bbbb");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(3))=="cccc");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
+  for(int i=0;i<30;i++)
+    CPPUNIT_ASSERT_EQUAL(int(expected1[i]),a4->getIJ(0,i));
+  // setSelectedComponents
+  const int arr3[2]={3,2};
+  std::vector<int> arr3V(arr3,arr3+2);
+  DataArrayDouble *a5=a1->keepSelectedComponents(arr3V);
+  a5->setInfoOnComponent(0,"eeee");
+  a5->setInfoOnComponent(1,"ffff");
+  const int arr4[2]={1,2};
+  std::vector<int> arr4V(arr4,arr4+2);
+  a2->setSelectedComponents(a5,arr4V);
+  CPPUNIT_ASSERT_EQUAL(6,a2->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(5,a2->getNumberOfTuples());
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(0))=="bbbb");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(1))=="eeee");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(2))=="ffff");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(3))=="cccc");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(4))=="aaaa");
+  CPPUNIT_ASSERT(std::string(a2->getInfoOnComponent(5))=="aaaa");
+  const double expected2[30]={2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.};
+  for(int i=0;i<30;i++)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],a2->getIJ(0,i),1e-14);
+  DataArrayInt *a6=a5->convertToIntArr();
+  a6->setInfoOnComponent(0,"eeee");
+  a6->setInfoOnComponent(1,"ffff");
+  a4->setSelectedComponents(a6,arr4V);
+  CPPUNIT_ASSERT_EQUAL(6,a4->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(5,a4->getNumberOfTuples());
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(0))=="bbbb");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(1))=="eeee");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(2))=="ffff");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(3))=="cccc");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(4))=="aaaa");
+  CPPUNIT_ASSERT(std::string(a4->getInfoOnComponent(5))=="aaaa");
+  for(int i=0;i<30;i++)
+    CPPUNIT_ASSERT_EQUAL(int(expected2[i]),a4->getIJ(0,i));
+  // test of throw
+  const int arr5[3]={2,3,6};
+  const int arr6[3]={2,7,5};
+  const int arr7[4]={2,1,4,6};
+  std::vector<int> arr5V(arr5,arr5+3);
+  std::vector<int> arr6V(arr6,arr6+3);
+  std::vector<int> arr7V(arr7,arr7+4);
+  CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr5V),INTERP_KERNEL::Exception);
+  CPPUNIT_ASSERT_THROW(a2->keepSelectedComponents(arr6V),INTERP_KERNEL::Exception);
+  CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
+  arr7V.resize(3);
+  CPPUNIT_ASSERT_THROW(a2->setSelectedComponents(a1,arr7V),INTERP_KERNEL::Exception);
+  //
+  a6->decrRef();
+  a5->decrRef();
+  a4->decrRef();
+  a3->decrRef();
+  a2->decrRef();
+  a1->decrRef();
+}
+
+void MEDCouplingBasicsTest::testKeepSetSelectedComponent2()
+{
+  MEDCouplingUMesh *m1=build2DTargetMesh_1();
+  const double arr1[20]={1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.};
+  DataArrayDouble *a1=DataArrayDouble::New();
+  a1->alloc(5,4);
+  std::copy(arr1,arr1+20,a1->getPointer());
+  a1->setInfoOnComponent(0,"aaaa");
+  a1->setInfoOnComponent(1,"bbbb");
+  a1->setInfoOnComponent(2,"cccc");
+  a1->setInfoOnComponent(3,"dddd");
+  MEDCouplingFieldDouble *f1=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+  f1->setTime(2.3,4,5);
+  f1->setMesh(m1);
+  f1->setName("f1");
+  f1->setArray(a1);
+  f1->checkCoherency();
+  //
+  const int arr2[6]={1,2,1,2,0,0};
+  std::vector<int> arr2V(arr2,arr2+6);
+  MEDCouplingFieldDouble *f2=f1->keepSelectedComponents(arr2V);
+  CPPUNIT_ASSERT(f2->getMesh()==f1->getMesh());
+  CPPUNIT_ASSERT(f2->getTimeDiscretization()==ONE_TIME);
+  int dt,it;
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13);
+  CPPUNIT_ASSERT_EQUAL(4,dt);
+  CPPUNIT_ASSERT_EQUAL(5,it);
+  f2->checkCoherency();
+  CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(0))=="bbbb");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(1))=="cccc");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(2))=="bbbb");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(3))=="cccc");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(4))=="aaaa");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(5))=="aaaa");
+  const double expected1[30]={2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.};
+  for(int i=0;i<30;i++)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(expected1[i],f2->getIJ(0,i),1e-14);
+  //setSelectedComponents
+  const int arr3[2]={3,2};
+  std::vector<int> arr3V(arr3,arr3+2);
+  MEDCouplingFieldDouble *f5=f1->keepSelectedComponents(arr3V);
+  f5->setTime(6.7,8,9);
+  f5->getArray()->setInfoOnComponent(0,"eeee");
+  f5->getArray()->setInfoOnComponent(1,"ffff");
+  f5->checkCoherency();
+  const int arr4[2]={1,2};
+  std::vector<int> arr4V(arr4,arr4+2);
+  f2->setSelectedComponents(f5,arr4V);
+  CPPUNIT_ASSERT_EQUAL(6,f2->getNumberOfComponents());
+  CPPUNIT_ASSERT_EQUAL(5,f2->getNumberOfTuples());
+  f2->checkCoherency();
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(2.3,f2->getTime(dt,it),1e-13);
+  CPPUNIT_ASSERT_EQUAL(4,dt);
+  CPPUNIT_ASSERT_EQUAL(5,it);
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(0))=="bbbb");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(1))=="eeee");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(2))=="ffff");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(3))=="cccc");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(4))=="aaaa");
+  CPPUNIT_ASSERT(std::string(f2->getArray()->getInfoOnComponent(5))=="aaaa");
+  const double expected2[30]={2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.};
+  for(int i=0;i<30;i++)
+    CPPUNIT_ASSERT_DOUBLES_EQUAL(expected2[i],f2->getIJ(0,i),1e-14);
+  f5->decrRef();
+  f1->decrRef();
+  f2->decrRef();
+  a1->decrRef();
+  m1->decrRef();
+}
index 474df2db3065c8558fb556bbf54165fcb8d35d99..281f525bf0ee17a237f2f4039457fbb3c0c1347f 100644 (file)
@@ -759,6 +759,8 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         m5=m4.build3DUnstructuredMesh();
         self.assertTrue(m5.isEqual(m3,1e-12));
         f=m5.getMeasureField(True);
+        f.setMesh(m4)
+        self.assertTrue(isinstance(f.getMesh(),MEDCouplingExtrudedMesh))
         arr=f.getArray();
         arrPtr=arr.getValues();
         for i in xrange(15):
@@ -4043,6 +4045,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         m2.checkCoherency();
         f1=m.getMeasureField(False);
         f2=m2.getMeasureField(False);
+        self.assertTrue(isinstance(f1.getMesh(),MEDCouplingCMesh))
         self.assertEqual(f1.getNumberOfTuples(),3);
         self.assertEqual(f2.getNumberOfTuples(),3);
         self.assertEqual(1,m2.getMeshDimension());
@@ -4122,6 +4125,152 @@ class MEDCouplingBasicsTest(unittest.TestCase):
             self.assertEqual(arr2[i],da3.getIJ(i,0));
             pass
         pass
+
+    def testKeepSetSelectedComponent1(self):
+        arr1=[1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.]
+        a1=DataArrayDouble.New();
+        a1.setValues(arr1,5,4);
+        a1.setInfoOnComponent(0,"aaaa");
+        a1.setInfoOnComponent(1,"bbbb");
+        a1.setInfoOnComponent(2,"cccc");
+        a1.setInfoOnComponent(3,"dddd");
+        arr2V=[1,2,1,2,0,0]
+        a2=a1.keepSelectedComponents(arr2V);
+        self.assertEqual(6,a2.getNumberOfComponents());
+        self.assertEqual(5,a2.getNumberOfTuples());
+        self.assertTrue(a2.getInfoOnComponent(0)=="bbbb");
+        self.assertTrue(a2.getInfoOnComponent(1)=="cccc");
+        self.assertTrue(a2.getInfoOnComponent(2)=="bbbb");
+        self.assertTrue(a2.getInfoOnComponent(3)=="cccc");
+        self.assertTrue(a2.getInfoOnComponent(4)=="aaaa");
+        self.assertTrue(a2.getInfoOnComponent(5)=="aaaa");
+        expected1=[2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.]
+        for i in xrange(30):
+            self.assertAlmostEqual(expected1[i],a2.getIJ(0,i),14);
+            pass
+        a3=a1.convertToIntArr();
+        a4=a3.keepSelectedComponents(arr2V);
+        self.assertEqual(6,a4.getNumberOfComponents());
+        self.assertEqual(5,a4.getNumberOfTuples());
+        self.assertTrue(a4.getInfoOnComponent(0)=="bbbb");
+        self.assertTrue(a4.getInfoOnComponent(1)=="cccc");
+        self.assertTrue(a4.getInfoOnComponent(2)=="bbbb");
+        self.assertTrue(a4.getInfoOnComponent(3)=="cccc");
+        self.assertTrue(a4.getInfoOnComponent(4)=="aaaa");
+        self.assertTrue(a4.getInfoOnComponent(5)=="aaaa");
+        for i in xrange(30):
+            self.assertEqual(int(expected1[i]),a4.getIJ(0,i));
+            pass
+        # setSelectedComponents
+        arr3V=[3,2]
+        a5=a1.keepSelectedComponents(arr3V);
+        a5.setInfoOnComponent(0,"eeee");
+        a5.setInfoOnComponent(1,"ffff");
+        arr4V=[1,2]
+        a2.setSelectedComponents(a5,arr4V);
+        self.assertEqual(6,a2.getNumberOfComponents());
+        self.assertEqual(5,a2.getNumberOfTuples());
+        self.assertTrue(a2.getInfoOnComponent(0)=="bbbb");
+        self.assertTrue(a2.getInfoOnComponent(1)=="eeee");
+        self.assertTrue(a2.getInfoOnComponent(2)=="ffff");
+        self.assertTrue(a2.getInfoOnComponent(3)=="cccc");
+        self.assertTrue(a2.getInfoOnComponent(4)=="aaaa");
+        self.assertTrue(a2.getInfoOnComponent(5)=="aaaa");
+        expected2=[2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.]
+        for i in xrange(30):
+            self.assertAlmostEqual(expected2[i],a2.getIJ(0,i),14);
+            pass
+        a6=a5.convertToIntArr();
+        a6.setInfoOnComponent(0,"eeee");
+        a6.setInfoOnComponent(1,"ffff");
+        a4.setSelectedComponents(a6,arr4V);
+        self.assertEqual(6,a4.getNumberOfComponents());
+        self.assertEqual(5,a4.getNumberOfTuples());
+        self.assertTrue(a4.getInfoOnComponent(0)=="bbbb");
+        self.assertTrue(a4.getInfoOnComponent(1)=="eeee");
+        self.assertTrue(a4.getInfoOnComponent(2)=="ffff");
+        self.assertTrue(a4.getInfoOnComponent(3)=="cccc");
+        self.assertTrue(a4.getInfoOnComponent(4)=="aaaa");
+        self.assertTrue(a4.getInfoOnComponent(5)=="aaaa");
+        for i in xrange(30):
+            self.assertEqual(int(expected2[i]),a4.getIJ(0,i));
+            pass
+        # test of throw
+        arr5V=[2,3,6]
+        arr6V=[2,7,5]
+        arr7V=[2,1,4,6]
+        self.assertRaises(Exception,a2.keepSelectedComponents,arr5V);
+        self.assertRaises(Exception,a2.keepSelectedComponents,arr6V);
+        self.assertRaises(Exception,a2.setSelectedComponents,a1,arr7V);
+        arr7V=arr7V[0:3]
+        self.assertRaises(Exception,a2.setSelectedComponents,a1,arr7V);
+        #
+        pass
+
+    def testKeepSetSelectedComponent2(self):
+        m1=MEDCouplingDataForTest.build2DTargetMesh_1();
+        arr1=[1.,2.,3.,4., 11.,12.,13.,14., 21.,22.,23.,24., 31.,32.,33.,34., 41.,42.,43.,44.]
+        a1=DataArrayDouble.New();
+        a1.setValues(arr1,5,4);
+        a1.setInfoOnComponent(0,"aaaa");
+        a1.setInfoOnComponent(1,"bbbb");
+        a1.setInfoOnComponent(2,"cccc");
+        a1.setInfoOnComponent(3,"dddd");
+        f1=MEDCouplingFieldDouble.New(ON_CELLS,ONE_TIME);
+        f1.setTime(2.3,4,5);
+        f1.setMesh(m1);
+        f1.setName("f1");
+        f1.setArray(a1);
+        f1.checkCoherency();
+        #
+        arr2V=[1,2,1,2,0,0]
+        f2=f1.keepSelectedComponents(arr2V);
+        self.assertTrue(f2.getTimeDiscretization()==ONE_TIME);
+        t,dt,it=f2.getTime()
+        self.assertAlmostEqual(2.3,t,13);
+        self.assertEqual(4,dt);
+        self.assertEqual(5,it);
+        f2.checkCoherency();
+        self.assertEqual(6,f2.getNumberOfComponents());
+        self.assertEqual(5,f2.getNumberOfTuples());
+        self.assertTrue(f2.getArray().getInfoOnComponent(0)=="bbbb");
+        self.assertTrue(f2.getArray().getInfoOnComponent(1)=="cccc");
+        self.assertTrue(f2.getArray().getInfoOnComponent(2)=="bbbb");
+        self.assertTrue(f2.getArray().getInfoOnComponent(3)=="cccc");
+        self.assertTrue(f2.getArray().getInfoOnComponent(4)=="aaaa");
+        self.assertTrue(f2.getArray().getInfoOnComponent(5)=="aaaa");
+        expected1=[2.,3.,2.,3.,1.,1., 12.,13.,12.,13.,11.,11., 22.,23.,22.,23.,21.,21., 32.,33.,32.,33.,31.,31., 42.,43.,42.,43.,41.,41.]
+        for i in xrange(30):
+            self.assertAlmostEqual(expected1[i],f2.getIJ(0,i),14);
+            pass
+        #setSelectedComponents
+        arr3V=[3,2]
+        f5=f1.keepSelectedComponents(arr3V);
+        f5.setTime(6.7,8,9);
+        f5.getArray().setInfoOnComponent(0,"eeee");
+        f5.getArray().setInfoOnComponent(1,"ffff");
+        f5.checkCoherency();
+        arr4V=[1,2]
+        f2.setSelectedComponents(f5,arr4V);
+        self.assertEqual(6,f2.getNumberOfComponents());
+        self.assertEqual(5,f2.getNumberOfTuples());
+        f2.checkCoherency();
+        t,dt,it=f2.getTime()
+        self.assertAlmostEqual(2.3,t,13);
+        self.assertEqual(4,dt);
+        self.assertEqual(5,it);
+        self.assertTrue(f2.getArray().getInfoOnComponent(0)=="bbbb");
+        self.assertTrue(f2.getArray().getInfoOnComponent(1)=="eeee");
+        self.assertTrue(f2.getArray().getInfoOnComponent(2)=="ffff");
+        self.assertTrue(f2.getArray().getInfoOnComponent(3)=="cccc");
+        self.assertTrue(f2.getArray().getInfoOnComponent(4)=="aaaa");
+        self.assertTrue(f2.getArray().getInfoOnComponent(5)=="aaaa");
+        expected2=[2.,4.,3.,3.,1.,1., 12.,14.,13.,13.,11.,11., 22.,24.,23.,23.,21.,21., 32.,34.,33.,33.,31.,31., 42.,44.,43.,43.,41.,41.]
+        for i in xrange(30):
+            self.assertAlmostEqual(expected2[i],f2.getIJ(0,i),14);
+            pass
+        #
+        pass
     
     def setUp(self):
         pass
index f6d3f696e8ae84725cfafabbbc266e0e14c204a8..d6b35f44750b7f27179c2b58fcab0f300337dc12 100644 (file)
@@ -76,6 +76,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deviator;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::magnitude;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::maxPerTuple;
+%newobject ParaMEDMEM::MEDCouplingFieldDouble::keepSelectedComponents;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dotFields;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::dot;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::crossProductFields;
@@ -97,6 +98,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::DataArrayInt::performCpy;
 %newobject ParaMEDMEM::DataArrayInt::substr;
 %newobject ParaMEDMEM::DataArrayInt::changeNbOfComponents;
+%newobject ParaMEDMEM::DataArrayInt::keepSelectedComponents;
 %newobject ParaMEDMEM::DataArrayInt::selectByTupleId;
 %newobject ParaMEDMEM::DataArrayInt::renumber;
 %newobject ParaMEDMEM::DataArrayInt::renumberR;
@@ -112,6 +114,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::DataArrayDouble::divide;
 %newobject ParaMEDMEM::DataArrayDouble::substr;
 %newobject ParaMEDMEM::DataArrayDouble::changeNbOfComponents;
+%newobject ParaMEDMEM::DataArrayDouble::keepSelectedComponents;
 %newobject ParaMEDMEM::DataArrayDouble::getIdsInRange;
 %newobject ParaMEDMEM::DataArrayDouble::selectByTupleId;
 %newobject ParaMEDMEM::DataArrayDouble::applyFunc;
@@ -751,6 +754,23 @@ namespace ParaMEDMEM
   };
 }
 
+%extend ParaMEDMEM::DataArray
+{
+  void copyPartOfStringInfoFrom(const DataArray& other, PyObject *li) throw(INTERP_KERNEL::Exception)
+  {
+    std::vector<int> tmp;
+    convertPyToNewIntArr3(li,tmp);
+    self->copyPartOfStringInfoFrom(other,tmp);
+  }
+
+  void copyPartOfStringInfoFrom2(PyObject *li, const DataArray& other) throw(INTERP_KERNEL::Exception)
+  {
+    std::vector<int> tmp;
+    convertPyToNewIntArr3(li,tmp);
+    self->copyPartOfStringInfoFrom2(tmp,other);
+  }
+}
+
 %extend ParaMEDMEM::DataArrayDouble
  {
    std::string __str__() const
@@ -895,6 +915,20 @@ namespace ParaMEDMEM
      PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
      return ret;
    }
+   
+   DataArrayDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+   {
+     std::vector<int> tmp;
+     convertPyToNewIntArr3(li,tmp);
+     return self->keepSelectedComponents(tmp);
+   }
+
+   void setSelectedComponents(const DataArrayDouble *a, PyObject *li) throw(INTERP_KERNEL::Exception)
+   {
+     std::vector<int> tmp;
+     convertPyToNewIntArr3(li,tmp);
+     self->setSelectedComponents(a,tmp);
+   }
  };
 
 %extend ParaMEDMEM::DataArrayInt
@@ -1017,6 +1051,20 @@ namespace ParaMEDMEM
      delete [] tmp;
      return ret;
    }
+
+   DataArrayInt *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+   {
+     std::vector<int> tmp;
+     convertPyToNewIntArr3(li,tmp);
+     return self->keepSelectedComponents(tmp);
+   }
+
+   void setSelectedComponents(const DataArrayInt *a, PyObject *li) throw(INTERP_KERNEL::Exception)
+   {
+     std::vector<int> tmp;
+     convertPyToNewIntArr3(li,tmp);
+     self->setSelectedComponents(a,tmp);
+   }
  };
 
 namespace ParaMEDMEM
@@ -1135,6 +1183,7 @@ namespace ParaMEDMEM
     MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
     void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
     void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
+    void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
     void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
     void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
     void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
@@ -1362,6 +1411,20 @@ namespace ParaMEDMEM
         PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
         return ret;
       }
+      
+      MEDCouplingFieldDouble *keepSelectedComponents(PyObject *li) const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<int> tmp;
+        convertPyToNewIntArr3(li,tmp);
+        return self->keepSelectedComponents(tmp);
+      }
+
+      void setSelectedComponents(const MEDCouplingFieldDouble *f, PyObject *li) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<int> tmp;
+        convertPyToNewIntArr3(li,tmp);
+        self->setSelectedComponents(f,tmp);
+      }
     }
   };
 }
index 1c08abd9429e20415e16e781fa1e71c4688dc99b..cde077cee2c0cf085b15299049b3aafc47f18f26 100644 (file)
@@ -390,6 +390,14 @@ std::vector<std::string> MEDLoader::GetMeshNamesOnField(const char *fileName, co
                     ret.push_back(curMeshName);
                 }
             }
+          med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
+          for(int k=0;k<nbPdt;k++)
+            {
+              MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+              std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
+              if(std::find(ret.begin(),ret.end(),curMeshName)==ret.end())
+                ret.push_back(curMeshName);
+            }
         }
     }
   delete [] maa_ass;
@@ -727,6 +735,137 @@ std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const char *fileName
   return ret;
 }
 
+std::vector< std::pair< std::pair<int,int>, double> > MEDLoader::GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+  CheckFileForRead(fileName);
+  std::string meshNameCpp(meshName);
+  std::vector< std::pair< std::pair<int,int>, double> > ret;
+  med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+  med_int nbFields=MEDnChamp(fid,0);
+  //
+  med_type_champ typcha;
+  med_int ngauss=0;
+  med_int numdt=0,numo=0,nbrefmaa;
+  med_float dt=0.0;
+  med_booleen local;
+  char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
+  char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  //
+  for(int i=0;i<nbFields;i++)
+    {
+      med_int ncomp=MEDnChamp(fid,i+1);
+      char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
+      char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
+      MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
+      std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
+      delete [] comp;
+      delete [] unit;
+      if(curFieldName==fieldName)
+        {
+          bool found=false;
+          for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+            {
+              med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
+              for(int k=0;k<nbPdt;k++)
+                {
+                  MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+                  std::string maa_ass_cpp(maa_ass);
+                  if(meshNameCpp==maa_ass_cpp)
+                    {
+                      found=true;
+                      ret.push_back(std::make_pair(std::make_pair(numdt,numo),dt));
+                    }
+                }
+            }
+          med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
+          for(int k=0;k<nbPdt;k++)
+            {
+              MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+              std::string maa_ass_cpp(maa_ass);
+              if(meshNameCpp==maa_ass_cpp)
+                ret.push_back(std::make_pair(std::make_pair(numdt,numo),dt));
+            }
+        }
+    }
+  delete [] maa_ass;
+  delete [] dt_unit;
+  delete [] nomcha;
+  MEDfermer(fid);
+  return ret;
+}
+
+double MEDLoader::GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+{
+  CheckFileForRead(fileName);
+  med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+  med_int nbFields=MEDnChamp(fid,0);
+  //
+  med_type_champ typcha;
+  med_int ngauss=0;
+  med_int numdt=0,numo=0,nbrefmaa;
+  med_float dt=0.0;
+  med_booleen local;
+  char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
+  char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+  //
+  bool found=false;
+  bool found2=false;
+  double ret;
+  for(int i=0;i<nbFields && !found;i++)
+    {
+      med_int ncomp=MEDnChamp(fid,i+1);
+      char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
+      char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
+      MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
+      std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
+      delete [] comp;
+      delete [] unit;
+      if(curFieldName==fieldName)
+        {
+          found=true;
+          for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found2;j++)
+            {
+              med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
+              for(int k=0;k<nbPdt;k++)
+                {
+                  MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+                  if(numdt==iteration && numo==order)
+                    {
+                      found2=true;
+                      ret=dt;
+                    }
+                }
+            }
+          if(!found2)
+            {
+              med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_NOEUD,MED_NONE);
+              for(int k=0;k<nbPdt && !found2;k++)
+                {
+                  MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,MED_NONE,k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+                  if(numdt==iteration && numo==order)
+                    {
+                      found2=true;
+                      ret=dt;
+                    }
+                }
+            }
+        }
+    }
+  delete [] maa_ass;
+  delete [] dt_unit;
+  delete [] nomcha;
+  MEDfermer(fid);
+  if(!found || !found2)
+    {
+      std::ostringstream oss;
+      oss << "No such field with name \"" << fieldName << "\" and iteration,order=(" << iteration << "," << order << ") exists in file \"" << fileName << "\" !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  return ret;
+}
+
 std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
 {
   CheckFileForRead(fileName);
@@ -1856,6 +1995,8 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField
 std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
                                                                                   const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
 {
+  if(its.empty())
+    return std::vector<ParaMEDMEM::MEDCouplingFieldDouble *>();
   CheckFileForRead(fileName);
   std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ret(its.size());
   if(its.empty())
@@ -2686,5 +2827,8 @@ void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const Pa
       std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions or not exists !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
+  std::string fieldName(f->getName());
+  if(fieldName.empty())
+    throw INTERP_KERNEL::Exception("Trying to write a field with no name ! MED file format needs a not empty field name !");
   MEDLoaderNS::appendFieldDirectly(fileName,f);
 }
index d262c04a34814505f708da4e76aa1ad890c4ad79..b90cad0f778f4114ed85c22b9cbd7b5bda3ad8df 100644 (file)
@@ -99,6 +99,8 @@ class MEDLOADER_EXPORT MEDLoader
   static std::vector< std::pair<int,int> > GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception);
   static std::vector< std::pair<int,int> > GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception);
   static std::vector< std::pair<int,int> > GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+  static std::vector< std::pair< std::pair<int,int>, double> > GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception);
+  static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
   static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
index ddf0c24c0afc1cbbe190c017c937bf4830b09a23..5feded4d5f6275a77b1376b6d20f77c0f8fa32fa 100644 (file)
@@ -58,6 +58,7 @@ public:
   static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
   static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
+  static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
   %extend
      {
        static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
@@ -75,6 +76,22 @@ public:
          return ret;
        }
 
+       static PyObject *GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+       {
+         std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,meshName,fieldName);
+         PyObject *ret=PyList_New(res.size());
+         int rk=0;
+         for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+           {
+             PyObject *elt=PyTuple_New(3);
+             PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first.first));
+             PyTuple_SetItem(elt,1,SWIG_From_int((*iter).first.second));
+             PyTuple_SetItem(elt,2,SWIG_From_double((*iter).second));
+             PyList_SetItem(ret,rk,elt);
+           }
+         return ret;
+       }
+
        static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
        {
          std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);