Salome HOME
Merge from V6_main 28/02/2013
authorvsr <vsr@opencascade.com>
Thu, 28 Feb 2013 14:08:57 +0000 (14:08 +0000)
committervsr <vsr@opencascade.com>
Thu, 28 Feb 2013 14:08:57 +0000 (14:08 +0000)
46 files changed:
CMakeLists.txt
build_cmake
build_cmake.bat
doc/CMakeLists.txt
idl/CMakeLists.txt
src/CMakeLists.txt
src/INTERP_KERNEL/CellModel.cxx
src/INTERP_KERNEL/CellModel.hxx
src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx
src/MEDCoupling/MEDCouplingExtrudedMesh.cxx
src/MEDCoupling/MEDCouplingExtrudedMesh.hxx
src/MEDCoupling/MEDCouplingField.cxx
src/MEDCoupling/MEDCouplingField.hxx
src/MEDCoupling/MEDCouplingFieldDiscretization.cxx
src/MEDCoupling/MEDCouplingFieldDiscretization.hxx
src/MEDCoupling/MEDCouplingFieldDouble.cxx
src/MEDCoupling/MEDCouplingFieldDouble.hxx
src/MEDCoupling/MEDCouplingMemArray.cxx
src/MEDCoupling/MEDCouplingMemArray.hxx
src/MEDCoupling/MEDCouplingMesh.hxx
src/MEDCoupling/MEDCouplingRemapper.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCoupling/MEDCouplingUMeshDesc.cxx
src/MEDCoupling/MEDCouplingUMeshDesc.hxx
src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx
src/MEDCouplingCorba_Swig/MEDCouplingCorba.i
src/MEDCouplingCorba_Swig/MEDCouplingCorbaTypemaps.i
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDCoupling_Swig/MEDCouplingRemapperTest.py
src/MEDLoader/CMakeLists.txt
src/MEDLoader/MEDFileData.cxx
src/MEDLoader/MEDFileData.hxx
src/MEDLoader/MEDFileField.cxx
src/MEDLoader/MEDFileParameter.cxx [new file with mode: 0644]
src/MEDLoader/MEDFileParameter.hxx [new file with mode: 0644]
src/MEDLoader/Makefile.am
src/MEDLoader/SauvMedConvertor.cxx
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest3.py
src/MEDLoader/Swig/MEDLoaderTypemaps.i
src/MEDMEM/MEDMEM_GibiMeshDriver.cxx
src/MEDPartitioner/Makefile.am

index 39e1b2347011c6e46461f552287ac994abbf8271..a613e771cbf14d75804c0dcdb4ebc9f8a6c4e093 100644 (file)
@@ -28,6 +28,9 @@ SET(VERSION "7.0.0")
 SET(VERSION_DEV "1")
 SET(WITH_MEDMEMGUI "0")
 
+#Defining all options first
+option(SALOME_USE_MPI "Use MPI containers" OFF)
+
 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
 IF(KERNEL_ROOT_DIR)
   FILE(TO_CMAKE_PATH $ENV{KERNEL_ROOT_DIR} KERNEL_ROOT_DIR)
@@ -35,38 +38,42 @@ IF(KERNEL_ROOT_DIR)
   
   SET(SALOME_MACROS_DIR ${KERNEL_ROOT_DIR}/salome_adm/cmake_files)
   
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPLATFORM.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPYTHON.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindMPI.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindOMNIORB.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindPTHREADS.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindHDF5.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindBOOST.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBXML2.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSWIG.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindPLATFORM.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindPYTHON.cmake)
+  if(SALOME_USE_MPI)
+    INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindMPI.cmake)
+  endif(SALOME_USE_MPI)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindOMNIORB.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindPTHREADS.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindHDF5.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindBOOST.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindLIBXML2.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindSWIG.cmake)
   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindCPPUNIT.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindDOXYGEN.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindDOXYGEN.cmake)
   INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSPHINX.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindLIBBATCH.cmake)
-  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindKERNEL.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/FindSalomeLIBBATCH.cmake)
+  INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/FindKERNEL.cmake)
 
   SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR})
   FILE(TO_CMAKE_PATH $ENV{GUI_ROOT_DIR} GUI_ROOT_DIR)
   IF(GUI_ROOT_DIR)
   SET(MED_ENABLE_GUI ON)
-  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindCAS.cmake)
-  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQT4.cmake)
-  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindOPENGL.cmake)
-  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindVTK.cmake)
-  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindQWT.cmake)
-  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindSIPPYQT.cmake)
-  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/FindGUI.cmake)
+  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindCAS.cmake)
+  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindQT4.cmake)
+  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindOPENGL.cmake)
+  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindVTK.cmake)
+  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindQWT.cmake)
+  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindSIPPYQT.cmake)
+  INCLUDE(${GUI_ROOT_DIR}/adm_local/cmake_files/deprecated/FindGUI.cmake)
   ENDIF(GUI_ROOT_DIR)
 ELSE(KERNEL_ROOT_DIR)
   SET(SALOME_MACROS_DIR ${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files)
   
   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindPLATFORM.cmake)
-  INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake)
+  if(SALOME_USE_MPI)
+    INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindMPI.cmake)
+  endif(SALOME_USE_MPI)
   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindBOOST.cmake)
   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindCPPUNIT.cmake)
   INCLUDE(${CMAKE_SOURCE_DIR}/adm_local_without_kernel/cmake_files/FindHDF5.cmake)
index 0d746fa25b9fd4ce762cb1adabacaa5635bfab62..c96a356db75f60b5177e481f066356c697ee060e 100755 (executable)
@@ -21,8 +21,8 @@
 CURRENT_DIR=`pwd`
 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
 cd ${CONF_DIR}
-if test -f $KERNEL_ROOT_DIR/salome_adm/cmake_files/am2cmake.py ; then
-    python $KERNEL_ROOT_DIR/salome_adm/cmake_files/am2cmake.py --med
+if test -f $KERNEL_ROOT_DIR/salome_adm/cmake_files/deprecated/am2cmake.py ; then
+    python $KERNEL_ROOT_DIR/salome_adm/cmake_files/deprecated/am2cmake.py --med
 else
     python adm_local_without_kernel/cmake_files/am2cmake.py --med
 fi
index 8ecf2a9b73559e6bba067b2d1b4fe7930e2a3726..e6f707d44a996cacee0577e7fbef914f5b4d7420 100644 (file)
@@ -17,4 +17,4 @@
 @REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 @REM
 
-%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --med\r
+%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\deprecated\am2cmake.py --med\r
index f3b35dd2f8182ddba27f63ad3e9871f613f02796..bbecf76550bd75c2efa0f17364977e937b253e6e 100644 (file)
@@ -17,7 +17,6 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-ADD_SUBDIRECTORY(MEDMEM)
 ADD_SUBDIRECTORY(salome)
 ADD_SUBDIRECTORY(doxygen)
 
index 3556b4e15378e97dcdba34486fd4296284b10786..89c389e42afc88bb0325f6d12edaaf5052033b5d 100644 (file)
@@ -18,7 +18,7 @@
 #
 # Author : Anthony Geay (CEA/DEN)
 
-INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/UseOMNIORB.cmake)
+INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/deprecated/UseOMNIORB.cmake)
 
 INCLUDE_DIRECTORIES(
   ${OMNIORB_INCLUDE_DIRS}
index d9ebfc85145f9e0a637cc4647e57fc93ea668739..a87e65412a37a6a31e9facf9356631ab220d6c80 100644 (file)
@@ -52,15 +52,19 @@ IF(MPI_IS_OK)
 ENDIF(MPI_IS_OK)
 
 IF(MED_ENABLE_SPLITTER)
-  SET(COMMON_SUBDIRS ${COMMON_SUBDIRS} MEDPartitioner)
-  SET(OLD_COMMON_SUBDIRS ${OLD_COMMON_SUBDIRS} MEDSPLITTER)
-  IF(SWIG_STATUS)
-    SET(OLD_COMMON_SUBDIRS ${OLD_COMMON_SUBDIRS} MEDSPLITTER_Swig)
-  ENDIF(SWIG_STATUS)
+  IF(MED_ENABLE_MED3)
+    SET(COMMON_SUBDIRS ${COMMON_SUBDIRS} MEDPartitioner)
+    SET(OLD_COMMON_SUBDIRS ${OLD_COMMON_SUBDIRS} MEDSPLITTER)
+    IF(SWIG_STATUS)
+      SET(OLD_COMMON_SUBDIRS ${OLD_COMMON_SUBDIRS} MEDSPLITTER_Swig)
+    ENDIF(SWIG_STATUS)
+  ENDIF(MED_ENABLE_MED3)
 ENDIF(MED_ENABLE_SPLITTER)
 
 IF(MED_ENABLE_RENUMBER)
-  SET(OLD_COMMON_SUBDIRS ${OLD_COMMON_SUBDIRS} RENUMBER)
+  IF(MED_ENABLE_MED3)
+    SET(OLD_COMMON_SUBDIRS ${OLD_COMMON_SUBDIRS} RENUMBER)
+  ENDIF(MED_ENABLE_MED3)
 ENDIF(MED_ENABLE_RENUMBER)
 
 IF(MED_ENABLE_KERNEL)
index 6a027a81990dc74a0211972229b7f598368e7d18..f1d517d575429bd80310c3f1f7f6a01f80293ec4 100644 (file)
@@ -113,6 +113,7 @@ namespace INTERP_KERNEL
     _quadratic=false;
     _dyn=false;
     _extruded_type=NORM_ERROR;
+    _reverse_extruded_type=NORM_ERROR;
     _linear_type=NORM_ERROR;
     _quadratic_type=NORM_ERROR;
     switch(type)
@@ -124,7 +125,7 @@ namespace INTERP_KERNEL
         break;
       case NORM_SEG2:
         {
-          _nb_of_pts=2; _nb_of_sons=2; _dim=1; _extruded_type=NORM_QUAD4; _quadratic_type=NORM_SEG3; _is_simplex=true; _is_extruded=true;
+          _nb_of_pts=2; _nb_of_sons=2; _dim=1; _extruded_type=NORM_QUAD4; _quadratic_type=NORM_SEG3; _is_simplex=true; _is_extruded=true; _reverse_extruded_type=NORM_POINT1;
           _sons_type[0]=NORM_POINT1; _sons_type[1]=NORM_POINT1;
           _sons_con[0][0]=0; _nb_of_sons_con[0]=1;
           _sons_con[1][0]=1; _nb_of_sons_con[1]=1;
@@ -161,7 +162,7 @@ namespace INTERP_KERNEL
         break;
       case NORM_HEXA8:
         {
-          _nb_of_pts=8; _nb_of_sons=6; _dim=3; _quadratic_type=NORM_HEXA20; _is_simplex=false; _is_extruded=true;
+          _nb_of_pts=8; _nb_of_sons=6; _dim=3; _quadratic_type=NORM_HEXA20; _is_simplex=false; _is_extruded=true; _reverse_extruded_type=NORM_QUAD4;
           _sons_type[0]=NORM_QUAD4; _sons_type[1]=NORM_QUAD4; _sons_type[2]=NORM_QUAD4; _sons_type[3]=NORM_QUAD4; _sons_type[4]=NORM_QUAD4; _sons_type[5]=NORM_QUAD4;
           _sons_con[0][0]=0; _sons_con[0][1]=1; _sons_con[0][2]=2; _sons_con[0][3]=3; _nb_of_sons_con[0]=4;
           _sons_con[1][0]=4; _sons_con[1][1]=7; _sons_con[1][2]=6; _sons_con[1][3]=5; _nb_of_sons_con[1]=4;
@@ -241,7 +242,7 @@ namespace INTERP_KERNEL
         break;
       case NORM_PENTA6:
         {
-          _nb_of_pts=6; _nb_of_sons=5; _dim=3; _quadratic_type=NORM_PENTA15; _is_simplex=false; _is_extruded=true;
+          _nb_of_pts=6; _nb_of_sons=5; _dim=3; _quadratic_type=NORM_PENTA15; _is_simplex=false; _is_extruded=true; _reverse_extruded_type=NORM_TRI3;
           _sons_type[0]=NORM_TRI3; _sons_type[1]=NORM_TRI3; _sons_type[2]=NORM_QUAD4; _sons_type[3]=NORM_QUAD4; _sons_type[4]=NORM_QUAD4;
           _sons_con[0][0]=0; _sons_con[0][1]=1; _sons_con[0][2]=2; _nb_of_sons_con[0]=3;
           _sons_con[1][0]=3; _sons_con[1][1]=5; _sons_con[1][2]=4; _nb_of_sons_con[1]=3;
index 27ec69f056128202b6c7583b282dce033f31b000..62c7828ee2c2f4c1540862fdd29c15d1b3ede0b5 100644 (file)
@@ -58,6 +58,7 @@ namespace INTERP_KERNEL
     INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon(unsigned sonId) const { return _nb_of_sons_con[sonId]; }
     INTERPKERNEL_EXPORT unsigned getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const;
     INTERPKERNEL_EXPORT NormalizedCellType getExtrudedType() const { return _extruded_type; }
+    INTERPKERNEL_EXPORT NormalizedCellType getReverseExtrudedType() const { return _reverse_extruded_type; }
     INTERPKERNEL_EXPORT NormalizedCellType getLinearType() const { return _linear_type; }
     INTERPKERNEL_EXPORT NormalizedCellType getQuadraticType() const { return _quadratic_type; }
     INTERPKERNEL_EXPORT NormalizedCellType getSonType(unsigned sonId) const { return _sons_type[sonId]; }
@@ -74,6 +75,7 @@ namespace INTERP_KERNEL
     unsigned _nb_of_sons;
     NormalizedCellType _type;
     NormalizedCellType _extruded_type;
+    NormalizedCellType _reverse_extruded_type;
     NormalizedCellType _linear_type;
     NormalizedCellType _quadratic_type;
     unsigned _sons_con[MAX_NB_OF_SONS][MAX_NB_OF_NODES_PER_ELEM];
index c045279d262248bc88eade712c9501c2c29cfde6..f63772167eab5059862574aac9a13a5bd128cbc4 100644 (file)
@@ -17,8 +17,8 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#ifndef __INTERPKERNELGAUSS_HXX__
-#define __INTERPKERNELGAUSS_HXX__
+#ifndef __INTERPKERNELGAUSSCOORDS_HXX__
+#define __INTERPKERNELGAUSSCOORDS_HXX__
 
 #include "INTERPKERNELDefines.hxx"
 #include "NormalizedUnstructuredMesh.hxx"
@@ -157,4 +157,4 @@ namespace INTERP_KERNEL
     GaussInfoVector _my_gauss_info;
   };
 }
-#endif //INTERPKERNELGAUSS
+#endif //INTERPKERNELGAUSSCOORDS
index 875889dadc19cb4d5f2d0c61752c5d8594fe2c16..e2a184545e146dae3898d684da7b477d9b878820 100644 (file)
@@ -252,6 +252,41 @@ std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingExtrudedMesh::getAllGeoTy
   return ret;
 }
 
+DataArrayInt *MEDCouplingExtrudedMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
+{
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
+  INTERP_KERNEL::NormalizedCellType revExtTyp=cm.getReverseExtrudedType();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+  if(revExtTyp==INTERP_KERNEL::NORM_ERROR)
+    {
+      ret->alloc(0,1);
+      return ret.retn();
+    }
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=_mesh2D->giveCellsWithType(revExtTyp);
+  int nbOfLevs=_mesh1D->getNumberOfCells();
+  int nbOfCells2D=_mesh2D->getNumberOfCells();
+  int nbOfTuples=tmp->getNumberOfTuples();
+  ret->alloc(nbOfLevs*nbOfTuples,1);
+  int *pt=ret->getPointer();
+  for(int i=0;i<nbOfLevs;i++,pt+=nbOfTuples)
+    std::transform(tmp->begin(),tmp->end(),pt,std::bind2nd(std::plus<double>(),i*nbOfCells2D));
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=ret->renumberR(_mesh3D_ids->begin());
+  ret2->sort();
+  return ret2.retn();
+}
+
+DataArrayInt *MEDCouplingExtrudedMesh::computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2D=_mesh2D->computeNbOfNodesPerCell();
+  int nbOfLevs=_mesh1D->getNumberOfCells();
+  int nbOfCells2D=_mesh2D->getNumberOfCells();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret3D=DataArrayInt::New(); ret3D->alloc(nbOfLevs*nbOfCells2D,1);
+  int *pt=ret3D->getPointer();
+  for(int i=0;i<nbOfLevs;i++,pt+=nbOfCells2D)
+     std::copy(ret2D->begin(),ret2D->end(),pt);
+  return ret3D->renumberR(_mesh3D_ids->begin());
+}
+
 int MEDCouplingExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
 {
   int ret=0;
index 8f9bc9c0918ae98377964298cd36f33ce3c8cc82..951a591a4f579fcdf6978321282d90484ce9678c 100644 (file)
@@ -55,6 +55,8 @@ namespace ParaMEDMEM
                                          DataArrayInt *&cellCor) const throw(INTERP_KERNEL::Exception);
     INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
     std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
+    DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
     int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const throw(INTERP_KERNEL::Exception);
index da93e7a6e1d555a5e33489db2ddc15ec0c1d89a5..7a11d759def74c3c7a530d7ad37a5a0c42e8656b 100644 (file)
@@ -395,3 +395,15 @@ int MEDCouplingField::getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL:
   else
     throw INTERP_KERNEL::Exception("MEDCouplingField::getNumberOfMeshPlacesExpected : Empty mesh !");
 }
+
+/*!
+ * Copy tiny info (component names, name, description) but warning the underlying mesh is not renamed (for safety reason).
+ */
+void MEDCouplingField::copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception)
+{
+  if(other)
+    {
+      setName(other->_name.c_str());
+      setDescription(other->_desc.c_str());    
+    }
+}
index 6dbe8bfddaf92747ce9a655719dce9a424d45942..06f5f59697db32edc929bc7f092ef4609700f466 100644 (file)
@@ -50,6 +50,7 @@ namespace ParaMEDMEM
     virtual bool isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const throw(INTERP_KERNEL::Exception);
     virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
     virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
+    virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
     void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh);
     const ParaMEDMEM::MEDCouplingMesh *getMesh() const { return _mesh; }
     void setName(const char *name) { _name=name; }
index 461efc9aa4161ff148172c9e0b33d99913dbbde9..b18ac9978b0e57ad6a5bb3055c4be8e7bf956b27 100644 (file)
@@ -34,6 +34,7 @@
 #include <list>
 #include <limits>
 #include <sstream>
+#include <numeric>
 #include <algorithm>
 #include <functional>
 
@@ -63,6 +64,20 @@ const char MEDCouplingFieldDiscretizationKriging::REPR[]="KRIGING";
 
 const TypeOfField MEDCouplingFieldDiscretizationKriging::TYPE=ON_NODES_KR;
 
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_SEG2[2]={1.,1.};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_SEG3[3]={0.5555555555555556,0.5555555555555556,0.8888888888888888};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_SEG4[4]={0.347854845137454,0.347854845137454,0.652145154862546,0.652145154862546};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_TRI3[3]={0.16666666666666666,0.16666666666666666,0.16666666666666666};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_TRI6[6]={0.0549758718227661,0.0549758718227661,0.0549758718227661,0.11169079483905,0.11169079483905,0.11169079483905};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_TRI7[7]={0.062969590272413,0.062969590272413,0.062969590272413,0.066197076394253,0.066197076394253,0.066197076394253,0.1125};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_QUAD4[4]={1.,1.,1.,1.};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_QUAD9[9]={0.30864197530864196,0.30864197530864196,0.30864197530864196,0.30864197530864196,0.49382716049382713,0.49382716049382713,0.49382716049382713,0.49382716049382713,0.7901234567901234};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_TETRA4[4]={0.041666666666666664,0.041666666666666664,0.041666666666666664,0.041666666666666664};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_PENTA6[6]={0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666,0.16666666666666666};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_HEXA8[8]={1.,1.,1.,1.,1.,1.,1.,1.};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_HEXA27[27]={0.1714677640603567,0.1714677640603567,0.1714677640603567,0.1714677640603567,0.1714677640603567,0.1714677640603567,0.1714677640603567,0.1714677640603567,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.27434842249657065,0.43895747599451296,0.43895747599451296,0.43895747599451296,0.43895747599451296,0.43895747599451296,0.43895747599451296,0.7023319615912208};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_PYRA5[5]={0.13333333333333333,0.13333333333333333,0.13333333333333333,0.13333333333333333,0.13333333333333333};
+
 MEDCouplingFieldDiscretization::MEDCouplingFieldDiscretization():_precision(DFLT_PRECISION)
 {
 }
@@ -140,7 +155,7 @@ std::size_t MEDCouplingFieldDiscretization::getHeapMemorySize() const
  */
 void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingFieldDouble *vol=getMeasureField(mesh,true);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
   int nbOfCompo=arr->getNumberOfComponents();
   int nbOfElems=getNumberOfTuples(mesh);
   std::fill(res,res+nbOfCompo,0.);
@@ -155,7 +170,6 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D
       deno+=v;
     }
   std::transform(res,res+nbOfCompo,res,std::bind2nd(std::multiplies<double>(),1./deno));
-  vol->decrRef();
 }
 
 /*!
@@ -165,7 +179,7 @@ void MEDCouplingFieldDiscretization::normL1(const MEDCouplingMesh *mesh, const D
  */
 void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, double *res) const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingFieldDouble *vol=getMeasureField(mesh,true);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=getMeasureField(mesh,true);
   int nbOfCompo=arr->getNumberOfComponents();
   int nbOfElems=getNumberOfTuples(mesh);
   std::fill(res,res+nbOfCompo,0.);
@@ -181,7 +195,6 @@ void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const D
     }
   std::transform(res,res+nbOfCompo,res,std::bind2nd(std::multiplies<double>(),1./deno));
   std::transform(res,res+nbOfCompo,res,std::ptr_fun<double,double>(std::sqrt));
-  vol->decrRef();
 }
 
 /*!
@@ -191,7 +204,7 @@ void MEDCouplingFieldDiscretization::normL2(const MEDCouplingMesh *mesh, const D
  */
 void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception)
 {
-  MEDCouplingFieldDouble *vol=getMeasureField(mesh,isWAbs);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
   int nbOfCompo=arr->getNumberOfComponents();
   int nbOfElems=getNumberOfTuples(mesh);
   std::fill(res,res+nbOfCompo,0.);
@@ -204,7 +217,6 @@ void MEDCouplingFieldDiscretization::integral(const MEDCouplingMesh *mesh, const
       std::transform(tmp,tmp+nbOfCompo,res,res,std::plus<double>());
     }
   delete [] tmp;
-  vol->decrRef();
 }
 
 void MEDCouplingFieldDiscretization::getSerializationIntArray(DataArrayInt *& arr) const
@@ -309,7 +321,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons
   int oldNbOfElems=arr->getNumberOfTuples();
   int nbOfComp=arr->getNumberOfComponents();
   int newNbOfTuples=newNbOfEntity;
-  DataArrayDouble *arrCpy=arr->deepCpy();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arrCpy=arr->deepCpy();
   const double *ptSrc=arrCpy->getConstPointer();
   arr->reAlloc(newNbOfTuples);
   double *ptToFill=arr->getPointer();
@@ -330,7 +342,6 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons
               //if(!std::equal(ptSrc+i*nbOfComp,ptSrc+(i+1)*nbOfComp,ptToFill+newNb*nbOfComp))
               if(*std::max_element((double *)tmp,((double *)tmp)+nbOfComp)>eps)
                 {
-                  arrCpy->decrRef();
                   std::ostringstream oss;
                   oss << msg << " " << i << " and " << std::find(old2NewPtr,old2NewPtr+i,newNb)-old2NewPtr
                       << " have been merged and " << msg << " field on them are different !";
@@ -339,13 +350,12 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons
             }
         }
     }
-  arrCpy->decrRef();
 }
 
 void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const char *msg)
 {
   int nbOfComp=arr->getNumberOfComponents();
-  DataArrayDouble *arrCpy=arr->deepCpy();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arrCpy=arr->deepCpy();
   const double *ptSrc=arrCpy->getConstPointer();
   arr->reAlloc(new2OldSz);
   double *ptToFill=arr->getPointer();
@@ -354,7 +364,6 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2O
       int oldNb=new2OldPtr[i];
       std::copy(ptSrc+oldNb*nbOfComp,ptSrc+(oldNb+1)*nbOfComp,ptToFill+i*nbOfComp);
     }
-  arrCpy->decrRef();
 }
 
 MEDCouplingFieldDiscretization::~MEDCouplingFieldDiscretization()
@@ -1593,6 +1602,90 @@ DataArrayDouble *MEDCouplingFieldDiscretizationGaussNE::getLocalizationOfDiscVal
   throw INTERP_KERNEL::Exception("Not implemented yet !");
 }
 
+void MEDCouplingFieldDiscretizationGaussNE::integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception)
+{
+  if(!mesh || !arr)
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::integral : input mesh or array is null !");
+  int nbOfCompo=arr->getNumberOfComponents();
+  std::fill(res,res+nbOfCompo,0.);
+  //
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> vol=getMeasureField(mesh,isWAbs);
+  std::set<INTERP_KERNEL::NormalizedCellType> types=mesh->getAllGeoTypes();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
+  nbOfNodesPerCell->computeOffsets2();
+  const double *arrPtr=arr->begin(),*volPtr=vol->getArray()->begin();
+  for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator it=types.begin();it!=types.end();it++)
+    {
+      std::size_t wArrSz=-1;
+      const double *wArr=GetWeightArrayFromGeometricType(*it,wArrSz);
+      INTERP_KERNEL::AutoPtr<double> wArr2=new double[wArrSz];
+      double sum=std::accumulate(wArr,wArr+wArrSz,0.);
+      std::transform(wArr,wArr+wArrSz,(double *)wArr2,std::bind2nd(std::multiplies<double>(),1./sum));      
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=mesh->giveCellsWithType(*it);
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids2=ids->buildExplicitArrByRanges(nbOfNodesPerCell);
+      const int *ptIds2=ids2->begin(),*ptIds=ids->begin();
+      int nbOfCellsWithCurGeoType=ids->getNumberOfTuples();
+      for(int i=0;i<nbOfCellsWithCurGeoType;i++,ptIds++,ptIds2+=wArrSz)
+        {
+          for(int k=0;k<nbOfCompo;k++)
+            {
+              double tmp=0.;
+              for(std::size_t j=0;j<wArrSz;j++)
+                tmp+=arrPtr[nbOfCompo*ptIds2[j]+k]*wArr2[j];
+              res[k]+=tmp*volPtr[*ptIds];
+            }
+        }
+    }
+}
+
+const double *MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth) throw(INTERP_KERNEL::Exception)
+{
+  switch(geoType)
+    {
+    case INTERP_KERNEL::NORM_SEG2:
+      lgth=(int)sizeof(FGP_SEG2)/sizeof(double);
+      return FGP_SEG2;
+    case INTERP_KERNEL::NORM_SEG3:
+      lgth=(int)sizeof(FGP_SEG3)/sizeof(double);
+      return FGP_SEG3;
+    case INTERP_KERNEL::NORM_SEG4:
+      lgth=(int)sizeof(FGP_SEG4)/sizeof(double);
+      return FGP_SEG4;
+    case INTERP_KERNEL::NORM_TRI3:
+      lgth=(int)sizeof(FGP_TRI3)/sizeof(double);
+      return FGP_TRI3;
+    case INTERP_KERNEL::NORM_TRI6:
+      lgth=(int)sizeof(FGP_TRI6)/sizeof(double);
+      return FGP_TRI6;
+    case INTERP_KERNEL::NORM_TRI7:
+      lgth=(int)sizeof(FGP_TRI7)/sizeof(double);
+      return FGP_TRI7;
+    case INTERP_KERNEL::NORM_QUAD4:
+      lgth=(int)sizeof(FGP_QUAD4)/sizeof(double);
+      return FGP_QUAD4;
+    case INTERP_KERNEL::NORM_QUAD9:
+      lgth=(int)sizeof(FGP_QUAD9)/sizeof(double);
+      return FGP_QUAD9;
+    case INTERP_KERNEL::NORM_TETRA4:
+      lgth=(int)sizeof(FGP_TETRA4)/sizeof(double);
+      return FGP_TETRA4;
+    case INTERP_KERNEL::NORM_PENTA6:
+      lgth=(int)sizeof(FGP_PENTA6)/sizeof(double);
+      return FGP_PENTA6;
+    case INTERP_KERNEL::NORM_HEXA8:
+      lgth=(int)sizeof(FGP_HEXA8)/sizeof(double);
+      return FGP_HEXA8;
+    case INTERP_KERNEL::NORM_HEXA27:
+      lgth=(int)sizeof(FGP_HEXA27)/sizeof(double);
+      return FGP_HEXA27;
+    case INTERP_KERNEL::NORM_PYRA5:
+      lgth=(int)sizeof(FGP_PYRA5)/sizeof(double);
+      return FGP_PYRA5;
+    default:
+      throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType : only SEG[2,3,4], TRI[3,6,7], QUAD[4,9], TETRA4, PENTA6, HEXA[8,27], PYRA5 supported !");
+    }
+}
+
 void MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *partBg, const int *partEnd,
                                                                                DataArrayInt *&cellRest)
 {
@@ -1665,8 +1758,7 @@ DataArrayInt *MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFrom
 {
   if(!mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::computeTupleIdsToSelectFromCellIds : null mesh !");
-  const MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> umesh=mesh->buildUnstructured();
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=umesh->computeNbOfNodesPerCell();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nbOfNodesPerCell=mesh->computeNbOfNodesPerCell();
   nbOfNodesPerCell->computeOffsets2();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> sel=DataArrayInt::New(); sel->useArray(startCellIds,false,CPP_DEALLOC,(int)std::distance(startCellIds,endCellIds),1);
   return sel->buildExplicitArrByRanges(nbOfNodesPerCell);
index 8e194911f71a02c4d5ce0df43a621dd2bc8c50fc..c4930dc0184e28eab707d138d60c166e8bf6c5ea 100644 (file)
@@ -286,6 +286,7 @@ namespace ParaMEDMEM
     void renumberArraysForCell(const MEDCouplingMesh *mesh, const std::vector<DataArrayDouble *>& arrays,
                                const int *old2NewBg, bool check) throw(INTERP_KERNEL::Exception);
     DataArrayDouble *getLocalizationOfDiscValues(const MEDCouplingMesh *mesh) const;
+    void integral(const MEDCouplingMesh *mesh, const DataArrayDouble *arr, bool isWAbs, double *res) const throw(INTERP_KERNEL::Exception);
     void computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *partBg, const int *partEnd,
                                             DataArrayInt *&cellRest);
     void checkCompatibilityWithNature(NatureOfField nat) const throw(INTERP_KERNEL::Exception);
@@ -300,11 +301,29 @@ namespace ParaMEDMEM
     void renumberValuesOnNodes(double epsOnVals, const int *old2New, int newNbOfNodes, DataArrayDouble *arr) const;
     void renumberValuesOnCells(double epsOnVals, const MEDCouplingMesh *mesh, const int *old2New, int newSz, DataArrayDouble *arr) const;
     void renumberValuesOnCellsR(const MEDCouplingMesh *mesh, const int *new2old, int newSz, DataArrayDouble *arr) const;
+    static const double *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth) throw(INTERP_KERNEL::Exception);
   protected:
     MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other);
   public:
     static const char REPR[];
     static const TypeOfField TYPE;
+    static const double FGP_SEG2[2];
+    static const double FGP_SEG3[3];
+    static const double FGP_SEG4[4];
+    static const double FGP_TRI3[3];
+    static const double FGP_TRI6[6];
+    static const double FGP_TRI7[7];
+    static const double FGP_QUAD4[4];
+    //static const double FGP_QUAD8[8];
+    static const double FGP_QUAD9[9];
+    static const double FGP_TETRA4[4];
+    //static const double FGP_TETRA10[10];
+    static const double FGP_PENTA6[6];
+    //static const double FGP_PENTA15[15];
+    static const double FGP_HEXA8[8];
+    static const double FGP_HEXA27[27];
+    static const double FGP_PYRA5[5];
+    //static const double FGP_PYRA13[13];
   };
 
   class MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes
index f2fb7e1bda84e3c35bcf7b6a0e68bdce61ecf409..03d44c8d0cc452cfd9266bb0f6c6235ef5592a4a 100644 (file)
@@ -176,13 +176,13 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfT
 /*!
  * Copy tiny info (component names, name, description) but warning the underlying mesh is not renamed (for safety reason).
  */
-void MEDCouplingFieldDouble::copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception)
+void MEDCouplingFieldDouble::copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception)
 {
-  if(other)
+  MEDCouplingField::copyTinyStringsFrom(other);
+  const MEDCouplingFieldDouble *otherC=dynamic_cast<const MEDCouplingFieldDouble *>(other);
+  if(otherC)
     {
-      setName(other->_name.c_str());
-      setDescription(other->_desc.c_str());
-      _time_discr->copyTinyStringsFrom(*other->_time_discr);
+      _time_discr->copyTinyStringsFrom(*otherC->_time_discr);
     }
 }
 
@@ -196,6 +196,13 @@ void MEDCouplingFieldDouble::copyTinyAttrFrom(const MEDCouplingFieldDouble *othe
     {
       _time_discr->copyTinyAttrFrom(*other->_time_discr);
     }
+  
+}
+
+void MEDCouplingFieldDouble::copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception)
+{
+  copyTinyStringsFrom(other);
+  copyTinyAttrFrom(other);
 }
 
 std::string MEDCouplingFieldDouble::simpleRepr() const
index 3b275f9de53cefab76674719e72295cad39aef41..da5e01ba0cf7a034fecc14ae3a2e8b23dc95bbf7 100644 (file)
@@ -38,8 +38,9 @@ namespace ParaMEDMEM
     void setTimeUnit(const char *unit);
     const char *getTimeUnit() const;
     void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
-    void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
+    void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
     void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
+    void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const;
     std::string advancedRepr() const;
     void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
index 4436fa7d1b4aa82e4dae4bbbf226a668d14e215b..a49ba2d8dab2714955859ef235235de5dcb17fcc 100644 (file)
@@ -360,13 +360,13 @@ void DataArray::CheckValueInRangeEx(int value, int start, int end, const char *m
     {
       if(value!=start || end!=start)
         {
-          std::ostringstream oss; oss << "DataArray::CheckValueInRange : " << msg  << " ! Expected start " << start << " of range in [0," << value << "[ !";
+          std::ostringstream oss; oss << "DataArray::CheckValueInRangeEx : " << msg  << " ! Expected start " << start << " of input range, in [0," << value << "[ !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
   if(end<0 || end>value)
     {
-      std::ostringstream oss; oss << "DataArray::CheckClosingParInRange : " << msg  << " ! Expected start " << end << " of range in [0," << value << "[ !";
+      std::ostringstream oss; oss << "DataArray::CheckValueInRangeEx : " << msg  << " ! Expected end " << end << " of input range, in [0," << value << "] !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
 }
@@ -375,7 +375,7 @@ void DataArray::CheckClosingParInRange(int ref, int value, const char *msg) thro
 {
   if(value<0 || value>ref)
     {
-      std::ostringstream oss; oss << "DataArray::CheckClosingParInRange : " << msg  << " ! Expected a range in [0," << ref << "] having closing open parenthesis " << value << " !";
+      std::ostringstream oss; oss << "DataArray::CheckClosingParInRange : " << msg  << " ! Expected input range in [0," << ref << "] having closing open parenthesis " << value << " !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
 }
@@ -584,12 +584,26 @@ void DataArrayDouble::pushBackSilent(double val) throw(INTERP_KERNEL::Exception)
     throw INTERP_KERNEL::Exception("DataArrayDouble::pushBackSilent : not available for DataArrayDouble with number of components different than 1 !");
 }
 
+void DataArrayDouble::pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception)
+{
+  int nbCompo=getNumberOfComponents();
+  if(nbCompo==1)
+    _mem.insertAtTheEnd(valsBg,valsEnd);
+  else if(nbCompo==0)
+    {
+      _info_on_compo.resize(1);
+      _mem.insertAtTheEnd(valsBg,valsEnd);
+    }
+  else
+    throw INTERP_KERNEL::Exception("DataArrayDouble::pushBackValsSilent : not available for DataArrayDouble with number of components different than 1 !");
+}
+
 double DataArrayDouble::popBackSilent() throw(INTERP_KERNEL::Exception)
 {
   if(getNumberOfComponents()==1)
     return _mem.popBack();
   else
-    throw INTERP_KERNEL::Exception("DataArrayDouble::pushBackSilent : not available for DataArrayDouble with number of components different than 1 !");
+    throw INTERP_KERNEL::Exception("DataArrayDouble::popBackSilent : not available for DataArrayDouble with number of components different than 1 !");
 }
 
 void DataArrayDouble::pack() const throw(INTERP_KERNEL::Exception)
@@ -847,7 +861,7 @@ DataArrayDouble *DataArrayDouble::fromNoInterlace() const throw(INTERP_KERNEL::E
 DataArrayDouble *DataArrayDouble::toNoInterlace() const throw(INTERP_KERNEL::Exception)
 {
   if(_mem.isNull())
-    throw INTERP_KERNEL::Exception("DataArrayDouble::fromNoInterlace : Not defined array !");
+    throw INTERP_KERNEL::Exception("DataArrayDouble::toNoInterlace : Not defined array !");
   double *tab=_mem.toNoInterlace(getNumberOfComponents());
   DataArrayDouble *ret=DataArrayDouble::New();
   ret->useArray(tab,true,CPP_DEALLOC,getNumberOfTuples(),getNumberOfComponents());
@@ -860,6 +874,7 @@ DataArrayDouble *DataArrayDouble::toNoInterlace() const throw(INTERP_KERNEL::Exc
  */
 void DataArrayDouble::renumberInPlace(const int *old2New)
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   double *tmp=new double[nbTuples*nbOfCompo];
@@ -877,6 +892,7 @@ void DataArrayDouble::renumberInPlace(const int *old2New)
  */
 void DataArrayDouble::renumberInPlaceR(const int *new2Old)
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   double *tmp=new double[nbTuples*nbOfCompo];
@@ -894,6 +910,7 @@ void DataArrayDouble::renumberInPlaceR(const int *new2Old)
  */
 DataArrayDouble *DataArrayDouble::renumber(const int *old2New) const
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   DataArrayDouble *ret=DataArrayDouble::New();
@@ -913,6 +930,7 @@ DataArrayDouble *DataArrayDouble::renumber(const int *old2New) const
  */
 DataArrayDouble *DataArrayDouble::renumberR(const int *new2Old) const
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   DataArrayDouble *ret=DataArrayDouble::New();
@@ -934,6 +952,7 @@ DataArrayDouble *DataArrayDouble::renumberR(const int *new2Old) const
  */
 DataArrayDouble *DataArrayDouble::renumberAndReduce(const int *old2New, int newNbOfTuple) const
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   DataArrayDouble *ret=DataArrayDouble::New();
@@ -956,7 +975,8 @@ DataArrayDouble *DataArrayDouble::renumberAndReduce(const int *old2New, int newN
  */
 DataArrayDouble *DataArrayDouble::selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const
 {
-  DataArrayDouble *ret=DataArrayDouble::New();
+  checkAllocated();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   int nbComp=getNumberOfComponents();
   ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
   ret->copyStringInfoFrom(*this);
@@ -966,7 +986,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleId(const int *new2OldBg, const in
   for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++)
     std::copy(srcPt+(*w)*nbComp,srcPt+((*w)+1)*nbComp,pt+i*nbComp);
   ret->copyStringInfoFrom(*this);
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -974,6 +994,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleId(const int *new2OldBg, const in
  */
 DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   int nbComp=getNumberOfComponents();
   int oldNbOfTuples=getNumberOfTuples();
@@ -1001,6 +1022,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, cons
  */
 DataArrayDouble *DataArrayDouble::selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   int nbComp=getNumberOfComponents();
   int newNbOfTuples=GetNumberOfItemGivenBES(bg,end2,step,"DataArrayDouble::selectByTupleId2 : ");
@@ -1080,6 +1102,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleRanges(const std::vector<std::pai
  */
 DataArrayDouble *DataArrayDouble::substr(int tupleIdBg, int tupleIdEnd) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbt=getNumberOfTuples();
   if(tupleIdBg<0)
     throw INTERP_KERNEL::Exception("DataArrayDouble::substr : The tupleIdBg parameter must be greater than 0 !");
@@ -1299,6 +1322,7 @@ DataArrayDouble *DataArrayDouble::duplicateEachTupleNTimes(int nbTimes) const th
  */
 DataArrayDouble *DataArrayDouble::getDifferentValues(double prec, int limitTupleId) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   DataArrayInt *c0=0,*cI0=0;
   findCommonTuples(prec,limitTupleId,c0,cI0);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(c0),cI(cI0);
@@ -1311,10 +1335,11 @@ void DataArrayDouble::setSelectedComponents(const DataArrayDouble *a, const std:
 {
   if(!a)
     throw INTERP_KERNEL::Exception("DataArrayDouble::setSelectedComponents : input DataArrayDouble is NULL !");
+  checkAllocated();
   copyPartOfStringInfoFrom2(compoIds,*a);
   std::size_t partOfCompoSz=compoIds.size();
   int nbOfCompo=getNumberOfComponents();
-  int nbOfTuples=getNumberOfTuples();
+  int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
   const double *ac=a->getConstPointer();
   double *nc=getPointer();
   for(int i=0;i<nbOfTuples;i++)
@@ -1339,14 +1364,34 @@ void DataArrayDouble::setPartOfValues1(const DataArrayDouble *a, int bgTuples, i
   int nbOfTuples=getNumberOfTuples();
   DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
   DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
-  a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
-  if(strictCompoCompare)
-    a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
-  double *pt=getPointer()+bgTuples*nbComp+bgComp;
+  bool assignTech=true;
+  if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+    {
+      if(strictCompoCompare)
+        a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+    }
+  else
+    {
+      a->checkNbOfTuplesAndComp(1,newNbOfComp,msg);
+      assignTech=false;
+    }
   const double *srcPt=a->getConstPointer();
-  for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
-    for(int j=0;j<newNbOfComp;j++,srcPt++)
-      pt[j*stepComp]=*srcPt;
+  double *pt=getPointer()+bgTuples*nbComp+bgComp;
+  if(assignTech)
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        for(int j=0;j<newNbOfComp;j++,srcPt++)
+          pt[j*stepComp]=*srcPt;
+    }
+  else
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        {
+          const double *srcPt2=srcPt;
+          for(int j=0;j<newNbOfComp;j++,srcPt2++)
+            pt[j*stepComp]=*srcPt2;
+        }
+    }
 }
 
 /*!
@@ -1514,6 +1559,66 @@ void DataArrayDouble::setPartOfValuesSimple3(double a, const int *bgTuples, cons
       }
 }
 
+void DataArrayDouble::setPartOfValues4(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
+{
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayDouble::setPartOfValues4 : input DataArrayDouble is NULL !");
+  const char msg[]="DataArrayDouble::setPartOfValues4";
+  checkAllocated();
+  a->checkAllocated();
+  int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+  int newNbOfComp=(int)std::distance(bgComp,endComp);
+  int nbComp=getNumberOfComponents();
+  for(const int *z=bgComp;z!=endComp;z++)
+    DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+  int nbOfTuples=getNumberOfTuples();
+  DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+  bool assignTech=true;
+  if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+    {
+      if(strictCompoCompare)
+        a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+    }
+  else
+    {
+      a->checkNbOfTuplesAndComp(1,newNbOfComp,msg);
+      assignTech=false;
+    }
+  const double *srcPt=a->getConstPointer();
+  double *pt=getPointer()+bgTuples*nbComp;
+  if(assignTech)
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        for(const int *z=bgComp;z!=endComp;z++,srcPt++)
+          pt[*z]=*srcPt;
+    }
+  else
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        {
+          const double *srcPt2=srcPt;
+          for(const int *z=bgComp;z!=endComp;z++,srcPt2++)
+            pt[*z]=*srcPt2;
+        }
+    }
+}
+
+void DataArrayDouble::setPartOfValuesSimple4(double a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception)
+{
+  const char msg[]="DataArrayDouble::setPartOfValuesSimple4";
+  checkAllocated();
+  int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+  int nbComp=getNumberOfComponents();
+  for(const int *z=bgComp;z!=endComp;z++)
+    DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+  int nbOfTuples=getNumberOfTuples();
+  DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+  double *pt=getPointer()+bgTuples*nbComp;
+  for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+    for(const int *z=bgComp;z!=endComp;z++)
+      pt[*z]=a;
+}
+
 /*!
  * 'this', 'a' and 'tuplesSelec' are expected to be defined. If not an exception will be thrown.
  * @param a is an array having exactly the same number of components than 'this'
@@ -1521,7 +1626,7 @@ void DataArrayDouble::setPartOfValuesSimple3(double a, const int *bgTuples, cons
  */
 void DataArrayDouble::setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
 {
-  if(!a)
+  if(!a || !tuplesSelec)
     throw INTERP_KERNEL::Exception("DataArrayDouble::setPartOfValuesAdv : input DataArrayDouble is NULL !");
   checkAllocated();
   a->checkAllocated();
@@ -1786,6 +1891,7 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do
 {
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : input pointer other is null !");
+  checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox=computeBBoxPerTuple(eps);
   other->checkAllocated();
   int nbOfCompo=getNumberOfComponents();
@@ -1845,6 +1951,7 @@ void DataArrayDouble::recenterForMaxPrecision(double eps) throw(INTERP_KERNEL::E
 
 double DataArrayDouble::getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before or call 'getMaxValueInArray' method !");
   int nbOfTuples=getNumberOfTuples();
@@ -1877,6 +1984,7 @@ double DataArrayDouble::getMaxValue2(DataArrayInt*& tupleIds) const throw(INTERP
 
 double DataArrayDouble::getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before call 'getMinValueInArray' method !");
   int nbOfTuples=getNumberOfTuples();
@@ -2001,7 +2109,7 @@ double DataArrayDouble::accumulate(int compId) const throw(INTERP_KERNEL::Except
   const double *ptr=getConstPointer();
   int nbTuple=getNumberOfTuples();
   int nbComps=getNumberOfComponents();
-  if(compId>=nbComps)
+  if(compId<0 || compId>=nbComps)
     throw INTERP_KERNEL::Exception("DataArrayDouble::accumulate : Invalid compId specified : No such nb of components !");
   double ret=0.;
   for(int i=0;i<nbTuple;i++)
@@ -2011,6 +2119,7 @@ double DataArrayDouble::accumulate(int compId) const throw(INTERP_KERNEL::Except
 
 DataArrayDouble *DataArrayDouble::fromPolarToCart() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=2)
     throw INTERP_KERNEL::Exception("DataArrayDouble::fromPolarToCart : must be an array with exactly 2 components !");
@@ -2029,6 +2138,7 @@ DataArrayDouble *DataArrayDouble::fromPolarToCart() const throw(INTERP_KERNEL::E
 
 DataArrayDouble *DataArrayDouble::fromCylToCart() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=3)
     throw INTERP_KERNEL::Exception("DataArrayDouble::fromCylToCart : must be an array with exactly 3 components !");
@@ -2049,6 +2159,7 @@ DataArrayDouble *DataArrayDouble::fromCylToCart() const throw(INTERP_KERNEL::Exc
 
 DataArrayDouble *DataArrayDouble::fromSpherToCart() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=3)
     throw INTERP_KERNEL::Exception("DataArrayDouble::fromSpherToCart : must be an array with exactly 3 components !");
@@ -2068,6 +2179,7 @@ DataArrayDouble *DataArrayDouble::fromSpherToCart() const throw(INTERP_KERNEL::E
 
 DataArrayDouble *DataArrayDouble::doublyContractedProduct() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=6)
     throw INTERP_KERNEL::Exception("DataArrayDouble::doublyContractedProduct : must be an array with exactly 6 components !");
@@ -2111,6 +2223,7 @@ DataArrayDouble *DataArrayDouble::determinant() const throw(INTERP_KERNEL::Excep
 
 DataArrayDouble *DataArrayDouble::eigenValues() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=6)
     throw INTERP_KERNEL::Exception("DataArrayDouble::eigenValues : must be an array with exactly 6 components !");
@@ -2126,6 +2239,7 @@ DataArrayDouble *DataArrayDouble::eigenValues() const throw(INTERP_KERNEL::Excep
 
 DataArrayDouble *DataArrayDouble::eigenVectors() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=6)
     throw INTERP_KERNEL::Exception("DataArrayDouble::eigenVectors : must be an array with exactly 6 components !");
@@ -2146,6 +2260,7 @@ DataArrayDouble *DataArrayDouble::eigenVectors() const throw(INTERP_KERNEL::Exce
 
 DataArrayDouble *DataArrayDouble::inverse() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
     throw INTERP_KERNEL::Exception("DataArrayDouble::inversion : must be an array with 4,6 or 9 components !");
@@ -2193,6 +2308,7 @@ if(nbOfComp==6)
 
 DataArrayDouble *DataArrayDouble::trace() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=6 && nbOfComp!=9 && nbOfComp!=4)
     throw INTERP_KERNEL::Exception("DataArrayDouble::trace : must be an array with 4,6 or 9 components !");
@@ -2215,6 +2331,7 @@ DataArrayDouble *DataArrayDouble::trace() const throw(INTERP_KERNEL::Exception)
 
 DataArrayDouble *DataArrayDouble::deviator() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfComp=getNumberOfComponents();
   if(nbOfComp!=6)
     throw INTERP_KERNEL::Exception("DataArrayDouble::deviator : must be an array with exactly 6 components !");
@@ -2379,6 +2496,7 @@ void DataArrayDouble::abs() throw(INTERP_KERNEL::Exception)
   double *ptr=getPointer();
   int nbOfElems=getNbOfElems();
   std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<double,double>(fabs));
+  declareAsNew();
 }
 
 void DataArrayDouble::applyLin(double a, double b, int compoId) throw(INTERP_KERNEL::Exception)
@@ -2675,6 +2793,7 @@ DataArrayDoubleIterator *DataArrayDouble::iterator()
 
 DataArrayInt *DataArrayDouble::getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayDouble::getIdsInRange : this must have exactly one component !");
   const double *cptr=getConstPointer();
@@ -2945,6 +3064,8 @@ void DataArrayDouble::addEqual(const DataArrayDouble *other) throw(INTERP_KERNEL
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayDouble::addEqual : input DataArrayDouble instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayDouble::addEqual  !";
+  checkAllocated();
+  other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -3042,6 +3163,8 @@ void DataArrayDouble::substractEqual(const DataArrayDouble *other) throw(INTERP_
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayDouble::substractEqual : input DataArrayDouble instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayDouble::substractEqual  !";
+  checkAllocated();
+  other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -3154,6 +3277,8 @@ void DataArrayDouble::multiplyEqual(const DataArrayDouble *other) throw(INTERP_K
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayDouble::multiplyEqual : input DataArrayDouble instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayDouble::multiplyEqual !";
+  checkAllocated();
+  other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -3251,6 +3376,8 @@ void DataArrayDouble::divideEqual(const DataArrayDouble *other) throw(INTERP_KER
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayDouble::divideEqual : input DataArrayDouble instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayDouble::divideEqual !";
+  checkAllocated();
+  other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -3586,12 +3713,26 @@ void DataArrayInt::pushBackSilent(int val) throw(INTERP_KERNEL::Exception)
     throw INTERP_KERNEL::Exception("DataArrayInt::pushBackSilent : not available for DataArrayInt with number of components different than 1 !");
 }
 
+void DataArrayInt::pushBackValsSilent(const int *valsBg, const int *valsEnd) throw(INTERP_KERNEL::Exception)
+{
+  int nbCompo=getNumberOfComponents();
+  if(nbCompo==1)
+    _mem.insertAtTheEnd(valsBg,valsEnd);
+  else if(nbCompo==0)
+    {
+      _info_on_compo.resize(1);
+      _mem.insertAtTheEnd(valsBg,valsEnd);
+    }
+  else
+    throw INTERP_KERNEL::Exception("DataArrayInt::pushBackValsSilent : not available for DataArrayInt with number of components different than 1 !");
+}
+
 int DataArrayInt::popBackSilent() throw(INTERP_KERNEL::Exception)
 {
   if(getNumberOfComponents()==1)
     return _mem.popBack();
   else
-    throw INTERP_KERNEL::Exception("DataArrayInt::pushBackSilent : not available for DataArrayInt with number of components different than 1 !");
+    throw INTERP_KERNEL::Exception("DataArrayInt::popBackSilent : not available for DataArrayInt with number of components different than 1 !");
 }
 
 void DataArrayInt::pack() const throw(INTERP_KERNEL::Exception)
@@ -3661,6 +3802,7 @@ std::string DataArrayInt::reprZip() const
 
 void DataArrayInt::writeVTK(std::ostream& ofs, int indent, const char *type, const char *nameInFile) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   std::string idt(indent,' ');
   ofs << idt << "<DataArray type=\"" << type << "\" Name=\"" << nameInFile << "\" NumberOfComponents=\"" << getNumberOfComponents() << "\"";
   ofs << " format=\"ascii\" RangeMin=\"" << getMinValueInArray() << "\" RangeMax=\"" << getMaxValueInArray() << "\">\n" << idt;
@@ -3718,6 +3860,7 @@ void DataArrayInt::reprCppStream(const char *varName, std::ostream& stream) cons
  */
 void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd) throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !");
   int nbElemsIn=(int)std::distance(indArrBg,indArrEnd);
@@ -3756,6 +3899,7 @@ void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd
 void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd,
                                      DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("Call splitByValueRange  method on DataArrayInt with only one component, you can call 'rearrange' method before !");
   int nbOfTuples=getNumberOfTuples();
@@ -3804,11 +3948,12 @@ void DataArrayInt::splitByValueRange(const int *arrBg, const int *arrEnd,
  * This method sweeps all the values (tuples) in 'this' (it should be allocated) and for each value v on place i, place indArr[v] will have 
  * value i.
  * indArr[v] where 'indArr' is defined by ['indArrBg','indArrEnd').
- * This method is half/safe that is to say if there is location i so that indArr[v] is not in [0,this->getNumberOfTuples()) an exception
- * will be thrown.
+ * This method is safe that is to say if there is location i so that indArr[v] is not in [0,this->getNumberOfTuples()) an exception
+ * will be thrown. An exception is also thrown if there is a location i so that \a this[i] not in [0,distance(indArrBg,indArrEnd)) !
  */
 DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("Call transformWithIndArrR method on DataArrayInt with only one component, you can call 'rearrange' method before !");
   int nbElemsIn=(int)std::distance(indArrBg,indArrEnd);
@@ -3820,12 +3965,20 @@ DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int
   int *tmp=ret->getPointer();
   for(int i=0;i<nbOfTuples;i++,pt++)
     {
-      int pos=indArrBg[*pt];
-      if(pos>=0 && pos<nbElemsIn)
-        tmp[pos]=i;
+      if(*pt>=0 && *pt<nbElemsIn)
+        {
+          int pos=indArrBg[*pt];
+          if(pos>=0 && pos<nbOfTuples)
+            tmp[pos]=i;
+          else
+            {
+              std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value of new pos is " << pos << " ( indArrBg[" << *pt << "]) ! Should be in [0," << nbOfTuples << ") !";
+              throw INTERP_KERNEL::Exception(oss.str().c_str());
+            }
+        }
       else
         {
-          std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value is " << *pt << " and indirectionnal array as a size equal to " << nbElemsIn;
+          std::ostringstream oss; oss << "DataArrayInt::transformWithIndArrR : error on tuple #" << i << " value is " << *pt << " and indirectionnal array as a size equal to " << nbElemsIn << " !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
@@ -3838,7 +3991,7 @@ DataArrayInt *DataArrayInt::transformWithIndArrR(const int *indArrBg, const int
  */
 DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const
 {
-  DataArrayInt *ret=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   ret->alloc(newNbOfElem,1);
   int nbOfOldNodes=getNumberOfTuples();
   const int *old2New=getConstPointer();
@@ -3846,7 +3999,7 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const
   for(int i=0;i!=nbOfOldNodes;i++)
     if(old2New[i]!=-1)
       pt[old2New[i]]=i;
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -3855,7 +4008,7 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2O(int newNbOfElem) const
  */
 DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const throw(INTERP_KERNEL::Exception)
 {
-  DataArrayInt *ret=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   ret->alloc(newNbOfElem,1);
   int nbOfOldNodes=getNumberOfTuples();
   const int *old2New=getConstPointer();
@@ -3863,7 +4016,7 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const throw(I
   for(int i=nbOfOldNodes-1;i>=0;i--)
     if(old2New[i]!=-1)
       pt[old2New[i]]=i;
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -3871,7 +4024,8 @@ DataArrayInt *DataArrayInt::invertArrayO2N2N2OBis(int newNbOfElem) const throw(I
  */
 DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const
 {
-  DataArrayInt *ret=DataArrayInt::New();
+  checkAllocated();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   ret->alloc(oldNbOfElem,1);
   const int *new2Old=getConstPointer();
   int *pt=ret->getPointer();
@@ -3879,7 +4033,7 @@ DataArrayInt *DataArrayInt::invertArrayN2O2O2N(int oldNbOfElem) const
   int nbOfNewElems=getNumberOfTuples();
   for(int i=0;i<nbOfNewElems;i++)
     pt[new2Old[i]]=i;
-  return ret;
+  return ret.retn();
 }
 
 bool DataArrayInt::isEqualIfNotWhy(const DataArrayInt& other, std::string& reason) const
@@ -4035,9 +4189,11 @@ void DataArrayInt::checkStrictlyMonotonic(bool increasing) const throw(INTERP_KE
  */
 DataArrayInt *DataArrayInt::buildPermutationArr(const DataArrayInt& other) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1 || other.getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' have to have exactly ONE component !");
   int nbTuple=getNumberOfTuples();
+  other.checkAllocated();
   if(nbTuple!=other.getNumberOfTuples())
     throw INTERP_KERNEL::Exception("DataArrayInt::buildPermutationArr : 'this' and 'other' must have the same number of tuple !");
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
@@ -4078,6 +4234,7 @@ void DataArrayInt::useExternalArrayWithRWAccess(const int *array, int nbOfTuple,
 
 DataArrayInt *DataArrayInt::fromNoInterlace() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(_mem.isNull())
     throw INTERP_KERNEL::Exception("DataArrayInt::fromNoInterlace : Not defined array !");
   int *tab=_mem.fromNoInterlace(getNumberOfComponents());
@@ -4088,6 +4245,7 @@ DataArrayInt *DataArrayInt::fromNoInterlace() const throw(INTERP_KERNEL::Excepti
 
 DataArrayInt *DataArrayInt::toNoInterlace() const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(_mem.isNull())
     throw INTERP_KERNEL::Exception("DataArrayInt::toNoInterlace : Not defined array !");
   int *tab=_mem.toNoInterlace(getNumberOfComponents());
@@ -4098,6 +4256,7 @@ DataArrayInt *DataArrayInt::toNoInterlace() const throw(INTERP_KERNEL::Exception
 
 void DataArrayInt::renumberInPlace(const int *old2New)
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   int *tmp=new int[nbTuples*nbOfCompo];
@@ -4111,6 +4270,7 @@ void DataArrayInt::renumberInPlace(const int *old2New)
 
 void DataArrayInt::renumberInPlaceR(const int *new2Old)
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   int *tmp=new int[nbTuples*nbOfCompo];
@@ -4129,6 +4289,7 @@ void DataArrayInt::renumberInPlaceR(const int *new2Old)
  */
 DataArrayInt *DataArrayInt::renumber(const int *old2New) const
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   DataArrayInt *ret=DataArrayInt::New();
@@ -4144,6 +4305,7 @@ DataArrayInt *DataArrayInt::renumber(const int *old2New) const
 
 DataArrayInt *DataArrayInt::renumberR(const int *new2Old) const
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   DataArrayInt *ret=DataArrayInt::New();
@@ -4165,6 +4327,7 @@ DataArrayInt *DataArrayInt::renumberR(const int *new2Old) const
  */
 DataArrayInt *DataArrayInt::renumberAndReduce(const int *old2New, int newNbOfTuple) const
 {
+  checkAllocated();
   int nbTuples=getNumberOfTuples();
   int nbOfCompo=getNumberOfComponents();
   DataArrayInt *ret=DataArrayInt::New();
@@ -4187,7 +4350,8 @@ DataArrayInt *DataArrayInt::renumberAndReduce(const int *old2New, int newNbOfTup
  */
 DataArrayInt *DataArrayInt::selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const
 {
-  DataArrayInt *ret=DataArrayInt::New();
+  checkAllocated();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   int nbComp=getNumberOfComponents();
   ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp);
   ret->copyStringInfoFrom(*this);
@@ -4197,7 +4361,7 @@ DataArrayInt *DataArrayInt::selectByTupleId(const int *new2OldBg, const int *new
   for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++)
     std::copy(srcPt+(*w)*nbComp,srcPt+((*w)+1)*nbComp,pt+i*nbComp);
   ret->copyStringInfoFrom(*this);
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -4205,6 +4369,7 @@ DataArrayInt *DataArrayInt::selectByTupleId(const int *new2OldBg, const int *new
  */
 DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   int nbComp=getNumberOfComponents();
   int oldNbOfTuples=getNumberOfTuples();
@@ -4232,6 +4397,7 @@ DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int
  */
 DataArrayInt *DataArrayInt::selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
   int nbComp=getNumberOfComponents();
   int newNbOfTuples=GetNumberOfItemGivenBES(bg,end2,step,"DataArrayInt::selectByTupleId2 : ");
@@ -4256,10 +4422,10 @@ DataArrayInt *DataArrayInt::selectByTupleRanges(const std::vector<std::pair<int,
   int nbOfTuplesThis=getNumberOfTuples();
   if(ranges.empty())
     {
-      DataArrayInt *ret=DataArrayInt::New();
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
       ret->alloc(0,nbOfComp);
       ret->copyStringInfoFrom(*this);
-      return ret;
+      return ret.retn();
     }
   int ref=ranges.front().first;
   int nbOfTuples=0;
@@ -4346,11 +4512,11 @@ void DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, Data
   for(int i=0;i<nbOfTuples;i++)
     {
       int tmp2=input[i];
-      if(tmp2<targetNb)
+      if(tmp2>=0 && tmp2<targetNb)
         tmp[tmp2].push_back(i);
       else
         {
-          std::ostringstream oss; oss << "DataArrayInt::changeSurjectiveFormat : At pos " << i << " presence of element " << tmp2 << " higher than " << targetNb;
+          std::ostringstream oss; oss << "DataArrayInt::changeSurjectiveFormat : At pos " << i << " presence of element " << tmp2 << " ! should be in [0," << targetNb << ") !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
     }
@@ -4524,6 +4690,7 @@ DataArrayDouble *DataArrayInt::convertToDblArr() const
  */
 DataArrayInt *DataArrayInt::substr(int tupleIdBg, int tupleIdEnd) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbt=getNumberOfTuples();
   if(tupleIdBg<0)
     throw INTERP_KERNEL::Exception("DataArrayInt::substr : The tupleIdBg parameter must be greater than 0 !");
@@ -4666,10 +4833,14 @@ void DataArrayInt::meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exce
 
 void DataArrayInt::setSelectedComponents(const DataArrayInt *a, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception)
 {
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayInt::setSelectedComponents : input DataArrayInt is NULL !");
+  checkAllocated();
+  a->checkAllocated();
   copyPartOfStringInfoFrom2(compoIds,*a);
   std::size_t partOfCompoSz=compoIds.size();
   int nbOfCompo=getNumberOfComponents();
-  int nbOfTuples=getNumberOfTuples();
+  int nbOfTuples=std::min(getNumberOfTuples(),a->getNumberOfTuples());
   const int *ac=a->getConstPointer();
   int *nc=getPointer();
   for(int i=0;i<nbOfTuples;i++)
@@ -4694,14 +4865,34 @@ void DataArrayInt::setPartOfValues1(const DataArrayInt *a, int bgTuples, int end
   int nbOfTuples=getNumberOfTuples();
   DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
   DataArray::CheckValueInRangeEx(nbComp,bgComp,endComp,"invalid component value");
-  a->checkNbOfElems(newNbOfTuples*newNbOfComp,msg);
-  if(strictCompoCompare)
-    a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+  bool assignTech=true;
+  if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+    {
+      if(strictCompoCompare)
+        a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+    }
+  else
+    {
+      a->checkNbOfTuplesAndComp(1,newNbOfComp,msg);
+      assignTech=false;
+    }
   int *pt=getPointer()+bgTuples*nbComp+bgComp;
   const int *srcPt=a->getConstPointer();
-  for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
-    for(int j=0;j<newNbOfComp;j++,srcPt++)
-      pt[j*stepComp]=*srcPt;
+  if(assignTech)
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        for(int j=0;j<newNbOfComp;j++,srcPt++)
+          pt[j*stepComp]=*srcPt;
+    }
+  else
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        {
+          const int *srcPt2=srcPt;
+          for(int j=0;j<newNbOfComp;j++,srcPt2++)
+            pt[j*stepComp]=*srcPt2;
+        }
+    }
 }
 
 /*!
@@ -4869,6 +5060,66 @@ void DataArrayInt::setPartOfValuesSimple3(int a, const int *bgTuples, const int
       }
 }
 
+void DataArrayInt::setPartOfValues4(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) throw(INTERP_KERNEL::Exception)
+{
+  if(!a)
+    throw INTERP_KERNEL::Exception("DataArrayInt::setPartOfValues4 : input DataArrayInt is NULL !");
+  const char msg[]="DataArrayInt::setPartOfValues4";
+  checkAllocated();
+  a->checkAllocated();
+  int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+  int newNbOfComp=(int)std::distance(bgComp,endComp);
+  int nbComp=getNumberOfComponents();
+  for(const int *z=bgComp;z!=endComp;z++)
+    DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+  int nbOfTuples=getNumberOfTuples();
+  DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+  bool assignTech=true;
+  if(a->getNbOfElems()==newNbOfTuples*newNbOfComp)
+    {
+      if(strictCompoCompare)
+        a->checkNbOfTuplesAndComp(newNbOfTuples,newNbOfComp,msg);
+    }
+  else
+    {
+      a->checkNbOfTuplesAndComp(1,newNbOfComp,msg);
+      assignTech=false;
+    }
+  const int *srcPt=a->getConstPointer();
+  int *pt=getPointer()+bgTuples*nbComp;
+  if(assignTech)
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        for(const int *z=bgComp;z!=endComp;z++,srcPt++)
+          pt[*z]=*srcPt;
+    }
+  else
+    {
+      for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+        {
+          const int *srcPt2=srcPt;
+          for(const int *z=bgComp;z!=endComp;z++,srcPt2++)
+            pt[*z]=*srcPt2;
+        }
+    }
+}
+
+void DataArrayInt::setPartOfValuesSimple4(int a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception)
+{
+  const char msg[]="DataArrayInt::setPartOfValuesSimple4";
+  checkAllocated();
+  int newNbOfTuples=DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg);
+  int nbComp=getNumberOfComponents();
+  for(const int *z=bgComp;z!=endComp;z++)
+    DataArray::CheckValueInRange(nbComp,*z,"invalid component id");
+  int nbOfTuples=getNumberOfTuples();
+  DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value");
+  int *pt=getPointer()+bgTuples*nbComp;
+  for(int i=0;i<newNbOfTuples;i++,pt+=stepTuples*nbComp)
+    for(const int *z=bgComp;z!=endComp;z++)
+      pt[*z]=a;
+}
+
 /*!
  * 'this', 'a' and 'tuplesSelec' are expected to be defined. If not an exception will be thrown.
  * @param a is an array having exactly the same number of components than 'this'
@@ -4876,7 +5127,7 @@ void DataArrayInt::setPartOfValuesSimple3(int a, const int *bgTuples, const int
  */
 void DataArrayInt::setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception)
 {
-  if(!a)
+  if(!a || !tuplesSelec)
     throw INTERP_KERNEL::Exception("DataArrayInt::setPartOfValuesAdv : DataArrayInt pointer in input is NULL !");
   checkAllocated();
   a->checkAllocated();
@@ -5035,6 +5286,7 @@ DataArrayIntIterator *DataArrayInt::iterator()
 
 DataArrayInt *DataArrayInt::getIdsEqual(int val) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::getIdsEqual : the array must have only one component, you can call 'rearrange' method before !");
   const int *cptr=getConstPointer();
@@ -5048,6 +5300,7 @@ DataArrayInt *DataArrayInt::getIdsEqual(int val) const throw(INTERP_KERNEL::Exce
 
 DataArrayInt *DataArrayInt::getIdsNotEqual(int val) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::getIdsNotEqual : the array must have only one component, you can call 'rearrange' method before !");
   const int *cptr=getConstPointer();
@@ -5067,9 +5320,9 @@ DataArrayInt *DataArrayInt::getIdsNotEqual(int val) const throw(INTERP_KERNEL::E
  */
 int DataArrayInt::changeValue(int oldValue, int newValue) throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::changeValue : the array must have only one component, you can call 'rearrange' method before !");
-  checkAllocated();
   int *start=getPointer();
   int *end2=start+getNbOfElems();
   int ret=0;
@@ -5132,6 +5385,7 @@ DataArrayInt *DataArrayInt::getIdsNotEqualList(const int *valsBg, const int *val
  */
 int DataArrayInt::locateTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfCompo=getNumberOfComponents();
   if(nbOfCompo==0)
     throw INTERP_KERNEL::Exception("DataArrayInt::locateTuple : 0 components in 'this' !");
@@ -5164,6 +5418,7 @@ int DataArrayInt::locateTuple(const std::vector<int>& tupl) const throw(INTERP_K
  */
 int DataArrayInt::search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   int nbOfCompo=getNumberOfComponents();
   if(nbOfCompo!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::search : works only for DataArrayInt instance with one component !");
@@ -5183,6 +5438,7 @@ int DataArrayInt::search(const std::vector<int>& vals) const throw(INTERP_KERNEL
  */
 int DataArrayInt::locateValue(int value) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
   const int *cptr=getConstPointer();
@@ -5201,6 +5457,7 @@ int DataArrayInt::locateValue(int value) const throw(INTERP_KERNEL::Exception)
  */
 int DataArrayInt::locateValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::presenceOfValue : the array must have only one component, you can call 'rearrange' method before !");
   std::set<int> vals2(vals.begin(),vals.end());
@@ -5265,7 +5522,7 @@ int DataArrayInt::accumulate(int compId) const throw(INTERP_KERNEL::Exception)
   const int *ptr=getConstPointer();
   int nbTuple=getNumberOfTuples();
   int nbComps=getNumberOfComponents();
-  if(compId>=nbComps)
+  if(compId<0 || compId>=nbComps)
     throw INTERP_KERNEL::Exception("DataArrayInt::accumulate : Invalid compId specified : No such nb of components !");
   int ret=0;
   for(int i=0;i<nbTuple;i++)
@@ -5318,6 +5575,7 @@ DataArrayInt *DataArrayInt::Aggregate(const std::vector<const DataArrayInt *>& a
 
 int DataArrayInt::getMaxValue(int& tupleId) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::getMaxValue : must be applied on DataArrayInt with only one component !");
   int nbOfTuples=getNumberOfTuples();
@@ -5341,6 +5599,7 @@ int DataArrayInt::getMaxValueInArray() const throw(INTERP_KERNEL::Exception)
 
 int DataArrayInt::getMinValue(int& tupleId) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::getMaxValue : must be applied on DataArrayInt with only one component !");
   int nbOfTuples=getNumberOfTuples();
@@ -5368,6 +5627,7 @@ void DataArrayInt::abs() throw(INTERP_KERNEL::Exception)
   int *ptr=getPointer();
   int nbOfElems=getNbOfElems();
   std::transform(ptr,ptr+nbOfElems,ptr,std::ptr_fun<int,int>(std::abs));
+  declareAsNew();
 }
 
 void DataArrayInt::applyLin(int a, int b, int compoId) throw(INTERP_KERNEL::Exception)
@@ -5467,6 +5727,7 @@ void DataArrayInt::applyModulus(int val) throw(INTERP_KERNEL::Exception)
  */
 DataArrayInt *DataArrayInt::getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception)
 {
+  checkAllocated();
   if(getNumberOfComponents()!=1)
     throw INTERP_KERNEL::Exception("DataArrayInt::getIdsInRange : this must have exactly one component !");
   const int *cptr=getConstPointer();
@@ -5661,12 +5922,12 @@ DataArrayInt *DataArrayInt::BuildIntersection(const std::vector<const DataArrayI
     {
       (*it)->checkAllocated();
       if((*it)->getNumberOfComponents()!=1)
-        throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : only single component allowed !");
+        throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : only single component allowed !");
       int tmp1;
       valm=std::min((*it)->getMinValue(tmp1),valm);
     }
   if(valm<0)
-    throw INTERP_KERNEL::Exception("DataArrayInt::BuildUnion : a negative value has been detected !");
+    throw INTERP_KERNEL::Exception("DataArrayInt::BuildIntersection : a negative value has been detected !");
   //
   std::set<int> r;
   for(std::vector<const DataArrayInt *>::const_iterator it=a.begin();it!=a.end();it++)
@@ -6183,6 +6444,7 @@ void DataArrayInt::addEqual(const DataArrayInt *other) throw(INTERP_KERNEL::Exce
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayInt::addEqual : input DataArrayInt instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayInt::addEqual  !";
+  checkAllocated(); other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -6280,6 +6542,7 @@ void DataArrayInt::substractEqual(const DataArrayInt *other) throw(INTERP_KERNEL
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayInt::substractEqual : input DataArrayInt instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayInt::substractEqual  !";
+  checkAllocated(); other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -6387,6 +6650,7 @@ void DataArrayInt::multiplyEqual(const DataArrayInt *other) throw(INTERP_KERNEL:
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayInt::multiplyEqual : input DataArrayInt instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayInt::multiplyEqual !";
+  checkAllocated(); other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -6484,6 +6748,7 @@ void DataArrayInt::divideEqual(const DataArrayInt *other) throw(INTERP_KERNEL::E
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayInt::divideEqual : input DataArrayInt instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayInt::divideEqual !";
+  checkAllocated(); other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
@@ -6581,6 +6846,7 @@ void DataArrayInt::modulusEqual(const DataArrayInt *other) throw(INTERP_KERNEL::
   if(!other)
     throw INTERP_KERNEL::Exception("DataArrayInt::modulusEqual : input DataArrayInt instance is NULL !");
   const char *msg="Nb of tuples mismatch for DataArrayInt::modulusEqual !";
+  checkAllocated(); other->checkAllocated();
   int nbOfTuple=getNumberOfTuples();
   int nbOfTuple2=other->getNumberOfTuples();
   int nbOfComp=getNumberOfComponents();
index eaa2727241935f361602f0499879d357f0e27209..115ad548fce39be88b01970d2feef27308bb25b7 100644 (file)
@@ -168,6 +168,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void cpyFrom(const DataArrayDouble& other) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void pushBackSilent(double val) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void pushBackValsSilent(const double *valsBg, const double *valsEnd) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT double popBackSilent() throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
@@ -222,6 +223,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void setPartOfValuesSimple2(double a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayDouble *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesSimple3(double a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setPartOfValues4(const DataArrayDouble *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setPartOfValuesSimple4(double a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayDouble *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayDouble *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
@@ -373,6 +376,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void cpyFrom(const DataArrayInt& other) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void reserve(int nbOfElems) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void pushBackSilent(int val) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void pushBackValsSilent(const int *valsBg, const int *valsEnd) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int popBackSilent() throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void pack() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getNbOfElemAllocated() const { return _mem.getNbOfElemAllocated(); }
@@ -440,6 +444,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void setPartOfValuesSimple2(int a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValues3(const DataArrayInt *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesSimple3(int a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setPartOfValues4(const DataArrayInt *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true) throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT void setPartOfValuesSimple4(int a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setPartOfValuesAdv(const DataArrayInt *a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArrayInt*a, const DataArrayInt *tuplesSelec) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void setContigPartOfSelectedValues2(int tupleIdStart, const DataArrayInt *a, int bg, int end2, int step) throw(INTERP_KERNEL::Exception);
index 9f86a7445ba6bab3ee53eaa6d65d4a7d3201c440..bf508c8ebb3b3ca104c68a7109ce81d68a44c8a2 100644 (file)
@@ -84,6 +84,8 @@ namespace ParaMEDMEM
     virtual int getMeshDimension() const = 0;
     virtual DataArrayDouble *getCoordinatesAndOwner() const = 0;
     virtual DataArrayDouble *getBarycenterAndOwner() const = 0;
+    virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception) = 0;
+    virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception) = 0;
     virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0;
     virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0;
     virtual std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const = 0;
index 0e120ce1017c95a179dd5f2c0726ca24c41896ff..033fe91b2a9239d2d4b4505cae1fc3ef0378222b 100644 (file)
@@ -138,7 +138,7 @@ MEDCouplingFieldDouble *MEDCouplingRemapper::transferField(const MEDCouplingFiel
   if(_src_method!=srcField->getDiscretization()->getStringRepr())
     throw INTERP_KERNEL::Exception("Incoherency with prepare call for source field");
   MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(MEDCouplingFieldDiscretization::getTypeOfFieldFromStringRepr(_target_method.c_str()),srcField->getTimeDiscretization());
-  ret->copyTinyAttrFrom(srcField);
+  ret->copyAllTinyAttrFrom(srcField);
   ret->setNature(srcField->getNature());
   ret->setMesh(_target_mesh);
   transfer(srcField,ret,dftValue);
@@ -149,8 +149,8 @@ MEDCouplingFieldDouble *MEDCouplingRemapper::reverseTransferField(const MEDCoupl
 {
   if(_target_method!=targetField->getDiscretization()->getStringRepr())
     throw INTERP_KERNEL::Exception("Incoherency with prepare call for target field");
-  MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(MEDCouplingFieldDiscretization::getTypeOfFieldFromStringRepr(_target_method.c_str()),targetField->getTimeDiscretization());
-  ret->copyTinyAttrFrom(targetField);
+  MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(MEDCouplingFieldDiscretization::getTypeOfFieldFromStringRepr(_src_method.c_str()),targetField->getTimeDiscretization());
+  ret->copyAllTinyAttrFrom(targetField);
   ret->setNature(targetField->getNature());
   ret->setMesh(_src_mesh);
   reverseTransfer(ret,targetField,dftValue);
index 4d02d732b9c8bb04d9be523b481080742e434786..f473cf7bd0731ff79081933e6a255e7df4cdd427 100644 (file)
@@ -71,45 +71,42 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(int c
 
 std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingStructuredMesh::getAllGeoTypes() const
 {
-  INTERP_KERNEL::NormalizedCellType ret;
-  switch(getMeshDimension())
-    {
-    case 3:
-      ret=INTERP_KERNEL::NORM_HEXA8;
-      break;
-    case 2:
-      ret=INTERP_KERNEL::NORM_QUAD4;
-      break;
-    case 1:
-      ret=INTERP_KERNEL::NORM_SEG2;
-      break;
-    default:
-      throw INTERP_KERNEL::Exception("Unexpected dimension for MEDCouplingStructuredMesh::getAllGeoTypes !");
-    }
   std::set<INTERP_KERNEL::NormalizedCellType> ret2;
-  ret2.insert(ret);
+  ret2.insert(getTypeOfCell(0));
   return ret2;
 }
 
 int MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
 {
   int ret=getNumberOfCells();
-  int dim=getMeshDimension();
-  switch(type)
+  if(type==getTypeOfCell(0))
+    return ret;
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
+  std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getNumberOfCellsWithType : no specified type ! Type available is " << cm.getRepr() << " !";
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+DataArrayInt *MEDCouplingStructuredMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+  if(getTypeOfCell(0)==type)
     {
-    case INTERP_KERNEL::NORM_HEXA8:
-      if(dim==3)
-        return ret;
-    case INTERP_KERNEL::NORM_QUAD4:
-      if(dim==2)
-        return ret;
-    case INTERP_KERNEL::NORM_SEG2:
-      if(dim==1)
-        return ret;
-    default:
-      throw INTERP_KERNEL::Exception("Unexpected dimension for MEDCouplingStructuredMesh::getTypeOfCell !");
+      ret->alloc(getNumberOfCells(),1);
+      ret->iota(0);
     }
-  return 0;
+  else
+    ret->alloc(0,1);
+  return ret.retn();
+}
+
+DataArrayInt *MEDCouplingStructuredMesh::computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+  int nbCells=getNumberOfCells();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+  ret->alloc(nbCells,1);
+  const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0));
+  ret->fillWithValue((int)cm.getNumberOfNodes());
+  return ret.retn();
 }
 
 void MEDCouplingStructuredMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
index 80f18ec9fdfb130cd408063bcbb165104f82059b..786d4d2d58c09a3a8a921c1fe67e046be9ca1a64 100644 (file)
@@ -32,6 +32,8 @@ namespace ParaMEDMEM
     INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
     std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
+    DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
     static void GetPosFromId(int nodeId, int meshDim, const int *split, int *res);
     void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     std::size_t getHeapMemorySize() const;
index a34d71b8043a69635880c316bfd945acc6cc5033..8443998f0adefdfc1ca001a2e2a11fbc3c6e8e52 100644 (file)
@@ -1989,7 +1989,7 @@ MEDCouplingPointSet *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const
   DataArrayInt *revDesc=DataArrayInt::New();
   DataArrayInt *revDescIndx=DataArrayInt::New();
   //
-  MEDCouplingUMesh *meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
   revDesc->decrRef();
   desc->decrRef();
   descIndx->decrRef();
@@ -2001,7 +2001,6 @@ MEDCouplingPointSet *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const
       boundaryCells.push_back(i);
   revDescIndx->decrRef();
   MEDCouplingPointSet *ret=meshDM1->buildPartOfMySelf(&boundaryCells[0],&boundaryCells[0]+boundaryCells.size(),keepCoords);
-  meshDM1->decrRef();
   return ret;
 }
 
@@ -2906,15 +2905,13 @@ void MEDCouplingUMesh::unserialization(const std::vector<double>& tinyInfoD, con
     {
       // Connectivity
       const int *recvBuffer=a1->getConstPointer();
-      DataArrayInt* myConnecIndex=DataArrayInt::New();
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> myConnecIndex=DataArrayInt::New();
       myConnecIndex->alloc(tinyInfo[6]+1,1);
       std::copy(recvBuffer,recvBuffer+tinyInfo[6]+1,myConnecIndex->getPointer());
-      DataArrayInt* myConnec=DataArrayInt::New();
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> myConnec=DataArrayInt::New();
       myConnec->alloc(tinyInfo[7],1);
       std::copy(recvBuffer+tinyInfo[6]+1,recvBuffer+tinyInfo[6]+1+tinyInfo[7],myConnec->getPointer());
-      setConnectivity(myConnec, myConnecIndex) ;
-      myConnec->decrRef();
-      myConnecIndex->decrRef();
+      setConnectivity(myConnec, myConnecIndex);
     }
 }
 
@@ -2999,14 +2996,12 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildPartOfMySelfKeepCoords(const int *begin
       types.insert((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*work]]);
       connRetWork=std::copy(conn+connIndex[*work],conn+connIndex[*work+1],connRetWork);
     }
-  DataArrayInt *connRetArr=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connRetArr=DataArrayInt::New();
   connRetArr->useArray(connRet,true,CPP_DEALLOC,connIndexRet[nbOfElemsRet],1);
-  DataArrayInt *connIndexRetArr=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connIndexRetArr=DataArrayInt::New();
   connIndexRetArr->useArray(connIndexRet,true,CPP_DEALLOC,(int)nbOfElemsRet+1,1);
   ret->setConnectivity(connRetArr,connIndexRetArr,false);
   ret->_types=types;
-  connRetArr->decrRef();
-  connIndexRetArr->decrRef();
   ret->copyTinyInfoFrom(this);
   return ret.retn();
 }
@@ -3025,13 +3020,12 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const
   std::string name="MeasureOfMesh_";
   name+=getName();
   int nbelem=getNumberOfCells();
-  MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   field->setName(name.c_str());
-  DataArrayDouble* array=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
   array->alloc(nbelem,1);
   double *area_vol=array->getPointer();
-  field->setArray(array) ;
-  array->decrRef();
+  field->setArray(array) ; array=0;
   field->setMesh(const_cast<MEDCouplingUMesh *>(this));
   field->synchronizeTimeWithMesh();
   if(getMeshDimension()!=-1)
@@ -3055,7 +3049,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const
     {
       area_vol[0]=std::numeric_limits<double>::max();
     }
-  return field;
+  return field.retn();
 }
 
 /*!
@@ -3067,7 +3061,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be
   std::string name="PartMeasureOfMesh_";
   name+=getName();
   int nbelem=(int)std::distance(begin,end);
-  DataArrayDouble* array=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
   array->setName(name.c_str());
   array->alloc(nbelem,1);
   double *area_vol=array->getPointer();
@@ -3092,7 +3086,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be
     {
       area_vol[0]=std::numeric_limits<double>::max();
     }
-  return array;
+  return array.retn();
 }
 
 /*!
@@ -3101,19 +3095,19 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be
  */
 MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) const
 {
-  MEDCouplingFieldDouble *tmp=getMeasureField(isAbs);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> tmp=getMeasureField(isAbs);
   std::string name="MeasureOnNodeOfMesh_";
   name+=getName();
   int nbNodes=getNumberOfNodes();
-  MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_NODES);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_NODES);
   double cst=1./((double)getMeshDimension()+1.);
-  DataArrayDouble* array=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
   array->alloc(nbNodes,1);
   double *valsToFill=array->getPointer();
   std::fill(valsToFill,valsToFill+nbNodes,0.);
   const double *values=tmp->getArray()->getConstPointer();
-  DataArrayInt *da=DataArrayInt::New();
-  DataArrayInt *daInd=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> daInd=DataArrayInt::New();
   getReverseNodalConnectivity(da,daInd);
   const int *daPtr=da->getConstPointer();
   const int *daIPtr=daInd->getConstPointer();
@@ -3121,12 +3115,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureFieldOnNode(bool isAbs) cons
     for(const int *cell=daPtr+daIPtr[i];cell!=daPtr+daIPtr[i+1];cell++)
       valsToFill[i]+=cst*values[*cell];
   ret->setMesh(this);
-  da->decrRef();
-  daInd->decrRef();
   ret->setArray(array);
-  array->decrRef();
-  tmp->decrRef();
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -3137,8 +3127,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const
 {
   if((getMeshDimension()!=2) && (getMeshDimension()!=1 || getSpaceDimension()!=2))
     throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !");
-  MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
-  DataArrayDouble *array=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
   int nbOfCells=getNumberOfCells();
   int nbComp=getMeshDimension()+1;
   array->alloc(nbOfCells,nbComp);
@@ -3150,7 +3140,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const
     {
       if(getSpaceDimension()==3)
         {
-          DataArrayDouble *loc=getBarycenterAndOwner();
+          MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=getBarycenterAndOwner();
           const double *locPtr=loc->getConstPointer();
           for(int i=0;i<nbOfCells;i++,vals+=3)
             {
@@ -3159,7 +3149,6 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const
               double n=INTERP_KERNEL::norm<3>(vals);
               std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies<double>(),1./n));
             }
-          loc->decrRef();
         }
       else
         {
@@ -3181,10 +3170,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildOrthogonalField() const
         }
     }
   ret->setArray(array);
-  array->decrRef();
   ret->setMesh(this);
   ret->synchronizeTimeWithSupport();
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -3195,8 +3183,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be
 {
   if((getMeshDimension()!=2) && (getMeshDimension()!=1 || getSpaceDimension()!=2))
     throw INTERP_KERNEL::Exception("Expected a umesh with ( meshDim == 2 spaceDim == 2 or 3 ) or ( meshDim == 1 spaceDim == 2 ) !");
-  MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
-  DataArrayDouble *array=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
   std::size_t nbelems=std::distance(begin,end);
   int nbComp=getMeshDimension()+1;
   array->alloc((int)nbelems,nbComp);
@@ -3208,7 +3196,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be
     {
       if(getSpaceDimension()==3)
         {
-          DataArrayDouble *loc=getPartBarycenterAndOwner(begin,end);
+          MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> loc=getPartBarycenterAndOwner(begin,end);
           const double *locPtr=loc->getConstPointer();
           for(const int *i=begin;i!=end;i++,vals+=3,locPtr+=3)
             {
@@ -3217,7 +3205,6 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be
               double n=INTERP_KERNEL::norm<3>(vals);
               std::transform(vals,vals+3,vals,std::bind2nd(std::multiplies<double>(),1./n));
             }
-          loc->decrRef();
         }
       else
         {
@@ -3239,10 +3226,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildPartOrthogonalField(const int *be
         }
     }
   ret->setArray(array);
-  array->decrRef();
   ret->setMesh(this);
   ret->synchronizeTimeWithSupport();
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -3255,8 +3241,8 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildDirectionVectorField() const
     throw INTERP_KERNEL::Exception("Expected a umesh with meshDim == 1 for buildDirectionVectorField !");
    if(_types.size()!=1 || *(_types.begin())!=INTERP_KERNEL::NORM_SEG2)
      throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for buildDirectionVectorField !");
-   MEDCouplingFieldDouble *ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
-   DataArrayDouble *array=DataArrayDouble::New();
+   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
+   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
    int nbOfCells=getNumberOfCells();
    int spaceDim=getSpaceDimension();
    array->alloc(nbOfCells,spaceDim);
@@ -3271,10 +3257,9 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::buildDirectionVectorField() const
        pt=std::transform(coo+conn[1]*spaceDim,coo+(conn[1]+1)*spaceDim,coo+conn[0]*spaceDim,pt,std::minus<double>());
      }
    ret->setArray(array);
-   array->decrRef();
    ret->setMesh(this);
    ret->synchronizeTimeWithSupport();
-   return ret;   
+   return ret.retn();   
 }
 
 /*!
@@ -3494,7 +3479,7 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps,
      throw INTERP_KERNEL::Exception("Expected a umesh with only NORM_SEG2 type of elements for project1D !");
    if(getSpaceDimension()!=3)
      throw INTERP_KERNEL::Exception("Expected a umesh with spaceDim==3 for project1D !");
-   MEDCouplingFieldDouble *f=buildDirectionVectorField();
+   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f=buildDirectionVectorField();
    const double *fPtr=f->getArray()->getConstPointer();
    double tmp[3];
    for(int i=0;i<getNumberOfCells();i++)
@@ -3506,10 +3491,7 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps,
        double n1=INTERP_KERNEL::norm<3>(tmp);
        n1/=INTERP_KERNEL::norm<3>(tmp1);
        if(n1>eps)
-         {
-           f->decrRef();
-           throw INTERP_KERNEL::Exception("UMesh::Projection 1D failed !");
-         }
+         throw INTERP_KERNEL::Exception("UMesh::Projection 1D failed !");
      }
    const double *coo=getCoords()->getConstPointer();
    for(int i=0;i<getNumberOfNodes();i++)
@@ -3518,7 +3500,6 @@ void MEDCouplingUMesh::project1D(const double *pt, const double *v, double eps,
        std::transform(tmp,tmp+3,v,tmp,std::multiplies<double>());
        res[i]=std::accumulate(tmp,tmp+3,0.);
      }
-   f->decrRef();
 }
 
 /*!
@@ -3997,7 +3978,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMesh(const MEDCouplingUMesh *me
     }
   zipCoords();
   int oldNbOfNodes=getNumberOfNodes();
-  DataArrayDouble *newCoords=0;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> newCoords;
   switch(policy)
     {
     case 0:
@@ -4014,10 +3995,9 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMesh(const MEDCouplingUMesh *me
       throw INTERP_KERNEL::Exception("Not implemented extrusion policy : must be in (0) !");
     }
   setCoords(newCoords);
-  newCoords->decrRef();
-  MEDCouplingUMesh *ret=buildExtrudedMeshFromThisLowLev(oldNbOfNodes,isQuad);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=buildExtrudedMeshFromThisLowLev(oldNbOfNodes,isQuad);
   updateTime();
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -4160,15 +4140,14 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con
   int nbOf1DCells=mesh1D->getNumberOfCells();
   if(nbOf1DCells<2)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
-  DataArrayDouble *ret=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   int nbOfLevsInVec=nbOf1DCells+1;
   ret->alloc(oldNbOfNodes*nbOfLevsInVec,2);
   double *retPtr=ret->getPointer();
   retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr);
-  MEDCouplingUMesh *tmp=MEDCouplingUMesh::New();
-  DataArrayDouble *tmp2=getCoords()->deepCpy();
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=getCoords()->deepCpy();
   tmp->setCoords(tmp2);
-  tmp2->decrRef();
   const double *coo1D=mesh1D->getCoords()->getConstPointer();
   const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
   const int *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer();
@@ -4189,8 +4168,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation2D(con
       tmp->rotate(end,0,angle);
       retPtr=std::copy(tmp2->getConstPointer(),tmp2->getConstPointer()+tmp2->getNbOfElems(),retPtr);
     }
-  tmp->decrRef();
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -4206,15 +4184,14 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con
   int nbOf1DCells=mesh1D->getNumberOfCells();
   if(nbOf1DCells<2)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D : impossible to detect any angle of rotation ! Change extrusion policy 1->0 !");
-  DataArrayDouble *ret=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret=DataArrayDouble::New();
   int nbOfLevsInVec=nbOf1DCells+1;
   ret->alloc(oldNbOfNodes*nbOfLevsInVec,3);
   double *retPtr=ret->getPointer();
   retPtr=std::copy(getCoords()->getConstPointer(),getCoords()->getConstPointer()+getCoords()->getNbOfElems(),retPtr);
-  MEDCouplingUMesh *tmp=MEDCouplingUMesh::New();
-  DataArrayDouble *tmp2=getCoords()->deepCpy();
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> tmp=MEDCouplingUMesh::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp2=getCoords()->deepCpy();
   tmp->setCoords(tmp2);
-  tmp2->decrRef();
   const double *coo1D=mesh1D->getCoords()->getConstPointer();
   const int *conn1D=mesh1D->getNodalConnectivity()->getConstPointer();
   const int *connI1D=mesh1D->getNodalConnectivityIndex()->getConstPointer();
@@ -4258,8 +4235,7 @@ DataArrayDouble *MEDCouplingUMesh::fillExtCoordsUsingTranslAndAutoRotation3D(con
         }
       retPtr=std::copy(tmp2->getConstPointer(),tmp2->getConstPointer()+tmp2->getNbOfElems(),retPtr);
     }
-  tmp->decrRef();
-  return ret;
+  return ret.retn();
 }
 
 /*!
@@ -4276,8 +4252,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNode
   MEDCouplingUMesh *ret=MEDCouplingUMesh::New("Extruded",getMeshDimension()+1);
   const int *conn=_nodal_connec->getConstPointer();
   const int *connI=_nodal_connec_index->getConstPointer();
-  DataArrayInt *newConn=DataArrayInt::New();
-  DataArrayInt *newConnI=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
   newConnI->alloc(nbOf3DCells+1,1);
   int *newConnIPtr=newConnI->getPointer();
   *newConnIPtr++=0;
@@ -4310,8 +4286,6 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildExtrudedMeshFromThisLowLev(int nbOfNode
         }
     }
   ret->setConnectivity(newConn,newConnI,true);
-  newConn->decrRef();
-  newConnI->decrRef();
   ret->setCoords(getCoords());
   return ret;
 }
@@ -4384,7 +4358,7 @@ void MEDCouplingUMesh::convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exce
   _types.clear();
   for(int i=0;i<nbOfCells;i++,ociptr++)
     {
-      INTERP_KERNEL::NormalizedCellType type=getTypeOfCell(i);
+      INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)icptr[iciptr[i]];
       const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(type);
       if(!cm.isQuadratic())
         {
@@ -4406,6 +4380,115 @@ void MEDCouplingUMesh::convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exce
   setConnectivity(newConn,newConnI,false);
 }
 
+/*!
+ * This method converts all linear cell in \a this to quadratic one.
+ * Contrary to MEDCouplingUMesh::convertQuadraticCellsToLinear method, here it is needed to specify the target
+ * type of cells expected. For example INTERP_KERNEL::NORM_TRI3 can be converted to INTERP_KERNEL::NORM_TRI6 if \a conversionType is equal to 0 (the default)
+ * or to INTERP_KERNEL::NORM_TRI7 if \a conversionType is equal to 1. All non linear cells and polyhedron in \a this are let untouched.
+ * Contrary to MEDCouplingUMesh::convertQuadraticCellsToLinear method, the coordinates in \a this can be become bigger. All created nodes will be put at the
+ * end of the existing coordinates.
+ * 
+ * \param [in] conversionType specifies the type of conversion expected. Only 0 (default) and 1 are supported presently. 0 those that creates the 'most' simple
+ *             corresponding quadratic cells. 1 is those creating the 'most' complex.
+ * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells.
+ * 
+ * \throw if \a this is not fully defined. It throws too if \a conversionType is not in [0,1].
+ *
+ * \sa MEDCouplingUMesh::convertQuadraticCellsToLinear
+ */
+DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic(int conversionType) throw(INTERP_KERNEL::Exception)
+{
+  DataArrayInt *conn=0,*connI=0;
+  DataArrayDouble *coords=0;
+  std::set<INTERP_KERNEL::NormalizedCellType> types;
+  checkFullyDefined();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret,connSafe,connISafe;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coordsSafe;
+  int meshDim=getMeshDimension();
+  switch(conversionType)
+    {
+    case 0:
+      switch(meshDim)
+        {
+        case 1:
+          ret=convertLinearCellsToQuadratic1D0(conn,connI,coords,types);
+          connSafe=conn; connISafe=connI; coordsSafe=coords;
+        case 2:
+          ret=convertLinearCellsToQuadratic2D0(conn,connI,coords,types);
+          connSafe=conn; connISafe=connI; coordsSafe=coords;
+        default:
+          throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertLinearCellsToQuadratic : conversion of type 0 mesh dimensions available are [1] !");
+        }
+      //case 1:
+      //return convertLinearCellsToQuadratic1();
+    default:
+      throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertLinearCellsToQuadratic : conversion type available are 0 (default, the simplest) and 1 (the most complex) !");
+    }
+  setConnectivity(connSafe,connISafe,false);
+  _types=types;
+  setCoords(coordsSafe);
+  return ret.retn();
+}
+
+/*!
+ * Implementes \a conversionType 0 for meshes with meshDim = 1, of MEDCouplingUMesh::convertLinearCellsToQuadratic method.
+ * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells.
+ * \sa MEDCouplingUMesh::convertLinearCellsToQuadratic.
+ */
+DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bary=getBarycenterAndOwner();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn=DataArrayInt::New(); newConn->alloc(0,1);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New(); newConnI->alloc(1,1); newConnI->setIJ(0,0,0);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc(0,1);
+  int nbOfCells=getNumberOfCells();
+  int nbOfNodes=getNumberOfNodes();
+  const int *cPtr=_nodal_connec->getConstPointer();
+  const int *icPtr=_nodal_connec_index->getConstPointer();
+  int lastVal=0,offset=nbOfNodes;
+  for(int i=0;i<nbOfCells;i++,icPtr++)
+    {
+      INTERP_KERNEL::NormalizedCellType type=(INTERP_KERNEL::NormalizedCellType)cPtr[*icPtr];
+      if(type==INTERP_KERNEL::NORM_SEG2)
+        {
+          types.insert(INTERP_KERNEL::NORM_SEG3);
+          newConn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG3);
+          newConn->pushBackValsSilent(cPtr+cPtr[0]+1,cPtr+cPtr[0]+3);
+          newConn->pushBackSilent(offset++);
+          newConnI->pushBackSilent(lastVal+4);
+          ret->pushBackSilent(i);
+          lastVal+=4;
+        }
+      else
+        {
+          types.insert(type);
+          int tmp=lastVal+(icPtr[1]-icPtr[0]);
+          newConnI->pushBackSilent(tmp);
+          newConn->pushBackValsSilent(cPtr+cPtr[0],cPtr+cPtr[1]);
+          lastVal=tmp;
+        }
+    }
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp=bary->selectByTupleIdSafe(ret->begin(),ret->end());
+  conn=newConn.retn(); connI=newConnI.retn(); coords=DataArrayDouble::Aggregate(getCoords(),tmp);
+  return ret.retn();
+}
+
+/*!
+ * Implementes \a conversionType 0 for meshes with meshDim = 2, of MEDCouplingUMesh::convertLinearCellsToQuadratic method.
+ * \return a newly created DataArrayInt instance that the caller should deal with containing cell ids of converted cells.
+ * \sa MEDCouplingUMesh::convertLinearCellsToQuadratic.
+ */
+DataArrayInt *MEDCouplingUMesh::convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc(DataArrayInt::New()),descI(DataArrayInt::New());
+  DataArrayInt *tmp2=DataArrayInt::New(),*tmp3=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1D=buildDescendingConnectivity2(desc,descI,tmp2,tmp3); tmp2->decrRef(); tmp3->decrRef();
+  DataArrayInt *conn1D=0,*conn1DI=0;
+  std::set<INTERP_KERNEL::NormalizedCellType> types1D;
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1D=m1D->convertLinearCellsToQuadratic1D0(conn1D,conn1DI,coords,types1D); ret1D=0;
+  return 0;//tony
+}
+
 /*!
  * This method tessallates 'this' so that the number of cells remains the same.
  * This method works only for meshes with spaceDim equal to 2 and meshDim equal to 2.
@@ -5150,11 +5233,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getEdgeRatioField() const throw(INTERP
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   ret->setMesh(this);
   int nbOfCells=getNumberOfCells();
-  DataArrayDouble *arr=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
   arr->alloc(nbOfCells,1);
   double *pt=arr->getPointer();
   ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
-  arr->decrRef();
   const int *conn=_nodal_connec->getConstPointer();
   const int *connI=_nodal_connec_index->getConstPointer();
   const double *coo=_coords->getConstPointer();
@@ -5210,11 +5292,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getAspectRatioField() const throw(INTE
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   ret->setMesh(this);
   int nbOfCells=getNumberOfCells();
-  DataArrayDouble *arr=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
   arr->alloc(nbOfCells,1);
   double *pt=arr->getPointer();
   ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
-  arr->decrRef();
   const int *conn=_nodal_connec->getConstPointer();
   const int *connI=_nodal_connec_index->getConstPointer();
   const double *coo=_coords->getConstPointer();
@@ -5270,11 +5351,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getWarpField() const throw(INTERP_KERN
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   ret->setMesh(this);
   int nbOfCells=getNumberOfCells();
-  DataArrayDouble *arr=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
   arr->alloc(nbOfCells,1);
   double *pt=arr->getPointer();
   ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
-  arr->decrRef();
   const int *conn=_nodal_connec->getConstPointer();
   const int *connI=_nodal_connec_index->getConstPointer();
   const double *coo=_coords->getConstPointer();
@@ -5318,11 +5398,10 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getSkewField() const throw(INTERP_KERN
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
   ret->setMesh(this);
   int nbOfCells=getNumberOfCells();
-  DataArrayDouble *arr=DataArrayDouble::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr=DataArrayDouble::New();
   arr->alloc(nbOfCells,1);
   double *pt=arr->getPointer();
   ret->setArray(arr);//In case of throw to avoid mem leaks arr will be used after decrRef.
-  arr->decrRef();
   const int *conn=_nodal_connec->getConstPointer();
   const int *connI=_nodal_connec_index->getConstPointer();
   const double *coo=_coords->getConstPointer();
@@ -6166,14 +6245,13 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(std::vector<const MEDCoupling
     }
   std::vector<const MEDCouplingPointSet *> aps(a.size());
   std::copy(a.begin(),a.end(),aps.begin());
-  DataArrayDouble *pts=MergeNodesArray(aps);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> pts=MergeNodesArray(aps);
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("merge",meshDim);
   ret->setCoords(pts);
-  pts->decrRef();
-  DataArrayInt *c=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
   c->alloc(meshLgth,1);
   int *cPtr=c->getPointer();
-  DataArrayInt *cI=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::New();
   cI->alloc(nbOfCells+1,1);
   int *cIPtr=cI->getPointer();
   *cIPtr++=0;
@@ -6202,8 +6280,6 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesLL(std::vector<const MEDCoupling
     }
   //
   ret->setConnectivity(c,cI,true);
-  c->decrRef();
-  cI->decrRef();
   return ret.retn();
 }
 
@@ -6248,10 +6324,10 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector<c
       meshLgth+=(*iter)->getMeshLength();
       meshIndexLgth+=(*iter)->getNumberOfCells();
     }
-  DataArrayInt *nodal=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodal=DataArrayInt::New();
   nodal->alloc(meshLgth,1);
   int *nodalPtr=nodal->getPointer();
-  DataArrayInt *nodalIndex=DataArrayInt::New();
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodalIndex=DataArrayInt::New();
   nodalIndex->alloc(meshIndexLgth+1,1);
   int *nodalIndexPtr=nodalIndex->getPointer();
   int offset=0;
@@ -6273,8 +6349,6 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector<c
   ret->setMeshDimension(meshDim);
   ret->setConnectivity(nodal,nodalIndex,true);
   ret->setCoords(coords);
-  nodalIndex->decrRef();
-  nodal->decrRef();
   return ret;
 }
 
@@ -6293,8 +6367,8 @@ MEDCouplingUMesh *MEDCouplingUMesh::MergeUMeshesOnSameCoords(const std::vector<c
 MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector<const MEDCouplingUMesh *>& meshes, int compType, std::vector<DataArrayInt *>& corr)
 {
   //All checks are delegated to MergeUMeshesOnSameCoords
-  MEDCouplingUMesh *ret=MergeUMeshesOnSameCoords(meshes);
-  DataArrayInt *o2n=ret->zipConnectivityTraducer(compType);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MergeUMeshesOnSameCoords(meshes);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=ret->zipConnectivityTraducer(compType);
   corr.resize(meshes.size());
   std::size_t nbOfMeshes=meshes.size();
   int offset=0;
@@ -6309,8 +6383,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector<co
       tmp->setName(meshes[i]->getName());
       corr[i]=tmp;
     }
-  o2n->decrRef();
-  return ret;
+  return ret.retn();
 }
 
 /*!
index c97142d8cd8e5ca4e17179f0e01cecd208aee177..5fc45aefe5a6377e906fa43a5f5863455b678025 100644 (file)
@@ -172,6 +172,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT bool isFullyQuadratic() const;
     MEDCOUPLING_EXPORT bool isPresenceOfQuadratic() const;
     MEDCOUPLING_EXPORT void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy) throw(INTERP_KERNEL::Exception);
@@ -270,6 +271,8 @@ namespace ParaMEDMEM
     static bool AreCellsEqualInPool(const std::vector<int>& candidates, int compType, const int *conn, const int *connI, DataArrayInt *result) ;
     MEDCouplingUMesh *buildPartOfMySelfKeepCoords(const int *begin, const int *end) const;
     MEDCouplingUMesh *buildPartOfMySelfKeepCoords2(int start, int end, int step) const;
+    DataArrayInt *convertLinearCellsToQuadratic1D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *convertLinearCellsToQuadratic2D0(DataArrayInt *&conn, DataArrayInt *&connI, DataArrayDouble *& coords, std::set<INTERP_KERNEL::NormalizedCellType>& types) const throw(INTERP_KERNEL::Exception);
     template<int SPACEDIM>
     void getCellsContainingPointsAlg(const double *coords, const double *pos, int nbOfPoints,
                                      double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const;
index 998a2a0434b766f80cac2332a772f58dc9c1c41c..f492da9f1d8bdb7cdb327097b906ca1ac6b90b0f 100644 (file)
@@ -158,6 +158,16 @@ std::set<INTERP_KERNEL::NormalizedCellType> MEDCouplingUMeshDesc::getAllGeoTypes
   return _types;
 }
 
+DataArrayInt *MEDCouplingUMeshDesc::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
+{
+  throw INTERP_KERNEL::Exception("MEDCouplingUMeshDesc::giveCellsWithType : not implemented yet !");
+}
+
+DataArrayInt *MEDCouplingUMeshDesc::computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
+{
+  throw INTERP_KERNEL::Exception("MEDCouplingUMeshDesc::computeNbOfNodesPerCell : not implemented yet !");
+}
+
 int MEDCouplingUMeshDesc::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const
 {
   const int *desc_connec=_desc_connec->getConstPointer();
index 18d3eb74a0e0d116916117cc5044a75be5c5f2b8..86ef28f73d18a9ca91f8306ee67c1ca736c596a3 100644 (file)
@@ -51,6 +51,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT int getMeshDimension() const { return _mesh_dim; }
     MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
     MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
+    MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
     MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
index c26bbe173aa7e941c874904d7a1cc147e26378f6..b3904a716f5a97fe7e8657932aa2357c455fe1f1 100644 (file)
@@ -274,6 +274,7 @@ void MEDCouplingBasicsTest1::testMeshPointsCloud()
   targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn+6);
   targetMesh->insertNextCell(INTERP_KERNEL::NORM_POINT1,1,targetConn+7);
   targetMesh->finishInsertingCells();
+  CPPUNIT_ASSERT_THROW(targetMesh->checkCoherency(),INTERP_KERNEL::Exception);
   DataArrayDouble *myCoords=DataArrayDouble::New();
   myCoords->alloc(9,3);
   std::copy(targetCoords,targetCoords+27,myCoords->getPointer());
index 47a7b7fa03abc6229e00592708b0201a41c298e9..447b039e0fce816fcc247dcfa08ec7c771a4cc34 100644 (file)
@@ -49,6 +49,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingFieldDoubleServant>(cppPointerOfMesh);
          }
+         
+         static PyObject *_this2(const MEDCouplingFieldDouble *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingFieldDoubleServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -61,6 +66,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingFieldTemplateServant>(cppPointerOfMesh);
          }
+         
+         static PyObject *_this2(const MEDCouplingFieldTemplate *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingFieldTemplateServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -73,6 +83,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingMultiFieldsServant>(cppPointerOfMesh);
          }
+
+         static PyObject *_this2(const MEDCouplingMultiFields *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingMultiFieldsServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -85,6 +100,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingFieldOverTimeServant>(cppPointerOfMesh);
          }
+
+         static PyObject *_this2(const MEDCouplingFieldOverTime *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingFieldOverTimeServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -97,6 +117,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingUMeshServant>(cppPointerOfMesh);
          }
+
+         static PyObject *_this2(const MEDCouplingUMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingUMeshServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -109,6 +134,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingExtrudedMeshServant>(cppPointerOfMesh);
          }
+
+         static PyObject *_this2(const MEDCouplingExtrudedMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingExtrudedMeshServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -121,6 +151,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingCMeshServant>(cppPointerOfMesh);
          }
+         
+         static PyObject *_this2(const MEDCouplingCMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingCMeshServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -133,6 +168,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<MEDCouplingCurveLinearMeshServant>(cppPointerOfMesh);
          }
+
+         static PyObject *_this2(const MEDCouplingCurveLinearMesh *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<MEDCouplingCurveLinearMeshServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -145,6 +185,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<DataArrayDoubleServant>(cppPointerOfMesh);
          }
+
+         static PyObject *_this2(const DataArrayDouble *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<DataArrayDoubleServant>(cppPointerOfMesh);
+         }
        }
   };
 
@@ -157,6 +202,11 @@ namespace ParaMEDMEM
          {
            return buildServantAndActivate<DataArrayIntServant>(cppPointerOfMesh);
          }
+
+         static PyObject *_this2(const DataArrayInt *cppPointerOfMesh)
+         {
+           return buildServantAndActivate2<DataArrayIntServant>(cppPointerOfMesh);
+         }
        }
   };
 }
index d37a9586d7cf685d40acf3444ef4957caf94064e..a21a8f7b9ceb7f15e6ffa3cc848d432596560dbe 100644 (file)
@@ -19,7 +19,7 @@
 // Author : Anthony Geay (CEA/DEN)
 
 template<class TServant>
-static PyObject *buildServantAndActivate(const typename TServant::CppType *pt)
+static PyObject *buildServantAndActivateCore(const typename TServant::CppType *pt, std::string& iorOut)
 {
   int argc=0;
   TServant *serv=new TServant(pt);
@@ -30,6 +30,7 @@ static PyObject *buildServantAndActivate(const typename TServant::CppType *pt)
   mgr->activate();
   CORBA::Object_var ret=serv->_this();
   char *ior=orb->object_to_string(ret);
+  iorOut=ior;
   PyObject *iorPython=PyString_FromString(ior);
   PyObject* pdict=PyDict_New();
   PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
@@ -44,3 +45,20 @@ static PyObject *buildServantAndActivate(const typename TServant::CppType *pt)
   return corbaObj;
 }
 
+template<class TServant>
+static PyObject *buildServantAndActivate(const typename TServant::CppType *pt)
+{
+  std::string dummy;
+  return buildServantAndActivateCore<TServant>(pt,dummy);
+}
+
+template<class TServant>
+static PyObject *buildServantAndActivate2(const typename TServant::CppType *pt)
+{
+  std::string ret1Cpp;
+  PyObject *ret0Py=buildServantAndActivateCore<TServant>(pt,ret1Cpp);
+  PyObject *ret=PyTuple_New(2);
+  PyTuple_SetItem(ret,0,ret0Py);
+  PyTuple_SetItem(ret,1,PyString_FromString(ret1Cpp.c_str()));
+  return ret;
+}
index b4446b1ddc98b947bdb8d83cab1b981c9309b2c5..b1a329f0a95fde206dd70d9a91d8f83bfb1b705a 100644 (file)
@@ -149,6 +149,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         targetMesh.insertNextCell(NORM_POINT1,1,[7]);
         targetMesh.insertNextCell(NORM_POINT1,1,[6]);
         targetMesh.finishInsertingCells();
+        self.assertRaises(InterpKernelException,targetMesh.checkCoherency);
         myCoords=DataArrayDouble.New();
         myCoords.setValues(targetCoords,9,3);
         targetMesh.setCoords(myCoords);
@@ -10833,7 +10834,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
             pass
         pass
 
-    def testSwigCellOrientation1(self):
+    def testSwig2CellOrientation1(self):
         coords=DataArrayDouble([-0.21606,-0.10803,0.29999999999999999,-0.21606,-0.10803,0.37700000000000006,0,-0.10803,0.29999999999999999,0,-0.10803,0.37700000000000006,0,0.10803,0.29999999999999999,0,0.10803,0.37700000000000006,-0.21606,0.10803,0.29999999999999999,-0.21606,0.10803,0.37700000000000006,0,0.03601,0.29999999999999999,0,0.03601,0.37700000000000006,0,-0.03601,0.29999999999999999,0,-0.03601,0.37700000000000006],12,3)
         conn=[[0,2,10,8,4,6],[1,3,11,9,5,7],[0,1,3,2],[2,3,11,10],[10,11,9,8],[8,9,5,4],[4,5,7,6],[6,7,1,0]]
         for i in xrange(256):
@@ -10855,7 +10856,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
             pass
         pass
 
-    def testSwigCheckConsecutiveCellTypesForMEDFileFrmt1(self):
+    def testSwig2CheckConsecutiveCellTypesForMEDFileFrmt1(self):
         m1=MEDCouplingUMesh("",2) ; m1.allocateCells(0)
         m1.insertNextCell(NORM_QUAD4,[0,1,2,3])
         m1.insertNextCell(NORM_TRI3,[0,1,2])
@@ -10868,7 +10869,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(m1.checkConsecutiveCellTypesForMEDFileFrmt())
         pass
 
-    def testSwigDAAccumulate1(self):
+    def testSwig2DAAccumulate1(self):
         d=DataArrayInt(10) ; d.iota(0)
         self.assertEqual([45],d.accumulate())
         self.assertEqual(45,d.accumulate(0))
@@ -10887,7 +10888,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(155.,d.accumulate(2))
         pass
 
-    def testSwigUMeshDistanceToMesh1(self):
+    def testSwig2UMeshDistanceToMesh1(self):
         m=MEDCouplingUMesh("toto",2)
         coords=DataArrayDouble([2.3,3.4,5.6,6.5,-4.3,3.2,-9.8,7.6,-5.4],3,3)
         m.setCoords(coords)
@@ -10937,7 +10938,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertAlmostEqual(0.07071067811865482,a,14) ; self.assertEqual(1,b) ; self.assertEqual(2,c)
         pass
 
-    def testSwigNonRegressionPartitionBySpreadZone1(self):
+    def testSwig2NonRegressionPartitionBySpreadZone1(self):
         m=MEDCouplingCMesh()
         arr=DataArrayDouble(6) ; arr.iota(0.)
         m.setCoords(arr,arr,arr)
@@ -11044,7 +11045,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(d2.isEqual(DataArrayInt([0,1,1,1,1,1,1,2,2,2,2,2,2,3])))
         pass
 
-    def testSwigCurveLinearMesh2(self):
+    def testSwig2CurveLinearMesh2(self):
         c=MEDCouplingCMesh()
         #2D
         arr1=DataArrayDouble([0,1,3,7])
@@ -11100,7 +11101,7 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(cl.buildUnstructured().getBarycenterAndOwner().isEqual(DataArrayDouble(li4_1,4,2),1e-14))
         pass
 
-    def testSwigCurveLinearMeshNonRegression1(self):
+    def testSwig2CurveLinearMeshNonRegression1(self):
         coords=DataArrayDouble([0.0, 0.0, 0.10000000149011612, 0.6000000238418579, 0.10000000149011612, 0.30000001192092896, 1.100000023841858, 0.10000000149011612, 0.20000000298023224, 0.10000000149011612, 0.6000000238418579, 0.20000000298023224, 0.699999988079071, 0.6000000238418579, 0.10000000149011612, 1.2000000476837158, 0.6000000238418579, 0.30000001192092896, 0.10000000149011612, 1.100000023841858, 0.30000001192092896, 0.5, 1.100000023841858, 0.20000000298023224, 1.0, 1.2000000476837158, 0.10000000149011612, 0.0, 0.10000000149011612, 0.5, 0.5, 0.10000000149011612, 0.6000000238418579, 1.2000000476837158, 0.10000000149011612, 0.699999988079071, 0.10000000149011612, 0.6000000238418579, 0.699999988079071, 0.6000000238418579, 0.6000000238418579, 0.5, 1.100000023841858, 0.6000000238418579, 0.6000000238418579, 0.10000000149011612, 1.0, 0.6000000238418579, 0.699999988079071, 1.2000000476837158, 0.699999988079071, 0.8999999761581421, 1.0, 0.5, 0.10000000149011612, 0.10000000149011612, 1.2000000476837158, 0.699999988079071, 0.10000000149011612, 1.0, 1.0, 0.10000000149011612, 1.100000023841858, 0.10000000149011612, 0.6000000238418579, 1.100000023841858, 0.6000000238418579, 0.6000000238418579, 1.100000023841858, 1.100000023841858, 0.6000000238418579, 1.2000000476837158, 0.10000000149011612, 1.2000000476837158, 1.0, 0.5, 1.100000023841858, 1.2000000476837158, 1.2000000476837158, 1.100000023841858, 1.0],27,3)
         m=MEDCouplingCurveLinearMesh("toto")
         m.setCoords(coords)
@@ -11113,6 +11114,149 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(m.getBarycenterAndOwner().isEqual(m.buildUnstructured().getBarycenterAndOwner(),1e-12))
         pass
 
+    def testSwig2NonRegressionDASetSelectedComponents1(self):
+        da=DataArrayDouble.New([1.,2.,3.,4.,5.,6.],3,2)
+        dv=DataArrayDouble.New();
+        dv.alloc(4,4)
+        dv.fillWithZero()
+        # da has less tuples than dv
+        dv.setSelectedComponents(da,[1,0])
+        #
+        self.assertTrue(dv.isEqual(DataArrayDouble([2.,1.,0.,0.,4.,3.,0.,0.,6.,5.,0.,0.,0.,0.,0.,0.],4,4),1e-14))
+        #
+        da=DataArrayInt.New([1,2,3,4,5,6],3,2)
+        dv=DataArrayInt.New();
+        dv.alloc(4,4)
+        dv.fillWithZero()
+        # da has less tuples than dv
+        dv.setSelectedComponents(da,[1,0])
+        #
+        self.assertTrue(dv.isEqual(DataArrayInt([2,1,0,0,4,3,0,0,6,5,0,0,0,0,0,0],4,4)))
+        pass
+
+    def testSwigSetItem3(self):
+        # 1-2 
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[3]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,0,0,1,2,0,0,0,0],6,2),1e-14))
+        # 2-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[5,3,2]]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,1,2,1,2,0,0,1,2],6,2),1e-14))
+        # 3-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[:]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayDouble([1,2,1,2,1,2,1,2,1,2,1,2],6,2),1e-14))
+        # 4-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[DataArrayInt([0,3,4])]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayDouble([1,2,0,0,0,0,1,2,1,2,0,0],6,2),1e-14))
+        # 5-2
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[5,1]=[7]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,7],6,2),1e-14))
+        # 6-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[3,5],1]=[7]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,0,0,0,7,0,0,0,7],6,2),1e-14))
+        # 7-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[:-1:2,1]=[7]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,7,0,0,0,7,0,0,0,7,0,0],6,2),1e-14))
+        # 8-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[DataArrayInt([0,3,4]),1]=[7]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,7,0,0,0,0,0,7,0,7,0,0],6,2),1e-14))
+        # 9-2
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[3,[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,0,0,0,0,8,7,0,0,0,0],6,2),1e-14))
+        # 10-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[1,3,4],[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,8,7,0,0,8,7,8,7,0,0],6,2),1e-14))
+        # 11-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[1::2,[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,8,7,0,0,8,7,0,0,8,7],6,2),1e-14))
+        # 12-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[DataArrayInt([1,4]),[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,8,7,0,0,0,0,8,7,0,0],6,2),1e-14))
+        # 13-2
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[1,:-1]=[9]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,9,0,0,0,0,0,0,0,0,0],6,2),1e-14))
+        # 14-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[1,4,5],:]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,7,8,0,0,0,0,7,8,7,8],6,2),1e-14))
+        # 15-2 false
+        d=DataArrayDouble([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[1::2,:]=[3,9]
+        self.assertTrue(d.isEqual(DataArrayDouble([0,0,3,9,0,0,3,9,0,0,3,9],6,2),1e-14))
+        # 1-2 
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[3]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0,1,2,0,0,0,0],6,2)))
+        # 2-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[5,3,2]]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,1,2,1,2,0,0,1,2],6,2)))
+        # 3-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[:]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayInt([1,2,1,2,1,2,1,2,1,2,1,2],6,2)))
+        # 4-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[DataArrayInt([0,3,4])]=[1,2]
+        self.assertTrue(d.isEqual(DataArrayInt([1,2,0,0,0,0,1,2,1,2,0,0],6,2)))
+        # 5-2
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[5,1]=[7]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,7],6,2)))
+        # 6-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[3,5],1]=[7]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0,0,7,0,0,0,7],6,2)))
+        # 7-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[:-1:2,1]=[7]
+        self.assertTrue(d.isEqual(DataArrayInt([0,7,0,0,0,7,0,0,0,7,0,0],6,2)))
+        # 8-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[DataArrayInt([0,3,4]),1]=[7]
+        self.assertTrue(d.isEqual(DataArrayInt([0,7,0,0,0,0,0,7,0,7,0,0],6,2)))
+        # 9-2
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[3,[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,0,0,0,0,8,7,0,0,0,0],6,2)))
+        # 10-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[1,3,4],[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,8,7,0,0,8,7,8,7,0,0],6,2)))
+        # 11-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[1::2,[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,8,7,0,0,8,7,0,0,8,7],6,2)))
+        # 12-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[DataArrayInt([1,4]),[1,0]]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,8,7,0,0,0,0,8,7,0,0],6,2)))
+        # 13-2
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[1,:-1]=[9]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,9,0,0,0,0,0,0,0,0,0],6,2)))
+        # 14-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[[1,4,5],:]=[7,8]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,7,8,0,0,0,0,7,8,7,8],6,2)))
+        # 15-2 false
+        d=DataArrayInt([0,0,0,0,0,0,0,0,0,0,0,0],6,2)
+        d[1::2,:]=[3,9]
+        self.assertTrue(d.isEqual(DataArrayInt([0,0,3,9,0,0,3,9,0,0,3,9],6,2)))
+        pass
+
     def setUp(self):
         pass
     pass
index 8f47503cfd3c4b6864ab58ff992a0bf74aaf84c4..872da9e44aa7a7a5991b5088d31431a5a4b315d0 100644 (file)
@@ -251,6 +251,8 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::DataArrayDoubleTuple::buildDADouble;
 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
 %newobject ParaMEDMEM::MEDCouplingMesh::checkTypeConsistencyAndContig;
+%newobject ParaMEDMEM::MEDCouplingMesh::computeNbOfNodesPerCell;
+%newobject ParaMEDMEM::MEDCouplingMesh::giveCellsWithType;
 %newobject ParaMEDMEM::MEDCouplingMesh::getCoordinatesAndOwner;
 %newobject ParaMEDMEM::MEDCouplingMesh::getBarycenterAndOwner;
 %newobject ParaMEDMEM::MEDCouplingMesh::buildOrthogonalField;
@@ -277,13 +279,11 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::MEDCouplingUMesh::__iter__;
 %newobject ParaMEDMEM::MEDCouplingUMesh::__getitem__;
 %newobject ParaMEDMEM::MEDCouplingUMesh::cellsByType;
-%newobject ParaMEDMEM::MEDCouplingUMesh::giveCellsWithType;
 %newobject ParaMEDMEM::MEDCouplingUMesh::zipConnectivityTraducer;
 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity;
 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDescendingConnectivity2;
 %newobject ParaMEDMEM::MEDCouplingUMesh::buildExtrudedMesh;
 %newobject ParaMEDMEM::MEDCouplingUMesh::buildSpreadZonesWithPoly;
-%newobject ParaMEDMEM::MEDCouplingUMesh::computeNbOfNodesPerCell;
 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshes;
 %newobject ParaMEDMEM::MEDCouplingUMesh::MergeUMeshesOnSameCoords;
 %newobject ParaMEDMEM::MEDCouplingUMesh::ComputeSpreadZoneGradually;
@@ -295,6 +295,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::MEDCouplingUMesh::computeFetchedNodeIds;
 %newobject ParaMEDMEM::MEDCouplingUMesh::getRenumArrForConsecutiveCellTypesSpec;
 %newobject ParaMEDMEM::MEDCouplingUMesh::buildDirectionVectorField;
+%newobject ParaMEDMEM::MEDCouplingUMesh::convertLinearCellsToQuadratic;
 %newobject ParaMEDMEM::MEDCouplingUMesh::getEdgeRatioField;
 %newobject ParaMEDMEM::MEDCouplingUMesh::getAspectRatioField;
 %newobject ParaMEDMEM::MEDCouplingUMesh::getWarpField;
@@ -491,6 +492,8 @@ namespace ParaMEDMEM
     virtual int getMeshDimension() const throw(INTERP_KERNEL::Exception);
     virtual DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
     virtual DataArrayDouble *getBarycenterAndOwner() const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
     virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
     virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
     virtual std::string simpleRepr() const;
@@ -1375,7 +1378,6 @@ namespace ParaMEDMEM
     int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
     int getMeshLength() const throw(INTERP_KERNEL::Exception);
     void computeTypes() throw(INTERP_KERNEL::Exception);
-    DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
     std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
     //tools
@@ -1390,7 +1392,6 @@ namespace ParaMEDMEM
     DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception);
     DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0) throw(INTERP_KERNEL::Exception);
-    DataArrayInt *computeNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
     void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
@@ -1400,6 +1401,7 @@ namespace ParaMEDMEM
     void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
     void tessellate2DCurve(double eps) throw(INTERP_KERNEL::Exception);
     void convertQuadraticCellsToLinear() throw(INTERP_KERNEL::Exception);
+    DataArrayInt *convertLinearCellsToQuadratic(int conversionType=0) throw(INTERP_KERNEL::Exception);
     void convertDegeneratedCells() throw(INTERP_KERNEL::Exception);
     bool areOnlySimplexCells() const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getEdgeRatioField() const throw(INTERP_KERNEL::Exception);
@@ -3507,7 +3509,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayDouble::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
                return self;
              case 3:
@@ -3547,7 +3549,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayDouble::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
                return self;
              case 3:
@@ -3587,7 +3589,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayDouble::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
                return self;
              case 3:
@@ -3627,7 +3629,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayDouble::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
                return self;
              case 3:
@@ -3700,27 +3702,18 @@ namespace ParaMEDMEM
          }
        case 11:
          {
-           int bb=pt1.first;
-           int ee=pt1.second.first;
-           int ss=pt1.second.second;
-           if(ee<bb || ss<=0)
-             throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
-           int nbOfE=(ee-bb)/ss;
-           std::vector<int> nv(nbOfE);
-           for(int jj=0;jj<nbOfE;jj++)
-             nv[jj]=bb+jj*ss;
            switch(sw1)
              {
              case 1:
-               self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+               self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
                return self;
              case 2:
                tmp=DataArrayDouble::New();
                tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-               self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
+               self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
                return self;
              case 3:
-               self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+               self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
                return self;
              default:
                throw INTERP_KERNEL::Exception(msg);
@@ -3756,7 +3749,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayDouble::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
                return self;
              case 3:
@@ -3796,7 +3789,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                  tmp=DataArrayDouble::New();
-                 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+                 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                  self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
                  return self;
              case 3:
@@ -5391,7 +5384,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayInt::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,it1,it1+1,1,0,nbOfComponents,1,false);
                return self;
              case 3:
@@ -5439,7 +5432,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayInt::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,0,nbOfComponents,1,false);
                return self;
              case 3:
@@ -5487,7 +5480,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayInt::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,it1,it1+1,1,ic1,ic1+1,1,false);
                return self;
              case 3:
@@ -5535,7 +5528,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayInt::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,ic1,ic1+1,1,false);
                return self;
              case 3:
@@ -5624,31 +5617,22 @@ namespace ParaMEDMEM
          }
        case 11:
          {
-           int bb=pt1.first;
-           int ee=pt1.second.first;
-           int ss=pt1.second.second;
-           if(ee<bb || ss<=0)
-             throw INTERP_KERNEL::Exception("Invalid slice in tuple selection");
-           int nbOfE=(ee-bb)/ss;
-           std::vector<int> nv(nbOfE);
-           for(int jj=0;jj<nbOfE;jj++)
-             nv[jj]=bb+jj*ss;
            switch(sw1)
              {
              case 1:
-               self->setPartOfValuesSimple2(i1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+               self->setPartOfValuesSimple4(i1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
                return self;
              case 2:
                tmp=DataArrayInt::New();
                tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
-               self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size(),false);
+               self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size(),false);
                return self;
              case 3:
-               self->setPartOfValues2(d1,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+               self->setPartOfValues4(d1,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
                return self;
              case 4:
                tmp=dd1->buildDAInt(1,self->getNumberOfComponents());
-               self->setPartOfValues2(tmp,&nv[0],&nv[0]+nv.size(),&vc1[0],&vc1[0]+vc1.size());
+               self->setPartOfValues4(tmp,pt1.first,pt1.second.first,pt1.second.second,&vc1[0],&vc1[0]+vc1.size());
                return self;
              default:
                throw INTERP_KERNEL::Exception(msg);
@@ -5688,7 +5672,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                tmp=DataArrayInt::New();
-               tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+               tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                self->setPartOfValues1(tmp,it1,it1+1,1,pc1.first,pc1.second.first,pc1.second.second,false);
                return self;
              case 3:
@@ -5736,7 +5720,7 @@ namespace ParaMEDMEM
                return self;
              case 2:
                  tmp=DataArrayInt::New();
-                 tmp->useArray(&v1[0],false,CPP_DEALLOC,v1.size(),1);
+                 tmp->useArray(&v1[0],false,CPP_DEALLOC,1,v1.size());
                  self->setPartOfValues1(tmp,pt1.first,pt1.second.first,pt1.second.second,pc1.first,pc1.second.first,pc1.second.second,false);
                  return self;
              case 3:
@@ -6353,6 +6337,7 @@ namespace ParaMEDMEM
     virtual bool areCompatibleForMerge(const MEDCouplingField *other) const throw(INTERP_KERNEL::Exception);
     virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
     virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const throw(INTERP_KERNEL::Exception);
+    virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
     void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception);
     void setName(const char *name) throw(INTERP_KERNEL::Exception);
     const char *getDescription() const throw(INTERP_KERNEL::Exception);
@@ -6503,8 +6488,8 @@ namespace ParaMEDMEM
     void setTimeUnit(const char *unit);
     const char *getTimeUnit() const;
     void synchronizeTimeWithSupport() throw(INTERP_KERNEL::Exception);
-    void copyTinyStringsFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
     void copyTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
+    void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other) throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const;
     std::string advancedRepr() const;
     void writeVTK(const char *fileName) const throw(INTERP_KERNEL::Exception);
index 1998d7fdfe386981d9b8027c2632bd5143e42c7f..b22ebf533db3efe3f6f39fd674d23fec78d9a315 100644 (file)
@@ -40,7 +40,15 @@ class MEDCouplingBasicsTest(unittest.TestCase):
             pass
         array.setValues(ptr,sourceMesh.getNumberOfCells(),1);
         srcField.setArray(array);
+        srcField.setName("abc") ; srcField.setDescription("def")
+        srcField.setTime(7.7,9,10)
         trgfield=remapper.transferField(srcField,4.57);
+        self.assertEqual("abc",trgfield.getName())
+        self.assertEqual("def",trgfield.getDescription())
+        a,b,c=trgfield.getTime()
+        self.assertAlmostEqual(7.7,a,14)
+        self.assertEqual(b,9)
+        self.assertEqual(c,10)
         values=trgfield.getArray().getValues();
         valuesExpected=[7.5 ,7. ,7.,8.,7.5];
         for i in xrange(targetMesh.getNumberOfCells()):
@@ -318,6 +326,34 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(f11.getArray().isEqual(expected2,1e-13))
         self.assertTrue(f22.getArray().isEqual(expected2,1e-13))
         pass
+
+    def testCellToNodeReverse3D(self):
+        c=DataArrayDouble([0.,1.,2.5])
+        cc=MEDCouplingCMesh()
+        cc.setCoords(c,c,c)
+        um=cc.buildUnstructured()
+        f=um.getMeasureField(ON_CELLS)
+        #
+        n2o=um.simplexize(PLANAR_FACE_5)
+        f.setArray(f.getArray()[n2o])
+        f.checkCoherency()
+        f.setNature(ConservativeVolumic)
+        f.setTime(5.6,7,8)
+        f.setName("toto") ; f.setDescription("aDescription")
+        p=MEDCouplingRemapper()
+        p.setP1P0BaryMethod(True)
+        p.prepare(um,um,"P1P0")
+        fNode=p.reverseTransferField(f,1e300)
+        self.assertEqual("toto",fNode.getName())
+        self.assertEqual("aDescription",fNode.getDescription())
+        a,b,c=fNode.getTime()
+        self.assertAlmostEqual(5.6,a,14)
+        self.assertEqual(7,b) ; self.assertEqual(8,c)
+        #
+        integExpected=34.328125
+        self.assertAlmostEqual(fNode.integral(False)[0],integExpected,14)
+        self.assertAlmostEqual(f.integral(False)[0],integExpected,14)
+        pass
     
     def build2DSourceMesh_1(self):
         sourceCoords=[-0.3,-0.3, 0.7,-0.3, -0.3,0.7, 0.7,0.7]
index 0a812c71a66ff5fe0564f735cf7c82844eb523dc..aeca829c2dce31e57600a2b614fca17375a127bc 100644 (file)
@@ -41,6 +41,7 @@ SET(medloader_SOURCES
   MEDFileBasis.cxx
   MEDFileMeshLL.cxx
   MEDFileField.cxx
+  MEDFileParameter.cxx
   MEDFileData.cxx
   SauvMedConvertor.cxx
   SauvReader.cxx
index fbabd4709e1fb50064f3bba2aaa411de901aadad..e5493423a44c989933bc9ac3946180a10cc48a82 100644 (file)
@@ -40,8 +40,11 @@ MEDFileData *MEDFileData::deepCpy() const throw(INTERP_KERNEL::Exception)
   MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> meshes;
   if((const MEDFileMeshes *)_meshes)
     meshes=_meshes->deepCpy();
+  MEDCouplingAutoRefCountObjectPtr<MEDFileParameters> params;
+  if((const MEDFileParameters *)_params)
+    params=_params->deepCpy();
   MEDCouplingAutoRefCountObjectPtr<MEDFileData> ret=MEDFileData::New();
-  ret->_fields=fields; ret->_meshes=meshes;
+  ret->_fields=fields; ret->_meshes=meshes; ret->_params=params;
   return ret.retn();
 }
 
@@ -52,6 +55,8 @@ std::size_t MEDFileData::getHeapMemorySize() const
     ret+=_fields->getHeapMemorySize();
   if((const MEDFileMeshes *)_meshes)
     ret+=_meshes->getHeapMemorySize();
+  if((const MEDFileParameters *)_params)
+    ret+=_params->getHeapMemorySize();
   return ret;
 }
 
@@ -65,22 +70,32 @@ MEDFileMeshes *MEDFileData::getMeshes() const
   return const_cast<MEDFileMeshes *>(static_cast<const MEDFileMeshes *>(_meshes));
 }
 
+MEDFileParameters *MEDFileData::getParams() const
+{
+  return const_cast<MEDFileParameters *>(static_cast<const MEDFileParameters *>(_params));
+}
+
 void MEDFileData::setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception)
 {
-  if(!fields)
-    throw INTERP_KERNEL::Exception("MEDFileData::setFields : input pointer is null !");
-  fields->incrRef();
+  if(fields)
+    fields->incrRef();
   _fields=fields;
 }
 
 void MEDFileData::setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception)
 {
-  if(!meshes)
-    throw INTERP_KERNEL::Exception("MEDFileData::setMeshes : input pointer is null !");
-  meshes->incrRef();
+  if(meshes)
+    meshes->incrRef();
   _meshes=meshes;
 }
 
+void MEDFileData::setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception)
+{
+  if(params)
+    params->incrRef();
+  _params=params;
+}
+
 int MEDFileData::getNumberOfFields() const throw(INTERP_KERNEL::Exception)
 {
   const MEDFileFields *f=_fields;
@@ -97,6 +112,14 @@ int MEDFileData::getNumberOfMeshes() const throw(INTERP_KERNEL::Exception)
   return m->getNumberOfMeshes();
 }
 
+int MEDFileData::getNumberOfParams() const throw(INTERP_KERNEL::Exception)
+{
+  const MEDFileParameters *p=_params;
+  if(!p)
+    throw INTERP_KERNEL::Exception("MEDFileData::getNumberOfParams : no params set !");
+  return p->getNumberOfParams();
+}
+
 std::string MEDFileData::simpleRepr() const
 {
   std::ostringstream oss;
@@ -116,7 +139,15 @@ std::string MEDFileData::simpleRepr() const
       tmp2->simpleReprWithoutHeader(oss);
     }
   else
-    oss << "No meshes set !!!\n";
+    oss << "No meshes set !!!\n\n";
+  oss << "Params part :\n*************\n\n";
+  const MEDFileParameters *tmp3=_params;
+  if(tmp3)
+    {
+      tmp3->simpleReprWithoutHeader(oss);
+    }
+  else
+    oss << "params set !!!\n";
   return oss.str();
 }
 
@@ -191,6 +222,7 @@ try
   {
     _fields=MEDFileFields::New(fileName);
     _meshes=MEDFileMeshes::New(fileName);
+    _params=MEDFileParameters::New(fileName);
   }
 catch(INTERP_KERNEL::Exception& e)
   {
@@ -207,4 +239,7 @@ void MEDFileData::write(const char *fileName, int mode) const throw(INTERP_KERNE
   const MEDFileFields *fs=_fields;
   if(fs)
     fs->writeLL(fid);
+  const MEDFileParameters *ps=_params;
+  if(ps)
+    ps->writeLL(fid);
 }
index c732aad9dff4614f227911589bcd9c2e046c7c69..43d9ac219fb8450024e357c023736e10807346b8 100644 (file)
@@ -22,6 +22,7 @@
 #define __MEDFILEDATA_HXX__
 
 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MEDFileParameter.hxx"
 #include "MEDFileField.hxx"
 #include "MEDFileMesh.hxx"
 
@@ -39,10 +40,13 @@ namespace ParaMEDMEM
     std::size_t getHeapMemorySize() const;
     MEDFileFields *getFields() const;
     MEDFileMeshes *getMeshes() const;
+    MEDFileParameters *getParams() const;
     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
     void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
+    void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
     int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
+    int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const;
     //
     bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab) throw(INTERP_KERNEL::Exception);
@@ -56,6 +60,7 @@ namespace ParaMEDMEM
   private:
     MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fields;
     MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> _meshes;
+    MEDCouplingAutoRefCountObjectPtr<MEDFileParameters> _params;
   };
 }
 
index a94f554730ab9edc0efda88fc1759c3f8f4feafb..e0bb931f40b7836f798045657f7d3c3235ea73dd 100644 (file)
@@ -2219,7 +2219,7 @@ MEDCouplingFieldDouble *MEDFileFieldPerMesh::finishFieldNode2(const MEDFileField
   int nnodes=mesh2->getNumberOfNodes();
   if(nnodes==da->getNbOfElems())
     {
-      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da->transformWithIndArrR(arr2->getConstPointer(),arr2->getConstPointer()+arr2->getNbOfElems());
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da3=da->transformWithIndArrR(arr2->begin(),arr2->end());
       ret->getArray()->renumberInPlace(da3->getConstPointer());
       mesh2->setName(mesh->getName());
       ret->setMesh(mesh2);
@@ -5011,6 +5011,9 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::deepCpy() const throw(INTERP_KERNEL::E
   return ret.retn();
 }
 
+/*!
+ * \return a new allocated object that the caller should deal with.
+ */
 MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception)
 {
   const MEDFileField1TSWithoutSDA *item=_content->getTimeStepAtPos2(pos);
@@ -5019,12 +5022,18 @@ MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepAtPos(int pos) const throw(INTE
   return ret.retn();
 }
 
+/*!
+ * \return a new allocated object that the caller should deal with.
+ */
 MEDFileField1TS *MEDFileFieldMultiTS::getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception)
 {
   int pos=getPosOfTimeStep(iteration,order);
   return getTimeStepAtPos(pos);
 }
 
+/*!
+ * \return a new allocated object that the caller should deal with.
+ */
 MEDFileField1TS *MEDFileFieldMultiTS::getTimeStepGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
 {
   int pos=getPosGivenTime(time,eps);
diff --git a/src/MEDLoader/MEDFileParameter.cxx b/src/MEDLoader/MEDFileParameter.cxx
new file mode 100644 (file)
index 0000000..e9c3c9a
--- /dev/null
@@ -0,0 +1,898 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (CEA/DEN)
+
+#include "MEDFileParameter.hxx"
+#include "MEDFileUtilities.hxx"
+#include "MEDLoaderBase.hxx"
+
+#include "InterpKernelAutoPtr.hxx"
+
+using namespace ParaMEDMEM;
+
+MEDFileParameter1TS::MEDFileParameter1TS(int iteration, int order, double time):_iteration(iteration),_order(order),_time(time)
+{
+}
+
+MEDFileParameter1TS::MEDFileParameter1TS():_iteration(-1),_order(-1),_time(0.)
+{
+}
+
+bool MEDFileParameter1TS::isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const
+{
+  std::ostringstream oss;
+  if(!other)
+    { what="Other is null"; return false; }
+  if(_iteration!=other->_iteration)
+    { oss << "iteration number mismatches " << _iteration << " != " << other->_iteration; what=oss.str(); return false; }
+  if(_order!=other->_order)
+    { oss << "order number mismatches " << _iteration << " != " << other->_iteration; what=oss.str(); return false; }
+  if(fabs(_time-other->_time)>eps)
+    { oss << "time mismatches " << _time << " != " << other->_time << " eps=" << eps; what=oss.str(); return false; }
+  return true;
+}
+
+MEDFileParameter1TS *MEDFileParameterDouble1TSWTI::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterDouble1TSWTI(*this);
+}
+
+bool MEDFileParameterDouble1TSWTI::isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const
+{
+  if(!MEDFileParameter1TS::isEqual(other,eps,what))
+    return false;
+  const MEDFileParameterDouble1TSWTI *otherC=dynamic_cast<const MEDFileParameterDouble1TSWTI *>(other);
+  if(!otherC)
+    { what="IsEqual fails because this is double parameter other no !"; return false; }
+  if(fabs(_arr-otherC->_arr)>eps)
+    { std::ostringstream oss; oss << "value differ " << _arr << " != " << otherC->_arr << " (eps=" << eps << ")"; return false; }
+  return true;
+}
+
+std::size_t MEDFileParameterDouble1TSWTI::getHeapMemorySize() const
+{
+  return sizeof(MEDFileParameterDouble1TSWTI);
+}
+
+std::string MEDFileParameterDouble1TSWTI::simpleRepr() const
+{
+  std::ostringstream oss;
+  simpleRepr2(0,oss);
+  return oss.str();
+}
+
+void MEDFileParameterDouble1TSWTI::simpleRepr2(int bkOffset, std::ostream& oss) const
+{
+  std::string startOfLine(bkOffset,' ');
+  oss << startOfLine << "ParameterDoubleItem with (iteration,order) = (" << _iteration << "," << _order << ")" << std::endl;
+  oss << startOfLine << "Time associacited = " << _time << std::endl;
+  oss << startOfLine << "The value is ***** " << _arr <<  " *****" << std::endl;
+}
+
+MEDFileParameterDouble1TSWTI *MEDFileParameterDouble1TSWTI::New(int iteration, int order, double time)
+{
+  return new MEDFileParameterDouble1TSWTI(iteration,order,time);
+}
+
+MEDFileParameterDouble1TSWTI::MEDFileParameterDouble1TSWTI():_arr(std::numeric_limits<double>::max())
+{
+}
+
+MEDFileParameterDouble1TSWTI::MEDFileParameterDouble1TSWTI(int iteration, int order, double time):MEDFileParameter1TS(iteration,order,time)
+{
+}
+
+void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int dt, int it, int nbOfSteps) throw(INTERP_KERNEL::Exception)
+{
+  std::ostringstream oss; oss << "MEDFileParameterDouble1TS::finishLoading : no specified time step (" << dt << "," << it << ") ! Time steps available : ";
+  for(int i=0;i<nbOfSteps;i++)
+    {
+      int locDt,locIt;
+      double tim;
+      MEDparameterComputationStepInfo(fid,name.c_str(),i+1,&locDt,&locIt,&tim);
+      if(dt==locDt && it==locIt)
+        {
+          _iteration=locDt; _order=locIt; _time=tim;
+          MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+          return ;
+        }
+      else
+        {
+          oss << "(" << locDt << "," << locIt << ")";
+          if(i!=nbOfSteps-1)
+            oss << ", ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+void MEDFileParameterDouble1TSWTI::readValue(med_idt fid, const std::string& name) throw(INTERP_KERNEL::Exception)
+{
+  MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+}
+
+void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int timeStepId) throw(INTERP_KERNEL::Exception)
+{
+  int locDt,locIt;
+  double dt;
+  MEDparameterComputationStepInfo(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt);
+  _iteration=locDt; _order=locIt; _time=dt;
+  MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+}
+
+void MEDFileParameterDouble1TSWTI::writeLL(med_idt fid, const std::string& name, const MEDFileWritable& mw) const throw(INTERP_KERNEL::Exception)
+{
+  char nameW[MED_NAME_SIZE+1];
+  MEDLoaderBase::safeStrCpy(name.c_str(),MED_NAME_SIZE,nameW,mw.getTooLongStrPolicy());
+  MEDparameterValueWr(fid,nameW,_iteration,_order,_time,reinterpret_cast<const unsigned char *>(&_arr));
+}
+
+std::size_t MEDFileParameterTinyInfo::getHeapMemSizeOfStrings() const
+{
+  return _dt_unit.capacity()+_name.capacity()+_desc_name.capacity();
+}
+
+bool MEDFileParameterTinyInfo::isEqualStrings(const MEDFileParameterTinyInfo& other, std::string& what) const
+{
+  std::ostringstream oss;
+  if(_name!=other._name)
+    { oss << "name differ ! this=" << _name << " and other=" << other._name; what=oss.str(); return false; }
+  if(_desc_name!=other._desc_name)
+    { oss << "name differ ! this=" << _desc_name << " and other=" << other._desc_name; what=oss.str(); return false; }
+  if(_dt_unit!=other._dt_unit)
+    { oss << "unit of time differ ! this=" << _dt_unit << " and other=" << other._dt_unit; what=oss.str(); return false; }
+  return true;
+}
+
+void MEDFileParameterTinyInfo::writeLLHeader(med_idt fid, med_parameter_type typ) const throw(INTERP_KERNEL::Exception)
+{
+  char nameW[MED_NAME_SIZE+1],descW[MED_COMMENT_SIZE+1],dtunitW[MED_SNAME_SIZE+1];
+  MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,nameW,getTooLongStrPolicy());
+  MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,descW,getTooLongStrPolicy());
+  MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_SNAME_SIZE,dtunitW,getTooLongStrPolicy());
+  MEDparameterCr(fid,nameW,typ,descW,dtunitW);
+}
+
+void MEDFileParameterTinyInfo::mainRepr(int bkOffset, std::ostream& oss) const
+{
+  std::string startOfLine(bkOffset,' ');
+  oss << startOfLine << "Parameter with name \"" << _name << "\"" << std::endl;
+  oss << startOfLine << "Parameter with description \"" << _desc_name << "\"" << std::endl;
+  oss << startOfLine << "Parameter with unit name \"" << _dt_unit << "\"" << std::endl;
+}
+
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New()
+{
+  return new MEDFileParameterDouble1TS;
+}
+
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterDouble1TS(fileName);
+}
+
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterDouble1TS(fileName,paramName);
+}
+
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterDouble1TS(fileName,paramName,dt,it);
+}
+
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS()
+{
+}
+
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  int nbPar=MEDnParameter(fid);
+  std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
+  INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
+  med_parameter_type paramType;
+  for(int i=0;i<nbPar;i++)
+    {
+      int nbOfSteps;
+      MEDparameterInfo(fid,i+1,pName,&paramType,descName,unitName,&nbOfSteps);
+      std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+      if(paramNameCpp==paramName && paramType==MED_FLOAT64)
+        {
+          _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
+          _name=paramNameCpp;
+          _desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
+          finishLoading(fid,_name,dt,it,nbOfSteps);
+          return ;
+        }
+      else
+        {
+          oss << paramNameCpp;
+          if(i!=nbPar-1) oss << ", ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  int nbPar=MEDnParameter(fid);
+  std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
+  INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
+  med_parameter_type paramType;
+  for(int i=0;i<nbPar;i++)
+    {
+      int nbOfSteps;
+      MEDparameterInfo(fid,i+1,pName,&paramType,descName,unitName,&nbOfSteps);
+      std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+      if(paramNameCpp==paramName && paramType==MED_FLOAT64)
+        {
+          if(nbOfSteps>0)
+            {
+              _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
+              _name=paramNameCpp;
+              _desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
+              finishLoading(fid,_name,0);
+              return ;
+            }
+          else
+            {
+              std::ostringstream oss2; oss2 << "Param name \"" << paramName << "\" exists but no time steps on it !";
+              throw INTERP_KERNEL::Exception(oss2.str().c_str());
+            }
+        }
+      else
+        {
+          oss << paramNameCpp;
+          if(i!=nbPar-1) oss << ", ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  int nbPar=MEDnParameter(fid);
+  if(nbPar<1)
+    {
+      std::ostringstream oss2; oss2 << "No parameter in file \"" << fileName << "\" !";  
+      throw INTERP_KERNEL::Exception(oss2.str().c_str());
+    }
+  INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
+  med_parameter_type paramType;
+  int nbOfSteps;
+  MEDparameterInfo(fid,1,pName,&paramType,descName,unitName,&nbOfSteps);
+  std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+  if(paramType==MED_FLOAT64)
+    {
+      if(nbOfSteps>0)
+        {
+          _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
+          _name=paramNameCpp;
+          _desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
+          finishLoading(fid,_name,0);
+          return ;
+        }
+      else
+        {
+          std::ostringstream oss2; oss2 << "Double param name \"" << paramNameCpp << "\" exists in file \""<< fileName << "\"but no time steps on it !";
+          throw INTERP_KERNEL::Exception(oss2.str().c_str());
+        }
+    }
+  else
+    {
+      std::ostringstream oss2; oss2 << "First parameter in file \"" << fileName << "\" is not double !";  
+      throw INTERP_KERNEL::Exception(oss2.str().c_str());
+    }
+}
+
+bool MEDFileParameterDouble1TS::isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const
+{
+  if(!MEDFileParameterDouble1TSWTI::isEqual(other,eps,what))
+    return false;
+  const MEDFileParameterDouble1TS *otherC=dynamic_cast<const MEDFileParameterDouble1TS *>(other);
+  if(!otherC)
+    { what="Other is not of type MEDFileParameterDouble1TS as this"; return false; }
+  if(!isEqualStrings(*otherC,what))
+    return false;
+  return true;
+}
+
+MEDFileParameter1TS *MEDFileParameterDouble1TS::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterDouble1TS(*this);
+}
+
+std::string MEDFileParameterDouble1TS::simpleRepr() const
+{
+  std::ostringstream oss;
+  MEDFileParameterTinyInfo::mainRepr(0,oss);
+  MEDFileParameterDouble1TSWTI::simpleRepr2(0,oss);
+  return oss.str();
+}
+
+std::size_t MEDFileParameterDouble1TS::getHeapMemorySize() const
+{
+  return getHeapMemSizeOfStrings()+sizeof(MEDFileParameterDouble1TS);
+}
+
+void MEDFileParameterDouble1TS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+  med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileParameterTinyInfo::writeLLHeader(fid,MED_FLOAT64);
+  MEDFileParameterDouble1TSWTI::writeLL(fid,_name,*this);
+}
+
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::New()
+{
+  return new MEDFileParameterMultiTS;
+}
+
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterMultiTS(fileName);
+}
+
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterMultiTS(fileName,paramName);
+}
+
+MEDFileParameterMultiTS::MEDFileParameterMultiTS()
+{
+}
+
+MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS& other, bool deepCopy):MEDFileParameterTinyInfo(other),_param_per_ts(other._param_per_ts)
+{
+  if(deepCopy)
+    for(std::size_t i=0;i<_param_per_ts.size();i++)
+      {
+        const MEDFileParameter1TS *elt=_param_per_ts[i];
+        if(elt)
+          _param_per_ts[i]=elt->deepCpy();
+      }
+}
+
+MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  int nbPar=MEDnParameter(fid);
+  if(nbPar<1)
+    {
+      std::ostringstream oss; oss << "MEDFileParameterMultiTS : no parameter in file \"" << fileName << "\" !" ;
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
+  med_parameter_type paramType;
+  int nbOfSteps;
+  MEDparameterInfo(fid,1,pName,&paramType,descName,unitName,&nbOfSteps);
+  std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+  _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
+  _name=paramNameCpp;
+  _desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
+  finishLoading(fid,paramType,nbOfSteps);
+}
+
+MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  int nbPar=MEDnParameter(fid);
+  std::ostringstream oss; oss << "MEDFileParameterDouble1TS : no double param name \"" << paramName << "\" ! Double Parameters available are : ";
+  INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
+  med_parameter_type paramType;
+  for(int i=0;i<nbPar;i++)
+    {
+      int nbOfSteps;
+      MEDparameterInfo(fid,i+1,pName,&paramType,descName,unitName,&nbOfSteps);
+      std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+      if(paramNameCpp==paramName)
+        {
+          if(nbOfSteps>0)
+            {
+              _dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
+              _name=paramNameCpp;
+              _desc_name=MEDLoaderBase::buildStringFromFortran(descName,MED_COMMENT_SIZE);
+              finishLoading(fid,paramType,nbOfSteps);
+              return ;
+            }
+          else
+            {
+              std::ostringstream oss2; oss2 << "Param name \"" << paramName << "\" exists but no time steps on it !";
+              throw INTERP_KERNEL::Exception(oss2.str().c_str());
+            }
+        }
+      else
+        {
+          oss << paramNameCpp;
+          if(i!=nbPar-1) oss << ", ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+void MEDFileParameterMultiTS::finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps) throw(INTERP_KERNEL::Exception)
+{
+  _param_per_ts.resize(nbOfSteps);
+  for(int i=0;i<nbOfSteps;i++)
+    {
+      int dt,it;
+      double tim;
+      MEDparameterComputationStepInfo(fid,_name.c_str(),i+1,&dt,&it,&tim);
+      switch(typ)
+        {
+        case MED_FLOAT64:
+          _param_per_ts[i]=MEDFileParameterDouble1TSWTI::New(dt,it,tim);
+          _param_per_ts[i]->readValue(fid,_name.c_str());
+          break;
+          /*case MED_INT32;
+         _param_per_ts[i]=;
+         break;*/
+        default:
+          throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::finishLoading : supporting only FLOAT64 !");
+        }
+    }
+}
+
+std::size_t MEDFileParameterMultiTS::getHeapMemorySize() const
+{
+  std::size_t ret=sizeof(MEDFileParameterMultiTS);
+  std::size_t ret2=sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS>)*_param_per_ts.capacity();
+  for(std::size_t i=0;i<_param_per_ts.size();i++)
+    {
+      const MEDFileParameter1TS *pt(_param_per_ts[i]);
+      if(pt)
+        ret2+=pt->getHeapMemorySize();
+    }
+  return ret2+ret;
+}
+
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameterMultiTS(*this,true);
+}
+
+bool MEDFileParameterMultiTS::isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const
+{
+  if(!other)
+    { what="other is null !"; return false; }
+  if(_param_per_ts.size()!=other->_param_per_ts.size())
+    { what="number of time steps differs !"; return false; }
+  std::ostringstream oss;
+  for(std::size_t i=0;i<_param_per_ts.size();i++)
+    {
+      const MEDFileParameter1TS *a(_param_per_ts[i]),*b(other->_param_per_ts[i]);
+      if((a && !b) || (!a && b))
+        { oss << "At time step id #" << i << " pointer is defined on one side not in the other !"; what=oss.str(); return false; }
+      if(a)
+        if(!a->isEqual(b,eps,what))
+          { oss << " At time step id #" << i << " non equality !"; what+=oss.str(); return false; }
+    }
+  return true;
+}
+
+void MEDFileParameterMultiTS::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+  med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  writeLL(fid,*this);
+}
+
+void MEDFileParameterMultiTS::writeLL(med_idt fid, const MEDFileWritable& mw) const throw(INTERP_KERNEL::Exception)
+{
+  std::set<med_parameter_type> diffType;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+    {
+      const MEDFileParameter1TS *elt(*it);
+      if(dynamic_cast<const MEDFileParameterDouble1TSWTI *>(elt))
+        diffType.insert(MED_FLOAT64);
+    }
+  if(diffType.size()>1)
+    throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::writeLL : impossible to mix type of data in parameters in MED file ! Only float64 or only int32 ...");
+  if(diffType.empty())
+    return;
+  med_parameter_type typ=*diffType.begin();
+  MEDFileParameterTinyInfo::writeLLHeader(fid,typ);
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+    {
+      const MEDFileParameter1TS *elt(*it);
+      if(elt)
+        elt->writeLL(fid,_name,mw);
+    }
+}
+
+std::string MEDFileParameterMultiTS::simpleRepr() const
+{
+  std::ostringstream oss;
+  simpleRepr2(0,oss);
+  return oss.str();
+}
+
+void MEDFileParameterMultiTS::simpleRepr2(int bkOffset, std::ostream& oss) const
+{
+  MEDFileParameterTinyInfo::mainRepr(bkOffset,oss);
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+    {
+      const MEDFileParameter1TS *elt(*it);
+      if(elt)
+        elt->simpleRepr2(bkOffset+2,oss);
+    }
+}
+
+void MEDFileParameterMultiTS::appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception)
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDFileParameterDouble1TSWTI> elt=MEDFileParameterDouble1TSWTI::New(dt,it,time);
+  elt->setValue(val);
+  MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> elt2((MEDFileParameterDouble1TSWTI*)elt); elt2->incrRef();
+  _param_per_ts.push_back(elt2);
+}
+
+double MEDFileParameterMultiTS::getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+{
+  int pos=getPosOfTimeStep(iteration,order);
+  const MEDFileParameter1TS *elt=_param_per_ts[pos];
+  if(!elt)
+    {
+      std::ostringstream oss; oss << "MEDFileParameterMultiTS::getDoubleValue : time iteration it=" << iteration << " order=" << order;
+      oss << " exists but elt is empty !"; 
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  const MEDFileParameterDouble1TSWTI *eltC=dynamic_cast<const MEDFileParameterDouble1TSWTI *>(elt);
+  if(!eltC)
+    {
+      std::ostringstream oss; oss << "MEDFileParameterMultiTS::getDoubleValue : time iteration it=" << iteration << " order=" << order;
+      oss << " exists but not double !"; 
+    }
+  return eltC->getValue();
+}
+
+int MEDFileParameterMultiTS::getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+{
+  int ret=0;
+  std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosOfTimeStep : no such iteration=" << iteration << " order=" << order << " ! Possibilities are :";
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+    {
+      const MEDFileParameter1TS *elt(*it);
+      if(elt)
+        {
+          if(elt->getIteration()==iteration && elt->getOrder())
+            return ret;
+          else
+            oss << "(" << elt->getIteration() << "," << elt->getOrder() << "), ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+int MEDFileParameterMultiTS::getPosGivenTime(double time, double eps) const throw(INTERP_KERNEL::Exception)
+{
+  int ret=0;
+  std::ostringstream oss; oss << "MEDFileParameterMultiTS::getPosGivenTime : no such time=" << time << " ! Possibilities are :";
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++,ret++)
+    {
+      const MEDFileParameter1TS *elt(*it);
+      if(elt)
+        {
+          if(fabs(elt->getTimeValue()-time)<=eps)
+            return ret;
+          else
+            oss << elt->getTimeValue() << ", ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+/*!
+ * \return an internal pointer that can be null. Warning the caller is \b not responsible of the returned pointer.
+ */
+MEDFileParameter1TS *MEDFileParameterMultiTS::getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
+{
+  if(posId<0 || posId>=(int)_param_per_ts.size())
+    {
+      std::ostringstream oss; oss << "MEDFileParameterMultiTS::getTimeStepAtPos : invalid pos ! Should be in [0," << _param_per_ts.size() << ") !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  return const_cast<MEDFileParameter1TS *>(static_cast<const MEDFileParameter1TS *>(_param_per_ts[posId]));
+}
+
+void MEDFileParameterMultiTS::eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception)
+{
+  std::vector<bool> b(_param_per_ts.size(),true);
+  int len=(int)_param_per_ts.size();
+  for(const int *w=startIds;w!=endIds;w++)
+    if(*w>=0 && *w<len)
+      b[*w]=false;
+    else
+      {
+        std::ostringstream oss; oss << "MEDFileParameterMultiTS::eraseTimeStepIds : At pos #" << std::distance(startIds,w) << " value is " << *w << " should be in [0," << len << ") !"; throw INTERP_KERNEL::Exception(oss.str().c_str());
+      }
+  std::size_t newNb=std::count(b.begin(),b.end(),true);
+  std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> > paramPerTs(newNb);
+  std::size_t j=0;
+  for(std::size_t i=0;i<_param_per_ts.size();i++)
+    if(b[i])
+      paramPerTs[j++]=_param_per_ts[i];
+  _param_per_ts=paramPerTs;
+}
+
+std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getIterations() const throw(INTERP_KERNEL::Exception)
+{
+  std::vector< std::pair<int,int> > ret;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+    {
+      const MEDFileParameter1TS *elt(*it);
+      if(elt)
+        ret.push_back(std::pair<int,int>(elt->getIteration(),elt->getOrder()));
+    }
+  return ret;
+}
+
+/*!
+ * \param [out] ret1
+ */
+std::vector< std::pair<int,int> > MEDFileParameterMultiTS::getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception)
+{
+  std::vector< std::pair<int,int> > ret0;
+  ret1.clear();
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> >::const_iterator it=_param_per_ts.begin();it!=_param_per_ts.end();it++)
+    {
+      const MEDFileParameter1TS *elt(*it);
+      if(elt)
+        {
+          ret0.push_back(std::pair<int,int>(elt->getIteration(),elt->getOrder()));
+          ret1.push_back(elt->getTimeValue());
+        }
+    }
+  return ret0;
+}
+
+MEDFileParameters *MEDFileParameters::New()
+{
+  return new MEDFileParameters;
+}
+
+MEDFileParameters *MEDFileParameters::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameters(fileName);
+}
+
+MEDFileParameters::MEDFileParameters(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+  MEDFileUtilities::CheckFileForRead(fileName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  int nbPar=MEDnParameter(fid);
+  _params.resize(nbPar);
+  INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+  INTERP_KERNEL::AutoPtr<char> descName=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
+  INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
+  med_parameter_type paramType;
+  for(int i=0;i<nbPar;i++)
+    {
+      int nbOfSteps;
+      MEDparameterInfo(fid,i+1,pName,&paramType,descName,unitName,&nbOfSteps);
+      std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
+      _params[i]=MEDFileParameterMultiTS::New(fileName,paramNameCpp.c_str());
+    }
+}
+
+MEDFileParameters::MEDFileParameters()
+{
+}
+
+std::size_t MEDFileParameters::getHeapMemorySize() const
+{
+  std::size_t ret=sizeof(MEDFileParameters);
+  std::size_t ret2=sizeof(MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS>)*_params.capacity();
+  for(std::size_t i=0;i<_params.size();i++)
+    {
+      const MEDFileParameterMultiTS *pt(_params[i]);
+      if(pt)
+        ret2+=pt->getHeapMemorySize();
+    }
+  return ret2+ret;
+}
+
+MEDFileParameters *MEDFileParameters::deepCpy() const throw(INTERP_KERNEL::Exception)
+{
+  return new MEDFileParameters(*this,true);
+}
+
+bool MEDFileParameters::isEqual(const MEDFileParameters *other, double eps, std::string& what) const
+{
+  if(!other)
+    { what="other is null !"; return false; }
+  if(_params.size()!=other->_params.size())
+    { what="number of parameters differs !"; return false; }
+  std::ostringstream oss;
+  for(std::size_t i=0;i<_params.size();i++)
+    {
+      const MEDFileParameterMultiTS *a(_params[i]),*b(other->_params[i]);
+      if((a && !b) || (!a && b))
+        { oss << "At param with id #" << i << " pointer is defined on one side not in the other !"; what=oss.str(); return false; }
+      if(a)
+        if(!a->isEqual(b,eps,what))
+          { oss << " At param with id #" << i << " non equality !"; what+=oss.str(); return false; }
+    }
+  return true;
+}
+
+MEDFileParameters::MEDFileParameters(const MEDFileParameters& other, bool deepCopy):MEDFileWritable(other),_params(other._params)
+{
+  if(deepCopy)
+    for(std::size_t i=0;i<_params.size();i++)
+      {
+        const MEDFileParameterMultiTS *elt=_params[i];
+        if(elt)
+          _params[i]=elt->deepCpy();
+      }
+}
+
+void MEDFileParameters::write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception)
+{
+  med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  writeLL(fid);
+}
+
+void MEDFileParameters::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception)
+{
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+    {
+      const MEDFileParameterMultiTS *elt(*it);
+      if(elt)
+        elt->writeLL(fid,*this);
+    }
+}
+
+std::vector<std::string> MEDFileParameters::getParamsNames() const throw(INTERP_KERNEL::Exception)
+{
+  std::vector<std::string> ret(_params.size());
+  int i=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,i++)
+    {
+      const MEDFileParameterMultiTS *p=(*it);
+      if(p)
+        {
+          ret[i]=p->getName();
+        }
+      else
+        {
+          std::ostringstream oss; oss << "MEDFileParameters::getParamsNames : At rank #" << i << " param is not defined !";
+          throw INTERP_KERNEL::Exception(oss.str().c_str());
+        }
+    }
+  return ret;
+}
+
+std::string MEDFileParameters::simpleRepr() const
+{
+  std::ostringstream oss;
+  simpleReprWithoutHeader(oss);
+  return oss.str();
+}
+
+void MEDFileParameters::simpleReprWithoutHeader(std::ostream& oss) const
+{
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++)
+    {
+      const MEDFileParameterMultiTS *elt(*it);
+      if(elt)
+        elt->simpleRepr2(2,oss);
+    }
+}
+
+void MEDFileParameters::resize(int newSize) throw(INTERP_KERNEL::Exception)
+{
+  if(newSize<0)
+    throw INTERP_KERNEL::Exception("MEDFileParameters::resize : should be positive !");
+  _params.resize(newSize);
+}
+
+void MEDFileParameters::pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception)
+{
+  if(param)
+    param->incrRef();
+  MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> elt(param);
+  _params.push_back(elt);
+}
+
+void MEDFileParameters::setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception)
+{
+  if(i<0)
+    throw INTERP_KERNEL::Exception("MEDFileParameters::setParamAtPos : should be positive !");
+  if(i>=(int)_params.size())
+    _params.resize(i+1);
+  if(param)
+    param->incrRef();
+  MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> elt(param);
+  _params[i]=elt;
+}
+
+/*!
+ * \return an internal pointer that can be null. Warning the caller is \b not responsible of the returned pointer.
+ */
+MEDFileParameterMultiTS *MEDFileParameters::getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
+{
+  if(i<0 || i>=(int)_params.size())
+    {
+      std::ostringstream oss; oss << "MEDFileParameters::getParamAtPos : should be in [0," << _params.size() << ") !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  const MEDFileParameterMultiTS *elt=_params[i];
+  return const_cast<MEDFileParameterMultiTS *>(elt);
+}
+
+/*!
+ * \return an internal pointer that can be null. Warning the caller is \b not responsible of the returned pointer.
+ */
+MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
+{
+  int pos=getPosFromParamName(paramName);
+  return getParamAtPos(pos);
+}
+
+void MEDFileParameters::destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception)
+{
+  if(i<0 || i>=(int)_params.size())
+    {
+      std::ostringstream oss; oss << "MEDFileParameters::destroyParamAtPos : should be in [0," << _params.size() << ") !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  _params[i]=MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS>(0);
+}
+
+int MEDFileParameters::getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception)
+{
+  std::ostringstream oss; oss << "MEDFileParameters::getPosFromParamName : no such name=" << paramName << " ! Possibilities are :";
+  int ret=0;
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> >::const_iterator it=_params.begin();it!=_params.end();it++,ret++)
+    {
+      const MEDFileParameterMultiTS *elt(*it);
+      if(elt)
+        {
+          if(std::string(elt->getName())==paramName)
+            return ret;
+          else
+            oss << elt->getName() << ", ";
+        }
+    }
+  throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+int MEDFileParameters::getNumberOfParams() const throw(INTERP_KERNEL::Exception)
+{
+  return (int)_params.size();
+}
diff --git a/src/MEDLoader/MEDFileParameter.hxx b/src/MEDLoader/MEDFileParameter.hxx
new file mode 100644 (file)
index 0000000..c3e6196
--- /dev/null
@@ -0,0 +1,182 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (CEA/DEN)
+
+#ifndef __MEDFILEPARAMETER_HXX__
+#define __MEDFILEPARAMETER_HXX__
+
+#include "MEDLoaderDefines.hxx"
+#include "MEDFileUtilities.hxx"
+#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+
+namespace ParaMEDMEM
+{
+  class MEDLOADER_EXPORT MEDFileParameter1TS : public RefCountObject
+  {
+  public:
+    virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception) = 0;
+    virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const;
+    virtual void simpleRepr2(int bkOffset, std::ostream& oss) const = 0;
+    virtual void readValue(med_idt fid, const std::string& name) throw(INTERP_KERNEL::Exception) = 0;
+    virtual void writeLL(med_idt fid, const std::string& name, const MEDFileWritable& mw) const throw(INTERP_KERNEL::Exception) = 0;
+  public:
+    void setIteration(int it) { _iteration=it; }
+    int getIteration() const { return _iteration; }
+    void setOrder(int order) { _order=order; }
+    int getOrder() const { return _order; }
+    void setTimeValue(double time) { _time=time; }
+    void setTime(int dt, int it, double time) { _time=time; _iteration=dt; _order=it; }
+    double getTime(int& dt, int& it) { dt=_iteration; it=_order; return _time; }
+    double getTimeValue() const { return _time; }
+  protected:
+    MEDFileParameter1TS(int iteration, int order, double time);
+    MEDFileParameter1TS();
+  protected:
+    int _iteration;
+    int _order;
+    double _time;    
+  };
+  
+  class MEDLOADER_EXPORT MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
+  {
+  public:
+    static MEDFileParameterDouble1TSWTI *New(int iteration, int order, double time);
+    MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    void setValue(double val) throw(INTERP_KERNEL::Exception) { _arr=val; }
+    double getValue() const throw(INTERP_KERNEL::Exception) { return _arr; }
+    bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const;
+    std::size_t getHeapMemorySize() const;
+    void readValue(med_idt fid, const std::string& name) throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+  protected:
+    MEDFileParameterDouble1TSWTI();
+    MEDFileParameterDouble1TSWTI(int iteration, int order, double time);
+    void simpleRepr2(int bkOffset, std::ostream& oss) const;
+    void finishLoading(med_idt fid, const std::string& name, int dt, int it, int nbOfSteps) throw(INTERP_KERNEL::Exception);
+    void finishLoading(med_idt fid, const std::string& name, int timeStepId) throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid, const std::string& name, const MEDFileWritable& mw) const throw(INTERP_KERNEL::Exception);
+  protected:
+    double _arr;
+  };
+
+  class MEDLOADER_EXPORT MEDFileParameterTinyInfo : public MEDFileWritable
+  {
+  public:
+    void setDescription(const char *name) { _desc_name=name; }
+    const char *getDescription() const { return _desc_name.c_str(); }
+    void setTimeUnit(const char *unit) { _dt_unit=unit; }
+    const char *getTimeUnit() const { return _dt_unit.c_str(); }
+    std::size_t getHeapMemSizeOfStrings() const;
+    bool isEqualStrings(const MEDFileParameterTinyInfo& other, std::string& what) const;
+  protected:
+    void writeLLHeader(med_idt fid, med_parameter_type typ) const throw(INTERP_KERNEL::Exception);
+    void mainRepr(int bkOffset, std::ostream& oss) const;
+  protected:
+    std::string _dt_unit;
+    std::string _name;
+    std::string _desc_name;
+  };
+
+  class MEDLOADER_EXPORT MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
+  {
+  public:
+    static MEDFileParameterDouble1TS *New();
+    static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
+    virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const;
+    virtual std::string simpleRepr() const;
+    std::size_t getHeapMemorySize() const;
+    void setName(const char *name) throw(INTERP_KERNEL::Exception) { _name=name; }
+    const char *getName() const throw(INTERP_KERNEL::Exception) { return _name.c_str(); }
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+  private:
+    MEDFileParameterDouble1TS();
+    MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+    MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
+  };
+
+  class MEDLOADER_EXPORT MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
+  {
+  public:
+    static MEDFileParameterMultiTS *New();
+    static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+    const char *getName() const { return _name.c_str(); }
+    void setName(const char *name) { _name=name; }
+    std::size_t getHeapMemorySize() const;
+    MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    bool isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const;
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid, const MEDFileWritable& mw) const throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+    void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
+    double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception);
+    void eraseTimeStepIds(const int *startIds, const int *endIds) throw(INTERP_KERNEL::Exception);
+    std::vector< std::pair<int,int> > getIterations() const throw(INTERP_KERNEL::Exception);
+    std::vector< std::pair<int,int> > getTimeSteps(std::vector<double>& ret1) const throw(INTERP_KERNEL::Exception);
+    void simpleRepr2(int bkOffset, std::ostream& oss) const;
+  protected:
+    MEDFileParameterMultiTS();
+    MEDFileParameterMultiTS(const MEDFileParameterMultiTS& other, bool deepCopy);
+    MEDFileParameterMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileParameterMultiTS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+    void finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps) throw(INTERP_KERNEL::Exception);
+  protected:
+    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> > _param_per_ts;
+  };
+
+  class MEDLOADER_EXPORT MEDFileParameters : public RefCountObject, public MEDFileWritable
+  {
+  public:
+    static MEDFileParameters *New();
+    static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    std::size_t getHeapMemorySize() const;
+    MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
+    bool isEqual(const MEDFileParameters *other, double eps, std::string& what) const;
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+    void simpleReprWithoutHeader(std::ostream& oss) const;
+    void resize(int newSize) throw(INTERP_KERNEL::Exception);
+    void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+    void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+    MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception);
+    MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception);
+    void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
+    int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
+    int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
+  protected:
+    void simpleRepr2(int bkOffset, std::ostream& oss) const;
+    MEDFileParameters(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileParameters(const MEDFileParameters& other, bool deepCopy);
+    MEDFileParameters();
+  protected:
+    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS> > _params;
+  };
+}
+
+#endif
index ccb326f69e4c403fbec89988835162a8319bb8b6..cd3ae64508c78d490f6ee03ad86a0894d40332b8 100755 (executable)
@@ -37,15 +37,16 @@ lib_LTLIBRARIES = libmedloader.la
 
 salomeinclude_HEADERS= \
 MEDLoaderDefines.hxx \
-MEDLoader.hxx MEDLoaderBase.hxx MEDFileUtilities.hxx MEDFileMesh.hxx MEDFileMeshLL.hxx \
-MEDFileMeshElt.hxx MEDFileBasis.hxx MEDFileField.hxx MEDFileData.hxx \
+MEDLoader.hxx MEDLoaderBase.hxx MEDFileUtilities.hxx MEDFileMesh.hxx MEDFileMeshLL.hxx    \
+MEDFileMeshElt.hxx MEDFileBasis.hxx MEDFileField.hxx MEDFileData.hxx MEDFileParameter.hxx \
 SauvMedConvertor.hxx SauvReader.hxx SauvWriter.hxx SauvUtilities.hxx
 
 dist_libmedloader_la_SOURCES= \
 MEDLoader.cxx MEDLoaderBase.cxx MEDFileUtilities.cxx      \
 MEDFileMesh.cxx MEDFileMeshElt.cxx MEDFileBasis.cxx       \
-MEDFileMeshLL.cxx MEDFileField.cxx MEDFileData.cxx      \
-SauvMedConvertor.cxx SauvReader.cxx SauvWriter.cxx
+MEDFileMeshLL.cxx MEDFileField.cxx MEDFileData.cxx        \
+SauvMedConvertor.cxx SauvReader.cxx SauvWriter.cxx        \
+MEDFileParameter.cxx
 
 libmedloader_la_CPPFLAGS= $(MED3_INCLUDES) $(HDF5_INCLUDES) @CXXTMPDPTHFLAGS@ \
        -I$(srcdir)/../INTERP_KERNEL \
index bf2c9d1d0f994d7ebfbd0a1a7a9bce5ad6b71a0f..7c775dbeffa1ba2364078c6919ef43f720d6496d 100644 (file)
@@ -268,7 +268,7 @@ const int * SauvUtilities::getGibi2MedQuadraticInterlace( INTERP_KERNEL::Normali
 {
   static vector<const int*> conn;
   static const int hexa20 [] = {0,6,4,2, 12,18,16,14, 7,5,3,1, 19,17,15,13, 8,11,10,9};
-  static const int penta15[] = {0,2,4, 9,11,13, 1,3,5, 10,12,14, 6,7,3};
+  static const int penta15[] = {0,2,4, 9,11,13, 1,3,5, 10,12,14, 6,8,7};
   static const int pyra13 [] = {0,2,4,6, 12, 1,3,5,7, 8,9,10,11};
   static const int tetra10[] = {0,2,4, 9, 1,3,5, 6,7,8};
   static const int quad8  [] = {0,2,4,6, 1,3,5,7};
index 84736406eca3009836b1f36018ad5f4b876a9ddb..6082423e5f6e2273beef44684754b366f3d54294 100644 (file)
@@ -29,6 +29,7 @@
 #include "MEDLoader.hxx"
 #include "MEDFileMesh.hxx"
 #include "MEDFileField.hxx"
+#include "MEDFileParameter.hxx"
 #include "MEDFileData.hxx"
 #include "MEDLoaderTypemaps.i"
 #include "SauvReader.hxx"
@@ -46,6 +47,11 @@ using namespace ParaMEDMEM;
   $result=convertMEDFileMesh($1,$owner);
 }
 
+%typemap(out) ParaMEDMEM::MEDFileParameter1TS*
+{
+  $result=convertMEDFileParameter1TS($1,$owner);
+}
+
 %newobject MEDLoader::ReadUMeshFromFamilies;
 %newobject MEDLoader::ReadUMeshFromGroups;
 %newobject MEDLoader::ReadUMeshFromFile;
@@ -121,6 +127,19 @@ using namespace ParaMEDMEM;
 %newobject ParaMEDMEM::MEDFileData::deepCpy;
 %newobject ParaMEDMEM::MEDFileData::getMeshes;
 %newobject ParaMEDMEM::MEDFileData::getFields;
+%newobject ParaMEDMEM::MEDFileData::getParams;
+
+%newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
+%newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
+%newobject ParaMEDMEM::MEDFileParameters::New;
+%newobject ParaMEDMEM::MEDFileParameters::deepCpy;
+%newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
+%newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
+%newobject ParaMEDMEM::MEDFileParameters::__getitem__;
 
 %newobject ParaMEDMEM::SauvWriter::New;
 %newobject ParaMEDMEM::SauvReader::New;
@@ -135,6 +154,11 @@ using namespace ParaMEDMEM;
 %feature("unref") MEDFileField1TS "$this->decrRef();"
 %feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
 %feature("unref") MEDFileFields "$this->decrRef();"
+%feature("unref") MEDFileParameter1TS "$this->decrRef();"
+%feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
+%feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
+%feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
+%feature("unref") MEDFileParameters "$this->decrRef();"
 %feature("unref") MEDFileData "$this->decrRef();"
 %feature("unref") SauvReader "$this->decrRef();"
 %feature("unref") SauvWriter "$this->decrRef();"
@@ -338,7 +362,7 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
-    static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1);
+    static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
     virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
     virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
     virtual void clearNonDiscrAttributes() const;
@@ -358,8 +382,8 @@ namespace ParaMEDMEM
     void setTimeUnit(const char *unit);
     const char *getTimeUnit() const;
     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
-    std::vector<int> getNonEmptyLevels() const;
-    std::vector<int> getNonEmptyLevelsExt() const;
+    std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
+    std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
     void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
     //
@@ -428,7 +452,7 @@ namespace ParaMEDMEM
            return MEDFileMesh::New(fileName);
          }
 
-         MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1)
+         MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileMesh::New(fileName,mName,dt,it);
          }
@@ -1674,6 +1698,371 @@ namespace ParaMEDMEM
        }
   };
 
+  class MEDFileParameter1TS : public RefCountObject
+  {
+  public:
+    void setIteration(int it);
+    int getIteration() const;
+    void setOrder(int order);
+    int getOrder() const;
+    void setTimeValue(double time);
+    void setTime(int dt, int it, double time);
+    double getTime(int& dt, int& it);
+    double getTimeValue() const;
+  };
+
+  class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
+  {
+  public:
+    void setValue(double val) throw(INTERP_KERNEL::Exception);
+    double getValue() const throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+    %extend
+    {
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+    }
+  };
+
+  class MEDFileParameterTinyInfo : public MEDFileWritable
+  {
+  public:
+    void setDescription(const char *name);
+    const char *getDescription() const;
+    void setTimeUnit(const char *unit);
+    const char *getTimeUnit() const;
+  };
+
+  class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
+  {
+  public:
+    static MEDFileParameterDouble1TS *New();
+    static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
+    virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    virtual std::string simpleRepr() const;
+    void setName(const char *name) throw(INTERP_KERNEL::Exception);
+    const char *getName() const throw(INTERP_KERNEL::Exception);
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileParameterDouble1TS()
+      {
+        return MEDFileParameterDouble1TS::New();
+      }
+      
+      MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileParameterDouble1TS::New(fileName);
+      }
+
+      MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileParameterDouble1TS::New(fileName,paramName);
+      }
+
+      MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
+      {
+        return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
+      {
+        std::string what;
+        bool ret0=self->isEqual(other,eps,what);
+        PyObject *res=PyList_New(2);
+        PyObject *ret0Py=ret0?Py_True:Py_False;
+        Py_XINCREF(ret0Py);
+        PyList_SetItem(res,0,ret0Py);
+        PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+        return res;
+      }
+    }
+  };
+
+  class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
+  {
+  public:
+    static MEDFileParameterMultiTS *New();
+    static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+    const char *getName() const;
+    void setName(const char *name);
+    MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+    void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
+    double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+    int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileParameterMultiTS()
+      {
+        return MEDFileParameterMultiTS::New();
+      }
+      
+      MEDFileParameterMultiTS(const char *fileName)
+      {
+        return MEDFileParameterMultiTS::New(fileName);
+      }
+
+      MEDFileParameterMultiTS(const char *fileName, const char *paramName)
+      {
+        return MEDFileParameterMultiTS::New(fileName,paramName);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+      
+      PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
+      {
+        std::string what;
+        bool ret0=self->isEqual(other,eps,what);
+        PyObject *res=PyList_New(2);
+        PyObject *ret0Py=ret0?Py_True:Py_False;
+        Py_XINCREF(ret0Py);
+        PyList_SetItem(res,0,ret0Py);
+        PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+        return res;
+      }
+      
+      void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
+      {
+        int sw;
+        int pos1;
+        std::vector<int> pos2;
+        DataArrayInt *pos3=0;
+        DataArrayIntTuple *pos4=0;
+        convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
+        switch(sw)
+          {
+          case 1:
+            {
+              self->eraseTimeStepIds(&pos1,&pos1+1);
+              return;
+            }
+          case 2:
+            {
+              if(pos2.empty())
+                return;
+              self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
+              return ;
+            }
+          case 3:
+            {
+              self->eraseTimeStepIds(pos3->begin(),pos3->end());
+              return ;
+            }
+          default:
+            throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
+          }
+      }
+
+      int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+      {
+        if(elt0 && PyInt_Check(elt0))
+          {//fmts[3]
+            int pos=PyInt_AS_LONG(elt0);
+            return pos;
+          }
+        else if(elt0 && PyTuple_Check(elt0))
+          {
+            if(PyTuple_Size(elt0)==2)
+              {
+                PyObject *o0=PyTuple_GetItem(elt0,0);
+                PyObject *o1=PyTuple_GetItem(elt0,1);
+                if(PyInt_Check(o0) && PyInt_Check(o1))
+                  {//fmts(1,-1)
+                    int iter=PyInt_AS_LONG(o0);
+                    int order=PyInt_AS_LONG(o1);
+                    return self->getPosOfTimeStep(iter,order);
+                  }
+                else
+                  throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
+              }
+            else
+              throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
+          }
+        else if(elt0 && PyFloat_Check(elt0))
+          {
+            double val=PyFloat_AS_DOUBLE(elt0);
+            return self->getPosGivenTime(val);
+          }
+        else
+          throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
+      }
+
+      MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+
+      std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
+      {
+        if(PyList_Check(elts))
+          {
+            int sz=PyList_Size(elts);
+            std::vector<int> ret(sz);
+            for(int i=0;i<sz;i++)
+              {
+                PyObject *elt=PyList_GetItem(elts,i);
+                ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
+              }
+            return ret;
+          }
+        else
+          {
+            std::vector<int> ret(1);
+            ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
+            return ret;
+          }
+      }
+
+      void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
+        if(!idsToRemove.empty())
+          self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+      }
+      
+      MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+
+      PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< std::pair<int,int> > res=self->getIterations();
+        PyObject *ret=PyList_New(res.size());
+        int rk=0;
+        for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+          {
+            PyObject *elt=PyTuple_New(2);
+            PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+            PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+            PyList_SetItem(ret,rk,elt);
+          }
+        return ret;
+      }
+
+      PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector<double> res2;
+        std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
+        PyObject *ret=PyList_New(res.size());
+        int rk=0;
+        for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+          {
+            PyObject *elt=PyTuple_New(3);
+            PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+            PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+            PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
+            PyList_SetItem(ret,rk,elt);
+          }
+        return ret;
+      }
+    }
+  };
+
+  class MEDFileParameters : public RefCountObject, public MEDFileWritable
+  {
+  public:
+    static MEDFileParameters *New();
+    static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
+    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
+    std::string simpleRepr() const;
+    void resize(int newSize) throw(INTERP_KERNEL::Exception);
+    void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+    void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+    void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
+    int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
+    int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
+    %extend
+    {
+      MEDFileParameters()
+      {
+        return MEDFileParameters::New();
+      }
+      
+      MEDFileParameters(const char *fileName)
+      {
+        return MEDFileParameters::New(fileName);
+      }
+
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        return self->simpleRepr();
+      }
+
+      MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+      {
+        if(PyInt_Check(obj))
+          {
+            MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
+            if(ret)
+              ret->incrRef();
+            return ret;
+          }
+        else if(PyString_Check(obj))
+          {
+            MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
+            if(ret)
+              ret->incrRef();
+            return ret;
+          }
+        else
+          throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
+      }
+      
+      MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+
+      MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
+      {
+        MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
+        if(ret)
+          ret->incrRef();
+        return ret;
+      }
+      
+      PyObject *isEqual(const MEDFileParameters *other, double eps) const
+      {
+        std::string what;
+        bool ret0=self->isEqual(other,eps,what);
+        PyObject *res=PyList_New(2);
+        PyObject *ret0Py=ret0?Py_True:Py_False;
+        Py_XINCREF(ret0Py);
+        PyList_SetItem(res,0,ret0Py);
+        PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+        return res;
+      }
+    }
+  };
+
   class MEDFileData : public RefCountObject, public MEDFileWritable
   {
   public:
@@ -1682,8 +2071,10 @@ namespace ParaMEDMEM
     MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
     void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
+    void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
     int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
+    int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
     //
     bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
     bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
@@ -1714,6 +2105,14 @@ namespace ParaMEDMEM
            return ret;
          }
 
+         MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
+         {
+           MEDFileParameters *ret=self->getParams();
+           if(ret)
+             ret->incrRef();
+           return ret;
+         }
+
          MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
          {
            MEDFileFields *ret=self->getFields();
index 3f66653fdcaa24a09d82dfc436b48dd8ee5035ff..cdef0aa24edd02e3e679b83417ff4f6690f6dd35 100644 (file)
@@ -29,6 +29,7 @@ class MEDLoaderTest(unittest.TestCase):
         fileName="Pyfile18.med"
         mname="ExampleOfMultiDimW"
         medmesh=MEDFileMesh.New(fileName,mname)
+        self.assertRaises(InterpKernelException,MEDFileMesh.New,fileName,"")
         self.assertEqual((0,-1),medmesh.getNonEmptyLevels())
         m1_0=medmesh.getLevel0Mesh(True)
         m1_1=MEDLoader.ReadUMeshFromFile(fileName,mname,0)
@@ -2004,6 +2005,59 @@ class MEDLoaderTest(unittest.TestCase):
         self.assertTrue(m1.getMesh().isEqual(mesh,1e-12))
         pass
 
+    def testParameters1(self):
+        fname="Pyfile56.med"
+        m=MEDCouplingCMesh() ; arr=DataArrayDouble([0.,1.2,3.5]) ; m.setCoords(arr,arr) ; m.setName("mesh")
+        mm=MEDFileCMesh() ; mm.setMesh(m)
+        ms=MEDFileMeshes() ; ms.pushMesh(mm)
+        data=MEDFileData()
+        p=MEDFileParameters()
+        data.setParams(p) ; data.setMeshes(ms)
+        pts=MEDFileParameterMultiTS()
+        pts.setName("A") ; pts.setDescription("An example of parameter") ; pts.setTimeUnit("ms")
+        pts.appendValue(1,2,3.4,567.89)
+        pts.appendValue(2,3,5.6,999.123)
+        pts2=pts.deepCpy() ; pts2.setName("B") ; pts2.setDescription("A second example")
+        p.pushParam(pts) ; p.pushParam(pts2)
+        data.write(fname,2)
+        p2=MEDFileParameters(fname)
+        self.assertTrue(p.isEqual(p2,1e-14)[0])
+        self.assertAlmostEqual(p[1][1,2].getValue(),567.89,13)
+        p3=p.deepCpy()
+        pts4=pts2.deepCpy()
+        pts3=pts2.deepCpy()
+        self.assertTrue(pts3.isEqual(pts2,1e-14)[0])
+        pts2.eraseTimeStepIds([0])
+        self.assertTrue(not pts3.isEqual(pts2,1e-14)[0])
+        del pts3[[3.4]]
+        self.assertTrue(pts3.isEqual(pts2,1e-14)[0])
+        self.assertRaises(InterpKernelException,p[1].__getitem__,(1,2))
+        self.assertRaises(InterpKernelException,p["B"].__getitem__,(1,2))
+        self.assertAlmostEqual(p[0][1,2].getValue(),567.89,13)
+        self.assertAlmostEqual(p["A"][1,2].getValue(),567.89,13)
+        p=p3
+        self.assertTrue(p.isEqual(p2,1e-14)[0])
+        self.assertTrue(p2["B"].isEqual(pts,1e-14)[0])
+        self.assertTrue(not p2["B"].isEqual(pts2,1e-14)[0])
+        self.assertAlmostEqual(p2[0][1,2].getValue(),567.89,13)
+        self.assertEqual(p.getParamsNames(),('A','B'))
+        ptsr=MEDFileParameterMultiTS(fname,"B")
+        self.assertTrue(ptsr.isEqual(pts4,1e-14)[0])
+        ptsr=MEDFileParameterMultiTS(fname)
+        self.assertTrue(ptsr.isEqual(pts,1e-14)[0])
+        p1tsr=MEDFileParameterDouble1TS(fname)
+        self.assertEqual(p1tsr.getName(),"A")
+        self.assertAlmostEqual(p1tsr.getValue(),567.89,13)
+        p1tsr=MEDFileParameterDouble1TS(fname,"B")
+        self.assertEqual(p1tsr.getName(),"B")
+        self.assertAlmostEqual(p1tsr.getValue(),567.89,13)
+        p1tsr=MEDFileParameterDouble1TS(fname,"B",2,3)
+        self.assertEqual(p1tsr.getName(),"B")
+        self.assertAlmostEqual(p1tsr.getValue(),999.123,13)
+        data2=MEDFileData(fname)
+        self.assertEqual(2,data2.getNumberOfParams())
+        self.assertAlmostEqual(data2.getParams()["B"][1,2].getValue(),567.89,13)
+        pass
     pass
 
 unittest.main()
index cbab3a4d0e60c9bf7466be846d5b7c214fdc5818..07ae0b12eabfc7917fcb75f88557acefcb8e36f4 100644 (file)
@@ -34,6 +34,18 @@ static PyObject* convertMEDFileMesh(ParaMEDMEM::MEDFileMesh* mesh, int owner) th
   return ret;
 }
 
+static PyObject* convertMEDFileParameter1TS(ParaMEDMEM::MEDFileParameter1TS* p1ts, int owner) throw(INTERP_KERNEL::Exception)
+{
+  PyObject *ret=0;
+  if(dynamic_cast<MEDFileParameterDouble1TS *>(p1ts))
+    ret=SWIG_NewPointerObj((void*)p1ts,SWIGTYPE_p_ParaMEDMEM__MEDFileParameterDouble1TS,owner);
+  if(dynamic_cast<MEDFileParameterDouble1TSWTI *>(p1ts))
+    ret=SWIG_NewPointerObj((void*)p1ts,SWIGTYPE_p_ParaMEDMEM__MEDFileParameterDouble1TSWTI,owner);
+  if(!ret)
+    throw INTERP_KERNEL::Exception("Not recognized type of MEDFileParameter1TS on downcast !");
+  return ret;
+}
+
 static std::vector<std::pair<int,int> > convertTimePairIdsFromPy(PyObject *pyLi) throw(INTERP_KERNEL::Exception)
 {
   std::vector<std::pair<int,int> > ret;
index 87312e66f57117a24f29d1e436bade3fda6c1374..624eb9a6e36cddb3b256a4c03a5f6b362be5ef61 100644 (file)
@@ -2090,7 +2090,7 @@ static const int * getGibi2MedConnectivity( const medGeometryElement type )
 {
   static vector<const int*> conn;
   static int hexa20 [] = {0,6,4,2, 12,18,16,14, 7,5,3,1, 19,17,15,13, 8,11,10,9};
-  static int penta15[] = {0,2,4, 9,11,13, 1,3,5, 10,12,14, 6,7,3};
+  static int penta15[] = {0,2,4, 9,11,13, 1,3,5, 10,12,14, 6,8,7};
   static int pyra13 [] = {0,2,4,6, 12, 1,3,5,7, 8,9,10,11};
   static int tetra10[] = {0,2,4, 9, 1,3,5, 6,7,8};
   static int quad8  [] = {0,2,4,6, 1,3,5,7};
index 3efca0b19547e37c615227365f74a432dea6a956..f494775187e9e994c268a1ab1067867fd1097f57 100644 (file)
@@ -121,7 +121,7 @@ medpartitioner_LDADD= $(libmedpartitioner_la_LDFLAGS) -lm libmedpartitioner.la
 medpartitioner_CXXFLAGS = @CXXTMPDPTHFLAGS@
 
 if MED_ENABLE_PARMETIS
-  bin_PROGRAMS=medpartitioner_para
+  bin_PROGRAMS+=medpartitioner_para
   dist_medpartitioner_para_SOURCES= medpartitioner_para.cxx
   medpartitioner_para_CPPFLAGS= $(libmedpartitioner_la_CPPFLAGS)
   medpartitioner_para_LDADD= $(libmedpartitioner_la_LDFLAGS) -lm libmedpartitioner.la