Salome HOME
Merge branch V7_main V7_3_1b1 V7_3_1rc1
authorvsr <vsr@opencascade.com>
Wed, 19 Feb 2014 10:52:56 +0000 (14:52 +0400)
committervsr <vsr@opencascade.com>
Wed, 19 Feb 2014 10:52:56 +0000 (14:52 +0400)
111 files changed:
CMakeLists.txt
SalomeMEDConfig.cmake.in
adm_local/cmake_files/FindXDR.cmake
adm_local_without_kernel/CMakeLists.txt
src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.cxx
src/INTERP_KERNEL/ExprEval/InterpKernelExprParser.hxx
src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx
src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DComposedEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdge.hxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DEdgeArcCircle.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DElementaryEdge.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DNode.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.cxx
src/INTERP_KERNEL/Geometric2D/InterpKernelGeo2DQuadraticPolygon.hxx
src/INTERP_KERNEL/Interpolation.hxx
src/INTERP_KERNEL/Interpolation.txx
src/INTERP_KERNEL/Interpolation2D1D.hxx
src/INTERP_KERNEL/Interpolation2D1D.txx
src/INTERP_KERNEL/Interpolation3D.hxx
src/INTERP_KERNEL/Interpolation3D.txx
src/INTERP_KERNEL/Interpolation3D2D.hxx
src/INTERP_KERNEL/Interpolation3D2D.txx
src/INTERP_KERNEL/InterpolationCurve.hxx
src/INTERP_KERNEL/InterpolationCurve.txx
src/INTERP_KERNEL/InterpolationOptions.cxx
src/INTERP_KERNEL/InterpolationOptions.hxx
src/INTERP_KERNEL/InterpolationPlanar.hxx
src/INTERP_KERNEL/InterpolationPlanar.txx
src/INTERP_KERNEL/InterpolationUtils.hxx
src/INTERP_KERNELTest/QuadraticPlanarInterpTest.hxx
src/INTERP_KERNELTest/QuadraticPlanarInterpTest5.cxx
src/MEDCoupling/MEDCoupling1GTUMesh.cxx
src/MEDCoupling/MEDCoupling1GTUMesh.hxx
src/MEDCoupling/MEDCouplingCMesh.cxx
src/MEDCoupling/MEDCouplingCMesh.hxx
src/MEDCoupling/MEDCouplingCurveLinearMesh.cxx
src/MEDCoupling/MEDCouplingCurveLinearMesh.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/MEDCouplingMemArrayChar.cxx
src/MEDCoupling/MEDCouplingMesh.cxx
src/MEDCoupling/MEDCouplingMesh.hxx
src/MEDCoupling/MEDCouplingPointSet.cxx
src/MEDCoupling/MEDCouplingPointSet.hxx
src/MEDCoupling/MEDCouplingRemapper.cxx
src/MEDCoupling/MEDCouplingRemapper.hxx
src/MEDCoupling/MEDCouplingStructuredMesh.cxx
src/MEDCoupling/MEDCouplingStructuredMesh.hxx
src/MEDCoupling/MEDCouplingTimeDiscretization.cxx
src/MEDCoupling/MEDCouplingTimeDiscretization.hxx
src/MEDCoupling/MEDCouplingUMesh.cxx
src/MEDCoupling/MEDCouplingUMesh.hxx
src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx
src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py
src/MEDCoupling_Swig/MEDCouplingBasicsTest.py
src/MEDCoupling_Swig/MEDCouplingCommon.i
src/MEDCoupling_Swig/MEDCouplingFieldDiscretization.i
src/MEDCoupling_Swig/MEDCouplingMemArray.i
src/MEDCoupling_Swig/MEDCouplingRemapper.i
src/MEDLoader/MEDFileData.cxx
src/MEDLoader/MEDFileData.hxx
src/MEDLoader/MEDFileField.cxx
src/MEDLoader/MEDFileField.hxx
src/MEDLoader/MEDFileFieldOverView.cxx
src/MEDLoader/MEDFileFieldOverView.hxx
src/MEDLoader/MEDFileMesh.cxx
src/MEDLoader/MEDFileMesh.hxx
src/MEDLoader/MEDFileMeshElt.cxx
src/MEDLoader/MEDFileMeshElt.hxx
src/MEDLoader/MEDFileMeshLL.cxx
src/MEDLoader/MEDFileMeshLL.hxx
src/MEDLoader/MEDFileParameter.cxx
src/MEDLoader/MEDFileParameter.hxx
src/MEDLoader/MEDFileUtilities.cxx
src/MEDLoader/MEDFileUtilities.hxx
src/MEDLoader/MEDLoader.cxx
src/MEDLoader/MEDLoader.hxx
src/MEDLoader/MEDLoaderBase.cxx
src/MEDLoader/MEDLoaderBase.hxx
src/MEDLoader/SauvMedConvertor.cxx
src/MEDLoader/SauvMedConvertor.hxx
src/MEDLoader/SauvReader.cxx
src/MEDLoader/SauvReader.hxx
src/MEDLoader/SauvWriter.cxx
src/MEDLoader/SauvWriter.hxx
src/MEDLoader/Swig/CaseReader.py
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/MEDLoaderTest.py
src/MEDLoader/Swig/MEDLoaderTest3.py
src/MEDLoader/Swig/MEDLoaderTest4.py
src/MEDOP/cmp/MEDDataManager_i.cxx
src/MEDOP/cmp/MEDDataManager_i.hxx
src/MEDOP/gui/DatasourceController.cxx
src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx
src/MEDPartitioner/MEDPARTITIONER_MeshCollectionDriver.cxx
src/MEDPartitioner/MEDPARTITIONER_Utils.cxx
src/ParaMEDMEM/InterpolationMatrix.cxx
src/ParaMEDMEM/NonCoincidentDEC.cxx
src/ParaMEDMEM/OverlapInterpolationMatrix.cxx
src/ParaMEDMEMComponent/ParaMEDMEMComponent_i.cxx
src/RENUMBER/renumbering.cxx

index 7de488fb9fc6092cbb3249fec679f8757ae2d54b..0934032de6d8f316df01615d3cc7f5b2cc052d53 100644 (file)
@@ -266,9 +266,7 @@ IF(WIN32)
 ENDIF(WIN32)
 
 ADD_SUBDIRECTORY(src)
-IF(NOT SALOME_MED_STANDALONE)
-  ADD_SUBDIRECTORY(adm_local)
-ENDIF(NOT SALOME_MED_STANDALONE)
+ADD_SUBDIRECTORY(adm_local)
 
 IF(SALOME_BUILD_DOC)
   ADD_SUBDIRECTORY(doc)
index 53e6278fcad40ad44172b23e9bcc178d4b736055..5b9ca3e2104b156d9208c0a2ca81b8d5c3f13079 100644 (file)
@@ -127,7 +127,7 @@ SET(SALOME_INSTALL_RES "@SALOME_INSTALL_RES@")
 
 IF(SALOME_MED_BUILD_GUI) 
   # Include GUI targets if they were not already loaded:
-  IF(NOT (TARGET Event)
+  IF(NOT (TARGET Event) AND NOT SALOME_MED_STANDALONE)
     INCLUDE("${GUI_ROOT_DIR_EXP}/${SALOME_INSTALL_CMAKE_LOCAL}/SalomeGUITargets.cmake")
   ENDIF()
 ELSE(SALOME_MED_BUILD_GUI)
index 8b39fda0fc88c55625efd651101f15409a161a79..7942f585ffdeb6c6ee48864f121856b7c45f07d6 100644 (file)
 #
 
 MESSAGE(STATUS "Check for XDR ...")
-SET(XDR_ROOT_DIR $ENV{XDR_ROOT_DIR} CACHE PATH "Path to the XDR.")
-IF(XDR_ROOT_DIR)
-  LIST(APPEND CMAKE_LIBRARY_PATH "${XDR_ROOT_DIR}/lib")
-  LIST(APPEND CMAKE_INCLUDE_PATH "${XDR_ROOT_DIR}/include")
-ENDIF(XDR_ROOT_DIR)
 
-FIND_LIBRARY(XDR_LIBRARIES xdr)
 FIND_PATH(XDR_INCLUDE_DIRS rpc/xdr.h)
 SET(XDR_DEFINITIONS "-DHAS_XDR")
 
 IF(WIN32)
-  LIST(APPEND XDR_INCLUDE_DIRS "${XDR_ROOT_DIR}/include/src/msvc")
+  FIND_LIBRARY(XDR_LIBRARIES xdr)                 # To get the .lib file from XDR
+  FIND_PATH(XDR_INCLUDE_DIRS2 src/msvc/stdint.h)  # To get the stdint.h from XDR (needed by types.h)
+  IF(XDR_INCLUDE_DIRS)
+    IF(XDR_INCLUDE_DIRS2)
+      LIST(APPEND XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}")
+    ELSE()
+      SET(XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}")  # Make the detection fail
+    ENDIF()
+  ENDIF()
 ENDIF(WIN32)
 
 INCLUDE(FindPackageHandleStandardArgs)
index 7bc70f3341918053324e909fcb199e3fd67d3190..3d30d14bf17087994b238e22bed7b6064fe3e001 100755 (executable)
@@ -22,3 +22,6 @@ SET(output ${CMAKE_CURRENT_BINARY_DIR}/SALOMEconfig.h)
 MESSAGE(STATUS "Creation of ${output}")
 CONFIGURE_FILE(${input} ${output})
 INSTALL(FILES ${output} DESTINATION ${SALOME_INSTALL_HEADERS})
+
+FILE(GLOB CMAKE_CONFIG_FILES "${CMAKE_CURRENT_SOURCE_DIR}/cmake_files/*.cmake")
+INSTALL(FILES ${CMAKE_CONFIG_FILES} DESTINATION ${SALOME_INSTALL_CMAKE_LOCAL})
index 42630e3ab0d03b2375820986a0cddfa4e535e5e4..5a9437a5741ee7674af23cbbd6924a00d5bd433e 100644 (file)
@@ -156,7 +156,7 @@ LeafExprVar::~LeafExprVar()
 {
 }
 
-ExprParser::ExprParser(const char *expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr)
+ExprParser::ExprParser(const std::string& expr, ExprParser *father):_father(father),_is_parsed(false),_leaf(0),_is_parsing_ok(false),_expr(expr)
 {
   _expr=deleteWhiteSpaces(_expr);
 }
index 85c4ac35b0bd17e4ed5f80d754c4ceab91f6d92d..a5730415b5e0beea227e8365036532bcc358f6f1 100644 (file)
@@ -82,7 +82,7 @@ namespace INTERP_KERNEL
   class ExprParser
   {
   public:
-    INTERPKERNEL_EXPORT ExprParser(const char *expr, ExprParser *father=0);
+    INTERPKERNEL_EXPORT ExprParser(const std::string& expr, ExprParser *father=0);
     INTERPKERNEL_EXPORT ExprParser(const char *expr, int lgth, ExprParser *father=0);
     INTERPKERNEL_EXPORT ~ExprParser();
     INTERPKERNEL_EXPORT void parse();
index 82278ad732f272bbff899798a2dc7a92efa02dcd..121a2c255cd4e9309ffb7b3f9553bcd543cb6c8f 100644 (file)
@@ -187,13 +187,51 @@ bool GaussInfo::isSatisfy()
   return anIsSatisfy;
 }
 
+std::vector<double> GaussInfo::NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector<double>& inputArray)
+{
+  std::size_t sz(inputArray.size()),dim((std::size_t)inputDim);
+  if(dim==0)
+    throw INTERP_KERNEL::Exception("GaussInfo::NormalizeCoordinatesIfNecessary : invalid dimension ! Must be !=0 !");
+  if(sz%dim!=0)
+    throw INTERP_KERNEL::Exception("GaussInfo::NormalizeCoordinatesIfNecessary : invalid input array ! Inconsistent with the given dimension !");
+  const CellModel& cm(CellModel::GetCellModel(ct));
+  std::size_t baseDim((std::size_t)cm.getDimension());
+  if(baseDim==dim)
+    return inputArray;
+  std::size_t nbOfItems(sz/dim);
+  std::vector<double> ret(nbOfItems*baseDim);
+  if(baseDim>dim)
+    {
+      for(std::size_t i=0;i<nbOfItems;i++)
+        {
+          std::size_t j=0;
+          for(;j<dim;j++)
+            ret[i*baseDim+j]=inputArray[i*dim+j];
+          for(;j<baseDim;j++)
+            ret[i*baseDim+j]=0.;
+        }
+    }
+  else
+    {
+      for(std::size_t i=0;i<nbOfItems;i++)
+        {
+          std::size_t j=0;
+          for(;j<baseDim;j++)
+            ret[i*baseDim+j]=inputArray[i*dim+j];
+        }
+    }
+  return ret;
+}
+
+typedef void (*MapToShapeFunction)(GaussInfo& obj);
+
 /*!
  * Initialize the internal vectors
  */
 void GaussInfo::initLocalInfo()
 {
   bool aSatify = false;
-  const CellModel& cellModel=CellModel::GetCellModel(_my_geometry);
+  const CellModel& cellModel(CellModel::GetCellModel(_my_geometry));
   switch( _my_geometry ) 
     {
     case NORM_SEG2:
@@ -240,17 +278,19 @@ void GaussInfo::initLocalInfo()
       break;
 
     case NORM_QUAD4:
-      _my_local_ref_dim = 2;
-      _my_local_nb_ref  = 4;
-      quad4aInit();
-      aSatify = isSatisfy();
-
-      if(!aSatify)
-        {
-          quad4bInit();
-          aSatify = isSatisfy();
-          CHECK_MACRO;
-        }
+      {
+        _my_local_ref_dim = 2;
+        _my_local_nb_ref  = 4;
+        MapToShapeFunction QUAD4PTR[]={Quad4aInit,Quad4bInit,Quad4cInit,Quad4DegSeg2Init};
+        std::size_t NB_OF_QUAD4PTR(sizeof(QUAD4PTR)/sizeof(MapToShapeFunction));
+        for(std::size_t i=0;i<NB_OF_QUAD4PTR && !aSatify;i++)
+          {
+            (QUAD4PTR[i])(*this);
+            aSatify = isSatisfy();
+          }
+        CHECK_MACRO;
+        break;
+      }
       break;
 
     case NORM_QUAD8:
@@ -267,6 +307,14 @@ void GaussInfo::initLocalInfo()
         }
       break;
 
+    case NORM_QUAD9:
+      _my_local_ref_dim = 2;
+      _my_local_nb_ref  = 9;
+      quad9aInit();
+      aSatify = isSatisfy();
+      CHECK_MACRO;
+      break;
+
     case NORM_TETRA4:
       _my_local_ref_dim = 3;
       _my_local_nb_ref  = 4;
@@ -324,6 +372,21 @@ void GaussInfo::initLocalInfo()
       break;
 
     case NORM_PENTA6:
+      {
+        _my_local_ref_dim = 3;
+        _my_local_nb_ref  = 6;
+        MapToShapeFunction PENTA6PTR[]={Penta6aInit,Penta6bInit,Penta6DegTria3aInit,Penta6DegTria3bInit};
+        std::size_t NB_OF_PENTA6PTR(sizeof(PENTA6PTR)/sizeof(MapToShapeFunction));
+        for(std::size_t i=0;i<NB_OF_PENTA6PTR && !aSatify;i++)
+          {
+            (PENTA6PTR[i])(*this);
+            aSatify = isSatisfy();
+          }
+        CHECK_MACRO;
+        break;
+      }
+
+
       _my_local_ref_dim = 3;
       _my_local_nb_ref  = 6;
       penta6aInit();
@@ -352,18 +415,19 @@ void GaussInfo::initLocalInfo()
       break;
 
     case NORM_HEXA8:
-      _my_local_ref_dim = 3;
-      _my_local_nb_ref  = 8;
-      hexa8aInit();
-      aSatify = isSatisfy();
-
-      if(!aSatify)
-        {
-          hexa8bInit();
-          aSatify = isSatisfy();
-          CHECK_MACRO;
-        }
-      break;
+      {
+        _my_local_ref_dim = 3;
+        _my_local_nb_ref  = 8;
+        MapToShapeFunction HEXA8PTR[]={Hexa8aInit,Hexa8bInit,Hexa8DegQuad4aInit,Hexa8DegQuad4bInit,Hexa8DegQuad4cInit};
+        std::size_t NB_OF_HEXA8PTR(sizeof(HEXA8PTR)/sizeof(MapToShapeFunction));
+        for(std::size_t i=0;i<NB_OF_HEXA8PTR && !aSatify;i++)
+          {
+            (HEXA8PTR[i])(*this);
+            aSatify = isSatisfy();
+          }
+        CHECK_MACRO;
+        break;
+      }
 
     case NORM_HEXA20:
       _my_local_ref_dim = 3;
@@ -431,7 +495,7 @@ void GaussInfo::seg3Init()
    LOCAL_COORD_MACRO_END;
 
    SHAPE_FUN_MACRO_BEGIN;
-   funValue[0] = 0.5*(1.0 - gc[0])*gc[0];
+   funValue[0] = -0.5*(1.0 - gc[0])*gc[0];
    funValue[1] = 0.5*(1.0 + gc[0])*gc[0];
    funValue[2] = (1.0 + gc[0])*(1.0 - gc[0]);
    SHAPE_FUN_MACRO_END;
@@ -653,6 +717,67 @@ void GaussInfo::quad4bInit()
    SHAPE_FUN_MACRO_END;
 }
 
+void GaussInfo::quad4cInit() 
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] = -1.0;
+   coords[1] = -1.0;
+   break;
+ case  1:
+   coords[0] = -1.0;
+   coords[1] =  1.0;
+   break;
+ case  2:
+   coords[0] =  1.0;
+   coords[1] =  1.0;
+   break;
+ case  3:
+   coords[0] =  1.0;
+   coords[1] = -1.0;
+   break;
+
+   LOCAL_COORD_MACRO_END;
+
+   SHAPE_FUN_MACRO_BEGIN;
+   funValue[0] = 0.25*(1.0 - gc[0])*(1.0 - gc[1]);
+   funValue[1] = 0.25*(1.0 - gc[0])*(1.0 + gc[1]);
+   funValue[2] = 0.25*(1.0 + gc[0])*(1.0 + gc[1]);
+   funValue[3] = 0.25*(1.0 + gc[0])*(1.0 - gc[1]);
+   SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * This shapefunc map is same as degenerated seg2Init
+ */
+void GaussInfo::quad4DegSeg2Init()
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] = -1.0;
+   coords[1] =  0.0;
+   break;
+ case  1:
+   coords[0] =  1.0;
+   coords[1] =  0.0;
+   break;
+ case  2:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   break;
+ case  3:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   break;
+   LOCAL_COORD_MACRO_END;
+
+   SHAPE_FUN_MACRO_BEGIN;
+   funValue[0] = 0.5*(1.0 - gc[0]);
+   funValue[1] = 0.5*(1.0 + gc[0]);
+   funValue[2] = 0.;
+   funValue[3] = 0.;
+   SHAPE_FUN_MACRO_END;
+}
 
 /*!
  * Init Quadratic Quadrangle Reference coordinates ans Shape function.
@@ -760,6 +885,60 @@ void GaussInfo::quad8bInit()
    SHAPE_FUN_MACRO_END;
 }
 
+void GaussInfo::quad9aInit()
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] = -1.0;
+   coords[1] = -1.0;
+   break;
+ case  1:
+   coords[0] =  1.0;
+   coords[1] = -1.0;
+   break;
+ case  2:
+   coords[0] =  1.0;
+   coords[1] =  1.0;
+   break;
+ case  3:
+   coords[0] = -1.0;
+   coords[1] =  1.0;
+   break;
+ case  4:
+   coords[0] =  0.0;
+   coords[1] = -1.0;
+   break;
+ case  5:
+   coords[0] =  1.0;
+   coords[1] =  0.0;
+   break;
+ case  6:
+   coords[0] =  0.0;
+   coords[1] =  1.0;
+   break;
+ case  7:
+   coords[0] = -1.0;
+   coords[1] =  0.0;
+   break;
+ case  8:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   break;
+   LOCAL_COORD_MACRO_END;
+
+   SHAPE_FUN_MACRO_BEGIN;
+   funValue[0] = 0.25*gc[0]*gc[1]*(gc[0]-1.)*(gc[1]-1.);
+   funValue[1] = 0.25*gc[0]*gc[1]*(gc[0]+1.)*(gc[1]-1.);
+   funValue[2] = 0.25*gc[0]*gc[1]*(gc[0]+1.)*(gc[1]+1.);
+   funValue[3] = 0.25*gc[0]*gc[1]*(gc[0]-1.)*(gc[1]+1.);
+   funValue[4] = 0.5*(1.-gc[0]*gc[0])*gc[1]*(gc[1]-1.);
+   funValue[5] = 0.5*gc[0]*(gc[0]+1.)*(1.-gc[1]*gc[1]);
+   funValue[6] = 0.5*(1.-gc[0]*gc[0])*gc[1]*(gc[1]+1.);
+   funValue[7] = 0.5*gc[0]*(gc[0]-1.)*(1.-gc[1]*gc[1]);
+   funValue[8] = (1.-gc[0]*gc[0])*(1.-gc[1]*gc[1]);
+   SHAPE_FUN_MACRO_END;
+}
+
 /*!
  * Init Tetrahedron Reference coordinates ans Shape function.
  * Case A.
@@ -1378,6 +1557,103 @@ void GaussInfo::penta6bInit()
    funValue[4] = 0.5*(1.0 - gc[1] - gc[2])*(1.0 + gc[0]);
    SHAPE_FUN_MACRO_END;
 }
+
+/*!
+ * This shapefunc map is same as degenerated tria3aInit
+ */
+void GaussInfo::penta6DegTria3aInit() 
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] = -1.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  1:
+   coords[0] = -1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  2:
+   coords[0] =  1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  3:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  4:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  5:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+   LOCAL_COORD_MACRO_END;
+
+   SHAPE_FUN_MACRO_BEGIN;
+   funValue[0] = 0.5*(1.0 + gc[1]);
+   funValue[1] = -0.5*(gc[0] + gc[1]);
+   funValue[2] = 0.5*(1.0 + gc[0]);
+   funValue[3] = 0.;
+   funValue[4] = 0.;
+   funValue[5] = 0.;
+   SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * This shapefunc map is same as degenerated tria3bInit
+ */
+void GaussInfo::penta6DegTria3bInit() 
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  1:
+   coords[0] =  1.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  2:
+   coords[0] =  0.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  3:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  4:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  5:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+   LOCAL_COORD_MACRO_END;
+
+   SHAPE_FUN_MACRO_BEGIN;
+   funValue[0] = 1.0 - gc[0] - gc[1];
+   funValue[1] = gc[0];
+   funValue[2] = gc[1];
+   funValue[3] = 0.;
+   funValue[4] = 0.;
+   funValue[5] = 0.;
+   SHAPE_FUN_MACRO_END;
+}
+
 /*!
  * Init Pentahedron Reference coordinates and Shape function.
  * Case A.
@@ -1718,6 +1994,187 @@ void GaussInfo::hexa8bInit()
    SHAPE_FUN_MACRO_END;
 }
 
+/*!
+ * This shapefunc map is same as degenerated quad4bInit
+ */
+void GaussInfo::hexa8DegQuad4aInit()
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] = -1.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  1:
+   coords[0] = -1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  2:
+   coords[0] =  1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  3:
+   coords[0] =  1.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  4:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  5:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  6:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  7:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+  LOCAL_COORD_MACRO_END;
+  
+  SHAPE_FUN_MACRO_BEGIN;
+  funValue[0] = 0.25*(1.0 + gc[1])*(1.0 - gc[0]);
+  funValue[1] = 0.25*(1.0 - gc[1])*(1.0 - gc[0]);
+  funValue[2] = 0.25*(1.0 - gc[1])*(1.0 + gc[0]);
+  funValue[3] = 0.25*(1.0 + gc[0])*(1.0 + gc[1]);
+  funValue[4] = 0.;
+  funValue[5] = 0.;
+  funValue[6] = 0.;
+  funValue[7] = 0.;
+  SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * This shapefunc map is same as degenerated quad4bInit
+ */
+void GaussInfo::hexa8DegQuad4bInit()
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] = -1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  1:
+   coords[0] =  1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  2:
+   coords[0] =  1.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  3:
+   coords[0] = -1.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  4:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  5:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  6:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  7:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+   LOCAL_COORD_MACRO_END;
+
+   SHAPE_FUN_MACRO_BEGIN;
+   funValue[0] = 0.25*(1.0 - gc[0])*(1.0 - gc[1]);
+   funValue[1] = 0.25*(1.0 + gc[0])*(1.0 - gc[1]);
+   funValue[2] = 0.25*(1.0 + gc[0])*(1.0 + gc[1]);
+   funValue[3] = 0.25*(1.0 - gc[0])*(1.0 + gc[1]);
+   funValue[4] = 0.;
+   funValue[5] = 0.;
+   funValue[6] = 0.;
+   funValue[7] = 0.;
+   SHAPE_FUN_MACRO_END;
+}
+
+/*!
+ * This shapefunc map is same as degenerated quad4cInit
+ */
+void GaussInfo::hexa8DegQuad4cInit() 
+{
+  LOCAL_COORD_MACRO_BEGIN;
+ case  0:
+   coords[0] = -1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  1:
+   coords[0] = -1.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  2:
+   coords[0] =  1.0;
+   coords[1] =  1.0;
+   coords[2] =  0.0;
+   break;
+ case  3:
+   coords[0] =  1.0;
+   coords[1] = -1.0;
+   coords[2] =  0.0;
+   break;
+ case  4:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  5:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  6:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+ case  7:
+   coords[0] =  0.0;
+   coords[1] =  0.0;
+   coords[2] =  0.0;
+   break;
+
+   LOCAL_COORD_MACRO_END;
+
+   SHAPE_FUN_MACRO_BEGIN;
+   funValue[0] = 0.25*(1.0 - gc[0])*(1.0 - gc[1]);
+   funValue[1] = 0.25*(1.0 - gc[0])*(1.0 + gc[1]);
+   funValue[2] = 0.25*(1.0 + gc[0])*(1.0 + gc[1]);
+   funValue[3] = 0.25*(1.0 + gc[0])*(1.0 - gc[1]);
+   funValue[4] = 0. ;
+   funValue[5] = 0. ;
+   funValue[6] = 0. ;
+   funValue[7] = 0. ;
+   SHAPE_FUN_MACRO_END;
+}
+
 /*!
  * Init Qaudratic Hehahedron Reference coordinates and Shape function.
  * Case A.
index 0e2d07e89b00c8569ed9e4d20f67a9c5346abb47..f05603096acf5723035cf3495baf6263facfec88 100644 (file)
@@ -54,6 +54,8 @@ namespace INTERP_KERNEL
     INTERPKERNEL_EXPORT const double* getFunctionValues( const int theGaussId ) const;
 
     INTERPKERNEL_EXPORT void initLocalInfo();
+    
+    INTERPKERNEL_EXPORT static std::vector<double> NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector<double>& inputArray);
 
   protected:
 
@@ -70,9 +72,16 @@ namespace INTERP_KERNEL
     void tria6bInit();
 
     void quad4aInit();
+    static void Quad4aInit(GaussInfo& obj) { obj.quad4aInit(); }
     void quad4bInit();
+    static void Quad4bInit(GaussInfo& obj) { obj.quad4bInit(); }
+    void quad4cInit();
+    static void Quad4cInit(GaussInfo& obj) { obj.quad4cInit(); }
+    void quad4DegSeg2Init();
+    static void Quad4DegSeg2Init(GaussInfo& obj) { obj.quad4DegSeg2Init(); }
     void quad8aInit();
     void quad8bInit();
+    void quad9aInit();
 
     //3D
     void tetra4aInit();
@@ -86,12 +95,27 @@ namespace INTERP_KERNEL
     void pyra13bInit();
 
     void penta6aInit();
+    static void Penta6aInit(GaussInfo& obj) { obj.penta6aInit(); }
     void penta6bInit();
+    static void Penta6bInit(GaussInfo& obj) { obj.penta6bInit(); }
+    void penta6DegTria3aInit();
+    static void Penta6DegTria3aInit(GaussInfo& obj) { obj.penta6DegTria3aInit(); }
+    void penta6DegTria3bInit();
+    static void Penta6DegTria3bInit(GaussInfo& obj) { obj.penta6DegTria3bInit(); }
+    
     void penta15aInit();
     void penta15bInit();
 
     void hexa8aInit();
+    static void Hexa8aInit(GaussInfo& obj) { obj.hexa8aInit(); }
     void hexa8bInit();
+    static void Hexa8bInit(GaussInfo& obj) { obj.hexa8bInit(); }
+    void hexa8DegQuad4aInit();
+    static void Hexa8DegQuad4aInit(GaussInfo& obj) { obj.hexa8DegQuad4aInit(); }
+    void hexa8DegQuad4bInit();
+    static void Hexa8DegQuad4bInit(GaussInfo& obj) { obj.hexa8DegQuad4bInit(); }
+    void hexa8DegQuad4cInit();
+    static void Hexa8DegQuad4cInit(GaussInfo& obj) { obj.hexa8DegQuad4cInit(); }
     void hexa20aInit();
     void hexa20bInit();
 
index b866dac1e86ea6d3d06d081dd8e5d0232e8b2c17..0f033d88ae760b51ea23aee107a4a164c320c3f0 100644 (file)
@@ -136,6 +136,10 @@ void ComposedEdge::initLocations() const
     (*iter)->initLocations();
 }
 
+/**
+ * Reset the status of all edges (OUT, IN, ON) because they were potentially assignated
+ * by the previous candidate processing.
+ */
 void ComposedEdge::initLocationsWithOther(const ComposedEdge& other) const
 {
   std::set<Edge *> s1,s2;
@@ -280,9 +284,14 @@ void ComposedEdge::unApplyGlobalSimilarityExt(ComposedEdge& other, double xBary,
   other.getAllNodes(allNodes);
   for(std::set<Node *>::iterator iter=allNodes.begin();iter!=allNodes.end();iter++)
     (*iter)->unApplySimilarity(xBary,yBary,fact);
+
+  // [Adrien] - same issue as in applyGlobalSimilarity() - see comments there
+  std::set<Edge *> allEdges;
   for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
-    (*iter)->unApplySimilarity(xBary,yBary,fact);
+    allEdges.insert((*iter)->getPtr());
   for(std::list<ElementaryEdge *>::iterator iter=other._sub_edges.begin();iter!=other._sub_edges.end();iter++)
+    allEdges.insert((*iter)->getPtr());
+  for(std::set<Edge *>::iterator iter = allEdges.begin();iter != allEdges.end();iter++)
     (*iter)->unApplySimilarity(xBary,yBary,fact);
 }
 
@@ -369,10 +378,15 @@ void ComposedEdge::applyGlobalSimilarity2(ComposedEdge *other, double xBary, dou
   allNodes.insert(allNodes2.begin(),allNodes2.end());
   for(std::set<Node *>::iterator iter=allNodes.begin();iter!=allNodes.end();iter++)
     (*iter)->applySimilarity(xBary,yBary,dimChar);
+  // [Adrien] many ElementaryEdge might reference the same Edge* - ensure we don'y scale twice!
+  std::set<Edge *> allEdges;
   for(std::list<ElementaryEdge *>::iterator iter=_sub_edges.begin();iter!=_sub_edges.end();iter++)
-    (*iter)->applySimilarity(xBary,yBary,dimChar);
+    allEdges.insert((*iter)->getPtr());
   for(std::list<ElementaryEdge *>::iterator iter=other->_sub_edges.begin();iter!=other->_sub_edges.end();iter++)
-    (*iter)->applySimilarity(xBary,yBary,dimChar);
+    allEdges.insert((*iter)->getPtr());
+  // Similarity only on set of unique underlying edges:
+  for(std::set<Edge *>::iterator iter = allEdges.begin();iter != allEdges.end();iter++)
+      (*iter)->applySimilarity(xBary,yBary,dimChar);
 }
 
 /*!
@@ -427,13 +441,19 @@ void ComposedEdge::getBarycenter(double *bary, double& weigh) const
 }
 
 /*!
+ * This method makes the hypothesis that \a nodeToTest can be either IN or OUT.
+ * 
  * \sa ComposedEdge::isInOrOut2
  */
 bool ComposedEdge::isInOrOut(Node *nodeToTest) const
 {
+  Bounds b; b.prepareForAggregation();
+  fillBounds(b);
+  if(b.nearlyWhere((*nodeToTest)[0],(*nodeToTest)[1])==OUT)
+    return false;
   std::set< IntersectElement > inOutSwitch;
   double ref(isInOrOutAlg(nodeToTest,inOutSwitch));
-  bool ret=false;
+  bool ret(false);
   for(std::set< IntersectElement >::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++)
     {
       if((*iter4).getVal1()<ref)
@@ -450,7 +470,6 @@ bool ComposedEdge::isInOrOut(Node *nodeToTest) const
 /*!
  * This method is close to ComposedEdge::isInOrOut behaviour except that here EPSILON is taken into account to detect if it is IN or OUT.
  * If \a nodeToTest is close to an edge in \a this, true will be returned even if it is outside informatically from \a this.
- * This method makes the hypothesis that 
  *
  * \sa ComposedEdge::isInOrOut
  */
@@ -458,7 +477,7 @@ bool ComposedEdge::isInOrOut2(Node *nodeToTest) const
 {
   std::set< IntersectElement > inOutSwitch;
   double ref(isInOrOutAlg(nodeToTest,inOutSwitch));
-  bool ret=false;
+  bool ret(false);
   for(std::set< IntersectElement >::iterator iter4=inOutSwitch.begin();iter4!=inOutSwitch.end();iter4++)
     {
       double val((*iter4).getVal1());
@@ -480,10 +499,6 @@ bool ComposedEdge::isInOrOut2(Node *nodeToTest) const
 
 double ComposedEdge::isInOrOutAlg(Node *nodeToTest, std::set< IntersectElement >& inOutSwitch) const
 {
-  Bounds b; b.prepareForAggregation();
-  fillBounds(b);
-  if(b.nearlyWhere((*nodeToTest)[0],(*nodeToTest)[1])==OUT)
-    return false;
   // searching for e1
   std::set<Node *> nodes;
   getAllNodes(nodes);
@@ -511,7 +526,7 @@ double ComposedEdge::isInOrOutAlg(Node *nodeToTest, std::set< IntersectElement >
           Edge *e=val->getPtr();
           std::auto_ptr<EdgeIntersector> intersc(Edge::BuildIntersectorWith(e1,e));
           bool obviousNoIntersection,areOverlapped;
-          intersc->areOverlappedOrOnlyColinears(0,obviousNoIntersection,areOverlapped);
+          intersc->areOverlappedOrOnlyColinears(0,obviousNoIntersection,areOverlapped);  // first parameter never used
           if(obviousNoIntersection)
             {
               continue;
index fcecc407a47593e7557e45249469c0e6b52b0eaf..8a00bee6ee52ab13890f2485bbf617bcf3314291 100644 (file)
@@ -876,7 +876,11 @@ inline bool eqpair(const std::pair<double,Node *>& p1, const std::pair<double,No
   return fabs(p1.first-p2.first)<QUADRATIC_PLANAR::_precision;
 }
 
-void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1, const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis)
+/**
+ * Sort nodes so that they all lie consecutively on the edge that has been cut.
+ */
+void Edge::sortIdsAbs(const std::vector<INTERP_KERNEL::Node *>& addNodes, const std::map<INTERP_KERNEL::Node *, int>& mapp1,
+                      const std::map<INTERP_KERNEL::Node *, int>& mapp2, std::vector<int>& edgesThis)
 {
   Bounds b;
   b.prepareForAggregation();
index 9159299b05651bab7962afcf1892ce0d9026d8f4..aa0164d7fddf275a7c23d9ea8722b139d6db6d1b 100644 (file)
@@ -191,9 +191,9 @@ namespace INTERP_KERNEL
 
   /*!
    * Deal with an oriented edge of a polygon.
-   * An Edge is definied with a start node a end node and an equation of 1D curve.
+   * An Edge is defined with a start node, an end node and an equation of 1D curve.
    * All other attributes are mutable because they don't impact these 3 invariant attributes.
-   * To be exact start and end node can change (adress) but their location remain
+   * To be exact start and end nodes can change (address) but their location remain
    * the same (at precision).
    */
   class INTERPKERNEL_EXPORT Edge
index 8233ef049454051b1381b2af20a9223448f435ac..46b2fb1562f7b830108a063ee60a762b83fa2c89 100644 (file)
@@ -308,7 +308,7 @@ ArcCSegIntersector::ArcCSegIntersector(const EdgeArcCircle& e1, const EdgeLin& e
 
 void ArcCSegIntersector::areOverlappedOrOnlyColinears(const Bounds *whereToFind, bool& obviousNoIntersection, bool& areOverlapped)
 {
-  areOverlapped=false;//No overlapping by contruction
+  areOverlapped=false;//No overlapping by construction
   const double *center=getE1().getCenter();
   _dx=(*(_e2.getEndNode()))[0]-(*(_e2.getStartNode()))[0];
   _dy=(*(_e2.getEndNode()))[1]-(*(_e2.getStartNode()))[1];
index f5870d6a7749f3fb6f7d2d59f7c19c7fd1192e11..4d161d7fcca04690a509a9f2c793a45a74e446c7 100644 (file)
@@ -138,7 +138,7 @@ TypeOfEdgeLocInPolygon ElementaryEdge::locateFullyMySelf(const ComposedEdge& pol
 
 TypeOfEdgeLocInPolygon ElementaryEdge::locateFullyMySelfAbsolute(const ComposedEdge& pol) const
 {
-  Node *node=_ptr->buildRepresentantOfMySelf();
+  Node *node=_ptr->buildRepresentantOfMySelf(); // build barycenter used to detect if the edge is IN or OUT
   if(pol.isInOrOut(node))
     declareIn(); 
   else
index 06d19bc982a06ac1438ce6816a222dc317e090a9..61e949db55e402ea053f6aefa9f2708a6447b0fc 100644 (file)
@@ -93,7 +93,7 @@ double Node::distanceWithSq(const Node& other) const
 
 /*!
  * WARNING different from 'computeAngle' method ! The returned value are not in the same interval !
- * Here in -Pi/2; Pi/2. Typically this method returns the same value by exchanging pt1 and pt2.
+ * Here in [0; Pi). Typically this method returns the same value by exchanging pt1 and pt2.
  * Use in process of detection of a point in or not in polygon.
  */
 double Node::computeSlope(const double *pt1, const double *pt2)
index 2e262b73098d2277e036c41de71a95f19f73351f..e4ecd62bcfb339bb1a5cb530f80921f7e6d4acfd 100644 (file)
@@ -225,18 +225,29 @@ double QuadraticPolygon::intersectWithAbs(QuadraticPolygon& other)
 }
 
 /*!
- * This method splits 'this' with 'other' into smaller pieces localizable. 'mapThis' is a map that gives the correspondance between nodes contained in 'this' and node ids in a global mesh.
- * In the same way, 'mapOther' gives the correspondance between nodes contained in 'other' and node ids in a global mesh from wich 'other' is extracted.
- * This method has 1 out paramater : 'edgesThis', After the call of this method contains nodal connectivity (including type) of 'this' into globlal "this mesh".
- * This method has 2 in/out parameters : 'subDivOther' and 'addCoo'.'otherEdgeIds' is useful to put values in 'edgesThis', 'subDivOther' and 'addCoo'.
+ * This method splits 'this' with 'other' into smaller pieces localizable. 'mapThis' is a map that gives the correspondance
+ * between nodes contained in 'this' and node ids in a global mesh.
+ * In the same way, 'mapOther' gives the correspondance between nodes contained in 'other' and node ids in a
+ * global mesh from wich 'other' is extracted.
+ * This method has 1 out paramater : 'edgesThis', After the call of this method, it contains the nodal connectivity (including type)
+ * of 'this' into globlal "this mesh".
+ * This method has 2 in/out parameters : 'subDivOther' and 'addCoo'.'otherEdgeIds' is useful to put values in
+ * 'edgesThis', 'subDivOther' and 'addCoo'.
  * Size of 'otherEdgeIds' has to be equal to number of ElementaryEdges in 'other'. No check of that will be done.
+ * The term 'abs' in the name recalls that we normalize the mesh (spatially) so that node coordinates fit into [0;1].
  * @param offset1 is the number of nodes contained in global mesh from which 'this' is extracted.
  * @param offset2 is the sum of nodes contained in global mesh from which 'this' is extracted and 'other' is extracted.
  * @param edgesInOtherColinearWithThis will be appended at the end of the vector with colinear edge ids of other (if any)
- * @otherEdgeIds is a vector with the same size than other before calling this method. It gives in the same order the cell id in global other mesh.
+ * @param otherEdgeIds is a vector with the same size than other before calling this method. It gives in the same order
+ * the cell id in global other mesh.
  */
-void QuadraticPolygon::splitAbs(QuadraticPolygon& other, const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2 , const std::vector<int>& otherEdgeIds,
-                                std::vector<int>& edgesThis, int cellIdThis, std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther, std::vector<double>& addCoo)
+void QuadraticPolygon::splitAbs(QuadraticPolygon& other,
+        const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther,
+        int offset1, int offset2 ,
+        const std::vector<int>& otherEdgeIds,
+        std::vector<int>& edgesThis, int cellIdThis,
+        std::vector< std::vector<int> >& edgesInOtherColinearWithThis, std::vector< std::vector<int> >& subDivOther,
+        std::vector<double>& addCoo)
 {
   double xBaryBB, yBaryBB;
   double fact=normalizeExt(&other, xBaryBB, yBaryBB);
@@ -306,8 +317,10 @@ void QuadraticPolygon::splitAbs(QuadraticPolygon& other, const std::map<INTERP_K
 }
 
 /*!
- * This method builds from descending conn of a quadratic polygon stored in crude mode (MEDCoupling). Descending conn is in FORTRAN relative mode in order to give the
- * orientation of edge.
+ * This method builds 'this' from its descending conn stored in crude mode (MEDCoupling).
+ * Descending conn is in FORTRAN relative mode in order to give the
+ * orientation of edge (see buildDescendingConnectivity2() method).
+ * See appendEdgeFromCrudeDataArray() for params description.
  */
 void QuadraticPolygon::buildFromCrudeDataArray(const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
                                                const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
@@ -319,13 +332,14 @@ void QuadraticPolygon::buildFromCrudeDataArray(const std::map<int,INTERP_KERNEL:
     }
 }
 
-void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad, const int *nodalBg, const double *coords,
-                                                    const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
+void QuadraticPolygon::appendEdgeFromCrudeDataArray(std::size_t edgePos, const std::map<int,INTERP_KERNEL::Node *>& mapp, bool isQuad,
+                            const int *nodalBg, const double *coords,
+                            const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges)
 {
   if(!isQuad)
     {
       bool direct=descBg[edgePos]>0;
-      int edgeId=abs(descBg[edgePos])-1;
+      int edgeId=abs(descBg[edgePos])-1; // back to C indexing mode
       const std::vector<int>& subEdge=intersectEdges[edgeId];
       std::size_t nbOfSubEdges=subEdge.size()/2;
       for(std::size_t j=0;j<nbOfSubEdges;j++)
@@ -509,8 +523,11 @@ void QuadraticPolygon::buildFromCrudeDataArray2(const std::map<int,INTERP_KERNEL
 
 /*!
  * Method expected to be called on pol2. Every params not suffixed by numbered are supposed to refer to pol2 (this).
+ * Method to find edges that are ON.
  */
-void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges, const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1, const std::vector<std::vector<int> >& intersectEdges1, const std::vector< std::vector<int> >& colinear1) const
+void QuadraticPolygon::updateLocOfEdgeFromCrudeDataArray2(const int *descBg, const int *descEnd, const std::vector<std::vector<int> >& intersectEdges,
+      const INTERP_KERNEL::QuadraticPolygon& pol1, const int *descBg1, const int *descEnd1,
+      const std::vector<std::vector<int> >& intersectEdges1, const std::vector< std::vector<int> >& colinear1) const
 {
   std::size_t nbOfSeg=std::distance(descBg,descEnd);
   for(std::size_t i=0;i<nbOfSeg;i++)//loop over all edges of pol2
@@ -599,7 +616,7 @@ void QuadraticPolygon::buildPartitionsAbs(QuadraticPolygon& other, std::set<INTE
   double xBaryBB, yBaryBB;
   double fact=normalizeExt(&other, xBaryBB, yBaryBB);
   //Locate 'this' relative to 'other'
-  other.performLocatingOperationSlow(*this);
+  other.performLocatingOperationSlow(*this);  // without any assumption
   std::vector<QuadraticPolygon *> res=buildIntersectionPolygons(other,*this);
   for(std::vector<QuadraticPolygon *>::iterator it=res.begin();it!=res.end();it++)
     {
index 6e5db5b1f391cf3d2f24aa48297e377037f2c34f..4df9e861b511a14aaa93d5afd9f181a9a6fa7694 100644 (file)
@@ -35,6 +35,11 @@ namespace INTERP_KERNEL
   class Edge;
   class MergePoints;
 
+  /**
+   * A set of quadratic or linear edges, not necessarily connected to form a closed polygon.
+   * Some methods however requires a closed form.
+   * Class ComposedEdge focuses more on connectivity aspect.
+   */
   class QuadraticPolygon : public ComposedEdge
   {
   public:
index a9402871fea95ce93fe8c4b0ddaed16d5134ea2f..77022c356cf16da0a3e779e0585d062aed295729 100644 (file)
@@ -40,14 +40,14 @@ namespace INTERP_KERNEL
     int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result)
     { return asLeaf().interpolateMeshes(meshS,meshT,result); }
     template<class MyMeshType, class MatrixType>
-    int fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const char *method) { return fromToIntegralUniform(false,meshT,result,method); }
+    int fromIntegralUniform(const MyMeshType& meshT, MatrixType& result, const std::string& method) { return fromToIntegralUniform(false,meshT,result,method); }
     template<class MyMeshType, class MatrixType>
-    int toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const char *method) { return fromToIntegralUniform(true,meshS,result,method); }
+    int toIntegralUniform(const MyMeshType& meshS, MatrixType& result, const std::string& method) { return fromToIntegralUniform(true,meshS,result,method); }
     template<class MyMeshType>
     static double CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel);
   protected:
     template<class MyMeshType, class MatrixType>
-    int fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const char *method);
+    int fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method);
   protected:
     TrueMainInterpolator& asLeaf() { return static_cast<TrueMainInterpolator&>(*this); }
   };
index e9d435d388abd2191601ced526f7623d967eb791..ee85877608a95383a653cf1cd09975b240317acc 100644 (file)
@@ -29,12 +29,11 @@ namespace INTERP_KERNEL
 { 
   template<class TrueMainInterpolator>
   template<class MyMeshType, class MatrixType>
-  int Interpolation<TrueMainInterpolator>::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const char *method)
+  int Interpolation<TrueMainInterpolator>::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method)
   {
     typedef typename MyMeshType::MyConnType ConnType;
-    std::string methodCPP(method);
     int ret=-1;
-    if(methodCPP=="P0")
+    if(method=="P0")
       {
         IntegralUniformIntersectorP0<MyMeshType,MatrixType> intersector(mesh,InterpolationOptions::getMeasureAbsStatus());
         intersector.setFromTo(fromTo);
@@ -42,7 +41,7 @@ namespace INTERP_KERNEL
         intersector.intersectCells(0,tmp,result);
         ret=intersector.getNumberOfColsOfResMatrix();
       }
-    else if(methodCPP=="P1")
+    else if(method=="P1")
       {
         IntegralUniformIntersectorP1<MyMeshType,MatrixType> intersector(mesh,InterpolationOptions::getMeasureAbsStatus());
         intersector.setFromTo(fromTo);
index 686d7d6fac68dcb9a8bbfbb553a55f969c1457ce..5121674cdbd2cb14f8cd9527f1f70709b7492fbf 100644 (file)
@@ -48,7 +48,7 @@ namespace INTERP_KERNEL
 
     // Main function to interpolate triangular and quadratic meshes
     template<class MyMeshType, class MatrixType>
-    int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const char *method);
+    int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);
     DuplicateFacesType retrieveDuplicateFaces() const
     {
       return _duplicate_faces;
index 365e697f61b4bfa9980424101d97e7bee55c0425..7f4283eacd9d0c3ec0d0d5100225b201eba5c980 100644 (file)
@@ -46,7 +46,7 @@ namespace INTERP_KERNEL
       *
       */
   template<class MyMeshType, class MatrixType>
-  int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const char *method)
+  int Interpolation2D1D::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
   {
     static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
     typedef typename MyMeshType::MyConnType ConnType;
index ddebd1827db7b38095757da73611c13419324b27..d3732c56d072fef561b0ad0314b5c734cfbaef22 100644 (file)
@@ -34,7 +34,7 @@ namespace INTERP_KERNEL
     Interpolation3D();
     Interpolation3D(const InterpolationOptions& io);
     template<class MyMeshType, class MatrixType>
-    int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method);
+    int interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method);
   private:
     SplittingPolicy _splitting_policy;
   };
index 851cb7902212fda3c8ef660c752f0dc3bd9b708d..67327f861a5b9765dacc630a018ba83611910156 100644 (file)
@@ -17,6 +17,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 // Author : Anthony Geay (CEA/DEN)
+
 #ifndef __INTERPOLATION3D_TXX__
 #define __INTERPOLATION3D_TXX__
 
@@ -73,7 +74,7 @@ namespace INTERP_KERNEL
    *
    */
   template<class MyMeshType, class MatrixType>
-  int Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const char *method)
+  int Interpolation3D::interpolateMeshes(const MyMeshType& srcMesh, const MyMeshType& targetMesh, MatrixType& result, const std::string& method)
   {
     typedef typename MyMeshType::MyConnType ConnType;
     // create MeshElement objects corresponding to each element of the two meshes
index 75bebaee84c6649585492218b08ca48175e7b8e8..8ece823b0ad19179634ae5d3cefc139a0572e927 100644 (file)
@@ -50,7 +50,7 @@ namespace INTERP_KERNEL
     int interpolateMeshes(const MyMeshType& srcMesh,
                           const MyMeshType& targetMesh,
                           MyMatrixType& matrix,
-                          const char *method);
+                          const std::string& method);
     INTERPKERNEL_EXPORT DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; }
   private:
     SplittingPolicy _splitting_policy;
index b84b992ad8c61e19fd79e9ca8cb196d7d45c3d0d..77878cf19dc695278c73603a3f88e22f3cb98f19 100644 (file)
@@ -63,7 +63,7 @@ namespace INTERP_KERNEL
   int Interpolation3D2D::interpolateMeshes(const MyMeshType& srcMesh,
                                            const MyMeshType& targetMesh,
                                            MyMatrixType& matrix,
-                                           const char *method)
+                                           const std::string& method)
   {
     typedef typename MyMeshType::MyConnType ConnType;
     // create MeshElement objects corresponding to each element of the two meshes
index 36aaa086b9725aa018696b13988e58ee80f5d430..a952bd8f54507be1012e75686f9f7b35ec2c0891 100644 (file)
@@ -36,7 +36,7 @@ namespace INTERP_KERNEL
     // Main function to interpolate
     template<class MyMeshType, class MatrixType>
     int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT,
-                          MatrixType& result, const char *method);
+                          MatrixType& result, const std::string& method);
     
   };
 }
index cd9e00355edc3c205550e6b387b109f0601894bc..111515ffbea226f2ae4968ef49af2d938c4c6e35 100644 (file)
@@ -72,10 +72,10 @@ namespace INTERP_KERNEL
       */
   template<class RealCurve>
   template<class MyMeshType, class MatrixType>
-  int InterpolationCurve<RealCurve>::interpolateMeshes (const MyMeshType& myMeshS,
-                                                        const MyMeshType& myMeshT,
-                                                        MatrixType&       result,
-                                                        const char *      method)
+  int InterpolationCurve<RealCurve>::interpolateMeshes (const MyMeshType&  myMeshS,
+                                                        const MyMeshType&  myMeshT,
+                                                        MatrixType&        result,
+                                                        const std::string& method)
   {
     static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
     typedef typename MyMeshType::MyConnType ConnType;
@@ -88,8 +88,7 @@ namespace INTERP_KERNEL
     long nbMailleT = myMeshT.getNumberOfElements();
     
     CurveIntersector<MyMeshType,MatrixType>* intersector=0;
-    std::string meth(method);
-    if(meth=="P0P0")
+    if(method=="P0P0")
       {
         intersector = new CurveIntersectorP0P0<MyMeshType,MatrixType>
           (myMeshT, myMeshS,
@@ -98,7 +97,7 @@ namespace INTERP_KERNEL
            InterpolationOptions::getMedianPlane(),
            InterpolationOptions::getPrintLevel());
       }
-    else if(meth=="P0P1")
+    else if(method=="P0P1")
       {
         intersector = new CurveIntersectorP0P1<MyMeshType,MatrixType>
           (myMeshT, myMeshS,
@@ -107,7 +106,7 @@ namespace INTERP_KERNEL
            InterpolationOptions::getMedianPlane(),
            InterpolationOptions::getPrintLevel());
       }
-    else if(meth=="P1P0")
+    else if(method=="P1P0")
       {
         intersector = new CurveIntersectorP1P0<MyMeshType,MatrixType>
           (myMeshT, myMeshS,
@@ -116,7 +115,7 @@ namespace INTERP_KERNEL
            InterpolationOptions::getMedianPlane(),
            InterpolationOptions::getPrintLevel());
       }
-    else if(meth=="P1P1")
+    else if(method=="P1P1")
       {
         intersector = new CurveIntersectorP1P1<MyMeshType,MatrixType>
           (myMeshT, myMeshS,
index 43d2e4222f424f56a9ddb72c8f93f0aa5c074c34..ebd37d1a1d533d4b06a2c4faa4bd55e7e9f2cec2 100644 (file)
@@ -286,19 +286,18 @@ std::string INTERP_KERNEL::InterpolationOptions::printOptions() const
   return oss.str();
 }
 
-void INTERP_KERNEL::InterpolationOptions::CheckAndSplitInterpolationMethod(const char *method, std::string& srcMeth, std::string& trgMeth)
+void INTERP_KERNEL::InterpolationOptions::CheckAndSplitInterpolationMethod(const std::string& method, std::string& srcMeth, std::string& trgMeth)
 {
   const int NB_OF_METH_MANAGED=4;
   const char *METH_MANAGED[NB_OF_METH_MANAGED]={"P0P0","P0P1","P1P0","P1P1"};
-  std::string methodC(method);
   bool found=false;
   for(int i=0;i<NB_OF_METH_MANAGED && !found;i++)
-    found=(methodC==METH_MANAGED[i]);
+    found=(method==METH_MANAGED[i]);
   if(!found)
     {
       std::string msg("The interpolation method : \'"); msg+=method; msg+="\' not managed by INTERP_KERNEL interpolators ! Supported are \"P0P0\", \"P0P1\", \"P1P0\" and \"P1P1\".";
       throw INTERP_KERNEL::Exception(msg.c_str());
     }
-  srcMeth=methodC.substr(0,2);
-  trgMeth=methodC.substr(2);
+  srcMeth=method.substr(0,2);
+  trgMeth=method.substr(2);
 }
index a37fbf6ddce630cdc80227018f7dfb6859324903..9b11b0cedf7a0b16ee40387258f5dd981b185b31 100644 (file)
@@ -111,7 +111,7 @@ namespace INTERP_KERNEL
     bool setOptionString(const std::string& key, const std::string& value);
     std::string printOptions() const;
   public:
-    static void CheckAndSplitInterpolationMethod(const char *method, std::string& srcMeth, std::string& trgMeth);
+    static void CheckAndSplitInterpolationMethod(const std::string& method, std::string& srcMeth, std::string& trgMeth);
   private:
     static const double DFT_MEDIAN_PLANE;
     static const double DFT_SURF3D_ADJ_EPS;
index 431c4c886bf8e122b29ae75d0ad3c7df7d21d5fa..744846e67464e1a92e673c278b0fad34ae055f1b 100755 (executable)
@@ -43,7 +43,7 @@ namespace INTERP_KERNEL
     
     // Main function to interpolate triangular and quadratic meshes
     template<class MyMeshType, class MatrixType>
-    int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const char *method);
+    int interpolateMeshes(const MyMeshType& meshS, const MyMeshType& meshT, MatrixType& result, const std::string& method);
   public:
     bool doRotate() const { return asLeafInterpPlanar().doRotate(); }
     double medianPlane() const { return asLeafInterpPlanar().medianPlane(); }
index 13a6817c300ae411283d1233d6ef14ed23fb118c..73b2e9d31d7a194ca77e1fc39179fd577f0dd1d7 100644 (file)
@@ -17,6 +17,7 @@
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 // Author : Anthony Geay (CEA/DEN)
+
 #ifndef __INTERPOLATIONPLANAR_TXX__
 #define __INTERPOLATIONPLANAR_TXX__
 
@@ -111,7 +112,7 @@ namespace INTERP_KERNEL
       */
   template<class RealPlanar>
   template<class MyMeshType, class MatrixType>
-  int InterpolationPlanar<RealPlanar>::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const char *method)
+  int InterpolationPlanar<RealPlanar>::interpolateMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, MatrixType& result, const std::string& method)
   {
     static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
     typedef typename MyMeshType::MyConnType ConnType;
index 46df158ddd4340252b5d912eacf0ddc4193331eb..18d550d32029b38d72a928581787f4418603e52f 100644 (file)
@@ -34,6 +34,7 @@
 #include <algorithm>
 #include <iostream>
 #include <limits>
+#include <functional>
 
 namespace INTERP_KERNEL
 {
index 18ed28c2c5e75865f2fb62d1e230cb370ca9cd17..b26696bf13e830076ca606a14f1703b233b3e6c0 100644 (file)
@@ -106,6 +106,8 @@ namespace INTERP_TEST
     //
     CPPUNIT_TEST( checkNormalize );
     CPPUNIT_TEST( checkMakePartitionAbs1 );
+    //
+    CPPUNIT_TEST( checkIsInOrOut );
     CPPUNIT_TEST_SUITE_END();
   public:  
     void setUp();
@@ -194,6 +196,9 @@ namespace INTERP_TEST
     //
     void checkNormalize();
     void checkMakePartitionAbs1();
+    // From Adrien:
+    void checkIsInOrOut();
+
   private:
     INTERP_KERNEL::QuadraticPolygon *buildQuadraticPolygonCoarseInfo(const double *coords, const int *conn, int lgth);
     INTERP_KERNEL::EdgeArcCircle *buildArcOfCircle(const double *center, double radius, double alphaStart, double alphaEnd);
index 23210afa5032e604331621515bd5aabac3d49421..1472341ad57e3a9581a34337e7e61e0c5edca40f 100644 (file)
@@ -1171,4 +1171,24 @@ void QuadraticPlanarInterpTest::checkNonRegressionOmar0030()
   delete pol2;
 }
 
+void QuadraticPlanarInterpTest::checkIsInOrOut()
+{
+  double coords[8]={   0.30662641093707971,  -0.47819928619088981,
+                      -0.47819928619088964,  0.30662641093707987,
+                       0.0, 0.0,
+                       0.4, 0.4
+  };
+  coords[4] = (coords[0] + coords[2]) / 2.0;
+  coords[5] = (coords[1] + coords[3]) / 2.0;
+
+  int tab4[4]={ 0, 1, 2, 3};
+  QuadraticPolygon *pol1=buildQuadraticPolygonCoarseInfo(coords,tab4,4);
+  Node * n = new Node(0.3175267678416348, -0.4890996430954449);
+
+  CPPUNIT_ASSERT(! pol1->isInOrOut(n)); // node should be out
+  n->decrRef();
+  delete pol1;
+}
+
+
 }
index ca92e2fa09a7705d8683bee975ebd47159153356..9328df367942345887e0ca759627b2c3cd8f4247 100644 (file)
@@ -32,7 +32,7 @@ MEDCoupling1GTUMesh::MEDCoupling1GTUMesh()
 {
 }
 
-MEDCoupling1GTUMesh::MEDCoupling1GTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm):_cm(&cm)
+MEDCoupling1GTUMesh::MEDCoupling1GTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm):_cm(&cm)
 {
   setName(name);
 }
@@ -41,7 +41,7 @@ MEDCoupling1GTUMesh::MEDCoupling1GTUMesh(const MEDCoupling1GTUMesh& other, bool
 {
 }
 
-MEDCoupling1GTUMesh *MEDCoupling1GTUMesh::New(const char *name, INTERP_KERNEL::NormalizedCellType type)
+MEDCoupling1GTUMesh *MEDCoupling1GTUMesh::New(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
 {
   if(type==INTERP_KERNEL::NORM_ERROR)
     throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::New : NORM_ERROR is not a valid type to be used as base geometric type for a mesh !");
@@ -404,7 +404,7 @@ MEDCouplingUMesh *MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh(const std::v
     throw INTERP_KERNEL::Exception("MEDCoupling1GTUMesh::AggregateOnSameCoordsToUMesh : the first instance in input parts is null !");
   const DataArrayDouble *coords(firstPart->getCoords());
   int meshDim(firstPart->getMeshDimension());
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(firstPart->getName().c_str(),meshDim)); ret->setDescription(firstPart->getDescription().c_str());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret(MEDCouplingUMesh::New(firstPart->getName(),meshDim)); ret->setDescription(firstPart->getDescription());
   ret->setCoords(coords);
   int nbOfCells(0),connSize(0);
   for(std::vector< const MEDCoupling1GTUMesh *>::const_iterator it=parts.begin();it!=parts.end();it++)
@@ -467,7 +467,7 @@ MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh(const MEDCoupling1SGTUMesh& other, bo
     }
 }
 
-MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm)
+MEDCoupling1SGTUMesh::MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm)
 {
 }
 
@@ -480,7 +480,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New()
   return new MEDCoupling1SGTUMesh;
 }
 
-MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const char *name, INTERP_KERNEL::NormalizedCellType type)
+MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
 {
   if(type==INTERP_KERNEL::NORM_ERROR)
     throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : NORM_ERROR is not a valid type to be used as base geometric type for a mesh !");
@@ -501,8 +501,8 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::New(const MEDCouplingUMesh *m)
   if(gts.size()!=1)
     throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::New : input mesh must have exactly one geometric type !");
   int geoType((int)*gts.begin());
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(m->getName().c_str(),*gts.begin()));
-  ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription().c_str());
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(m->getName(),*gts.begin()));
+  ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
   int nbCells(m->getNumberOfCells());
   int nbOfNodesPerCell(ret->getNumberOfNodesPerCell());
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()); conn->alloc(nbCells*nbOfNodesPerCell,1);
@@ -949,7 +949,7 @@ MEDCouplingMesh *MEDCoupling1SGTUMesh::mergeMyselfWith(const MEDCouplingMesh *ot
 
 MEDCouplingUMesh *MEDCoupling1SGTUMesh::buildUnstructured() const
 {
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName().c_str(),getMeshDimension());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
   ret->setCoords(getCoords());
   const int *nodalConn=_conn->begin();
   int nbCells=getNumberOfCells();
@@ -1168,7 +1168,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::Merge1SGTUMeshesLL(std::vector<const
 MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
 {
   int ncell=getNumberOfCells();
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName().c_str(),*_cm));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
   ret->setCoords(_coords);
   std::size_t nbOfElemsRet=std::distance(begin,end);
   const int *inConn=_conn->getConstPointer();
@@ -1194,7 +1194,7 @@ MEDCouplingPointSet *MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2(int star
 {
   int ncell=getNumberOfCells();
   int nbOfElemsRet=DataArray::GetNumberOfItemGivenBESRelative(start,end,step,"MEDCoupling1SGTUMesh::buildPartOfMySelfKeepCoords2 : ");
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName().c_str(),*_cm));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
   ret->setCoords(_coords);
   const int *inConn=_conn->getConstPointer();
   int sz=getNumberOfNodesPerCell();
@@ -1237,7 +1237,7 @@ void MEDCoupling1SGTUMesh::computeNodeIdsAlg(std::vector<bool>& nodeIdsInUse) co
 
 MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::buildSetInstanceFromThis(int spaceDim) const
 {
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName().c_str(),*_cm));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(new MEDCoupling1SGTUMesh(getName(),*_cm));
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1;
   const DataArrayInt *nodalConn(_conn);
   if(!nodalConn)
@@ -1442,9 +1442,9 @@ void MEDCoupling1SGTUMesh::unserialization(const std::vector<double>& tinyInfoD,
 {
   INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
   _cm=&INTERP_KERNEL::CellModel::GetCellModel(gt);
-  setName(littleStrings[0].c_str());
-  setDescription(littleStrings[1].c_str());
-  setTimeUnit(littleStrings[2].c_str());
+  setName(littleStrings[0]);
+  setDescription(littleStrings[1]);
+  setTimeUnit(littleStrings[2]);
   setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]);
   int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]);
   //
@@ -1648,7 +1648,7 @@ MEDCoupling1SGTUMesh *MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4() const
     throw INTERP_KERNEL::Exception("MEDCoupling1SGTUMesh::explodeEachHexa8To6Quad4 : this method can be applied only on HEXA8 mesh !");
   int nbHexa8(getNumberOfCells());
   const int *inConnPtr(getNodalConnectivity()->begin());
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName().c_str(),INTERP_KERNEL::NORM_QUAD4));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_QUAD4));
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c(DataArrayInt::New()); c->alloc(nbHexa8*6*4,1);
   int *cPtr(c->getPointer());
   for(int i=0;i<nbHexa8;i++,inConnPtr+=8)
@@ -1838,7 +1838,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh3D() const
   std::vector<const DataArrayDouble *> v(4); v[0]=getCoords(); v[1]=facesBaryArr; v[2]=edgesBaryArr; v[3]=baryArr;
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0; facesBaryArr=0;
   std::string name("DualOf_"); name+=getName();
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name.c_str(),INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr);
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYHED)); ret->setCoords(zeArr);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
   for(int i=0;i<nbOfNodes;i++,revNodI++)
     {
@@ -1910,7 +1910,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1SGTUMesh::computeDualMesh2D() const
   std::vector<const DataArrayDouble *> v(3); v[0]=getCoords(); v[1]=edgesBaryArr; v[2]=baryArr;
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> zeArr(DataArrayDouble::Aggregate(v)); baryArr=0; edgesBaryArr=0;
   std::string name("DualOf_"); name+=getName();
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name.c_str(),INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr);
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(name,INTERP_KERNEL::NORM_POLYGON)); ret->setCoords(zeArr);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cArr(DataArrayInt::New()),ciArr(DataArrayInt::New()); ciArr->alloc(nbOfNodes+1,1); ciArr->setIJ(0,0,0); cArr->alloc(0,1);
   for(int i=0;i<nbOfNodes;i++,revNodI++)
     {
@@ -2011,7 +2011,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New()
   return new MEDCoupling1DGTUMesh;
 }
 
-MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New(const char *name, INTERP_KERNEL::NormalizedCellType type)
+MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New(const std::string& name, INTERP_KERNEL::NormalizedCellType type)
 {
   if(type==INTERP_KERNEL::NORM_ERROR)
     throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : NORM_ERROR is not a valid type to be used as base geometric type for a mesh !");
@@ -2028,7 +2028,7 @@ MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh()
 {
 }
 
-MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm)
+MEDCoupling1DGTUMesh::MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm):MEDCoupling1GTUMesh(name,cm)
 {
 }
 
@@ -2624,7 +2624,7 @@ MEDCouplingMesh *MEDCoupling1DGTUMesh::mergeMyselfWith(const MEDCouplingMesh *ot
 
 MEDCouplingUMesh *MEDCoupling1DGTUMesh::buildUnstructured() const
 {
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName().c_str(),getMeshDimension());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),getMeshDimension());
   ret->setCoords(getCoords());
   const int *nodalConn=_conn->begin(),*nodalConnI=_conn_indx->begin();
   int nbCells=getNumberOfCells();//checkCoherency
@@ -2710,7 +2710,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::mergeMyselfWithOnSameCoords(const MED
 MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int *begin, const int *end) const
 {
   checkCoherency();
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
   ret->setCoords(_coords);
   DataArrayInt *c=0,*ci=0;
   MEDCouplingUMesh::ExtractFromIndexedArrays(begin,end,_conn,_conn_indx,c,ci);
@@ -2722,7 +2722,7 @@ MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords(const int
 MEDCouplingPointSet *MEDCoupling1DGTUMesh::buildPartOfMySelfKeepCoords2(int start, int end, int step) const
 {
   checkCoherency();
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
   ret->setCoords(_coords);
   DataArrayInt *c=0,*ci=0;
   MEDCouplingUMesh::ExtractFromIndexedArrays2(start,end,step,_conn,_conn_indx,c,ci);
@@ -2900,9 +2900,9 @@ void MEDCoupling1DGTUMesh::unserialization(const std::vector<double>& tinyInfoD,
 {
   INTERP_KERNEL::NormalizedCellType gt((INTERP_KERNEL::NormalizedCellType)tinyInfo[0]);
   _cm=&INTERP_KERNEL::CellModel::GetCellModel(gt);
-  setName(littleStrings[0].c_str());
-  setDescription(littleStrings[1].c_str());
-  setTimeUnit(littleStrings[2].c_str());
+  setName(littleStrings[0]);
+  setDescription(littleStrings[1]);
+  setTimeUnit(littleStrings[2]);
   setTime(tinyInfoD[0],tinyInfo[1],tinyInfo[2]);
   int sz0(tinyInfo[3]),sz1(tinyInfo[4]),sz2(tinyInfo[5]),sz3(tinyInfo[6]),sz4(tinyInfo[7]),sz5(tinyInfo[8]);
   //
@@ -3139,7 +3139,7 @@ DataArrayInt *MEDCoupling1DGTUMesh::getNodalConnectivityIndex() const
  */
 MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::copyWithNodalConnectivityPacked(bool& isShallowCpyOfNodalConnn) const
 {
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
   DataArrayInt *nc=0,*nci=0;
   isShallowCpyOfNodalConnn=retrievePackedNodalConnectivity(nc,nci);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ncs(nc),ncis(nci);
@@ -3322,7 +3322,7 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::Merge1DGTUMeshesLL(std::vector<const
 
 MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::buildSetInstanceFromThis(int spaceDim) const
 {
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName().c_str(),*_cm));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(new MEDCoupling1DGTUMesh(getName(),*_cm));
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1,tmp2;
   const DataArrayInt *nodalConn(_conn),*nodalConnI(_conn_indx);
   if(!nodalConn)
@@ -3481,8 +3481,8 @@ MEDCoupling1DGTUMesh *MEDCoupling1DGTUMesh::New(const MEDCouplingUMesh *m)
   if(gts.size()!=1)
     throw INTERP_KERNEL::Exception("MEDCoupling1DGTUMesh::New : input mesh must have exactly one geometric type !");
   int geoType((int)*gts.begin());
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(m->getName().c_str(),*gts.begin()));
-  ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription().c_str());
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> ret(MEDCoupling1DGTUMesh::New(m->getName(),*gts.begin()));
+  ret->setCoords(m->getCoords()); ret->setDescription(m->getDescription());
   int nbCells(m->getNumberOfCells());
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
   conn->alloc(m->getMeshLength()-nbCells,1); connI->alloc(nbCells+1,1);
index 805ba002d0155d9b50f8b4ffd3d13d7cc67f0eb5..32414fb043aafde5af75b89edd9e4b5bd045dc99 100644 (file)
@@ -35,7 +35,7 @@ namespace ParaMEDMEM
   class MEDCoupling1GTUMesh : public MEDCouplingPointSet
   {
   public:
-    MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type);
+    MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
     MEDCOUPLING_EXPORT static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m);
     MEDCOUPLING_EXPORT const INTERP_KERNEL::CellModel& getCellModel() const;
     MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getCellModelEnum() const;
@@ -73,7 +73,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual DataArrayInt *getNodalConnectivity() const = 0;
     MEDCOUPLING_EXPORT virtual void checkCoherencyOfConnectivity() const = 0;
   protected:
-    MEDCoupling1GTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm);
+    MEDCoupling1GTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
     MEDCoupling1GTUMesh(const MEDCoupling1GTUMesh& other, bool recDeepCpy);
     MEDCoupling1GTUMesh();
   protected:
@@ -85,7 +85,7 @@ namespace ParaMEDMEM
   class MEDCoupling1SGTUMesh : public MEDCoupling1GTUMesh
   {
   public:
-    MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type);
+    MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
     MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m);
     //! useless constructor only for CORBA -> not swigged
     MEDCOUPLING_EXPORT static MEDCoupling1SGTUMesh *New();
@@ -153,7 +153,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
                                             const std::vector<std::string>& littleStrings);
   private:
-    MEDCoupling1SGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm);
+    MEDCoupling1SGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
     MEDCoupling1SGTUMesh(const MEDCoupling1SGTUMesh& other, bool recDeepCpy);
     MEDCoupling1SGTUMesh();
   private:
@@ -174,7 +174,7 @@ namespace ParaMEDMEM
   class MEDCoupling1DGTUMesh : public MEDCoupling1GTUMesh
   {
   public:
-    MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type);
+    MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type);
     MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m);
     //! useless constructor only for CORBA -> not swigged
     MEDCOUPLING_EXPORT static MEDCoupling1DGTUMesh *New();
@@ -244,7 +244,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
                                             const std::vector<std::string>& littleStrings);
   private:
-    MEDCoupling1DGTUMesh(const char *name, const INTERP_KERNEL::CellModel& cm);
+    MEDCoupling1DGTUMesh(const std::string& name, const INTERP_KERNEL::CellModel& cm);
     MEDCoupling1DGTUMesh(const MEDCoupling1DGTUMesh& other, bool recDeepCpy);
     MEDCoupling1DGTUMesh();
   private:
index 0a2878258ce1471de64c8b602b02d2996c92d505..b928c5d87e04d424e7c33e035daccf61d74f14cb 100644 (file)
@@ -79,7 +79,7 @@ MEDCouplingCMesh *MEDCouplingCMesh::New()
   return new MEDCouplingCMesh;
 }
 
-MEDCouplingCMesh *MEDCouplingCMesh::New(const char *meshName)
+MEDCouplingCMesh *MEDCouplingCMesh::New(const std::string& meshName)
 {
   MEDCouplingCMesh *ret=new MEDCouplingCMesh;
   ret->setName(meshName);
@@ -217,6 +217,7 @@ void MEDCouplingCMesh::checkCoherency() const
   const char msg0[]="Invalid ";
   const char msg1[]=" array ! Must contain more than 1 element.";
   const char msg2[]=" array ! Must be with only one component.";
+  getSpaceDimension();// here to check that no holes in arrays !
   if(_x_array)
     {
       if(_x_array->getNbOfElems()<2)
@@ -301,19 +302,19 @@ int MEDCouplingCMesh::getNumberOfNodes() const
 
 void MEDCouplingCMesh::getSplitCellValues(int *res) const
 {
-  int spaceDim=getSpaceDimension();
-  for(int l=0;l<spaceDim;l++)
+  int meshDim(getMeshDimension());
+  for(int l=0;l<meshDim;l++)
     {
       int val=1;
-      for(int p=0;p<spaceDim-l-1;p++)
+      for(int p=0;p<meshDim-l-1;p++)
         val*=getCoordsAt(p)->getNbOfElems()-1;
-      res[spaceDim-l-1]=val;
+      res[meshDim-l-1]=val;
     }
 }
 
 void MEDCouplingCMesh::getSplitNodeValues(int *res) const
 {
-  int spaceDim=getSpaceDimension();
+  int spaceDim(getSpaceDimension());
   for(int l=0;l<spaceDim;l++)
     {
       int val=1;
@@ -325,14 +326,14 @@ void MEDCouplingCMesh::getSplitNodeValues(int *res) const
 
 void MEDCouplingCMesh::getNodeGridStructure(int *res) const
 {
-  int meshDim=getMeshDimension();
-  for(int i=0;i<meshDim;i++)
+  int spaceDim(getSpaceDimension());
+  for(int i=0;i<spaceDim;i++)
     res[i]=getCoordsAt(i)->getNbOfElems();
 }
 
 std::vector<int> MEDCouplingCMesh::getNodeGridStructure() const
 {
-  std::vector<int> ret(getMeshDimension());
+  std::vector<int> ret(getSpaceDimension());
   getNodeGridStructure(&ret[0]);
   return ret;
 }
@@ -355,21 +356,61 @@ MEDCouplingStructuredMesh *MEDCouplingCMesh::buildStructuredSubPart(const std::v
   return ret.retn();
 }
 
+/*!
+ * Return the space dimension of \a this. It only considers the arrays along X, Y and Z to deduce that.
+ * This method throws exceptions if the not null arrays defining this are not contiguouly at the end. For example X!=0,Y==0,Z!=0 will throw.
+ */
 int MEDCouplingCMesh::getSpaceDimension() const
 {
-  int ret=0;
+  static const char MSG[]="MEDCouplingCMesh::getSpaceDimension : mesh is invalid ! null vectors (X, Y or Z) must be put contiguously at the end !";
+  int ret(0);
+  bool isOK(true);
   if(_x_array)
     ret++;
+  else
+    isOK=false;
   if(_y_array)
-    ret++;
+    {
+      if(!isOK)
+        throw INTERP_KERNEL::Exception(MSG);
+      ret++;
+    }
+  else
+    isOK=false;
   if(_z_array)
-    ret++;
+    {
+      if(!isOK)
+        throw INTERP_KERNEL::Exception(MSG);
+      ret++;
+    }
   return ret;
 }
 
+/*!
+ * This method returns the mesh dimension of \a this. It can be different from space dimension in case of a not null dimension contains only one node.
+ */
 int MEDCouplingCMesh::getMeshDimension() const
 {
-  return getSpaceDimension();
+  int ret(getSpaceDimension());
+  if(_x_array)
+    {
+      if(_x_array->isAllocated())
+        if(_x_array->getNumberOfTuples()==1)
+          ret--;
+    }
+  if(_y_array)
+    {
+      if(_y_array->isAllocated())
+        if(_y_array->getNumberOfTuples()==1)
+          ret--;
+    }
+  if(_z_array)
+    {
+      if(_z_array->isAllocated())
+        if(_z_array->getNumberOfTuples()==1)
+          ret--;
+    }
+  return ret;
 }
 
 void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
@@ -576,7 +617,7 @@ MEDCouplingFieldDouble *MEDCouplingCMesh::getMeasureField(bool isAbs) const
   name+=getName();
   int nbelem=getNumberOfCells();
   MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
-  field->setName(name.c_str());
+  field->setName(name);
   DataArrayDouble* array=DataArrayDouble::New();
   array->alloc(nbelem,1);
   double *area_vol=array->getPointer();
@@ -717,7 +758,7 @@ DataArrayDouble *MEDCouplingCMesh::getCoordinatesAndOwner() const
   for(int j=0;j<spaceDim;j++)
     {
       tabsPtr[j]=tabs[j]->getConstPointer();
-      ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str());
+      ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
     }
   int tmp2[3];
   for(int i=0;i<nbNodes;i++)
@@ -751,7 +792,7 @@ DataArrayDouble *MEDCouplingCMesh::getBarycenterAndOwner() const
   for(int j=0;j<spaceDim;j++)
     {
       int sz=tabs[j]->getNbOfElems()-1;
-      ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str());
+      ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
       const double *srcPtr=tabs[j]->getConstPointer();
       tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz);
       std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),srcPtr+1,tabsPtr[j].begin(),std::plus<double>());
@@ -837,9 +878,9 @@ void MEDCouplingCMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const
 void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
                                        const std::vector<std::string>& littleStrings)
 {
-  setName(littleStrings[0].c_str());
-  setDescription(littleStrings[1].c_str());
-  setTimeUnit(littleStrings[2].c_str());
+  setName(littleStrings[0]);
+  setDescription(littleStrings[1]);
+  setTimeUnit(littleStrings[2]);
   DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array};
   const double *data=a2->getConstPointer();
   for(int i=0;i<3;i++)
@@ -848,7 +889,7 @@ void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, con
         {
           (*(thisArr[i]))=DataArrayDouble::New();
           (*(thisArr[i]))->alloc(tinyInfo[i],1);
-          (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3].c_str());
+          (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3]);
           std::copy(data,data+tinyInfo[i],(*(thisArr[i]))->getPointer());
           data+=tinyInfo[i];
         }
index 5a6cc2576bb790281f2f852f646643b0945c15da..0a503fe974475e92cbf87660f9142ea4c966df5a 100644 (file)
@@ -33,7 +33,7 @@ namespace ParaMEDMEM
   {
   public:
     MEDCOUPLING_EXPORT static MEDCouplingCMesh *New();
-    MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(const char *meshName);
+    MEDCOUPLING_EXPORT static MEDCouplingCMesh *New(const std::string& meshName);
     MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const;
     MEDCOUPLING_EXPORT MEDCouplingCMesh *clone(bool recDeepCpy) const;
     MEDCOUPLING_EXPORT void updateTime() const;
index 6dc3063daacc8714a70bd019ef81515aea0ab395..e8e1aa46734b1481b81b5b5e52bfa2aae9314547 100644 (file)
@@ -57,7 +57,7 @@ MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New()
   return new MEDCouplingCurveLinearMesh;
 }
 
-MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const char *meshName)
+MEDCouplingCurveLinearMesh *MEDCouplingCurveLinearMesh::New(const std::string& meshName)
 {
   MEDCouplingCurveLinearMesh *ret=new MEDCouplingCurveLinearMesh;
   ret->setName(meshName);
@@ -391,7 +391,7 @@ MEDCouplingFieldDouble *MEDCouplingCurveLinearMesh::getMeasureField(bool isAbs)
   int meshDim=getMeshDimension();
   std::string name="MeasureOfMesh_"; name+=getName();
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
-  field->setName(name.c_str()); field->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(this)); field->synchronizeTimeWithMesh();
+  field->setName(name); field->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(this)); field->synchronizeTimeWithMesh();
   switch(meshDim)
     {
     case 3:
@@ -878,9 +878,9 @@ void MEDCouplingCurveLinearMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&
 void MEDCouplingCurveLinearMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
                                                  const std::vector<std::string>& littleStrings)
 {
-  setName(littleStrings[0].c_str());
-  setDescription(littleStrings[1].c_str());
-  setTimeUnit(littleStrings[2].c_str());
+  setName(littleStrings[0]);
+  setDescription(littleStrings[1]);
+  setTimeUnit(littleStrings[2]);
   setTime(tinyInfoD[0],tinyInfo[0],tinyInfo[1]);
   int sz=tinyInfo[2];
   _structure.resize(sz);
index 46a09bfdf4401ec1e6e4aadd8fc363bdd0f5bb70..faba1c7b4b231444f594527340e724edcdec025a 100644 (file)
@@ -34,7 +34,7 @@ namespace ParaMEDMEM
   {
   public:
     MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New();
-    MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(const char *meshName);
+    MEDCOUPLING_EXPORT static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
     MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const;
     MEDCOUPLING_EXPORT MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
     MEDCOUPLING_EXPORT void updateTime() const;
index 3658b43bee4b276b6ffa30d407909fa5501e97d1..8ebcf8a71b585ee1576ebcad01acd2aee1ec9ba9 100644 (file)
@@ -101,7 +101,7 @@ try:_mesh2D(const_cast<MEDCouplingUMesh *>(mesh2D)),_mesh1D(MEDCouplingUMesh::Ne
   if(_mesh2D!=0)
     _mesh2D->incrRef();
   computeExtrusion(mesh3D);
-  setName(mesh3D->getName().c_str());
+  setName(mesh3D->getName());
 }
 catch(INTERP_KERNEL::Exception& e)
   {
@@ -448,7 +448,7 @@ MEDCouplingUMesh *MEDCouplingExtrudedMesh::build3DUnstructuredMesh() const
   MEDCouplingUMesh *ret=_mesh2D->buildExtrudedMesh(_mesh1D,0);
   const int *renum=_mesh3D_ids->getConstPointer();
   ret->renumberCells(renum,false);
-  ret->setName(getName().c_str());
+  ret->setName(getName());
   return ret;
 }
 
@@ -480,7 +480,7 @@ MEDCouplingFieldDouble *MEDCouplingExtrudedMesh::getMeasureField(bool) const
       retPtr[renum[i*nbOf2DCells+j]]=ret2DPtr[j]*ret1DPtr[i];
   ret->setArray(da);
   da->decrRef();
-  ret->setName(name.c_str());
+  ret->setName(name);
   ret2D->decrRef();
   ret1D->decrRef();
   return ret;
@@ -766,6 +766,12 @@ DataArrayDouble *MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell() c
   throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell: not yet implemented !");
 }
 
+void MEDCouplingExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
+{
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m(buildUnstructured());
+  m->getReverseNodalConnectivity(revNodal,revNodalIndx);
+}
+
 void MEDCouplingExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D)
 {
   _mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1);
@@ -897,8 +903,8 @@ void MEDCouplingExtrudedMesh::serialize(DataArrayInt *&a1, DataArrayDouble *&a2)
 
 void MEDCouplingExtrudedMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector<std::string>& littleStrings)
 {
-  setName(littleStrings[littleStrings.size()-2].c_str());
-  setDescription(littleStrings.back().c_str());
+  setName(littleStrings[littleStrings.size()-2]);
+  setDescription(littleStrings.back());
   std::size_t sz=tinyInfo.size();
   int sz1=tinyInfo[sz-2];
   _cell_2D_id=tinyInfo[sz-3];
index ebceee9c3415dfecab98b4fc57cbee07c7b36352..6902eeda9215a0815a710d8c1238872be28b9374 100644 (file)
@@ -97,6 +97,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const;
     MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const;
     MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const;
+    MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
     //Serialization unserialisation
     MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector<double>& tinyInfoD, std::vector<int>& tinyInfo, std::vector<std::string>& littleStrings) const;
     MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector<int>& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector<std::string>& littleStrings) const;
index 3f50f4c57471fce86ec20de44f749434dd9182fd..55b6e0b98a0a3d0cce69cd73f53268173194686e 100644 (file)
@@ -590,8 +590,8 @@ void MEDCouplingField::copyTinyStringsFrom(const MEDCouplingField *other)
 {
   if(other)
     {
-      setName(other->_name.c_str());
-      setDescription(other->_desc.c_str());    
+      setName(other->_name);
+      setDescription(other->_desc);    
     }
 }
 
index 8b2117c26eb2200ed47f2a3e2d742fc10a5dfa7f..d857aceb9b6677111f68f812db90ed4eb1d64c44 100644 (file)
@@ -53,9 +53,9 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingField *other);
     MEDCOUPLING_EXPORT void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh);
     MEDCOUPLING_EXPORT const ParaMEDMEM::MEDCouplingMesh *getMesh() const { return _mesh; }
-    MEDCOUPLING_EXPORT void setName(const char *name) { _name=name; }
+    MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; }
     MEDCOUPLING_EXPORT std::string getDescription() const { return _desc; }
-    MEDCOUPLING_EXPORT void setDescription(const char *desc) { _desc=desc; }
+    MEDCOUPLING_EXPORT void setDescription(const std::string& desc) { _desc=desc; }
     MEDCOUPLING_EXPORT std::string getName() const { return _name; }
     MEDCOUPLING_EXPORT TypeOfField getTypeOfField() const;
     MEDCOUPLING_EXPORT NatureOfField getNature() const;
index 50ed785a031bac13f9a7167aad1bd8e06c129038..4790b4cb95d900865a2a569eb0ad42dd3ed9d460 100644 (file)
@@ -66,12 +66,13 @@ const TypeOfField MEDCouplingFieldDiscretizationKriging::TYPE=ON_NODES_KR;
 
 // doc is here http://www.code-aster.org/V2/doc/default/fr/man_r/r3/r3.01.01.pdf
 const double MEDCouplingFieldDiscretizationGaussNE::FGP_SEG2[2]={1.,1.};
-const double MEDCouplingFieldDiscretizationGaussNE::FGP_SEG3[3]={0.5555555555555556,0.5555555555555556,0.8888888888888888};
+const double MEDCouplingFieldDiscretizationGaussNE::FGP_SEG3[3]={0.5555555555555556,0.8888888888888888,0.5555555555555556};
 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_QUAD8[8]={1.,1.,1.,1.,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};
@@ -79,7 +80,7 @@ const double MEDCouplingFieldDiscretizationGaussNE::FGP_HEXA8[8]={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};
 const double MEDCouplingFieldDiscretizationGaussNE::REF_SEG2[2]={-1.,1.};
-const double MEDCouplingFieldDiscretizationGaussNE::REF_SEG3[3]={-1.,0.,1.};
+const double MEDCouplingFieldDiscretizationGaussNE::REF_SEG3[3]={-1.,1.,0.};
 const double MEDCouplingFieldDiscretizationGaussNE::REF_SEG4[4]={-1.,1.,-0.3333333333333333,0.3333333333333333};
 const double MEDCouplingFieldDiscretizationGaussNE::REF_TRI3[6]={0.,0.,1.,0.,0.,1.};
 const double MEDCouplingFieldDiscretizationGaussNE::REF_TRI6[12]={0.,0.,1.,0.,0.,1.,0.5,0.,0.5,0.5,0.,0.5};
@@ -96,6 +97,20 @@ const double MEDCouplingFieldDiscretizationGaussNE::REF_HEXA20[60]={-1.,-1.,-1.,
 const double MEDCouplingFieldDiscretizationGaussNE::REF_HEXA27[81]={-1.,-1.,-1.,1.,-1.,-1.,1.,1.,-1.,-1.,1.,-1.,-1.,-1.,1.,1.,-1.,1.,1.,1.,1.,-1.,1.,1.,0.,-1.,-1.,1.,0.,-1.,0.,1.,-1.,-1.,0.,-1.,-1.,-1.,0.,1.,-1.,0.,1.,1.,0.,-1.,1.,0.,0.,-1.,1.,1.,0.,1.,0.,1.,1.,-1.,0.,1.,0.,0.,-1.,0.,-1.,0.,1.,0.,0.,0.,1.,0.,-1.,0.,0.,0.,0.,1.,0.,0.,0.};
 const double MEDCouplingFieldDiscretizationGaussNE::REF_PYRA5[15]={1.,0.,0.,0.,1.,0.,-1.,0.,0.,0.,-1.,0.,0.,0.,1.};
 const double MEDCouplingFieldDiscretizationGaussNE::REF_PYRA13[39]={1.,0.,0.,0.,1.,0.,-1.,0.,0.,0.,-1.,0.,0.,0.,1.,0.5,0.5,0.,-0.5,0.5,0.,-0.5,-0.5,0.,0.5,-0.5,0.,0.5,0.,0.5,0.,0.5,0.5,-0.5,0.,0.5,0.,-0.5,0.5};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_SEG2[2]={0.577350269189626,-0.577350269189626};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_SEG3[3]={-0.774596669241,0.,0.774596669241};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_SEG4[4]={0.339981043584856,-0.339981043584856,0.861136311594053,-0.861136311594053};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_TRI3[6]={0.16666666666666667,0.16666666666666667,0.6666666666666667,0.16666666666666667,0.16666666666666667,0.6666666666666667};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_TRI6[12]={0.091576213509771,0.091576213509771,0.816847572980458,0.091576213509771,0.091576213509771,0.816847572980458,0.445948490915965,0.10810301816807,0.445948490915965,0.445948490915965,0.10810301816807,0.445948490915965};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_TRI7[14]={0.3333333333333333,0.3333333333333333,0.470142064105115,0.470142064105115,0.05971587178977,0.470142064105115,0.470142064105115,0.05971587178977,0.101286507323456,0.101286507323456,0.797426985353088,0.101286507323456,0.101286507323456,0.797426985353088};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_QUAD4[8]={-0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_QUAD8[16]={-0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.,-0.774596669241483,0.774596669241483,0.,0.,0.774596669241483,-0.774596669241483,0.};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_QUAD9[18]={-0.774596669241483,-0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.774596669241483,-0.774596669241483,0.774596669241483,0.,-0.774596669241483,0.774596669241483,0.,0.,0.774596669241483,-0.774596669241483,0.,0.,0.};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_TETRA4[12]={0.1381966011250105,0.1381966011250105,0.1381966011250105,0.1381966011250105,0.1381966011250105,0.5854101966249685,0.1381966011250105,0.5854101966249685,0.1381966011250105,0.5854101966249685,0.1381966011250105,0.1381966011250105};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_PENTA6[18]={-0.5773502691896258,0.5,0.5,-0.5773502691896258,0.,0.5,-0.5773502691896258,0.5,0.,0.5773502691896258,0.5,0.5,0.5773502691896258,0.,0.5,0.5773502691896258,0.5,0.};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_HEXA8[24]={-0.5773502691896258,-0.5773502691896258,-0.5773502691896258,-0.5773502691896258,-0.5773502691896258,0.5773502691896258,-0.5773502691896258,0.5773502691896258,-0.5773502691896258,-0.5773502691896258,0.5773502691896258,0.5773502691896258,0.5773502691896258,-0.5773502691896258,-0.5773502691896258,0.5773502691896258,-0.5773502691896258,0.5773502691896258,0.5773502691896258,0.5773502691896258,-0.5773502691896258,0.5773502691896258,0.5773502691896258,0.5773502691896258};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_HEXA27[81]={-0.7745966692414834,-0.7745966692414834,-0.7745966692414834,-0.7745966692414834,-0.7745966692414834,0.,-0.7745966692414834,-0.7745966692414834,0.7745966692414834,-0.7745966692414834,0.,-0.7745966692414834,-0.7745966692414834,0.,0.,-0.7745966692414834,0.,0.7745966692414834,-0.7745966692414834,0.7745966692414834,-0.7745966692414834,-0.7745966692414834,0.7745966692414834,0.,-0.7745966692414834,0.7745966692414834,0.7745966692414834,0.,-0.7745966692414834,-0.7745966692414834,0,-0.7745966692414834,0.,0.,-0.7745966692414834,0.7745966692414834,0.,0.,-0.7745966692414834,0.,0.,0.,0.,0.,0.7745966692414834,0.,0.7745966692414834,-0.7745966692414834,0.,0.7745966692414834,0.,0.,0.7745966692414834,0.7745966692414834,0.7745966692414834,-0.7745966692414834,-0.7745966692414834,0.7745966692414834,-0.7745966692414834,0.,0.7745966692414834,-0.7745966692414834,0.7745966692414834,0.7745966692414834,0,-0.7745966692414834,0.7745966692414834,0.,0.,0.7745966692414834,0.,0.7745966692414834,0.7745966692414834,0.7745966692414834,-0.7745966692414834,0.7745966692414834,0.7745966692414834,0.,0.7745966692414834,0.7745966692414834,0.7745966692414834};
+const double MEDCouplingFieldDiscretizationGaussNE::LOC_PYRA5[15]={0.5,0.,0.1531754163448146,0.,0.5,0.1531754163448146,-0.5,0.,0.1531754163448146,0.,-0.5,0.1531754163448146,0.,0.,0.6372983346207416};
 
 MEDCouplingFieldDiscretization::MEDCouplingFieldDiscretization():_precision(DFLT_PRECISION)
 {
@@ -120,18 +135,17 @@ MEDCouplingFieldDiscretization *MEDCouplingFieldDiscretization::New(TypeOfField
     }
 }
 
-TypeOfField MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(const char *repr)
+TypeOfField MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(const std::string& repr)
 {
-  std::string reprCpp(repr);
-  if(reprCpp==MEDCouplingFieldDiscretizationP0::REPR)
+  if(repr==MEDCouplingFieldDiscretizationP0::REPR)
     return MEDCouplingFieldDiscretizationP0::TYPE;
-  if(reprCpp==MEDCouplingFieldDiscretizationP1::REPR)
+  if(repr==MEDCouplingFieldDiscretizationP1::REPR)
     return MEDCouplingFieldDiscretizationP1::TYPE;
-  if(reprCpp==MEDCouplingFieldDiscretizationGauss::REPR)
+  if(repr==MEDCouplingFieldDiscretizationGauss::REPR)
     return MEDCouplingFieldDiscretizationGauss::TYPE;
-  if(reprCpp==MEDCouplingFieldDiscretizationGaussNE::REPR)
+  if(repr==MEDCouplingFieldDiscretizationGaussNE::REPR)
     return MEDCouplingFieldDiscretizationGaussNE::TYPE;
-  if(reprCpp==MEDCouplingFieldDiscretizationKriging::REPR)
+  if(repr==MEDCouplingFieldDiscretizationKriging::REPR)
     return MEDCouplingFieldDiscretizationKriging::TYPE;
   throw INTERP_KERNEL::Exception("Representation does not match with any field discretization !");
 }
@@ -381,7 +395,7 @@ void MEDCouplingFieldDiscretization::getCellIdsHavingGaussLocalization(int locId
   throw INTERP_KERNEL::Exception("Invalid method for the corresponding field discretization : available only for GaussPoint discretization !");
 }
 
-void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const char *msg)
+void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg)
 {
   if(!arr)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr : input array is NULL !");
@@ -419,7 +433,7 @@ void MEDCouplingFieldDiscretization::RenumberEntitiesFromO2NArr(double eps, cons
     }
 }
 
-void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const char *msg)
+void MEDCouplingFieldDiscretization::RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg)
 {
   int nbOfComp=arr->getNumberOfComponents();
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arrCpy=arr->deepCpy();
@@ -2276,6 +2290,9 @@ const double *MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometric
     case INTERP_KERNEL::NORM_QUAD4:
       lgth=(int)sizeof(FGP_QUAD4)/sizeof(double);
       return FGP_QUAD4;
+    case INTERP_KERNEL::NORM_QUAD8:
+      lgth=(int)sizeof(FGP_QUAD8)/sizeof(double);
+      return FGP_QUAD8;
     case INTERP_KERNEL::NORM_QUAD9:
       lgth=(int)sizeof(FGP_QUAD9)/sizeof(double);
       return FGP_QUAD9;
@@ -2362,6 +2379,85 @@ const double *MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricTy
     }
 }
 
+const double *MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth)
+{
+  switch(geoType)
+    {
+    case INTERP_KERNEL::NORM_SEG2:
+      {
+        lgth=(int)sizeof(LOC_SEG2)/sizeof(double);
+        return LOC_SEG2;
+      }
+    case INTERP_KERNEL::NORM_SEG3:
+      {
+        lgth=(int)sizeof(LOC_SEG3)/sizeof(double);
+        return LOC_SEG3;
+      }
+    case INTERP_KERNEL::NORM_SEG4:
+      {
+        lgth=(int)sizeof(LOC_SEG4)/sizeof(double);
+        return LOC_SEG4;
+      }
+    case INTERP_KERNEL::NORM_TRI3:
+      {
+        lgth=(int)sizeof(LOC_TRI3)/sizeof(double);
+        return LOC_TRI3;
+      }
+    case INTERP_KERNEL::NORM_TRI6:
+      {
+        lgth=(int)sizeof(LOC_TRI6)/sizeof(double);
+        return LOC_TRI6;
+      }
+    case INTERP_KERNEL::NORM_TRI7:
+      {
+        lgth=(int)sizeof(LOC_TRI7)/sizeof(double);
+        return LOC_TRI7;
+      }
+    case INTERP_KERNEL::NORM_QUAD4:
+      {
+        lgth=(int)sizeof(LOC_QUAD4)/sizeof(double);
+        return LOC_QUAD4;
+      }
+    case INTERP_KERNEL::NORM_QUAD8:
+      {
+        lgth=(int)sizeof(LOC_QUAD8)/sizeof(double);
+        return LOC_QUAD8;
+      }
+    case INTERP_KERNEL::NORM_QUAD9:
+      {
+        lgth=(int)sizeof(LOC_QUAD9)/sizeof(double);
+        return LOC_QUAD9;
+      }
+    case INTERP_KERNEL::NORM_TETRA4:
+      {
+        lgth=(int)sizeof(LOC_TETRA4)/sizeof(double);
+        return LOC_TETRA4;
+      }
+    case INTERP_KERNEL::NORM_PENTA6:
+      {
+        lgth=(int)sizeof(LOC_PENTA6)/sizeof(double);
+        return LOC_PENTA6;
+      }
+    case INTERP_KERNEL::NORM_HEXA8:
+      {
+        lgth=(int)sizeof(LOC_HEXA8)/sizeof(double);
+        return LOC_HEXA8;
+      }
+    case INTERP_KERNEL::NORM_HEXA27:
+      {
+        lgth=(int)sizeof(LOC_HEXA27)/sizeof(double);
+        return LOC_HEXA27;
+      }
+    case INTERP_KERNEL::NORM_PYRA5:
+      {
+        lgth=(int)sizeof(LOC_PYRA5)/sizeof(double);
+        return LOC_PYRA5;
+      }
+    default:
+      throw INTERP_KERNEL::Exception("MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType : only SEG[2,3,4], TRI[3,6,7], QUAD[4,8,9], TETRA[4,10], PENTA[6,15], HEXA[8,20,27], PYRA[5,13] supported !");
+    }
+}
+
 void MEDCouplingFieldDiscretizationGaussNE::computeMeshRestrictionFromTupleIds(const MEDCouplingMesh *mesh, const int *tupleIdsBg, const int *tupleIdsEnd,
                                                                                DataArrayInt *&cellRestriction, DataArrayInt *&trueTupleRestriction) const throw(INTERP_KERNEL::Exception)
 {
index a6f895b893ee3ae419bc32179be4e10b57f00a53..599747830498abbe8ac2e0fcc9a9c84adcb99244 100644 (file)
@@ -49,7 +49,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void updateTime() const;
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
-    MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const char *repr);
+    MEDCOUPLING_EXPORT static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr);
     MEDCOUPLING_EXPORT virtual TypeOfField getEnum() const = 0;
     MEDCOUPLING_EXPORT virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const;
     MEDCOUPLING_EXPORT virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const = 0;
@@ -107,8 +107,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual ~MEDCouplingFieldDiscretization();
   protected:
     MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization();
-    MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const char *msg);
-    MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const char *msg);
+    MEDCOUPLING_EXPORT static void RenumberEntitiesFromO2NArr(double epsOnVals, const int *old2NewPtr, int newNbOfEntity, DataArrayDouble *arr, const std::string& msg);
+    MEDCOUPLING_EXPORT static void RenumberEntitiesFromN2OArr(const int *new2OldPtr, int new2OldSz, DataArrayDouble *arr, const std::string& msg);
   protected:
     double _precision;
     static const double DFLT_PRECISION;
@@ -329,6 +329,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
     MEDCOUPLING_EXPORT static const double *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth);
     MEDCOUPLING_EXPORT static const double *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth);
+    MEDCOUPLING_EXPORT static const double *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType, std::size_t& lgth);
   protected:
     MEDCOUPLING_EXPORT MEDCouplingFieldDiscretizationGaussNE(const MEDCouplingFieldDiscretizationGaussNE& other);
   public:
@@ -341,7 +342,7 @@ namespace ParaMEDMEM
     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_QUAD8[8];
     static const double FGP_QUAD9[9];
     static const double FGP_TETRA4[4];
     //static const double FGP_TETRA10[10];
@@ -369,6 +370,23 @@ namespace ParaMEDMEM
     static const double REF_HEXA27[81];
     static const double REF_PYRA5[15];
     static const double REF_PYRA13[39];
+    static const double LOC_SEG2[2];
+    static const double LOC_SEG3[3];
+    static const double LOC_SEG4[4];
+    static const double LOC_TRI3[6];
+    static const double LOC_TRI6[12];
+    static const double LOC_TRI7[14];
+    static const double LOC_QUAD4[8];
+    static const double LOC_QUAD8[16];
+    static const double LOC_QUAD9[18];
+    static const double LOC_TETRA4[12];
+    //static const double LOC_TETRA10[30];
+    static const double LOC_PENTA6[18];
+    //static const double LOC_PENTA15[45];
+    static const double LOC_HEXA8[24];
+    static const double LOC_HEXA27[81];
+    static const double LOC_PYRA5[15];
+    //static const double LOC_PYRA13[39];
   };
 
   class MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes
index 097e3a78884c98af707efae18ac9461bc6f3d217..1619b2984080a252944bc0a5be6a86ffff1131c0 100644 (file)
@@ -85,7 +85,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::New(const MEDCouplingFieldTempla
  * Sets a time \a unit of \a this field. For more info, see \ref MEDCouplingFirstSteps3.
  * \param [in] unit \a unit (string) in which time is measured.
  */
-void MEDCouplingFieldDouble::setTimeUnit(const char *unit)
+void MEDCouplingFieldDouble::setTimeUnit(const std::string& unit)
 {
   _time_discr->setTimeUnit(unit);
 }
@@ -94,7 +94,7 @@ void MEDCouplingFieldDouble::setTimeUnit(const char *unit)
  * Returns a time unit of \a this field.
  * \return a string describing units in which time is measured.
  */
-const char *MEDCouplingFieldDouble::getTimeUnit() const
+std::string MEDCouplingFieldDouble::getTimeUnit() const
 {
   return _time_discr->getTimeUnit();
 }
@@ -212,8 +212,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::buildNewTimeReprFromThis(TypeOfT
     disc=_type->clone();
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn());
   ret->setMesh(getMesh());
-  ret->setName(getName().c_str());
-  ret->setDescription(getDescription().c_str());
+  ret->setName(getName());
+  ret->setDescription(getDescription());
   return ret.retn();
 }
 
@@ -273,6 +273,48 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const
   return ret.retn();
 }
 
+/*!
+ * This method converts a field on cell (\a this) to a node field (returned field). The convertion is a \b non \b conservative remapping !
+ * This method is useful only for users that need a fast convertion from cell to node spatial discretization. The algorithm applied is simply to attach
+ * to each node the average of values on cell sharing this node. If \a this lies on a mesh having orphan nodes the values applied on them will be NaN (division by 0.).
+ *
+ * \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The
+ *         caller is to delete this field using decrRef() as it is no more needed. The returned field will share the same mesh object object than those in \a this.
+ * \throw If \a this spatial discretization is empty or not ON_CELLS.
+ * \throw If \a this is not coherent (see MEDCouplingFieldDouble::checkCoherency).
+ *
+ * \warning This method is a \b non \b conservative method of remapping from cell spatial discretization to node spatial discretization.
+ * If a conservative method of interpolation is required ParaMEDMEM::MEDCouplingRemapper class should be used instead with "P0P1" method.
+ */
+MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const
+{
+  checkCoherency();
+  TypeOfField tf(getTypeOfField());
+  if(tf!=ON_CELLS)
+    throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::cellToNodeDiscretization : this field is expected to be on ON_CELLS !");
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret(clone(false));
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretizationP1> nsp(new MEDCouplingFieldDiscretizationP1);
+  ret->setDiscretization(nsp);
+  const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkCoherency call
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rn(DataArrayInt::New()),rni(DataArrayInt::New());
+  m->getReverseNodalConnectivity(rn,rni);
+  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rni2(rni->deltaShiftIndex());
+  MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> rni3(rni2->convertToDblArr()); rni2=0;
+  std::vector<DataArrayDouble *> arrs(getArrays());
+  std::size_t sz(arrs.size());
+  std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
+  for(std::size_t j=0;j<sz;j++)
+    {
+      MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end()));
+      outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=0;
+      outArrsSafe[j]->divideEqual(rni3);
+      outArrsSafe[j]->copyStringInfoFrom(*arrs[j]);
+      outArrs[j]=outArrsSafe[j];
+    }
+  ret->setArrays(outArrs);
+  return ret.retn();
+}
+
 /*!
  * Copies tiny info (component names, name and description) from an \a other field to
  * \a this one.
@@ -408,7 +450,7 @@ std::string MEDCouplingFieldDouble::advancedRepr() const
   return ret.str();
 }
 
-void MEDCouplingFieldDouble::writeVTK(const char *fileName, bool isBinary) const
+void MEDCouplingFieldDouble::writeVTK(const std::string& fileName, bool isBinary) const
 {
   std::vector<const MEDCouplingFieldDouble *> fs(1,this);
   MEDCouplingFieldDouble::WriteVTK(fileName,fs,isBinary);
@@ -1471,7 +1513,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, FunctionToEvaluate f
  *  \ref cpp_mcfielddouble_fillFromAnalytic "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_fillFromAnalytic "Here is a Python example".
  */
-void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func)
 {
   if(!_mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic : no mesh defined !");
@@ -1486,7 +1528,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func)
  * The function is applied to coordinates of value location points. For example, if
  * \a this field is on cells, the function is applied to cell barycenters.<br>
  * This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) "fillFromAnalytic()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) "fillFromAnalytic()"
  * by the way how variable
  * names, used in the function, are associated with components of coordinates of field
  * location points; here, a variable name corresponding to a component is retrieved from
@@ -1518,7 +1560,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func)
  *  \ref cpp_mcfielddouble_fillFromAnalytic2 "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_fillFromAnalytic2 "Here is a Python example".
  */
-void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& func)
 {
   if(!_mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
@@ -1533,7 +1575,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func)
  * The function is applied to coordinates of value location points. For example, if
  * \a this field is on cells, the function is applied to cell barycenters.<br>
  * This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) "fillFromAnalytic()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) "fillFromAnalytic()"
  * by the way how variable
  * names, used in the function, are associated with components of coordinates of field
  * location points; here, a component index of a variable is defined by a
@@ -1565,7 +1607,7 @@ void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func)
  *  \ref cpp_mcfielddouble_fillFromAnalytic3 "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_fillFromAnalytic3 "Here is a Python example".
  */
-void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
 {
   if(!_mesh)
     throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
@@ -1642,7 +1684,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, double val)
  *  \ref cpp_mcfielddouble_applyFunc "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_applyFunc "Here is a Python example".
  */
-void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func)
 {
   _time_discr->applyFunc(nbOfComp,func);
 }
@@ -1654,7 +1696,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func)
  * For more info on supported expressions that can be used in the function, see \ref
  * MEDCouplingArrayApplyFuncExpr. <br>
  * This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) "applyFunc()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) "applyFunc()"
  * by the way how variable
  * names, used in the function, are associated with components of field values;
  * here, a variable name corresponding to a component is retrieved from
@@ -1680,7 +1722,7 @@ void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func)
  *  \ref cpp_mcfielddouble_applyFunc2 "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_applyFunc2 "Here is a Python example".
  */
-void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const std::string& func)
 {
   _time_discr->applyFunc2(nbOfComp,func);
 }
@@ -1689,7 +1731,7 @@ void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func)
  * Modifies values of \a this field by applying a function to each tuple of all
  * data arrays.
  * This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) "applyFunc()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) "applyFunc()"
  * by the way how variable
  * names, used in the function, are associated with components of field values;
  * here, a component index of a variable is defined by a
@@ -1717,7 +1759,7 @@ void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func)
  *  \ref cpp_mcfielddouble_applyFunc3 "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_applyFunc3 "Here is a Python example".
  */
-void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
 {
   _time_discr->applyFunc3(nbOfComp,varsOrder,func);
 }
@@ -1747,7 +1789,7 @@ void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::str
  *  \ref cpp_mcfielddouble_applyFunc_same_nb_comp "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_applyFunc_same_nb_comp "Here is a Python example".
  */
-void MEDCouplingFieldDouble::applyFunc(const char *func)
+void MEDCouplingFieldDouble::applyFunc(const std::string& func)
 {
   _time_discr->applyFunc(func);
 }
@@ -1757,7 +1799,7 @@ void MEDCouplingFieldDouble::applyFunc(const char *func)
  * The field will contain exactly the same number of components after the call.
  * Use is not warranted for the moment !
  */
-void MEDCouplingFieldDouble::applyFuncFast32(const char *func)
+void MEDCouplingFieldDouble::applyFuncFast32(const std::string& func)
 {
   _time_discr->applyFuncFast32(func);
 }
@@ -1767,7 +1809,7 @@ void MEDCouplingFieldDouble::applyFuncFast32(const char *func)
  * The field will contain exactly the same number of components after the call.
  * Use is not warranted for the moment !
  */
-void MEDCouplingFieldDouble::applyFuncFast64(const char *func)
+void MEDCouplingFieldDouble::applyFuncFast64(const std::string& func)
 {
   _time_discr->applyFuncFast64(func);
 }
@@ -1875,7 +1917,7 @@ void MEDCouplingFieldDouble::synchronizeTimeWithMesh()
   double val=_mesh->getTime(it,ordr);
   std::string timeUnit(_mesh->getTimeUnit());
   setTime(val,it,ordr);
-  setTimeUnit(timeUnit.c_str());
+  setTimeUnit(timeUnit);
 }
 
 /*!
@@ -2024,7 +2066,7 @@ void MEDCouplingFieldDouble::finishUnserialization(const std::vector<int>& tinyI
   int nbOfElemS=(int)tinyInfoS.size();
   _name=tinyInfoS[nbOfElemS-3];
   _desc=tinyInfoS[nbOfElemS-2];
-  setTimeUnit(tinyInfoS[nbOfElemS-1].c_str());
+  setTimeUnit(tinyInfoS[nbOfElemS-1]);
 }
 
 /*!
@@ -2556,7 +2598,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::maxPerTuple() const
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
   std::ostringstream oss;
   oss << "Max_" << getName();
-  ret->setName(oss.str().c_str());
+  ret->setName(oss.str());
   ret->setMesh(getMesh());
   return ret.retn();
 }
@@ -2595,7 +2637,7 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::keepSelectedComponents(const std
   MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds);
   td->copyTinyAttrFrom(*_time_discr);
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
-  ret->setName(getName().c_str());
+  ret->setName(getName());
   ret->setMesh(getMesh());
   return ret.retn();
 }
@@ -2656,8 +2698,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const MEDCouplingFie
   MEDCouplingTimeDiscretization *td=f1->_time_discr->aggregate(f2->_time_discr);
   td->copyTinyAttrFrom(*f1->_time_discr);
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
-  ret->setName(f1->getName().c_str());
-  ret->setDescription(f1->getDescription().c_str());
+  ret->setName(f1->getName());
+  ret->setDescription(f1->getDescription());
   if(m1)
     {
       MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=m1->mergeMyselfWith(m2);
@@ -2708,8 +2750,8 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::MergeFields(const std::vector<co
   MEDCouplingTimeDiscretization *td=tds[0]->aggregate(tds);
   td->copyTinyAttrFrom(*(a[0]->_time_discr));
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone());
-  ret->setName(a[0]->getName().c_str());
-  ret->setDescription(a[0]->getDescription().c_str());
+  ret->setName(a[0]->getName());
+  ret->setDescription(a[0]->getDescription());
   if(ms2[0])
     {
       MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=MEDCouplingUMesh::MergeUMeshes(ms2);
@@ -3137,7 +3179,7 @@ const MEDCouplingFieldDouble &MEDCouplingFieldDouble::operator^=(const MEDCoupli
  *  \ref cpp_mcfielddouble_WriteVTK "Here is a C++ example".<br>
  *  \ref  py_mcfielddouble_WriteVTK "Here is a Python example".
  */
-void MEDCouplingFieldDouble::WriteVTK(const char *fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary)
+void MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary)
 {
   if(fs.empty())
     return;
@@ -3167,9 +3209,9 @@ void MEDCouplingFieldDouble::WriteVTK(const char *fileName, const std::vector<co
         }
       TypeOfField typ=cur->getTypeOfField();
       if(typ==ON_CELLS)
-        cur->getArray()->writeVTK(coss,8,cur->getName().c_str(),byteArr);
+        cur->getArray()->writeVTK(coss,8,cur->getName(),byteArr);
       else if(typ==ON_NODES)
-        cur->getArray()->writeVTK(noss,8,cur->getName().c_str(),byteArr);
+        cur->getArray()->writeVTK(noss,8,cur->getName(),byteArr);
       else
         throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : only node and cell fields supported for the moment !");
     }
index b64819edca9f96b709938472c48a4e44d1b92f42..d4a088bc5f09cc89517402dea1abf0f71e655018 100644 (file)
@@ -35,15 +35,15 @@ namespace ParaMEDMEM
   public:
     MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
     MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
-    MEDCOUPLING_EXPORT void setTimeUnit(const char *unit);
-    MEDCOUPLING_EXPORT const char *getTimeUnit() const;
+    MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit);
+    MEDCOUPLING_EXPORT std::string getTimeUnit() const;
     MEDCOUPLING_EXPORT void synchronizeTimeWithSupport();
     MEDCOUPLING_EXPORT void copyTinyStringsFrom(const MEDCouplingField *other);
     MEDCOUPLING_EXPORT void copyTinyAttrFrom(const MEDCouplingFieldDouble *other);
     MEDCOUPLING_EXPORT void copyAllTinyAttrFrom(const MEDCouplingFieldDouble *other);
     MEDCOUPLING_EXPORT std::string simpleRepr() const;
     MEDCOUPLING_EXPORT std::string advancedRepr() const;
-    MEDCOUPLING_EXPORT void writeVTK(const char *fileName, bool isBinary=true) const;
+    MEDCOUPLING_EXPORT void writeVTK(const std::string& fileName, bool isBinary=true) const;
     MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const;
     MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
     MEDCOUPLING_EXPORT bool areCompatibleForMerge(const MEDCouplingField *other) const;
@@ -64,6 +64,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const;
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const;
+    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const;
     MEDCOUPLING_EXPORT TypeOfTimeDiscretization getTimeDiscretization() const;
     MEDCOUPLING_EXPORT void checkCoherency() const;
     MEDCOUPLING_EXPORT void setNature(NatureOfField nat);
@@ -116,17 +117,17 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void applyLin(double a, double b, int compoId);
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, FunctionToEvaluate func);
-    MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT void fillFromAnalytic2(int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
+    MEDCOUPLING_EXPORT void fillFromAnalytic(int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT void fillFromAnalytic2(int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
     MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, FunctionToEvaluate func);
     MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, double val);
-    MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT void applyFunc2(int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
-    MEDCOUPLING_EXPORT void applyFunc(const char *func);
-    MEDCOUPLING_EXPORT void applyFuncFast32(const char *func);
-    MEDCOUPLING_EXPORT void applyFuncFast64(const char *func);
+    MEDCOUPLING_EXPORT void applyFunc(int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT void applyFunc2(int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
+    MEDCOUPLING_EXPORT void applyFunc(const std::string& func);
+    MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func);
+    MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func);
     MEDCOUPLING_EXPORT int getNumberOfComponents() const;
     MEDCOUPLING_EXPORT int getNumberOfTuples() const;
     MEDCOUPLING_EXPORT int getNumberOfValues() const;
@@ -189,7 +190,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *operator^(const MEDCouplingFieldDouble& other) const throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT const MEDCouplingFieldDouble &operator^=(const MEDCouplingFieldDouble& other) throw(INTERP_KERNEL::Exception);
     MEDCOUPLING_EXPORT static MEDCouplingFieldDouble *PowFields(const MEDCouplingFieldDouble *f1, const MEDCouplingFieldDouble *f2);
-    MEDCOUPLING_EXPORT static void WriteVTK(const char *fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary=true);
+    MEDCOUPLING_EXPORT static void WriteVTK(const std::string& fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary=true);
   public:
     MEDCOUPLING_EXPORT const MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() const { return _time_discr; }
     MEDCOUPLING_EXPORT MEDCouplingTimeDiscretization *getTimeDiscretizationUnderGround() { return _time_discr; }
index ff071afa6900e094d3a01acf462312d08df7ede6..0d5d059a04685eb0884cd269f8348c7107558110 100644 (file)
@@ -130,7 +130,7 @@ std::vector<const BigMemoryObject *> DataArray::getDirectChildren() const
  * See \ref MEDCouplingArrayBasicsName "DataArrays infos" for more information.
  *  \param [in] name - new array name
  */
-void DataArray::setName(const char *name)
+void DataArray::setName(const std::string& name)
 {
   _name=name;
 }
@@ -164,7 +164,7 @@ void DataArray::copyPartOfStringInfoFrom(const DataArray& other, const std::vect
         throw INTERP_KERNEL::Exception(oss.str().c_str());
       }
   for(std::size_t i=0;i<newNbOfCompo;i++)
-    setInfoOnComponent((int)i,other.getInfoOnComponent(compoIds[i]).c_str());
+    setInfoOnComponent((int)i,other.getInfoOnComponent(compoIds[i]));
 }
 
 void DataArray::copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other)
@@ -180,7 +180,7 @@ void DataArray::copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, cons
         throw INTERP_KERNEL::Exception(oss.str().c_str());
       }
   for(std::size_t i=0;i<partOfCompoToSet;i++)
-    setInfoOnComponent(compoIds[i],other.getInfoOnComponent((int)i).c_str());
+    setInfoOnComponent(compoIds[i],other.getInfoOnComponent((int)i));
 }
 
 bool DataArray::areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const
@@ -231,7 +231,7 @@ void DataArray::reprWithoutNameStream(std::ostream& stream) const
   stream << "\n";
 }
 
-std::string DataArray::cppRepr(const char *varName) const
+std::string DataArray::cppRepr(const std::string& varName) const
 {
   std::ostringstream ret;
   reprCppStream(varName,ret);
@@ -478,7 +478,7 @@ DataArray *DataArray::Aggregate(const std::vector<const DataArray *>& arrs)
  *  \param [in] info - the string containing the information.
  *  \throw If \a i is not a valid component index.
  */
-void DataArray::setInfoOnComponent(int i, const char *info)
+void DataArray::setInfoOnComponent(int i, const std::string& info)
 {
   if(i<(int)_info_on_compo.size() && i>=0)
     _info_on_compo[i]=info;
@@ -516,7 +516,7 @@ void DataArray::setInfoAndChangeNbOfCompo(const std::vector<std::string>& info)
     _info_on_compo=info;
 }
 
-void DataArray::checkNbOfTuples(int nbOfTuples, const char *msg) const
+void DataArray::checkNbOfTuples(int nbOfTuples, const std::string& msg) const
 {
   if(getNumberOfTuples()!=nbOfTuples)
     {
@@ -525,7 +525,7 @@ void DataArray::checkNbOfTuples(int nbOfTuples, const char *msg) const
     }
 }
 
-void DataArray::checkNbOfComps(int nbOfCompo, const char *msg) const
+void DataArray::checkNbOfComps(int nbOfCompo, const std::string& msg) const
 {
   if(getNumberOfComponents()!=nbOfCompo)
     {
@@ -534,7 +534,7 @@ void DataArray::checkNbOfComps(int nbOfCompo, const char *msg) const
     }
 }
 
-void DataArray::checkNbOfElems(std::size_t nbOfElems, const char *msg) const
+void DataArray::checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const
 {
   if(getNbOfElems()!=nbOfElems)
     {
@@ -543,7 +543,7 @@ void DataArray::checkNbOfElems(std::size_t nbOfElems, const char *msg) const
     }
 }
 
-void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const
+void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const
 {
    if(getNumberOfTuples()!=other.getNumberOfTuples())
     {
@@ -557,7 +557,7 @@ void DataArray::checkNbOfTuplesAndComp(const DataArray& other, const char *msg)
     }
 }
 
-void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const
+void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const
 {
   checkNbOfTuples(nbOfTuples,msg);
   checkNbOfComps(nbOfCompo,msg);
@@ -566,7 +566,7 @@ void DataArray::checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char
 /*!
  * Simply this method checks that \b value is in [0,\b ref).
  */
-void DataArray::CheckValueInRange(int ref, int value, const char *msg)
+void DataArray::CheckValueInRange(int ref, int value, const std::string& msg)
 {
   if(value<0 || value>=ref)
     {
@@ -579,7 +579,7 @@ void DataArray::CheckValueInRange(int ref, int value, const char *msg)
  * This method checks that [\b start, \b end) is compliant with ref length \b value.
  * typicaly start in [0,\b value) and end in [0,\b value). If value==start and start==end, it is supported.
  */
-void DataArray::CheckValueInRangeEx(int value, int start, int end, const char *msg)
+void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::string& msg)
 {
   if(start<0 || start>=value)
     {
@@ -596,7 +596,7 @@ void DataArray::CheckValueInRangeEx(int value, int start, int end, const char *m
     }
 }
 
-void DataArray::CheckClosingParInRange(int ref, int value, const char *msg)
+void DataArray::CheckClosingParInRange(int ref, int value, const std::string& msg)
 {
   if(value<0 || value>ref)
     {
@@ -644,7 +644,7 @@ void DataArray::GetSlice(int start, int stop, int step, int sliceId, int nbOfSli
     stopSlice=stop;
 }
 
-int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg)
+int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg)
 {
   if(end<begin)
     {
@@ -661,7 +661,7 @@ int DataArray::GetNumberOfItemGivenBES(int begin, int end, int step, const char
   return (end-1-begin)/step+1;
 }
 
-int DataArray::GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg)
+int DataArray::GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg)
 {
   if(step==0)
     throw INTERP_KERNEL::Exception("DataArray::GetNumberOfItemGivenBES : step=0 is not allowed !");
@@ -1150,7 +1150,7 @@ std::string DataArrayDouble::reprZip() const
   return ret.str();
 }
 
-void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const char *nameInFile, DataArrayByte *byteArr) const
+void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const
 {
   static const char SPACE[4]={' ',' ',' ',' '};
   checkAllocated();
@@ -1204,7 +1204,7 @@ void DataArrayDouble::reprZipWithoutNameStream(std::ostream& stream) const
   _mem.reprZip(getNumberOfComponents(),stream);
 }
 
-void DataArrayDouble::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayDouble::reprCppStream(const std::string& varName, std::ostream& stream) const
 {
   int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
   const double *data=getConstPointer();
@@ -1783,10 +1783,10 @@ DataArrayDouble *DataArrayDouble::changeNbOfComponents(int newNbOfComp, double d
       for(;j<newNbOfComp;j++)
         nc[newNbOfComp*i+j]=dftValue;
     }
-  ret->setName(getName().c_str());
+  ret->setName(getName());
   for(int i=0;i<dim;i++)
-    ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
-  ret->setName(getName().c_str());
+    ret->setInfoOnComponent(i,getInfoOnComponent(i));
+  ret->setName(getName());
   return ret.retn();
 }
 
@@ -3536,7 +3536,7 @@ DataArrayDouble *DataArrayDouble::fromCylToCart() const
       w[1]=wIn[0]*sin(wIn[1]);
       w[2]=wIn[2];
     }
-  ret->setInfoOnComponent(2,getInfoOnComponent(2).c_str());
+  ret->setInfoOnComponent(2,getInfoOnComponent(2));
   return ret;
 }
 
@@ -4276,7 +4276,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, FunctionToEvaluate fun
  *  \throw If \a this is not allocated.
  *  \throw If computing \a func fails.
  */
-DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const std::string& func) const
 {
   checkAllocated();
   INTERP_KERNEL::ExprParser expr(func);
@@ -4330,7 +4330,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(int nbOfComp, const char *func) cons
  *  \throw If \a this is not allocated.
  *  \throw If computing \a func fails.
  */
-DataArrayDouble *DataArrayDouble::applyFunc(const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc(const std::string& func) const
 {
   checkAllocated();
   INTERP_KERNEL::ExprParser expr(func);
@@ -4376,7 +4376,7 @@ DataArrayDouble *DataArrayDouble::applyFunc(const char *func) const
  *  \throw If \a func contains vars that are not in \a this->getInfoOnComponent().
  *  \throw If computing \a func fails.
  */
-DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const std::string& func) const
 {
   checkAllocated();
   INTERP_KERNEL::ExprParser expr(func);
@@ -4432,7 +4432,7 @@ DataArrayDouble *DataArrayDouble::applyFunc2(int nbOfComp, const char *func) con
  *  \throw If \a func contains vars not in \a varsOrder.
  *  \throw If computing \a func fails.
  */
-DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const
+DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const
 {
   checkAllocated();
   INTERP_KERNEL::ExprParser expr(func);
@@ -4472,7 +4472,7 @@ DataArrayDouble *DataArrayDouble::applyFunc3(int nbOfComp, const std::vector<std
   return newArr;
 }
 
-void DataArrayDouble::applyFuncFast32(const char *func)
+void DataArrayDouble::applyFuncFast32(const std::string& func)
 {
   checkAllocated();
   INTERP_KERNEL::ExprParser expr(func);
@@ -4490,7 +4490,7 @@ void DataArrayDouble::applyFuncFast32(const char *func)
   declareAsNew();
 }
 
-void DataArrayDouble::applyFuncFast64(const char *func)
+void DataArrayDouble::applyFuncFast64(const std::string& func)
 {
   checkAllocated();
   INTERP_KERNEL::ExprParser expr(func);
@@ -4705,7 +4705,7 @@ DataArrayDouble *DataArrayDouble::Meld(const std::vector<const DataArrayDouble *
   int k=0;
   for(int i=0;i<(int)a.size();i++)
     for(int j=0;j<nbc[i];j++,k++)
-      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str());
+      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
   return ret;
 }
 
@@ -4749,8 +4749,8 @@ DataArrayDouble *DataArrayDouble::Dot(const DataArrayDouble *a1, const DataArray
         sum+=a1Ptr[i*nbOfComp+j]*a2Ptr[i*nbOfComp+j];
       retPtr[i]=sum;
     }
-  ret->setInfoOnComponent(0,a1->getInfoOnComponent(0).c_str());
-  ret->setName(a1->getName().c_str());
+  ret->setInfoOnComponent(0,a1->getInfoOnComponent(0));
+  ret->setName(a1->getName());
   return ret;
 }
 
@@ -5605,12 +5605,12 @@ bool DataArrayDouble::resizeForUnserialization(const std::vector<int>& tinyInfoI
  */
 void DataArrayDouble::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
 {
-  setName(tinyInfoS[0].c_str());
+  setName(tinyInfoS[0]);
   if(isAllocated())
     {
       int nbOfCompo=getNumberOfComponents();
       for(int i=0;i<nbOfCompo;i++)
-        setInfoOnComponent(i,tinyInfoS[i+1].c_str());
+        setInfoOnComponent(i,tinyInfoS[i+1]);
     }
 }
 
@@ -6028,7 +6028,7 @@ std::string DataArrayInt::reprZip() const
   return ret.str();
 }
 
-void DataArrayInt::writeVTK(std::ostream& ofs, int indent, const char *type, const char *nameInFile, DataArrayByte *byteArr) const
+void DataArrayInt::writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const
 {
   static const char SPACE[4]={' ',' ',' ',' '};
   checkAllocated();
@@ -6093,7 +6093,7 @@ void DataArrayInt::reprZipWithoutNameStream(std::ostream& stream) const
   _mem.reprZip(getNumberOfComponents(),stream);
 }
 
-void DataArrayInt::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayInt::reprCppStream(const std::string& varName, std::ostream& stream) const
 {
   int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
   const int *data=getConstPointer();
@@ -7568,10 +7568,10 @@ DataArrayInt *DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue)
       for(;j<newNbOfComp;j++)
         nc[newNbOfComp*i+j]=dftValue;
     }
-  ret->setName(getName().c_str());
+  ret->setName(getName());
   for(int i=0;i<dim;i++)
-    ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
-  ret->setName(getName().c_str());
+    ret->setInfoOnComponent(i,getInfoOnComponent(i));
+  ret->setName(getName());
   return ret.retn();
 }
 
@@ -9407,7 +9407,7 @@ DataArrayInt *DataArrayInt::Meld(const std::vector<const DataArrayInt *>& arr)
   int k=0;
   for(int i=0;i<(int)a.size();i++)
     for(int j=0;j<nbc[i];j++,k++)
-      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str());
+      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
   return ret;
 }
 
@@ -11192,12 +11192,12 @@ bool DataArrayInt::resizeForUnserialization(const std::vector<int>& tinyInfoI)
  */
 void DataArrayInt::finishUnserialization(const std::vector<int>& tinyInfoI, const std::vector<std::string>& tinyInfoS)
 {
-  setName(tinyInfoS[0].c_str());
+  setName(tinyInfoS[0]);
   if(isAllocated())
     {
       int nbOfCompo=tinyInfoI[1];
       for(int i=0;i<nbOfCompo;i++)
-        setInfoOnComponent(i,tinyInfoS[i+1].c_str());
+        setInfoOnComponent(i,tinyInfoS[i+1]);
     }
 }
 
index 3f6e38a893276ab311b8c314b1dfca25c12358bd..99895f1886d6cc92219393357c985ea428b37cfc 100644 (file)
@@ -117,13 +117,13 @@ namespace ParaMEDMEM
   public:
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
-    MEDCOUPLING_EXPORT void setName(const char *name);
+    MEDCOUPLING_EXPORT void setName(const std::string& name);
     MEDCOUPLING_EXPORT void copyStringInfoFrom(const DataArray& other);
     MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds);
     MEDCOUPLING_EXPORT void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other);
     MEDCOUPLING_EXPORT bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const;
     MEDCOUPLING_EXPORT bool areInfoEquals(const DataArray& other) const;
-    MEDCOUPLING_EXPORT std::string cppRepr(const char *varName) const;
+    MEDCOUPLING_EXPORT std::string cppRepr(const std::string& varName) const;
     MEDCOUPLING_EXPORT std::string getName() const { return _name; }
     MEDCOUPLING_EXPORT const std::vector<std::string> &getInfoOnComponents() const { return _info_on_compo; }
     MEDCOUPLING_EXPORT std::vector<std::string> &getInfoOnComponents() { return _info_on_compo; }
@@ -134,7 +134,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT std::string getInfoOnComponent(int i) const;
     MEDCOUPLING_EXPORT std::string getVarOnComponent(int i) const;
     MEDCOUPLING_EXPORT std::string getUnitOnComponent(int i) const;
-    MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const char *info);
+    MEDCOUPLING_EXPORT void setInfoOnComponent(int i, const std::string& info);
     MEDCOUPLING_EXPORT int getNumberOfComponents() const { return (int)_info_on_compo.size(); }
     MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true);
     MEDCOUPLING_EXPORT virtual DataArray *deepCpy() const = 0;
@@ -156,14 +156,14 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0;
     MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId2(int bg, int end2, int step) const = 0;
     MEDCOUPLING_EXPORT virtual void rearrange(int newNbOfCompo) = 0;
-    MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const char *msg) const;
-    MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const char *msg) const;
-    MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const;
-    MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const;
-    MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const char *msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfTuples(int nbOfTuples, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfComps(int nbOfCompo, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const;
+    MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const;
     MEDCOUPLING_EXPORT static void GetSlice(int start, int stop, int step, int sliceId, int nbOfSlices, int& startSlice, int& stopSlice);
-    MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg);
-    MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg);
+    MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg);
+    MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg);
     MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step);
     MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info);
     MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info);
@@ -172,16 +172,16 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual void reprZipStream(std::ostream& stream) const = 0;
     MEDCOUPLING_EXPORT virtual void reprWithoutNameStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT virtual void reprZipWithoutNameStream(std::ostream& stream) const = 0;
-    MEDCOUPLING_EXPORT virtual void reprCppStream(const char *varName, std::ostream& stream) const = 0;
+    MEDCOUPLING_EXPORT virtual void reprCppStream(const std::string& varName, std::ostream& stream) const = 0;
     MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
     MEDCOUPLING_EXPORT virtual void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const = 0;
   protected:
     DataArray() { }
     ~DataArray() { }
   protected:
-    static void CheckValueInRange(int ref, int value, const char *msg);
-    static void CheckValueInRangeEx(int value, int start, int end, const char *msg);
-    static void CheckClosingParInRange(int ref, int value, const char *msg);
+    static void CheckValueInRange(int ref, int value, const std::string& msg);
+    static void CheckValueInRangeEx(int value, int start, int end, const std::string& msg);
+    static void CheckClosingParInRange(int ref, int value, const std::string& msg);
   protected:
     std::string _name;
     std::vector<std::string> _info_on_compo;
@@ -227,12 +227,12 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const;
     MEDCOUPLING_EXPORT std::string repr() const;
     MEDCOUPLING_EXPORT std::string reprZip() const;
-    MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const char *nameInFile, DataArrayByte *byteArr) const;
+    MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const;
     MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
-    MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
     MEDCOUPLING_EXPORT bool isEqual(const DataArrayDouble& other, double prec) const;
@@ -340,12 +340,12 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void applyRPow(double val);
     MEDCOUPLING_EXPORT DataArrayDouble *negate() const;
     MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const;
-    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const char *func) const;
-    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const char *func) const;
-    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const;
-    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const;
-    MEDCOUPLING_EXPORT void applyFuncFast32(const char *func);
-    MEDCOUPLING_EXPORT void applyFuncFast64(const char *func);
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(int nbOfComp, const std::string& func) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc(const std::string& func) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func) const;
+    MEDCOUPLING_EXPORT DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
+    MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func);
+    MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func);
     MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(double vmin, double vmax) const;
     MEDCOUPLING_EXPORT DataArrayInt *getIdsNotInRange(double vmin, double vmax) const;
     MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2);
@@ -464,12 +464,12 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void iota(int init=0);
     MEDCOUPLING_EXPORT std::string repr() const;
     MEDCOUPLING_EXPORT std::string reprZip() const;
-    MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const char *type, const char *nameInFile, DataArrayByte *byteArr) const;
+    MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const;
     MEDCOUPLING_EXPORT void reprStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
-    MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
     MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd);
@@ -776,7 +776,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
-    MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
     MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
@@ -833,7 +833,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT void reprZipStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprWithoutNameStream(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprZipWithoutNameStream(std::ostream& stream) const;
-    MEDCOUPLING_EXPORT void reprCppStream(const char *varName, std::ostream& stream) const;
+    MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const;
     MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const;
     MEDCOUPLING_EXPORT bool isEqualIfNotWhy(const DataArrayChar& other, std::string& reason) const;
index 25aab4219c0340300d071994e2726014bb1af8a6..bd7cc6973ea1bd68bae499d5e32e6de0400be6d0 100644 (file)
@@ -714,10 +714,10 @@ DataArrayChar *DataArrayChar::changeNbOfComponents(int newNbOfComp, char dftValu
       for(;j<newNbOfComp;j++)
         nc[newNbOfComp*i+j]=dftValue;
     }
-  ret->setName(getName().c_str());
+  ret->setName(getName());
   for(int i=0;i<dim;i++)
-    ret->setInfoOnComponent(i,getInfoOnComponent(i).c_str());
-  ret->setName(getName().c_str());
+    ret->setInfoOnComponent(i,getInfoOnComponent(i));
+  ret->setName(getName());
   return ret.retn();
 }
 
@@ -1937,7 +1937,7 @@ DataArrayChar *DataArrayChar::Meld(const std::vector<const DataArrayChar *>& arr
   int k=0;
   for(int i=0;i<(int)a.size();i++)
     for(int j=0;j<nbc[i];j++,k++)
-      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j).c_str());
+      ret->setInfoOnComponent(k,a[i]->getInfoOnComponent(j));
   return ret;
 }
 
@@ -2070,7 +2070,7 @@ void DataArrayByte::reprZipWithoutNameStream(std::ostream& stream) const
   _mem.reprZip(getNumberOfComponents(),stream);
 }
 
-void DataArrayByte::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayByte::reprCppStream(const std::string& varName, std::ostream& stream) const
 {
   int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
   const char *data=getConstPointer();
@@ -2402,7 +2402,7 @@ void DataArrayAsciiChar::reprZipWithoutNameStream(std::ostream& stream) const
   reprWithoutNameStream(stream);
 }
 
-void DataArrayAsciiChar::reprCppStream(const char *varName, std::ostream& stream) const
+void DataArrayAsciiChar::reprCppStream(const std::string& varName, std::ostream& stream) const
 {
   int nbTuples=getNumberOfTuples(),nbComp=getNumberOfComponents();
   const char *data=getConstPointer();
index 4aae2aa584dbf839003236c034effd85c513489b..181288b4bf3190809ef665a52266f65c02a909b3 100644 (file)
@@ -374,7 +374,7 @@ void MEDCouplingMesh::copyTinyInfoFrom(const MEDCouplingMesh *other)
  *  \ref cpp_mcmesh_fillFromAnalytic "Here is a C++ example".<br>
  *  \ref  py_mcmesh_fillFromAnalytic "Here is a Python example".
  */
-MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const
+MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
   ret->setMesh(this);
@@ -389,7 +389,7 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbO
  * function to coordinates of field location points (defined by the given field type).
  * For example, if \a t == ParaMEDMEM::ON_CELLS, the function is applied to cell
  * barycenters. This method differs from
- * \ref MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const "fillFromAnalytic()"
+ * \ref MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const "fillFromAnalytic()"
  * by the way how variable
  * names, used in the function, are associated with components of coordinates of field
  * location points; here, a variable name corresponding to a component is retrieved from
@@ -424,7 +424,7 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic(TypeOfField t, int nbO
  *  \ref cpp_mcmesh_fillFromAnalytic2 "Here is a C++ example".<br>
  *  \ref  py_mcmesh_fillFromAnalytic2 "Here is a Python example".
  */
-MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const
+MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
   ret->setMesh(this);
@@ -475,7 +475,7 @@ MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic2(TypeOfField t, int nb
  *  \ref cpp_mcmesh_fillFromAnalytic3 "Here is a C++ example".<br>
  *  \ref  py_mcmesh_fillFromAnalytic3 "Here is a Python example".
  */
-MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const
+MEDCouplingFieldDouble *MEDCouplingMesh::fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=MEDCouplingFieldDouble::New(t,ONE_TIME);
   ret->setMesh(this);
@@ -682,7 +682,7 @@ void MEDCouplingMesh::getCellsContainingPoints(const double *pos, int nbOfPoints
  *  \param [in] fileName - the name of the file to write in.
  *  \throw If \a fileName is not a writable file.
  */
-void MEDCouplingMesh::writeVTK(const char *fileName, bool isBinary) const
+void MEDCouplingMesh::writeVTK(const std::string& fileName, bool isBinary) const
 {
   std::string cda,pda;
   MEDCouplingAutoRefCountObjectPtr<DataArrayByte> byteArr;
@@ -691,18 +691,18 @@ void MEDCouplingMesh::writeVTK(const char *fileName, bool isBinary) const
   writeVTKAdvanced(fileName,cda,pda,byteArr);
 }
 
-void MEDCouplingMesh::writeVTKAdvanced(const char *fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const
+void MEDCouplingMesh::writeVTKAdvanced(const std::string& fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const
 {
-  std::ofstream ofs(fileName);
+  std::ofstream ofs(fileName.c_str());
   ofs << "<VTKFile type=\""  << getVTKDataSetType() << "\" version=\"0.1\" byte_order=\"" << MEDCouplingByteOrderStr() << "\">\n";
   writeVTKLL(ofs,cda,pda,byteData);
   if(byteData)
     {
       ofs << "<AppendedData encoding=\"raw\">\n_1234";
       ofs << std::flush; ofs.close();
-      std::ofstream ofs2(fileName,std::ios_base::binary | std::ios_base::app);
+      std::ofstream ofs2(fileName.c_str(),std::ios_base::binary | std::ios_base::app);
       ofs2.write(byteData->begin(),byteData->getNbOfElems()); ofs2 << std::flush; ofs2.close();
-      std::ofstream ofs3(fileName,std::ios_base::app); ofs3 << "\n</AppendedData>\n</VTKFile>\n"; ofs3.close();
+      std::ofstream ofs3(fileName.c_str(),std::ios_base::app); ofs3 << "\n</AppendedData>\n</VTKFile>\n"; ofs3.close();
     }
   else
     {
index c8203c56b042d28aaf76396a0440cf5abf1f7d75..5c9e3355351b4e4cf7598148f094e12e0058ac18 100644 (file)
@@ -55,14 +55,14 @@ namespace ParaMEDMEM
   {
   public:
     MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
-    MEDCOUPLING_EXPORT void setName(const char *name) { _name=name; }
+    MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; }
     MEDCOUPLING_EXPORT std::string getName() const { return _name; }
-    MEDCOUPLING_EXPORT void setDescription(const char *descr) { _description=descr; }
+    MEDCOUPLING_EXPORT void setDescription(const std::string& descr) { _description=descr; }
     MEDCOUPLING_EXPORT std::string getDescription() const { return _description; }
     MEDCOUPLING_EXPORT double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _time; }
     MEDCOUPLING_EXPORT void setTime(double val, int iteration, int order) { _time=val; _iteration=iteration; _order=order; }
-    MEDCOUPLING_EXPORT void setTimeUnit(const char *unit) { _time_unit=unit; }
-    MEDCOUPLING_EXPORT const char *getTimeUnit() const { return _time_unit.c_str(); }
+    MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; }
+    MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; }
     MEDCOUPLING_EXPORT virtual MEDCouplingMesh *deepCpy() const = 0;
     MEDCOUPLING_EXPORT virtual MEDCouplingMeshType getType() const = 0;
     MEDCOUPLING_EXPORT bool isStructured() const;
@@ -113,9 +113,9 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
     MEDCOUPLING_EXPORT virtual void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& elts, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& eltsIndex) const;
     MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, FunctionToEvaluate func) const;
-    MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const;
-    MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const;
-    MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const;
+    MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const;
+    MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const;
+    MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const;
     MEDCOUPLING_EXPORT virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0;
     MEDCOUPLING_EXPORT virtual void rotate(const double *center, const double *vector, double angle) = 0;
     MEDCOUPLING_EXPORT virtual void translate(const double *vector) = 0;
@@ -128,6 +128,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const;
     MEDCOUPLING_EXPORT virtual MEDCouplingUMesh *buildUnstructured() const = 0;
     MEDCOUPLING_EXPORT virtual DataArrayInt *simplexize(int policy) = 0;
+    MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const = 0;
     MEDCOUPLING_EXPORT virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const;
     MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2);
     MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(std::vector<const MEDCouplingMesh *>& meshes);
@@ -143,9 +144,9 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const = 0;
     MEDCOUPLING_EXPORT virtual void unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
                                                     const std::vector<std::string>& littleStrings) = 0;
-    MEDCOUPLING_EXPORT void writeVTK(const char *fileName, bool isBinary=true) const;
+    MEDCOUPLING_EXPORT void writeVTK(const std::string& fileName, bool isBinary=true) const;
     /// @cond INTERNAL
-    MEDCOUPLING_EXPORT void writeVTKAdvanced(const char *fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const;
+    MEDCOUPLING_EXPORT void writeVTKAdvanced(const std::string& fileName, const std::string& cda, const std::string& pda, DataArrayByte *byteData) const;
     /// @endcond
     MEDCOUPLING_EXPORT virtual void writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const = 0;
     MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
index f8f15be3e1adf19351a6e2378210df42ac476c4a..5e903305843a6ebcde4ba0e71c1d119361dce73f 100644 (file)
@@ -910,19 +910,19 @@ void MEDCouplingPointSet::unserialization(const std::vector<double>& tinyInfoD,
   if(tinyInfo[2]>=0 && tinyInfo[1]>=1)
     {
       setCoords(a2);
-      setName(littleStrings[0].c_str());
-      setDescription(littleStrings[1].c_str());
-      a2->setName(littleStrings[2].c_str());
-      setTimeUnit(littleStrings[3].c_str());
+      setName(littleStrings[0]);
+      setDescription(littleStrings[1]);
+      a2->setName(littleStrings[2]);
+      setTimeUnit(littleStrings[3]);
       for(int i=0;i<tinyInfo[1];i++)
-        getCoords()->setInfoOnComponent(i,littleStrings[i+4].c_str());
+        getCoords()->setInfoOnComponent(i,littleStrings[i+4]);
       setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
     }
   else
     {
-      setName(littleStrings[0].c_str());
-      setDescription(littleStrings[1].c_str());
-      setTimeUnit(littleStrings[2].c_str());
+      setName(littleStrings[0]);
+      setDescription(littleStrings[1]);
+      setTimeUnit(littleStrings[2]);
       setTime(tinyInfoD[0],tinyInfo[3],tinyInfo[4]);
     }
 }
@@ -1537,7 +1537,7 @@ DataArrayInt *MEDCouplingPointSet::getCellIdsLyingOnNodes(const int *begin, cons
 {
   DataArrayInt *cellIdsKept=0;
   fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
-  cellIdsKept->setName(getName().c_str());
+  cellIdsKept->setName(getName());
   return cellIdsKept;
 }
 
index aa5622b19b926eddfab5bfe2de5c7727141b8580..f63360d3fa8bc04084892d6853c6da6f15d5b2db 100644 (file)
@@ -136,7 +136,6 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 0;
     MEDCOUPLING_EXPORT virtual DataArrayInt *zipCoordsTraducer();
     MEDCOUPLING_EXPORT virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0);
-    MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const = 0;
     //tools
   public:
     MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const;
index dd837acda957070eaf5bc73c5d1d0b7bd4912782..1c5e17a917958fe933db1eea4040d2759d160b58 100644 (file)
@@ -49,15 +49,15 @@ MEDCouplingRemapper::~MEDCouplingRemapper()
   releaseData(false);
 }
 
-int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method)
+int MEDCouplingRemapper::prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method)
 {
   if(!srcMesh || !targetMesh)
     throw INTERP_KERNEL::Exception("MEDCouplingRemapper::prepare : presence of NULL input pointer !");
   std::string srcMethod,targetMethod;
   INTERP_KERNEL::Interpolation<INTERP_KERNEL::Interpolation3D>::CheckAndSplitInterpolationMethod(method,srcMethod,targetMethod);
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod.c_str()));
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> src=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(srcMethod));
   src->setMesh(srcMesh);
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod.c_str()));
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldTemplate> target=MEDCouplingFieldTemplate::New(MEDCouplingFieldDiscretization::GetTypeOfFieldFromStringRepr(targetMethod));
   target->setMesh(targetMesh);
   return prepareEx(src,target);
 }
@@ -322,35 +322,35 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
       MEDCouplingNormalizedUnstructuredMesh<1,1> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<1,1> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation1D interpolation(*this);
-      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
     }
   else if(srcMeshDim==1 && trgMeshDim==1 && srcSpaceDim==2)
     {
       MEDCouplingNormalizedUnstructuredMesh<2,1> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<2,1> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation2DCurve interpolation(*this);
-      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
     }
   else if(srcMeshDim==2 && trgMeshDim==2 && srcSpaceDim==2)
     {
       MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation2D interpolation(*this);
-      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
     }
   else if(srcMeshDim==3 && trgMeshDim==3 && srcSpaceDim==3)
     {
       MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation3D interpolation(*this);
-      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
     }
   else if(srcMeshDim==2 && trgMeshDim==2 && srcSpaceDim==3)
     {
       MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<3,2> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
     }
   else if(srcMeshDim==3 && trgMeshDim==1 && srcSpaceDim==3)
     {
@@ -359,7 +359,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
       MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation3D interpolation(*this);
-      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
     }
   else if(srcMeshDim==1 && trgMeshDim==3 && srcSpaceDim==3)
     {
@@ -369,7 +369,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
       MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation3D interpolation(*this);
       std::vector<std::map<int,double> > matrixTmp;
-      nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str());
+      nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method);
       ReverseMatrix(matrixTmp,nbCols,_matrix);
       nbCols=matrixTmp.size();
     }
@@ -380,7 +380,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
           MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh);
           MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
           INTERP_KERNEL::Interpolation2D interpolation(*this);
-          nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+          nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
         }
       else
         {
@@ -388,7 +388,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
           MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
           INTERP_KERNEL::Interpolation2D1D interpolation(*this);
           std::vector<std::map<int,double> > matrixTmp;
-          nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str());
+          nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method);
           ReverseMatrix(matrixTmp,nbCols,_matrix);
           nbCols=matrixTmp.size();
           INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
@@ -412,7 +412,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
           MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
           INTERP_KERNEL::Interpolation2D interpolation(*this);
           std::vector<std::map<int,double> > matrixTmp;
-          nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str());
+          nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method);
           ReverseMatrix(matrixTmp,nbCols,_matrix);
           nbCols=matrixTmp.size();
         }
@@ -421,7 +421,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
           MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh);
           MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(target_mesh);
           INTERP_KERNEL::Interpolation2D1D interpolation(*this);
-          nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+          nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
           INTERP_KERNEL::Interpolation2D1D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
           if(!duplicateFaces.empty())
             {
@@ -440,7 +440,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
       MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation3D2D interpolation(*this);
-      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method.c_str());
+      nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
       INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
       if(!duplicateFaces.empty())
         {
@@ -459,7 +459,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
       MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
       INTERP_KERNEL::Interpolation3D2D interpolation(*this);
       std::vector<std::map<int,double> > matrixTmp;
-      nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method.c_str());
+      nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,method);
       ReverseMatrix(matrixTmp,nbCols,_matrix);
       nbCols=matrixTmp.size();
       INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
@@ -480,19 +480,19 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
         {
           MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(src_mesh);
           INTERP_KERNEL::Interpolation2D interpolation(*this);
-          nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth.c_str());
+          nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth);
         }
       else if(srcMeshDim==3 && srcSpaceDim==3)
         {
           MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
           INTERP_KERNEL::Interpolation3D interpolation(*this);
-          nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth.c_str());
+          nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth);
         }
       else if(srcMeshDim==2 && srcSpaceDim==3)
         {
           MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(src_mesh);
           INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-          nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth.c_str());
+          nbCols=interpolation.toIntegralUniform(source_mesh_wrapper,_matrix,srcMeth);
         }
       else
         throw INTERP_KERNEL::Exception("No interpolation available for the given mesh and space dimension of source mesh to -1D targetMesh");
@@ -503,19 +503,19 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
         {
           MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(target_mesh);
           INTERP_KERNEL::Interpolation2D interpolation(*this);
-          nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth.c_str());
+          nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth);
         }
       else if(trgMeshDim==3 && trgSpaceDim==3)
         {
           MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(target_mesh);
           INTERP_KERNEL::Interpolation3D interpolation(*this);
-          nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth.c_str());
+          nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth);
         }
       else if(trgMeshDim==2 && trgSpaceDim==3)
         {
           MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(target_mesh);
           INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-          nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth.c_str());
+          nbCols=interpolation.fromIntegralUniform(source_mesh_wrapper,_matrix,trgMeth);
         }
       else
         throw INTERP_KERNEL::Exception("No interpolation available for the given mesh and space dimension of source mesh from -1D sourceMesh");
@@ -542,7 +542,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE()
   MEDCouplingNormalizedUnstructuredMesh<3,2> target_mesh_wrapper(target_mesh->getMesh2D());
   INTERP_KERNEL::Interpolation3DSurf interpolation2D(*this);
   std::vector<std::map<int,double> > matrix2D;
-  int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC.c_str());
+  int nbCols2D=interpolation2D.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,matrix2D,methC);
   MEDCouplingUMesh *s1D,*t1D;
   double v[3];
   MEDCouplingExtrudedMesh::Project1DMeshes(src_mesh->getMesh1D(),target_mesh->getMesh1D(),getPrecision(),s1D,t1D,v);
@@ -550,7 +550,7 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyEE()
   MEDCouplingNormalizedUnstructuredMesh<1,1> t1DWrapper(t1D);
   std::vector<std::map<int,double> > matrix1D;
   INTERP_KERNEL::Interpolation1D interpolation1D(*this);
-  int nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC.c_str());
+  int nbCols1D=interpolation1D.interpolateMeshes(s1DWrapper,t1DWrapper,matrix1D,methC);
   s1D->decrRef();
   t1D->decrRef();
   buildFinalInterpolationMatrixByConvolution(matrix1D,matrix2D,src_mesh->getMesh3DIds()->getConstPointer(),nbCols2D,nbCols1D,
@@ -810,7 +810,7 @@ bool MEDCouplingRemapper::isInterpKernelOnlyOrNotOnly() const
         try
           {
             std::string tmp1,tmp2;
-            INTERP_KERNEL::Interpolation<INTERP_KERNEL::Interpolation3D>::CheckAndSplitInterpolationMethod(method.c_str(),tmp1,tmp2);
+            INTERP_KERNEL::Interpolation<INTERP_KERNEL::Interpolation3D>::CheckAndSplitInterpolationMethod(method,tmp1,tmp2);
             return true;
           }
         catch(INTERP_KERNEL::Exception& /*e*/)
index 36cb6236990071dcb1aa33dfcb38aee847f4c232..2904d5d9ae20ee374d9c2f49681300f59093b630 100644 (file)
@@ -54,7 +54,7 @@ namespace ParaMEDMEM
   public:
     MEDCOUPLINGREMAPPER_EXPORT MEDCouplingRemapper();
     MEDCOUPLINGREMAPPER_EXPORT ~MEDCouplingRemapper();
-    MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method);
+    MEDCOUPLINGREMAPPER_EXPORT int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method);
     MEDCOUPLINGREMAPPER_EXPORT int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target);
     MEDCOUPLINGREMAPPER_EXPORT void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue);
     MEDCOUPLINGREMAPPER_EXPORT void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField);
index 011c49dea6103bec790e257a6d0a3930a57ec25e..20982788adddaabd6972ca53d2ba323e4a6fa468 100644 (file)
@@ -70,6 +70,8 @@ INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::GetGeoTypeGivenMesh
       return INTERP_KERNEL::NORM_QUAD4;
     case 1:
       return INTERP_KERNEL::NORM_SEG2;
+    case 0:
+      return INTERP_KERNEL::NORM_POINT1;
     default:
       throw INTERP_KERNEL::Exception("Unexpected dimension for MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension !");
     }
@@ -283,7 +285,7 @@ MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const
   int ns[3];
   getNodeGridStructure(ns);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(Build1GTNodalConnectivity(ns,ns+meshDim));
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName().c_str(),GetGeoTypeGivenMeshDimension(meshDim)));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim)));
   ret->setNodalConnectivity(conn); ret->setCoords(coords);
   return ret.retn();
 }
@@ -375,6 +377,161 @@ MEDCouplingFieldDouble *MEDCouplingStructuredMesh::buildOrthogonalField() const
   return ret;
 }
 
+void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const
+{
+  std::vector<int> ngs(getNodeGridStructure());
+  int dim(getSpaceDimension());
+  switch(dim)
+  {
+    case 1:
+      return GetReverseNodalConnectivity1(ngs,revNodal,revNodalIndx);
+    case 2:
+      return GetReverseNodalConnectivity2(ngs,revNodal,revNodalIndx);
+    case 3:
+      return GetReverseNodalConnectivity3(ngs,revNodal,revNodalIndx);
+    default:
+      throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::getReverseNodalConnectivity : only dimensions 1, 2 and 3 are supported !");
+  }
+}
+
+void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx)
+{
+  int nbNodes(ngs[0]);
+  revNodalIndx->alloc(nbNodes+1,1);
+  if(nbNodes==0)
+    { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
+  if(nbNodes==1)
+    { revNodal->alloc(1,1); revNodal->setIJ(0,0,0); revNodalIndx->setIJ(0,0,0); revNodalIndx->setIJ(1,0,1); return ; }
+  revNodal->alloc(2*(nbNodes-1),1);
+  int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
+  *rni++=0; *rni=1; *rn++=0;
+  for(int i=1;i<nbNodes-1;i++,rni++)
+    {
+      rn[0]=i-1; rn[1]=i;
+      rni[1]=rni[0]+2;
+      rn+=2;
+    }
+  rn[0]=nbNodes-2; rni[1]=rni[0]+1;
+}
+
+void MEDCouplingStructuredMesh::GetReverseNodalConnectivity2(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx)
+{
+  int nbNodesX(ngs[0]),nbNodesY(ngs[1]);
+  int nbNodes(nbNodesX*nbNodesY);
+  if(nbNodesX==0 || nbNodesY==0)
+    { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
+  if(nbNodesX==1 || nbNodesY==1)
+    { std::vector<int> ngs2(1); ngs2[0]=std::max(nbNodesX,nbNodesY); return GetReverseNodalConnectivity1(ngs2,revNodal,revNodalIndx); }
+  revNodalIndx->alloc(nbNodes+1,1);
+  int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1);
+  revNodal->alloc(4*(nbNodesX-2)*(nbNodesY-2)+2*2*(nbNodesX-2)+2*2*(nbNodesY-2)+4,1);
+  int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
+  *rni++=0; *rni=1; *rn++=0;
+  for(int i=1;i<nbNodesX-1;i++,rni++,rn+=2)
+    {
+      rn[0]=i-1; rn[1]=i;
+      rni[1]=rni[0]+2;
+    }
+  rni[1]=rni[0]+1; *rn++=nbCellsX-1;
+  rni++;
+  for(int j=1;j<nbNodesY-1;j++)
+    {
+      int off(nbCellsX*(j-1)),off2(nbCellsX*j);
+      rni[1]=rni[0]+2; rn[0]=off; rn[1]=off2;
+      rni++; rn+=2;
+      for(int i=1;i<nbNodesX-1;i++,rni++,rn+=4)
+        {
+          rn[0]=i-1+off; rn[1]=i+off; rn[2]=i-1+off2; rn[3]=i+off2;
+          rni[1]=rni[0]+4;
+        }
+      rni[1]=rni[0]+2; rn[0]=off+nbCellsX-1; rn[1]=off2+nbCellsX-1;
+      rni++; rn+=2;
+    }
+  int off3(nbCellsX*(nbCellsY-1));
+  rni[1]=rni[0]+1;
+  rni++; *rn++=off3;
+  for(int i=1;i<nbNodesX-1;i++,rni++,rn+=2)
+    {
+      rn[0]=i-1+off3; rn[1]=i+off3;
+      rni[1]=rni[0]+2;
+    }
+  rni[1]=rni[0]+1; rn[0]=nbCellsX*nbCellsY-1;
+}
+
+void MEDCouplingStructuredMesh::GetReverseNodalConnectivity3(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx)
+{
+  int nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]);
+  int nbNodes(nbNodesX*nbNodesY*nbNodesZ);
+  if(nbNodesX==0 || nbNodesY==0 || nbNodesZ==0)
+    { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; }
+  if(nbNodesX==1 || nbNodesY==1 || nbNodesZ==1)
+    {
+      std::vector<int> ngs2(2);
+      int pos(0);
+      bool pass(false);
+      for(int i=0;i<3;i++)
+        {
+          if(pass)
+            { ngs2[pos++]=ngs[i]; }
+          else
+            {
+              pass=ngs[i]==1;
+              if(!pass)
+                { ngs2[pos++]=ngs[i]; }
+            }
+        }
+      return GetReverseNodalConnectivity2(ngs2,revNodal,revNodalIndx);
+    }
+  revNodalIndx->alloc(nbNodes+1,1);
+  int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1),nbCellsZ(nbNodesZ-1);
+  revNodal->alloc(8*(nbNodesX-2)*(nbNodesY-2)*(nbNodesZ-2)+4*(2*(nbNodesX-2)*(nbNodesY-2)+2*(nbNodesX-2)*(nbNodesZ-2)+2*(nbNodesY-2)*(nbNodesZ-2))+2*4*(nbNodesX-2)+2*4*(nbNodesY-2)+2*4*(nbNodesZ-2)+8,1);
+  int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer());
+  *rni=0;
+  for(int k=0;k<nbNodesZ;k++)
+    {
+      bool factZ(k!=0 && k!=nbNodesZ-1);
+      int offZ0((k-1)*nbCellsX*nbCellsY),offZ1(k*nbCellsX*nbCellsY);
+      for(int j=0;j<nbNodesY;j++)
+        {
+          bool factYZ(factZ && (j!=0 && j!=nbNodesY-1));
+          int off00((j-1)*nbCellsX+offZ0),off01(j*nbCellsX+offZ0),off10((j-1)*nbCellsX+offZ1),off11(j*nbCellsX+offZ1);
+          for(int i=0;i<nbNodesX;i++,rni++)
+            {
+              int fact(factYZ && (i!=0 && i!=nbNodesX-1));
+              if(fact)
+                {//most of points fall in this part of code
+                  rn[0]=off00+i-1; rn[1]=off00+i; rn[2]=off01+i-1; rn[3]=off01+i;
+                  rn[4]=off10+i-1; rn[5]=off10+i; rn[6]=off11+i-1; rn[7]=off11+i;
+                  rni[1]=rni[0]+8;
+                  rn+=8;
+                }
+              else
+                {
+                  int *rnRef(rn);
+                  if(k>=1 && j>=1 && i>=1)
+                    *rn++=off00+i-1;
+                  if(k>=1 && j>=1 && i<nbCellsX)
+                    *rn++=off00+i;
+                  if(k>=1 && j<nbCellsY && i>=1)
+                    *rn++=off01+i-1;
+                  if(k>=1 && j<nbCellsY && i<nbCellsX)
+                    *rn++=off01+i;
+                  //
+                  if(k<nbCellsZ && j>=1 && i>=1)
+                    *rn++=off10+i-1;
+                  if(k<nbCellsZ && j>=1 && i<nbCellsX)
+                    *rn++=off10+i;
+                  if(k<nbCellsZ && j<nbCellsY && i>=1)
+                    *rn++=off11+i-1;
+                  if(k<nbCellsZ && j<nbCellsY && i<nbCellsX)
+                    *rn++=off11+i;
+                  rni[1]=rni[0]+(int)(std::distance(rnRef,rn));
+                }
+            }
+        }
+    }
+}
+
 /*!
  * \return DataArrayInt * - newly allocated instance of nodal connectivity compatible for MEDCoupling1SGTMesh instance
  */
@@ -383,6 +540,12 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *no
   std::size_t dim=std::distance(nodeStBg,nodeStEnd);
   switch(dim)
     {
+    case 0:
+      {
+        MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
+        conn->alloc(1,1); conn->setIJ(0,0,0);
+        return conn.retn();
+      }
     case 1:
       return Build1GTNodalConnectivity1D(nodeStBg);
     case 2:
@@ -390,7 +553,7 @@ DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *no
     case 3:
       return Build1GTNodalConnectivity3D(nodeStBg);
     default:
-      throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::Build1GTNodalConnectivity : only dimension in [1,2,3] supported !");
+      throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::Build1GTNodalConnectivity : only dimension in [0,1,2,3] supported !");
     }
 }
 
@@ -465,7 +628,7 @@ int MEDCouplingStructuredMesh::getCellIdFromPos(int i, int j, int k) const
 {
   int tmp[3]={i,j,k};
   int tmp2[3];
-  int meshDim=getMeshDimension();
+  int meshDim(getMeshDimension());
   getSplitCellValues(tmp2);
   std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies<int>());
   return std::accumulate(tmp,tmp+meshDim,0);
@@ -482,10 +645,10 @@ int MEDCouplingStructuredMesh::getNodeIdFromPos(int i, int j, int k) const
 {
   int tmp[3]={i,j,k};
   int tmp2[3];
-  int meshDim=getMeshDimension();
+  int spaceDim(getSpaceDimension());
   getSplitNodeValues(tmp2);
-  std::transform(tmp,tmp+meshDim,tmp2,tmp,std::multiplies<int>());
-  return std::accumulate(tmp,tmp+meshDim,0);
+  std::transform(tmp,tmp+spaceDim,tmp2,tmp,std::multiplies<int>());
+  return std::accumulate(tmp,tmp+spaceDim,0);
 }
 
 void MEDCouplingStructuredMesh::GetPosFromId(int nodeId, int meshDim, const int *split, int *res)
index e17412345ec7dd9437e6df22cb2befedcad41cd8..70c12d7b9d0fb181c90623ccc4538b2a835b74d7 100644 (file)
@@ -54,6 +54,7 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT MEDCouplingMesh *buildPartAndReduceNodes(const int *start, const int *end, DataArrayInt*& arr) const;
     MEDCOUPLING_EXPORT DataArrayInt *simplexize(int policy);
     MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildOrthogonalField() const;
+    MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const;
     //some useful methods
     MEDCOUPLING_EXPORT int getCellIdFromPos(int i, int j, int k) const;
     MEDCOUPLING_EXPORT int getNodeIdFromPos(int i, int j, int k) const;
@@ -67,6 +68,9 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT static DataArrayInt *BuildExplicitIdsFrom(const std::vector<int>& st, const std::vector< std::pair<int,int> >& partCompactFormat);
     MEDCOUPLING_EXPORT static DataArrayInt *Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd);
   private:
+    static void GetReverseNodalConnectivity1(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx);
+    static void GetReverseNodalConnectivity2(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx);
+    static void GetReverseNodalConnectivity3(const std::vector<int>& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx);
     static DataArrayInt *Build1GTNodalConnectivity1D(const int *nodeStBg);
     static DataArrayInt *Build1GTNodalConnectivity2D(const int *nodeStBg);
     static DataArrayInt *Build1GTNodalConnectivity3D(const int *nodeStBg);
index f0900c107911a1e8948d49a264f2ee1e78677204..3ed4634bb1fc31befd30974e8bd4aa6d04a5e391 100644 (file)
@@ -264,7 +264,7 @@ void MEDCouplingTimeDiscretization::finishUnserialization(const std::vector<int>
   _time_tolerance=tinyInfoD[0];
   int nbOfCompo=_array->getNumberOfComponents();
   for(int i=0;i<nbOfCompo;i++)
-    _array->setInfoOnComponent(i,tinyInfoS[i].c_str());
+    _array->setInfoOnComponent(i,tinyInfoS[i]);
 }
 
 void MEDCouplingTimeDiscretization::getTinySerializationDbleInformation(std::vector<double>& tinyInfo) const
@@ -715,7 +715,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, FunctionToEvaluate f
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -733,7 +733,7 @@ void MEDCouplingTimeDiscretization::applyFunc(int nbOfComp, const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -751,7 +751,7 @@ void MEDCouplingTimeDiscretization::applyFunc2(int nbOfComp, const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -769,7 +769,7 @@ void MEDCouplingTimeDiscretization::applyFunc3(int nbOfComp, const std::vector<s
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFunc(const char *func)
+void MEDCouplingTimeDiscretization::applyFunc(const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -787,7 +787,7 @@ void MEDCouplingTimeDiscretization::applyFunc(const char *func)
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
+void MEDCouplingTimeDiscretization::applyFuncFast32(const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -798,7 +798,7 @@ void MEDCouplingTimeDiscretization::applyFuncFast32(const char *func)
     }
 }
 
-void MEDCouplingTimeDiscretization::applyFuncFast64(const char *func)
+void MEDCouplingTimeDiscretization::applyFuncFast64(const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -822,7 +822,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc,
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -835,7 +835,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic(const DataArrayDouble *loc,
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func)
+void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
@@ -848,7 +848,7 @@ void MEDCouplingTimeDiscretization::fillFromAnalytic2(const DataArrayDouble *loc
   setArrays(arrays3,0);
 }
 
-void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingTimeDiscretization::fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
 {
   std::vector<DataArrayDouble *> arrays;
   getArrays(arrays);
index 263539b0f853f684839ac4d7d458662cfcbf3b9c..ca9e5da63eca61b6a4c1726df13e674505848f5d 100644 (file)
@@ -44,8 +44,8 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDCOUPLING_EXPORT virtual std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDCOUPLING_EXPORT static MEDCouplingTimeDiscretization *New(TypeOfTimeDiscretization type);
-    MEDCOUPLING_EXPORT void setTimeUnit(const char *unit) { _time_unit=unit; }
-    MEDCOUPLING_EXPORT const char *getTimeUnit() const { return _time_unit.c_str(); }
+    MEDCOUPLING_EXPORT void setTimeUnit(const std::string& unit) { _time_unit=unit; }
+    MEDCOUPLING_EXPORT std::string getTimeUnit() const { return _time_unit; }
     MEDCOUPLING_EXPORT virtual void copyTinyAttrFrom(const MEDCouplingTimeDiscretization& other);
     MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingTimeDiscretization& other);
     MEDCOUPLING_EXPORT virtual void checkCoherency() const;
@@ -139,16 +139,16 @@ namespace ParaMEDMEM
     MEDCOUPLING_EXPORT virtual void setOrCreateUniformValueOnAllComponents(int nbOfTuple, double value);
     MEDCOUPLING_EXPORT virtual void applyLin(double a, double b, int compoId);
     MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, FunctionToEvaluate func);
-    MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT virtual void applyFunc2(int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
-    MEDCOUPLING_EXPORT virtual void applyFunc(const char *func);
-    MEDCOUPLING_EXPORT virtual void applyFuncFast32(const char *func);
-    MEDCOUPLING_EXPORT virtual void applyFuncFast64(const char *func);
+    MEDCOUPLING_EXPORT virtual void applyFunc(int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT virtual void applyFunc2(int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT virtual void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
+    MEDCOUPLING_EXPORT virtual void applyFunc(const std::string& func);
+    MEDCOUPLING_EXPORT virtual void applyFuncFast32(const std::string& func);
+    MEDCOUPLING_EXPORT virtual void applyFuncFast64(const std::string& func);
     MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, FunctionToEvaluate func);
-    MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const char *func);
-    MEDCOUPLING_EXPORT virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func);
+    MEDCOUPLING_EXPORT virtual void fillFromAnalytic(const DataArrayDouble *loc, int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT virtual void fillFromAnalytic2(const DataArrayDouble *loc, int nbOfComp, const std::string& func);
+    MEDCOUPLING_EXPORT virtual void fillFromAnalytic3(const DataArrayDouble *loc, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func);
     //
     MEDCOUPLING_EXPORT virtual ~MEDCouplingTimeDiscretization();
   protected:
index d070522b48a43230530dc4f843c9ffd3ce5bd01f..29d78628ea0310f3194bc542901cb27752c8b830 100644 (file)
@@ -58,7 +58,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::New()
   return new MEDCouplingUMesh;
 }
 
-MEDCouplingUMesh *MEDCouplingUMesh::New(const char *meshName, int meshDim)
+MEDCouplingUMesh *MEDCouplingUMesh::New(const std::string& meshName, int meshDim)
 {
   MEDCouplingUMesh *ret=new MEDCouplingUMesh;
   ret->setName(meshName);
@@ -879,7 +879,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildDescendingConnectivityGen(DataArrayInt
   const int *conn=_nodal_connec->getConstPointer();
   const int *connIndex=_nodal_connec_index->getConstPointer();
   std::string name="Mesh constituent of "; name+=getName();
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(name.c_str(),getMeshDimension()-SonsGenerator::DELTA);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(name,getMeshDimension()-SonsGenerator::DELTA);
   ret->setCoords(getCoords());
   ret->allocateCells(2*nbOfCells);
   descIndx->alloc(nbOfCells+1,1);
@@ -1849,7 +1849,7 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com
     }
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=mesh->zipConnectivityTraducer(compType,nbOfCells);
   arr=o2n->substr(nbOfCells);
-  arr->setName(other->getName().c_str());
+  arr->setName(other->getName());
   int tmp;
   if(other->getNumberOfCells()==0)
     return true;
@@ -1893,7 +1893,7 @@ bool MEDCouplingUMesh::areCellsIncludedIn2(const MEDCouplingUMesh *other, DataAr
             }
         }
     }
-  arr2->setName(other->getName().c_str());
+  arr2->setName(other->getName());
   if(arr2->presenceOfValue(0))
     return false;
   arr=arr2.retn();
@@ -2863,7 +2863,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSetInstanceFromThis(int spaceDim) const
   int mdim=getMeshDimension();
   if(mdim<0)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSetInstanceFromThis : invalid mesh dimension ! Should be >= 0 !");
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName().c_str(),mdim);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp1,tmp2;
   bool needToCpyCT=true;
   if(!_nodal_connec)
@@ -3251,7 +3251,7 @@ MEDCouplingFieldDouble *MEDCouplingUMesh::getMeasureField(bool isAbs) const
   name+=getName();
   int nbelem=getNumberOfCells();
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
-  field->setName(name.c_str());
+  field->setName(name);
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
   array->alloc(nbelem,1);
   double *area_vol=array->getPointer();
@@ -3306,7 +3306,7 @@ DataArrayDouble *MEDCouplingUMesh::getPartMeasureField(bool isAbs, const int *be
   name+=getName();
   int nbelem=(int)std::distance(begin,end);
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> array=DataArrayDouble::New();
-  array->setName(name.c_str());
+  array->setName(name);
   array->alloc(nbelem,1);
   double *area_vol=array->getPointer();
   if(getMeshDimension()!=-1)
@@ -4103,6 +4103,7 @@ namespace ParaMEDMEM
           INTERP_KERNEL::EdgeLin *e1=new INTERP_KERNEL::EdgeLin(mapp2[bg[0]].first,mapp2[bg[2]].first);
           INTERP_KERNEL::EdgeLin *e2=new INTERP_KERNEL::EdgeLin(mapp2[bg[2]].first,mapp2[bg[1]].first);
           INTERP_KERNEL::SegSegIntersector inters(*e1,*e2);
+          // is the SEG3 degenerated, and thus can be reduced to a SEG2?
           bool colinearity=inters.areColinears();
           delete e1; delete e2;
           if(colinearity)
@@ -4119,11 +4120,14 @@ namespace ParaMEDMEM
   }
 
   /*!
-   * This method creates a sub mesh in Geometric2D DS. The sub mesh is composed be the sub set of cells in 'candidates' and the global mesh 'mDesc'.
-   * The input meth 'mDesc' must be so that mDim==1 et spaceDim==3.
-   * 'mapp' contains a mapping between local numbering in submesh and the global node numbering in 'mDesc'.
+   * This method creates a sub mesh in Geometric2D DS. The sub mesh is composed by the sub set of cells in 'candidates' taken from
+   * the global mesh 'mDesc'.
+   * The input mesh 'mDesc' must be so that mDim==1 and spaceDim==2.
+   * 'mapp' returns a mapping between local numbering in submesh (represented by a Node*) and the global node numbering in 'mDesc'.
    */
-  INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMesh(const MEDCouplingUMesh *mDesc, const std::vector<int>& candidates, std::map<INTERP_KERNEL::Node *,int>& mapp) throw(INTERP_KERNEL::Exception)
+  INTERP_KERNEL::QuadraticPolygon *MEDCouplingUMeshBuildQPFromMesh(const MEDCouplingUMesh *mDesc, const std::vector<int>& candidates,
+      std::map<INTERP_KERNEL::Node *,int>& mapp)
+      throw(INTERP_KERNEL::Exception)
   {
     mapp.clear();
     std::map<int, std::pair<INTERP_KERNEL::Node *,bool> > mapp2;//bool is for a flag specifying if node is boundary (true) or only a middle for SEG3.
@@ -4168,6 +4172,9 @@ namespace ParaMEDMEM
     return new INTERP_KERNEL::Node(coo1[2*nodeId],coo1[2*nodeId+1]);
   }
 
+  /**
+   * Construct a mapping between set of Nodes and the standart MEDCoupling connectivity format (c, cI).
+   */
   void MEDCouplingUMeshBuildQPFromMesh3(const double *coo1, int offset1, const double *coo2, int offset2, const std::vector<double>& addCoo,
                                         const int *desc1Bg, const int *desc1End, const std::vector<std::vector<int> >& intesctEdges1,
                                         /*output*/std::map<INTERP_KERNEL::Node *,int>& mapp, std::map<int,INTERP_KERNEL::Node *>& mappRev)
@@ -6906,7 +6913,7 @@ MEDCoupling1GTUMesh *MEDCouplingUMesh::convertIntoSingleGeoTypeMesh() const
     if(_types.size()!=1)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::convertIntoSingleGeoTypeMesh : current mesh does not contain exactly one geometric type !");
   INTERP_KERNEL::NormalizedCellType typ=*_types.begin();
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> ret=MEDCoupling1GTUMesh::New(getName().c_str(),typ);
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> ret=MEDCoupling1GTUMesh::New(getName(),typ);
   ret->setCoords(getCoords());
   MEDCoupling1SGTUMesh *retC=dynamic_cast<MEDCoupling1SGTUMesh *>((MEDCoupling1GTUMesh*)ret);
   if(retC)
@@ -7382,7 +7389,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::Build0DMeshFromCoords(DataArrayDouble *da)
   if(!da)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Build0DMeshFromCoords : instance of DataArrayDouble must be not null !");
   da->checkAllocated();
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(da->getName().c_str(),0);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(da->getName(),0);
   ret->setCoords(da);
   int nbOfTuples=da->getNumberOfTuples();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
@@ -7655,7 +7662,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::FuseUMeshesOnSameCoords(const std::vector<co
       tmp->alloc(curNbOfCells,1);
       std::copy(o2nPtr+offset,o2nPtr+offset+curNbOfCells,tmp->getPointer());
       offset+=curNbOfCells;
-      tmp->setName(meshes[i]->getName().c_str());
+      tmp->setName(meshes[i]->getName());
       corr[i]=tmp;
     }
   return ret.retn();
@@ -8383,7 +8390,10 @@ std::string MEDCouplingUMesh::getVTKDataSetType() const
 
 /*!
  * Partitions the first given 2D mesh using the second given 2D mesh as a tool, and
- * returns a result mesh constituted by polygons. The meshes should be in 2D space. In
+ * returns a result mesh constituted by polygons.
+ * Thus the final result contains all nodes from m1 plus new nodes. However it doesn't necessarily contains
+ * all nodes from m2.
+ * The meshes should be in 2D space. In
  * addition, returns two arrays mapping cells of the result mesh to cells of the input
  * meshes.
  *  \param [in] m1 - the first input mesh which is a partitioned object.
@@ -8404,31 +8414,40 @@ std::string MEDCouplingUMesh::getVTKDataSetType() const
  *  \throw If the nodal connectivity of cells is not defined in any of the meshes.
  *  \throw If any of the meshes is not a 2D mesh in 2D space.
  */
-MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps, DataArrayInt *&cellNb1, DataArrayInt *&cellNb2)
+MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2,
+                                                      double eps, DataArrayInt *&cellNb1, DataArrayInt *&cellNb2)
 {
   m1->checkFullyDefined();
   m2->checkFullyDefined();
   if(m1->getMeshDimension()!=2 || m1->getSpaceDimension()!=2 || m2->getMeshDimension()!=2 || m2->getSpaceDimension()!=2)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshes works on umeshes m1 AND m2  with meshdim equal to 2 and spaceDim equal to 2 too!");
+
+  // Step 1: compute all edge intersections (new nodes)
   std::vector< std::vector<int> > intersectEdge1, colinear2, subDiv2;
-  MEDCouplingUMesh *m1Desc=0,*m2Desc=0;
+  MEDCouplingUMesh *m1Desc=0,*m2Desc=0; // descending connec. meshes
   DataArrayInt *desc1=0,*descIndx1=0,*revDesc1=0,*revDescIndx1=0,*desc2=0,*descIndx2=0,*revDesc2=0,*revDescIndx2=0;
-  std::vector<double> addCoo,addCoordsQuadratic;
+  std::vector<double> addCoo,addCoordsQuadratic;  // coordinates of newly created nodes
   INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
   INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
-  IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,colinear2, subDiv2,m1Desc,desc1,descIndx1,revDesc1,revDescIndx1,
-                              m2Desc,desc2,descIndx2,revDesc2,revDescIndx2,addCoo);
+  IntersectDescending2DMeshes(m1,m2,eps,intersectEdge1,colinear2, subDiv2,
+                                      m1Desc,desc1,descIndx1,revDesc1,revDescIndx1,
+                              addCoo, m2Desc,desc2,descIndx2,revDesc2,revDescIndx2);
   revDesc1->decrRef(); revDescIndx1->decrRef(); revDesc2->decrRef(); revDescIndx2->decrRef();
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> dd1(desc1),dd2(descIndx1),dd3(desc2),dd4(descIndx2);
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> dd5(m1Desc),dd6(m2Desc);
+
+  // Step 2: re-order newly created nodes according to the ordering found in m2
   std::vector< std::vector<int> > intersectEdge2;
   BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2);
   subDiv2.clear(); dd5=0; dd6=0;
+
+  // Step 3:
   std::vector<int> cr,crI; //no DataArrayInt because interface with Geometric2D
   std::vector<int> cNb1,cNb2; //no DataArrayInt because interface with Geometric2D
   BuildIntersecting2DCellsFromEdges(eps,m1,desc1->getConstPointer(),descIndx1->getConstPointer(),intersectEdge1,colinear2,m2,desc2->getConstPointer(),descIndx2->getConstPointer(),intersectEdge2,addCoo,
                                     /* outputs -> */addCoordsQuadratic,cr,crI,cNb1,cNb2);
-  //
+
+  // Step 4: Prepare final result:
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> addCooDa=DataArrayDouble::New();
   addCooDa->alloc((int)(addCoo.size())/2,2);
   std::copy(addCoo.begin(),addCoo.end(),addCooDa->getPointer());
@@ -8449,6 +8468,15 @@ MEDCouplingUMesh *MEDCouplingUMesh::Intersect2DMeshes(const MEDCouplingUMesh *m1
   return ret.retn();
 }
 
+
+/**
+ * Private. Third step of the partitioning algorithm (Intersect2DMeshes): reconstruct full 2D cells from the
+ * (newly created) nodes corresponding to the edge intersections.
+ * Output params:
+ * @param[out] cr, crI connectivity of the resulting mesh
+ * @param[out] cNb1, cNb2 correspondance arrays giving for the merged mesh the initial cells IDs in m1 / m2
+ * TODO: describe input parameters
+ */
 void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1,
                                                          const std::vector<std::vector<int> >& intesctEdges1, const std::vector< std::vector<int> >& colinear2,
                                                          const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
@@ -8467,6 +8495,7 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo
   int offset3=offset2+((int)addCoords.size())/2;
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox1Arr(m1->getBoundingBoxForBBTree()),bbox2Arr(m2->getBoundingBoxForBBTree());
   const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
+  // Here a BBTree on 2D-cells, not on segments:
   BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2->getNumberOfCells(),eps);
   int ncell1=m1->getNumberOfCells();
   crI.push_back(0);
@@ -8479,7 +8508,9 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo
       INTERP_KERNEL::QuadraticPolygon pol1;
       INTERP_KERNEL::NormalizedCellType typ=(INTERP_KERNEL::NormalizedCellType)conn1[connI1[i]];
       const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(typ);
+      // Populate mapp and mappRev with nodes from the current cell (i) from mesh1 - this also builds the Node* objects:
       MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,/* output */mapp,mappRev);
+      // pol1 is the full cell from mesh2, in QP format, with all the additional intersecting nodes.
       pol1.buildFromCrudeDataArray(mappRev,cm.isQuadratic(),conn1+connI1[i]+1,coo1,
                                    desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1);
       //
@@ -8489,16 +8520,18 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo
       for(it1.first();!it1.finished();it1.next())
         edges1.insert(it1.current()->getPtr());
       //
-      std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> > edgesIn2ForShare;
+      std::map<int,std::vector<INTERP_KERNEL::ElementaryEdge *> > edgesIn2ForShare; // common edges
       std::vector<INTERP_KERNEL::QuadraticPolygon> pol2s(candidates2.size());
       int ii=0;
       for(std::vector<int>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)
         {
           INTERP_KERNEL::NormalizedCellType typ2=(INTERP_KERNEL::NormalizedCellType)conn2[connI2[*it2]];
           const INTERP_KERNEL::CellModel& cm2=INTERP_KERNEL::CellModel::GetCellModel(typ2);
+          // Complete mapping with elements coming from the current cell it2 in mesh2:
           MEDCouplingUMeshBuildQPFromMesh3(coo1,offset1,coo2,offset2,addCoords,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,/* output */mapp,mappRev);
+          // pol2 is the new QP in the final merged result.
           pol2s[ii].buildFromCrudeDataArray2(mappRev,cm2.isQuadratic(),conn2+connI2[*it2]+1,coo2,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,
-                                             pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2,edgesIn2ForShare);
+                                             pol1,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,colinear2, /* output */ edgesIn2ForShare);
         }
       ii=0;
       for(std::vector<int>::const_iterator it2=candidates2.begin();it2!=candidates2.end();it2++,ii++)
@@ -8508,6 +8541,8 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo
           //MEDCouplingUMeshAssignOnLoc(pol1,pol2,desc1+descIndx1[i],desc1+descIndx1[i+1],intesctEdges1,desc2+descIndx2[*it2],desc2+descIndx2[*it2+1],intesctEdges2,colinear2);
           pol1.buildPartitionsAbs(pol2s[ii],edges1,edgesBoundary2,mapp,i,*it2,offset3,addCoordsQuadratic,cr,crI,cNb1,cNb2);
         }
+      // Deals with remaining (non-consumed) edges from m1: these are the edges that were never touched
+      // by m2 but that we still want to keep in the final result.
       if(!edges1.empty())
         {
           try
@@ -8527,15 +8562,19 @@ void MEDCouplingUMesh::BuildIntersecting2DCellsFromEdges(double eps, const MEDCo
 
 /*!
  * This method is private and is the first step of Partition of 2D mesh (spaceDim==2 and meshDim==2).
- * 
+ * It builds the descending connectivity of the two meshes, and then using a binary tree
+ * it computes the edge intersections. This results in new points being created : they're stored in addCoo.
+ * Documentation about parameters  colinear2 and subDiv2 can be found in method QuadraticPolygon::splitAbs().
  */
 void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps,
                                                    std::vector< std::vector<int> >& intersectEdge1, std::vector< std::vector<int> >& colinear2, std::vector< std::vector<int> >& subDiv2,
                                                    MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1,
-                                                   MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2,
-                                                   std::vector<double>& addCoo) throw(INTERP_KERNEL::Exception)
+                                                   std::vector<double>& addCoo,
+                                                   MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2)
+                                                   throw(INTERP_KERNEL::Exception)
 {
   static const int SPACEDIM=2;
+  // Build desc connectivity
   desc1=DataArrayInt::New(); descIndx1=DataArrayInt::New(); revDesc1=DataArrayInt::New(); revDescIndx1=DataArrayInt::New();
   desc2=DataArrayInt::New();
   descIndx2=DataArrayInt::New();
@@ -8548,29 +8587,33 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> dd9(m1Desc),dd10(m2Desc);
   const int *c1=m1Desc->getNodalConnectivity()->getConstPointer();
   const int *ci1=m1Desc->getNodalConnectivityIndex()->getConstPointer();
+
+  // Build BB tree of all edges in the tool mesh (second mesh)
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> bbox1Arr(m1Desc->getBoundingBoxForBBTree()),bbox2Arr(m2Desc->getBoundingBoxForBBTree());
   const double *bbox1(bbox1Arr->begin()),*bbox2(bbox2Arr->begin());
-  int ncell1=m1Desc->getNumberOfCells();
-  int ncell2=m2Desc->getNumberOfCells();
-  intersectEdge1.resize(ncell1);
-  colinear2.resize(ncell2);
-  subDiv2.resize(ncell2);
+  int nDescCell1=m1Desc->getNumberOfCells();
+  int nDescCell2=m2Desc->getNumberOfCells();
+  intersectEdge1.resize(nDescCell1);
+  colinear2.resize(nDescCell2);
+  subDiv2.resize(nDescCell2);
   BBTree<SPACEDIM,int> myTree(bbox2,0,0,m2Desc->getNumberOfCells(),-eps);
+
   std::vector<int> candidates1(1);
   int offset1=m1->getNumberOfNodes();
   int offset2=offset1+m2->getNumberOfNodes();
-  for(int i=0;i<ncell1;i++)
+  for(int i=0;i<nDescCell1;i++)  // for all edges in the first mesh
     {
-      std::vector<int> candidates2;
+      std::vector<int> candidates2; // edges of mesh2 candidate for intersection
       myTree.getIntersectingElems(bbox1+i*2*SPACEDIM,candidates2);
-      if(!candidates2.empty())
+      if(!candidates2.empty()) // candidates2 holds edges from the second mesh potentially intersecting current edge i in mesh1
         {
           std::map<INTERP_KERNEL::Node *,int> map1,map2;
+          // pol2 is not necessarily a closed polygon: just a set of (quadratic) edges (same as candidates2) in the Geometric DS format
           INTERP_KERNEL::QuadraticPolygon *pol2=MEDCouplingUMeshBuildQPFromMesh(m2Desc,candidates2,map2);
           candidates1[0]=i;
           INTERP_KERNEL::QuadraticPolygon *pol1=MEDCouplingUMeshBuildQPFromMesh(m1Desc,candidates1,map1);
-          // this following part is to avoid that a some remove nodes (for example due to a merge between pol1 and pol2) can be replaced by a newlt created one
-          // This trick garanties that Node * are discriminant
+          // This following part is to avoid that some removed nodes (for example due to a merge between pol1 and pol2) are replaced by a newly created one
+          // This trick guarantees that Node * are discriminant (i.e. form a unique identifier)
           std::set<INTERP_KERNEL::Node *> nodes;
           pol1->getAllNodes(nodes); pol2->getAllNodes(nodes);
           std::size_t szz(nodes.size());
@@ -8579,6 +8622,7 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c
           for(std::size_t iii=0;iii<szz;iii++,itt++)
             { (*itt)->incrRef(); nodesSafe[iii]=*itt; }
           // end of protection
+          // Performs egde cutting:
           pol1->splitAbs(*pol2,map1,map2,offset1,offset2,candidates2,intersectEdge1[i],i,colinear2,subDiv2,addCoo);
           delete pol2;
           delete pol1;
@@ -8595,13 +8639,18 @@ void MEDCouplingUMesh::IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, c
  * This method has 4 inputs :
  *  - a mesh 'm1' with meshDim==1 and a SpaceDim==2
  *  - a mesh 'm2' with meshDim==1 and a SpaceDim==2
- *  - subDiv of size 'm2->getNumberOfCells()' that lists for each seg cell in 'm' the splitting node ids in randomly sorted.
- * The aim of this method is to sort the splitting nodes, if any, and to put in 'intersectEdge' output paramter based on edges of mesh 'm2'
- * \param m1 is expected to be a mesh of meshDimension equal to 1 and spaceDim equal to 2. No check of that is performed by this method. Only present for its coords in case of 'subDiv' shares some nodes of 'm1'
+ *  - subDiv of size 'm2->getNumberOfCells()' that lists for each seg cell in 'm' the splitting node ids randomly sorted.
+ * The aim of this method is to sort the splitting nodes, if any, and to put them in 'intersectEdge' output parameter based on edges of mesh 'm2'
+ * Nodes end up lying consecutively on a cutted edge.
+ * \param m1 is expected to be a mesh of meshDimension equal to 1 and spaceDim equal to 2. No check of that is performed by this method.
+ * (Only present for its coords in case of 'subDiv' shares some nodes of 'm1')
  * \param m2 is expected to be a mesh of meshDimension equal to 1 and spaceDim equal to 2. No check of that is performed by this method.
- * \param addCoo input parameter with additionnal nodes linked to intersection of the 2 meshes.
+ * \param addCoo input parameter with additional nodes linked to intersection of the 2 meshes.
+ * \param[out] intersectEdge the same content as subDiv, but correclty oriented.
  */
-void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector<double>& addCoo, const std::vector< std::vector<int> >& subDiv, std::vector< std::vector<int> >& intersectEdge)
+void MEDCouplingUMesh::BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2,
+      const std::vector<double>& addCoo,
+      const std::vector< std::vector<int> >& subDiv, std::vector< std::vector<int> >& intersectEdge)
 {
   int offset1=m1->getNumberOfNodes();
   int ncell=m2->getNumberOfCells();
@@ -9430,7 +9479,7 @@ MEDCouplingUMesh *MEDCouplingUMesh::buildSpreadZonesWithPoly() const
   std::vector<DataArrayInt *> partition=partitionBySpreadZone();
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > partitionAuto; partitionAuto.reserve(partition.size());
   std::copy(partition.begin(),partition.end(),std::back_insert_iterator<std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > >(partitionAuto));
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName().c_str(),mdim);
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New(getName(),mdim);
   ret->setCoords(getCoords());
   ret->allocateCells((int)partition.size());
   //
@@ -9540,7 +9589,7 @@ MEDCoupling1SGTUMesh *MEDCouplingUMesh::tetrahedrize(int policy, DataArrayInt *&
   if(getMeshDimension()!=3 || getSpaceDimension()!=3)
     throw INTERP_KERNEL::Exception("MEDCouplingUMesh::tetrahedrize : only available for mesh with meshdim == 3 and spacedim == 3 !");
   int nbOfCells(getNumberOfCells()),nbNodes(getNumberOfNodes());
-  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret0(MEDCoupling1SGTUMesh::New(getName().c_str(),INTERP_KERNEL::NORM_TETRA4));
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret0(MEDCoupling1SGTUMesh::New(getName(),INTERP_KERNEL::NORM_TETRA4));
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(nbOfCells,1);
   int *retPt(ret->getPointer());
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConn(DataArrayInt::New()); newConn->alloc(0,1);
index 204368c9f97f94ca06714849111558d776b0ba03..eaacda6841524fc7ea2a053683f54b8accd10736 100644 (file)
@@ -40,7 +40,7 @@ namespace ParaMEDMEM
   {
   public:
     MEDCOUPLING_EXPORT static MEDCouplingUMesh *New();
-    MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const char *meshName, int meshDim);
+    MEDCOUPLING_EXPORT static MEDCouplingUMesh *New(const std::string& meshName, int meshDim);
     MEDCOUPLING_EXPORT MEDCouplingMesh *deepCpy() const;
     MEDCOUPLING_EXPORT MEDCouplingUMesh *clone(bool recDeepCpy) const;
     MEDCOUPLING_EXPORT MEDCouplingPointSet *deepCpyConnectivityOnly() const;
@@ -303,8 +303,9 @@ namespace ParaMEDMEM
     static void IntersectDescending2DMeshes(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, double eps,
                                             std::vector< std::vector<int> >& intersectEdge1, std::vector< std::vector<int> >& colinear2, std::vector< std::vector<int> >& subDiv2,
                                             MEDCouplingUMesh *& m1Desc, DataArrayInt *&desc1, DataArrayInt *&descIndx1, DataArrayInt *&revDesc1, DataArrayInt *&revDescIndx1,
-                                            MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2,
-                                            std::vector<double>& addCoo) throw(INTERP_KERNEL::Exception);
+                                            std::vector<double>& addCoo,
+                                            MEDCouplingUMesh *& m2Desc, DataArrayInt *&desc2, DataArrayInt *&descIndx2, DataArrayInt *&revDesc2, DataArrayInt *&revDescIndx2)
+                                            throw(INTERP_KERNEL::Exception);
     static void BuildIntersectEdges(const MEDCouplingUMesh *m1, const MEDCouplingUMesh *m2, const std::vector<double>& addCoo, const std::vector< std::vector<int> >& subDiv, std::vector< std::vector<int> >& intersectEdge);
     static void BuildIntersecting2DCellsFromEdges(double eps, const MEDCouplingUMesh *m1, const int *desc1, const int *descIndx1, const std::vector<std::vector<int> >& intesctEdges1, const std::vector< std::vector<int> >& colinear2,
                                                   const MEDCouplingUMesh *m2, const int *desc2, const int *descIndx2, const std::vector<std::vector<int> >& intesctEdges2,
index b24be2164ca7c98e890fc814b25c0436d35d6522..e5c4d7b19b4eb32440160b62c643dabff800e596 100644 (file)
@@ -209,7 +209,7 @@ namespace SALOME_TEST
     std::copy(a2Data,a2Data+6,a2->getPointer());
     //
     targetMesh->setCoordsAt(0,a1);
-    targetMesh->setCoordsAt(2,a2);
+    targetMesh->setCoordsAt(1,a2);
     //
     a1->decrRef();
     a2->decrRef();
@@ -772,9 +772,19 @@ namespace SALOME_TEST
 
   std::string MEDCouplingCorbaServBasicsTest::buildFileNameForIOR()
   {
-    std::string ret;
-    ret+=getenv("TMP");
-    ret+="/entryPointMEDCouplingCorba.ior";
+    std::string tmpdir;
+    if (getenv("TMP"))
+      tmpdir = getenv("TMP");
+    if (tmpdir == "")
+      tmpdir = "/tmp";
+
+    std::string username;
+    if ( getenv("USERNAME") )
+      username = std::string(getenv("USERNAME"))+"_";
+    else if ( getenv("USER") )
+      username = std::string(getenv("USER"))+"_";
+
+    std::string ret = tmpdir+"/"+username+"entryPointMEDCouplingCorba.ior";
     return ret;
   }
 }
index a8dd95ab5a62aee8d75d7566bb269ab42e940396..01289cf51e0a36b5fb9f418062aac6c2fbae84e5 100644 (file)
@@ -168,7 +168,7 @@ class MEDCouplingCorbaServBasicsTest:
         a2.setInfoOnComponent(0,"SmthZ");
         #
         targetMesh.setCoordsAt(0,a1);
-        targetMesh.setCoordsAt(2,a2);
+        targetMesh.setCoordsAt(1,a2);
         #
         #
         targetMesh.checkCoherency();
@@ -600,8 +600,13 @@ class MEDCouplingCorbaServBasicsTest:
         return ret;
 
     def buildFileNameForIOR(self):
-        ret=os.getenv("TMP");
-        ret+="/entryPointMEDCouplingCorba.ior";
+        tmpdir=os.getenv("TMP", "/tmp");
+        username="";
+        if os.getenv("USERNAME"):
+            username = os.getenv("USERNAME")+"_";
+        elif os.getenv("USER"):
+            username = os.getenv("USER")+"_";
+        ret=tmpdir+"/"+username+"entryPointMEDCouplingCorba.ior";
         return ret;
     pass
 
index f4e4e111bdfc65eeaca106e1f3014cb9e31251ce..734391fa911d1c3281dfac9b201bbae0dfbb03f3 100644 (file)
@@ -10367,6 +10367,58 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertEqual(expected2,d2.getValues())
         pass
 
+    def testSwig2Intersect2DMeshesQuadra1(self):
+        import cmath
+        def createDiagCircle(lX, lY, R, cells=[0,1]):  
+            """ A circle in a square box, cut along the diagonal. 
+            """    
+            c = []
+            for i in range(8):
+              c.append(cmath.rect(R, i*pi/4))
+        
+            coords = [0.0,0.0,          c[3].real,c[3].imag,       -lX/2.0, lY/2.0,
+                      0.0, lY/2.0,      lX/2.0,lY/2.0,             lX/2.0,0.0,
+                      #   6                  7                              8
+                      lX/2.0,-lY/2.0,   c[7].real,c[7].imag,       c[1].real,c[1].imag,
+                      #   9                  10                            11  
+                      c[5].real,c[5].imag,   -lX/2.0,-lY/2.0,      0.0, -lY/2.0,
+                      #   12                  13                            14
+                      -lX/2.0,0.0,         0.0,0.0,                  0.0, 0.0]
+            # Points 13 (reps. 14) are average of points (6,7) (resp (1,2))
+            coords[13*2]   = 0.5*(coords[6*2]+coords[7*2])
+            coords[13*2+1] = 0.5*(coords[6*2+1]+coords[7*2+1])
+            coords[14*2]   = 0.5*(coords[1*2]+coords[2*2])
+            coords[14*2+1] = 0.5*(coords[1*2+1]+coords[2*2+1])
+            connec  = [1,7,8,0]      # half circle up right
+            connec3 = [6,7,1,2,4,13,8,14,3,5]
+            
+            baseMesh = MEDCouplingUMesh.New("box_circle", 2)  
+            baseMesh.allocateCells(2)
+            meshCoords = DataArrayDouble.New(coords, len(coords)/2, 2)
+            meshCoords.setInfoOnComponents(["X [au]", "Y [au]"])
+            baseMesh.setCoords(meshCoords)
+            
+            if 0 in cells:
+              baseMesh.insertNextCell(NORM_QPOLYG, connec)  
+            if 1 in cells: 
+              baseMesh.insertNextCell(NORM_QPOLYG, connec3) 
+            baseMesh.finishInsertingCells()  
+            baseMesh.checkCoherency() 
+            return baseMesh 
+        
+        eps = 1.0e-7
+        m1 = createDiagCircle(1.0, 1.0, 0.5*0.90, cells=[0,1])  
+        m2 = createDiagCircle(1.0, 1.0, 0.5*0.95, cells=[0])
+        m3, _, _= MEDCouplingUMesh.Intersect2DMeshes(m1, m2, eps)
+        m3.mergeNodes(eps)
+        m3.convertDegeneratedCells()
+        m3.zipCoords()        
+        m4 = m3.deepCpy()
+        m5, _, _ = MEDCouplingUMesh.Intersect2DMeshes(m3, m4, eps)
+        m5.mergeNodes(eps)
+        # Check coordinates:
+        self.assertTrue(m3.getCoords().isEqual(m5.getCoords(), eps))
+
     def testDAIBuildUnique1(self):
         d=DataArrayInt([1,2,2,3,3,3,3,4,5,5,7,7,7,19])
         e=d.buildUnique()
@@ -14039,8 +14091,128 @@ class MEDCouplingBasicsTest(unittest.TestCase):
         self.assertTrue(da.getIdsEqualTuple(2).isEqual(da.getIdsEqual(2)))
         pass
 
+    def testSwig2GaussNEStaticInfo1(self):
+        self.assertTrue(DataArrayDouble(MEDCouplingFieldDiscretizationGaussNE.GetWeightArrayFromGeometricType(NORM_TRI3)).isEqual(DataArrayDouble([0.16666666666666666,0.16666666666666666,0.16666666666666666]),1e-12))
+        self.assertTrue(DataArrayDouble(MEDCouplingFieldDiscretizationGaussNE.GetRefCoordsFromGeometricType(NORM_TRI3)).isEqual(DataArrayDouble([0.,0.,1.,0.,0.,1.]),1e-12))
+        self.assertTrue(DataArrayDouble(MEDCouplingFieldDiscretizationGaussNE.GetLocsFromGeometricType(NORM_TRI3)).isEqual(DataArrayDouble([0.16666666666666666,0.16666666666666666,0.6666666666666667,0.16666666666666666,0.16666666666666666,0.6666666666666667]),1e-12))
+        pass
+
+    def testSwigReverseNodalConnOnStructuredMesh(self):
+        # 1D - standard
+        c=MEDCouplingCMesh() ; arr=DataArrayDouble(10) ; arr.iota()
+        c.setCoordsAt(0,arr)
+        rn,rni=c.getReverseNodalConnectivity()
+        rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity()
+        self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8])))
+        self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,9,11,13,15,17,18])))
+        self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2))
+        # 1D - limit
+        c=MEDCouplingCMesh() ; arr=DataArrayDouble(1) ; arr.iota()
+        c.setCoordsAt(0,arr)
+        rn,rni=c.getReverseNodalConnectivity()
+        rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity()
+        self.assertTrue(rn.isEqual(DataArrayInt([0])))
+        self.assertTrue(rni.isEqual(DataArrayInt([0,1])))
+        self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2))
+        # 1D - limit
+        c=MEDCouplingCMesh() ; arr=DataArrayDouble(0) ; arr.iota()
+        c.setCoordsAt(0,arr)
+        rn,rni=c.getReverseNodalConnectivity()
+        rn.isEqual(DataArrayInt([]))
+        rni.isEqual(DataArrayInt([0]))
+        # 2D - standard
+        c=MEDCouplingCMesh() ; arr=DataArrayDouble(5) ; arr.iota() ; arr2=DataArrayDouble(4) ; arr.iota()
+        c.setCoords(arr,arr2)
+        rn,rni=c.getReverseNodalConnectivity()
+        rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity()
+        self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,0,4,0,1,4,5,1,2,5,6,2,3,6,7,3,7,4,8,4,5,8,9,5,6,9,10,6,7,10,11,7,11,8,8,9,9,10,10,11,11])))
+        self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,8,10,14,18,22,24,26,30,34,38,40,41,43,45,47,48])))
+        self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2))
+        # 2D - limit
+        c=MEDCouplingCMesh() ; arr=DataArrayDouble(10) ; arr.iota() ; arr2=DataArrayDouble(1) ; arr.iota()
+        c.setCoords(arr,arr2)
+        rn,rni=c.getReverseNodalConnectivity()
+        self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8])))
+        self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,9,11,13,15,17,18])))
+        # 2D - limit
+        c=MEDCouplingCMesh() ; arr=DataArrayDouble(10) ; arr.iota() ; arr2=DataArrayDouble(1) ; arr.iota()
+        c.setCoords(arr2,arr)
+        rn,rni=c.getReverseNodalConnectivity()
+        self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8])))
+        self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,9,11,13,15,17,18])))
+        # 3D - standard
+        c=MEDCouplingCMesh() ; arr0=DataArrayDouble(5) ; arr0.iota() ; arr1=DataArrayDouble(3) ; arr1.iota() ; arr2=DataArrayDouble(4) ; arr2.iota()
+        c.setCoords(arr0,arr1,arr2)
+        rn,rni=c.getReverseNodalConnectivity()
+        self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,0,4,0,1,4,5,1,2,5,6,2,3,6,7,3,7,4,4,5,5,6,6,7,7,0,8,0,1,8,9,1,2,9,10,2,3,10,11,3,11,0,4,8,12,0,1,4,5,8,9,12,13,1,2,5,6,9,10,13,14,2,3,6,7,10,11,14,15,3,7,11,15,4,12,4,5,12,13,5,6,13,14,6,7,14,15,7,15,8,16,8,9,16,17,9,10,17,18,10,11,18,19,11,19,8,12,16,20,8,9,12,13,16,17,20,21,9,10,13,14,17,18,21,22,10,11,14,15,18,19,22,23,11,15,19,23,12,20,12,13,20,21,13,14,21,22,14,15,22,23,15,23,16,16,17,17,18,18,19,19,16,20,16,17,20,21,17,18,21,22,18,19,22,23,19,23,20,20,21,21,22,22,23,23])))
+        self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,8,10,14,18,22,24,25,27,29,31,32,34,38,42,46,48,52,60,68,76,80,82,86,90,94,96,98,102,106,110,112,116,124,132,140,144,146,150,154,158,160,161,163,165,167,168,170,174,178,182,184,185,187,189,191,192])))
+        rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity()
+        self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2))
+        pass
+
+    def testSwig2CellToNodeDiscretization1(self):
+        m=MEDCouplingCMesh() ; arr0=DataArrayDouble(5) ; arr0.iota() ; arr1=DataArrayDouble(4) ; arr1.iota() ; m.setCoords(arr0,arr1)
+        f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) ; f.setTime(1.1,5,6)
+        arr=DataArrayDouble(12) ; arr.iota()
+        arr=DataArrayDouble.Meld(arr,arr+100.) ; arr.setInfoOnComponents(["aaa","bbb"])
+        f.setArray(arr)
+        f.checkCoherency()
+        #
+        ref=DataArrayDouble([0.,0.5,1.5,2.5,3.,2.,2.5,3.5,4.5,5.,6.,6.5,7.5,8.5,9.,8.,8.5,9.5,10.5,11.])
+        ref=DataArrayDouble.Meld(ref,ref+100.) ; ref.setInfoOnComponents(["aaa","bbb"])
+        f2=f.cellToNodeDiscretization()
+        f2.checkCoherency()
+        self.assertEqual(f2.getTime()[1:],[5,6])
+        self.assertAlmostEqual(f2.getTime()[0],1.1,15)
+        self.assertEqual(f2.getMesh().getHiddenCppPointer(),m.getHiddenCppPointer())
+        self.assertTrue(f2.getArray().isEqual(ref,1e-12))
+        rn,rni=m.getReverseNodalConnectivity()
+        rni2=(rni.deltaShiftIndex()).convertToDblArr()
+        arr2=(f.getArray()[rn]).accumulatePerChunck(rni)/rni2
+        self.assertTrue(f2.getArray().isEqual(arr2,1e-12))
+        del f2
+        #
+        u=m.buildUnstructured() ; f.setMesh(u) ; del m
+        f3=f.cellToNodeDiscretization()
+        f3.checkCoherency()
+        self.assertEqual(f3.getTime()[1:],[5,6])
+        self.assertAlmostEqual(f3.getTime()[0],1.1,15)
+        self.assertEqual(f3.getMesh().getHiddenCppPointer(),u.getHiddenCppPointer())
+        self.assertTrue(f3.getArray().isEqual(ref,1e-12))
+        pass
+
+    def testSwig2GetMeshSpaceDimensionCMesh1(self):
+        c=MEDCouplingCMesh()
+        arr0=DataArrayDouble([0,1,2])
+        arr1=DataArrayDouble([0])
+        c.setCoords(arr0,arr0,arr0)
+        self.assertEqual(c.getMeshDimension(),3)
+        self.assertEqual(c.getSpaceDimension(),3)
+        #
+        c.setCoords(arr0,arr0,arr1)
+        self.assertEqual(c.getMeshDimension(),2)
+        self.assertEqual(c.getSpaceDimension(),3)
+        #
+        c.setCoords(arr0,arr0)
+        self.assertEqual(c.getMeshDimension(),2)
+        self.assertEqual(c.getSpaceDimension(),2)
+        #
+        c.setCoords(arr0,arr1)
+        self.assertEqual(c.getMeshDimension(),1)
+        self.assertEqual(c.getSpaceDimension(),2)
+        #
+        c.setCoords(arr0)
+        self.assertEqual(c.getMeshDimension(),1)
+        self.assertEqual(c.getSpaceDimension(),1)
+        #
+        c.setCoords(arr1)
+        self.assertEqual(c.getMeshDimension(),0)
+        self.assertEqual(c.getSpaceDimension(),1)
+        pass
+
     def setUp(self):
         pass
     pass
 
-unittest.main()
+if __name__ == '__main__':
+    unittest.main()
index 9845712543dc131491904492896d70440473d09d..8723563df575f94a4290808acd7527851e8293c7 100644 (file)
@@ -183,6 +183,7 @@ using namespace INTERP_KERNEL;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization;
+%newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization;
 %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti;
 %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New;
 %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy;
@@ -397,13 +398,13 @@ namespace ParaMEDMEM
   class MEDCouplingMesh : public RefCountObject, public TimeLabel
   {
   public:
-    void setName(const char *name);
+    void setName(const std::string& name);
     std::string getName() const;
-    void setDescription(const char *descr);
+    void setDescription(const std::string& descr);
     std::string getDescription() const;
     void setTime(double val, int iteration, int order);
-    void setTimeUnit(const char *unit);
-    const char *getTimeUnit() const;
+    void setTimeUnit(const std::string& unit);
+    std::string getTimeUnit() const;
     virtual MEDCouplingMeshType getType() const throw(INTERP_KERNEL::Exception);
     bool isStructured() const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingMesh *deepCpy() const;
@@ -431,13 +432,13 @@ namespace ParaMEDMEM
     virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
     virtual std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
-    void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
+    void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
     // tools
     virtual MEDCouplingFieldDouble *getMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const throw(INTERP_KERNEL::Exception);
-    virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
-    virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
-    virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
+    virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
+    virtual MEDCouplingFieldDouble *fillFromAnalytic2(TypeOfField t, int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
+    virtual MEDCouplingFieldDouble *fillFromAnalytic3(TypeOfField t, int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingFieldDouble *buildOrthogonalField() const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
     virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception);
@@ -554,6 +555,17 @@ namespace ParaMEDMEM
            return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
          }
          
+         virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
+         {
+           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
+           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
+           self->getReverseNodalConnectivity(d0,d1);
+           PyObject *ret=PyTuple_New(2);
+           PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+           PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+           return ret;
+         }
+         
          void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception)
          {
            int sw,sz(-1);
@@ -1172,17 +1184,6 @@ namespace ParaMEDMEM
                }
            }
 
-           virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception)
-           {
-             MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
-             MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
-             self->getReverseNodalConnectivity(d0,d1);
-             PyObject *ret=PyTuple_New(2);
-             PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-             PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
-             return ret;
-           }
-
            virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
            {
              DataArrayInt *v0=0,*v1=0;
@@ -1515,6 +1516,7 @@ namespace ParaMEDMEM
     MEDCouplingUMesh *explode3DMeshTo1D(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception);
     void orientCorrectlyPolyhedrons() throw(INTERP_KERNEL::Exception);
     bool isPresenceOfQuadratic() const throw(INTERP_KERNEL::Exception);
+    bool isFullyQuadratic() const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *buildDirectionVectorField() const throw(INTERP_KERNEL::Exception);
     bool isContiguous1D() const throw(INTERP_KERNEL::Exception);
     void tessellate2D(double eps) throw(INTERP_KERNEL::Exception);
@@ -2541,7 +2543,7 @@ namespace ParaMEDMEM
   class MEDCoupling1GTUMesh : public ParaMEDMEM::MEDCouplingPointSet
   {
   public:
-    static MEDCoupling1GTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static MEDCoupling1GTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     static MEDCoupling1GTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
     INTERP_KERNEL::NormalizedCellType getCellModelEnum() const throw(INTERP_KERNEL::Exception);
     int getNodalConnectivityLength() const throw(INTERP_KERNEL::Exception);
@@ -2578,7 +2580,7 @@ namespace ParaMEDMEM
   class MEDCoupling1SGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
   {
   public:
-    static MEDCoupling1SGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static MEDCoupling1SGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     static MEDCoupling1SGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
     void setNodalConnectivity(DataArrayInt *nodalConn) throw(INTERP_KERNEL::Exception);
     int getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
@@ -2589,7 +2591,7 @@ namespace ParaMEDMEM
     DataArrayInt *sortHexa8EachOther() throw(INTERP_KERNEL::Exception);
     %extend
     {
-      MEDCoupling1SGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
+      MEDCoupling1SGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
       {
         return MEDCoupling1SGTUMesh::New(name,type);
       }
@@ -2634,14 +2636,14 @@ namespace ParaMEDMEM
   class MEDCoupling1DGTUMesh : public ParaMEDMEM::MEDCoupling1GTUMesh
   {
   public:
-    static MEDCoupling1DGTUMesh *New(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
+    static MEDCoupling1DGTUMesh *New(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception);
     static MEDCoupling1DGTUMesh *New(const MEDCouplingUMesh *m) throw(INTERP_KERNEL::Exception);
     void setNodalConnectivity(DataArrayInt *nodalConn, DataArrayInt *nodalConnIndex) throw(INTERP_KERNEL::Exception);
     MEDCoupling1DGTUMesh *buildSetInstanceFromThis(int spaceDim) const throw(INTERP_KERNEL::Exception);
     bool isPacked() const throw(INTERP_KERNEL::Exception);
     %extend
     {
-      MEDCoupling1DGTUMesh(const char *name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
+      MEDCoupling1DGTUMesh(const std::string& name, INTERP_KERNEL::NormalizedCellType type) throw(INTERP_KERNEL::Exception)
       {
         return MEDCoupling1DGTUMesh::New(name,type);
       }
@@ -2826,7 +2828,7 @@ namespace ParaMEDMEM
   {
   public:
     static MEDCouplingCMesh *New();
-    static MEDCouplingCMesh *New(const char *meshName);
+    static MEDCouplingCMesh *New(const std::string& meshName);
     MEDCouplingCMesh *clone(bool recDeepCpy) const;
     void setCoords(const DataArrayDouble *coordsX,
                    const DataArrayDouble *coordsY=0,
@@ -2837,7 +2839,7 @@ namespace ParaMEDMEM
       {
         return MEDCouplingCMesh::New();
       }
-      MEDCouplingCMesh(const char *meshName)
+      MEDCouplingCMesh(const std::string& meshName)
       {
         return MEDCouplingCMesh::New(meshName);
       }
@@ -2869,7 +2871,7 @@ namespace ParaMEDMEM
   {
   public:
     static MEDCouplingCurveLinearMesh *New();
-    static MEDCouplingCurveLinearMesh *New(const char *meshName);
+    static MEDCouplingCurveLinearMesh *New(const std::string& meshName);
     MEDCouplingCurveLinearMesh *clone(bool recDeepCpy) const;
     void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
     %extend {
@@ -2877,7 +2879,7 @@ namespace ParaMEDMEM
       {
         return MEDCouplingCurveLinearMesh::New();
       }
-      MEDCouplingCurveLinearMesh(const char *meshName)
+      MEDCouplingCurveLinearMesh(const std::string& meshName)
       {
         return MEDCouplingCurveLinearMesh::New(meshName);
       }
@@ -3108,19 +3110,20 @@ namespace ParaMEDMEM
   public:
     static MEDCouplingFieldDouble *New(TypeOfField type, TypeOfTimeDiscretization td=ONE_TIME);
     static MEDCouplingFieldDouble *New(const MEDCouplingFieldTemplate& ft, TypeOfTimeDiscretization td=ONE_TIME);
-    void setTimeUnit(const char *unit);
-    const char *getTimeUnit() const;
+    void setTimeUnit(const std::string& unit);
+    std::string getTimeUnit() const;
     void synchronizeTimeWithSupport() 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 throw(INTERP_KERNEL::Exception);
     std::string advancedRepr() const throw(INTERP_KERNEL::Exception);
-    void writeVTK(const char *fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
+    void writeVTK(const std::string& fileName, bool isBinary=true) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *clone(bool recDeepCpy) const;
     MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const;
     MEDCouplingFieldDouble *deepCpy() const;
     MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception);
     TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception);
     double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception);
     double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception);
@@ -3161,16 +3164,16 @@ namespace ParaMEDMEM
     void changeNbOfComponents(int newNbOfComp, double dftValue=0.) throw(INTERP_KERNEL::Exception);
     void sortPerTuple(bool asc) throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble &operator=(double value) throw(INTERP_KERNEL::Exception);
-    void fillFromAnalytic(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
-    void fillFromAnalytic2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
-    void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
-    void applyFunc(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
-    void applyFunc2(int nbOfComp, const char *func) throw(INTERP_KERNEL::Exception);
-    void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) throw(INTERP_KERNEL::Exception);
+    void fillFromAnalytic(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
+    void fillFromAnalytic2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
+    void fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
+    void applyFunc(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
+    void applyFunc2(int nbOfComp, const std::string& func) throw(INTERP_KERNEL::Exception);
+    void applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) throw(INTERP_KERNEL::Exception);
     void applyFunc(int nbOfComp, double val) throw(INTERP_KERNEL::Exception);
-    void applyFunc(const char *func) throw(INTERP_KERNEL::Exception);
-    void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
-    void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
+    void applyFunc(const std::string& func) throw(INTERP_KERNEL::Exception);
+    void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
+    void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
     double accumulate(int compId) const throw(INTERP_KERNEL::Exception);
     double getMaxValue() const throw(INTERP_KERNEL::Exception);
     double getMinValue() const throw(INTERP_KERNEL::Exception);
index 40207ea69f6b9ecd23090c7a9d538712cd342ca2..8b8e3789495b9677b37366c6d19a22f1d9117b56 100644 (file)
@@ -37,7 +37,7 @@ namespace ParaMEDMEM
     static MEDCouplingFieldDiscretization *New(TypeOfField type) throw(INTERP_KERNEL::Exception);
     double getPrecision() const throw(INTERP_KERNEL::Exception);
     void setPrecision(double val) throw(INTERP_KERNEL::Exception);
-    static TypeOfField GetTypeOfFieldFromStringRepr(const char *repr) throw(INTERP_KERNEL::Exception);
+    static TypeOfField GetTypeOfFieldFromStringRepr(const std::string& repr) throw(INTERP_KERNEL::Exception);
     virtual TypeOfField getEnum() const throw(INTERP_KERNEL::Exception);
     virtual bool isEqual(const MEDCouplingFieldDiscretization *other, double eps) const throw(INTERP_KERNEL::Exception);
     virtual bool isEqualIfNotWhy(const MEDCouplingFieldDiscretization *other, double eps, std::string& reason) const throw(INTERP_KERNEL::Exception);
@@ -345,6 +345,30 @@ namespace ParaMEDMEM
 
   class MEDCouplingFieldDiscretizationGaussNE : public MEDCouplingFieldDiscretization
   {
+  public:
+    %extend
+    {
+      static PyObject *GetWeightArrayFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
+      {
+        std::size_t sz(0);
+        const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetWeightArrayFromGeometricType(geoType,sz));
+        return convertDblArrToPyList(ret,sz);
+      }
+      
+      static PyObject *GetRefCoordsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
+      {
+        std::size_t sz(0);
+        const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetRefCoordsFromGeometricType(geoType,sz));
+        return convertDblArrToPyList(ret,sz);
+      }
+      
+      static PyObject *GetLocsFromGeometricType(INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception)
+      {
+        std::size_t sz(0);
+        const double *ret(MEDCouplingFieldDiscretizationGaussNE::GetLocsFromGeometricType(geoType,sz));
+        return convertDblArrToPyList(ret,sz);
+      }
+    }
   };
 
   class MEDCouplingFieldDiscretizationKriging : public MEDCouplingFieldDiscretizationOnNodes
index d664d08944f865fd35caa312b85337ce675987e0..100f477bef47f4afe7bb19e53b2f6f1ce894d05c 100644 (file)
@@ -203,13 +203,13 @@ namespace ParaMEDMEM
   class DataArray : public RefCountObject, public TimeLabel
   {
   public:
-    void setName(const char *name);
+    void setName(const std::string& name);
     void copyStringInfoFrom(const DataArray& other) throw(INTERP_KERNEL::Exception);
     void copyPartOfStringInfoFrom(const DataArray& other, const std::vector<int>& compoIds) throw(INTERP_KERNEL::Exception);
     void copyPartOfStringInfoFrom2(const std::vector<int>& compoIds, const DataArray& other) throw(INTERP_KERNEL::Exception);
     bool areInfoEqualsIfNotWhy(const DataArray& other, std::string& reason) const throw(INTERP_KERNEL::Exception);
     bool areInfoEquals(const DataArray& other) const throw(INTERP_KERNEL::Exception);
-    std::string cppRepr(const char *varName) const throw(INTERP_KERNEL::Exception);
+    std::string cppRepr(const std::string& varName) const throw(INTERP_KERNEL::Exception);
     std::string getName() const;
     void setInfoOnComponents(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
     void setInfoAndChangeNbOfCompo(const std::vector<std::string>& info) throw(INTERP_KERNEL::Exception);
@@ -218,7 +218,7 @@ namespace ParaMEDMEM
     std::string getInfoOnComponent(int i) const throw(INTERP_KERNEL::Exception);
     std::string getVarOnComponent(int i) const throw(INTERP_KERNEL::Exception);
     std::string getUnitOnComponent(int i) const throw(INTERP_KERNEL::Exception);
-    void setInfoOnComponent(int i, const char *info) throw(INTERP_KERNEL::Exception);
+    void setInfoOnComponent(int i, const std::string& info) throw(INTERP_KERNEL::Exception);
     int getNumberOfComponents() const;
     virtual void alloc(int nbOfTuple, int nbOfCompo=1) throw(INTERP_KERNEL::Exception);
     virtual void reAlloc(int nbOfTuples) throw(INTERP_KERNEL::Exception);
@@ -231,13 +231,13 @@ namespace ParaMEDMEM
     virtual DataArray *deepCpy() const throw(INTERP_KERNEL::Exception);
     virtual DataArray *selectByTupleId2(int bg, int end2, int step) const throw(INTERP_KERNEL::Exception);
     virtual void rearrange(int newNbOfCompo) throw(INTERP_KERNEL::Exception);
-    void checkNbOfTuples(int nbOfTuples, const char *msg) const throw(INTERP_KERNEL::Exception);
-    void checkNbOfComps(int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
-    void checkNbOfTuplesAndComp(const DataArray& other, const char *msg) const throw(INTERP_KERNEL::Exception);
-    void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const char *msg) const throw(INTERP_KERNEL::Exception);
-    void checkNbOfElems(std::size_t nbOfElems, const char *msg) const throw(INTERP_KERNEL::Exception);
-    static int GetNumberOfItemGivenBES(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
-    static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const char *msg) throw(INTERP_KERNEL::Exception);
+    void checkNbOfTuples(int nbOfTuples, const std::string& msg) const throw(INTERP_KERNEL::Exception);
+    void checkNbOfComps(int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
+    void checkNbOfTuplesAndComp(const DataArray& other, const std::string& msg) const throw(INTERP_KERNEL::Exception);
+    void checkNbOfTuplesAndComp(int nbOfTuples, int nbOfCompo, const std::string& msg) const throw(INTERP_KERNEL::Exception);
+    void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const throw(INTERP_KERNEL::Exception);
+    static int GetNumberOfItemGivenBES(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
+    static int GetNumberOfItemGivenBESRelative(int begin, int end, int step, const std::string& msg) throw(INTERP_KERNEL::Exception);
     static int GetPosOfItemGivenBESRelativeNoThrow(int value, int begin, int end, int step) throw(INTERP_KERNEL::Exception);
     static std::string GetVarNameFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
     static std::string GetUnitFromInfo(const std::string& info) throw(INTERP_KERNEL::Exception);
@@ -574,12 +574,12 @@ namespace ParaMEDMEM
     void applyRPow(double val) throw(INTERP_KERNEL::Exception);
     DataArrayDouble *negate() const throw(INTERP_KERNEL::Exception);
     DataArrayDouble *applyFunc(int nbOfComp, FunctionToEvaluate func) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *applyFunc(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *applyFunc(const char *func) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *applyFunc2(int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func) const throw(INTERP_KERNEL::Exception);
-    void applyFuncFast32(const char *func) throw(INTERP_KERNEL::Exception);
-    void applyFuncFast64(const char *func) throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *applyFunc(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *applyFunc(const std::string& func) const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *applyFunc2(int nbOfComp, const std::string& func) const throw(INTERP_KERNEL::Exception);
+    DataArrayDouble *applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func) const throw(INTERP_KERNEL::Exception);
+    void applyFuncFast32(const std::string& func) throw(INTERP_KERNEL::Exception);
+    void applyFuncFast64(const std::string& func) throw(INTERP_KERNEL::Exception);
     DataArrayInt *getIdsInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *getIdsNotInRange(double vmin, double vmax) const throw(INTERP_KERNEL::Exception);
     static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2) throw(INTERP_KERNEL::Exception);
index 557d63bcfc5f2e8f2720c7f5d8e97457d5722398..91b0add29b8bb3d091bc1c1a7b63e9339ab5b027 100644 (file)
@@ -57,7 +57,7 @@ namespace ParaMEDMEM
     public:
       MEDCouplingRemapper();
       ~MEDCouplingRemapper();
-      int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const char *method) throw(INTERP_KERNEL::Exception);
+      int prepare(const MEDCouplingMesh *srcMesh, const MEDCouplingMesh *targetMesh, const std::string& method) throw(INTERP_KERNEL::Exception);
       int prepareEx(const MEDCouplingFieldTemplate *src, const MEDCouplingFieldTemplate *target) throw(INTERP_KERNEL::Exception);
       void transfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField, double dftValue) throw(INTERP_KERNEL::Exception);
       void partialTransfer(const MEDCouplingFieldDouble *srcField, MEDCouplingFieldDouble *targetField) throw(INTERP_KERNEL::Exception);
index ba72ae4648e58412161b9493c022e78af30e8171..537bee6e7b44c635c55b7c2a3fe9b5d5700ae2c2 100644 (file)
@@ -22,7 +22,7 @@
 
 using namespace ParaMEDMEM;
 
-MEDFileData *MEDFileData::New(const char *fileName)
+MEDFileData *MEDFileData::New(const std::string& fileName)
 {
   return new MEDFileData(fileName);
 }
@@ -169,7 +169,7 @@ bool MEDFileData::changeMeshNames(const std::vector< std::pair<std::string,std::
   return ret;
 }
 
-bool MEDFileData::changeMeshName(const char *oldMeshName, const char *newMeshName)
+bool MEDFileData::changeMeshName(const std::string& oldMeshName, const std::string& newMeshName)
 {
   std::string oldName(oldMeshName);
   std::vector< std::pair<std::string,std::string> > v(1);
@@ -214,7 +214,7 @@ bool MEDFileData::unPolyzeMeshes()
       MEDFileFields *fs=_fields;
       if(fs)
         for(std::size_t i=0;i<meshesImpacted.size();i++)
-          fs->renumberEntitiesLyingOnMesh(meshesImpacted[i]->getName().c_str(),oldCodeOfMeshImpacted[i],newCodeOfMeshImpacted[i],renumParamsOfMeshImpacted[i]);
+          fs->renumberEntitiesLyingOnMesh(meshesImpacted[i]->getName(),oldCodeOfMeshImpacted[i],newCodeOfMeshImpacted[i],renumParamsOfMeshImpacted[i]);
     }
   return !meshesImpacted.empty();
 }
@@ -223,7 +223,7 @@ MEDFileData::MEDFileData()
 {
 }
 
-MEDFileData::MEDFileData(const char *fileName)
+MEDFileData::MEDFileData(const std::string& fileName)
 try
   {
     _fields=MEDFileFields::New(fileName);
@@ -235,10 +235,10 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-void MEDFileData::write(const char *fileName, int mode) const
+void MEDFileData::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   const MEDFileMeshes *ms=_meshes;
   if(ms)
     ms->write(fid);
index b9683f8a5b76183baf638e456253293614709da6..cbe25dd825f121b5cbcec635da6d59eb545501e8 100644 (file)
@@ -34,7 +34,7 @@ namespace ParaMEDMEM
   class MEDFileData : public RefCountObject, public MEDFileWritable
   {
   public:
-    MEDLOADER_EXPORT static MEDFileData *New(const char *fileName);
+    MEDLOADER_EXPORT static MEDFileData *New(const std::string& fileName);
     MEDLOADER_EXPORT static MEDFileData *New();
     MEDLOADER_EXPORT MEDFileData *deepCpy() const;
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
@@ -51,13 +51,13 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT std::string simpleRepr() const;
     //
     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
-    MEDLOADER_EXPORT bool changeMeshName(const char *oldMeshName, const char *newMeshName);
+    MEDLOADER_EXPORT bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
     MEDLOADER_EXPORT bool unPolyzeMeshes();
     //
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
   private:
     MEDFileData();
-    MEDFileData(const char *fileName);
+    MEDFileData(const std::string& fileName);
   private:
     MEDCouplingAutoRefCountObjectPtr<MEDFileFields> _fields;
     MEDCouplingAutoRefCountObjectPtr<MEDFileMeshes> _meshes;
index b68147e4b6a5395066f665ef6f0a2489d3f59e5a..0d5f1216e2819b110dcd16ffa8a0a7166b051a5f 100644 (file)
@@ -43,7 +43,7 @@ using namespace ParaMEDMEM;
 const char MEDFileField1TSWithoutSDA::TYPE_STR[]="FLOAT64";
 const char MEDFileIntField1TSWithoutSDA::TYPE_STR[]="INT32";
 
-MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, const char *locName)
+MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, const std::string& locName)
 {
   return new MEDFileFieldLoc(fid,locName);
 }
@@ -53,26 +53,26 @@ MEDFileFieldLoc *MEDFileFieldLoc::New(med_idt fid, int id)
   return new MEDFileFieldLoc(fid,id);
 }
 
-MEDFileFieldLoc *MEDFileFieldLoc::New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
+MEDFileFieldLoc *MEDFileFieldLoc::New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
 {
   return new MEDFileFieldLoc(locName,geoType,refCoo,gsCoo,w);
 }
 
-MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const char *locName):_name(locName)
+MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, const std::string& locName):_name(locName)
 {
   med_geometry_type geotype;
   med_geometry_type sectiongeotype;
   int nsectionmeshcell;
   INTERP_KERNEL::AutoPtr<char> geointerpname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> sectionmeshname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
-  MEDlocalizationInfoByName(fid,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,&sectiongeotype);
+  MEDlocalizationInfoByName(fid,locName.c_str(),&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,&sectiongeotype);
   _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype)));
   const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
   _nb_node_per_cell=cm.getNumberOfNodes();
   _ref_coo.resize(_dim*_nb_node_per_cell);
   _gs_coo.resize(_dim*_nb_gauss_pt);
   _w.resize(_nb_gauss_pt);
-  MEDlocalizationRd(fid,locName,MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]);
+  MEDlocalizationRd(fid,locName.c_str(),MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]);
 }
 
 MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id)
@@ -94,7 +94,7 @@ MEDFileFieldLoc::MEDFileFieldLoc(med_idt fid, int id)
   MEDlocalizationRd(fid,locName,MED_FULL_INTERLACE,&_ref_coo[0],&_gs_coo[0],&_w[0]);
 }
 
-MEDFileFieldLoc::MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType,
+MEDFileFieldLoc::MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType,
                                  const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w):_name(locName),_geo_type(geoType),_ref_coo(refCoo),_gs_coo(gsCoo),
                                                                                                                                     _w(w)
 {
@@ -132,7 +132,7 @@ void MEDFileFieldLoc::simpleRepr(std::ostream& oss) const
   oss << "GaussPtsCoords="; std::copy(_gs_coo.begin(),_gs_coo.end(),std::ostream_iterator<double>(oss," ")); oss << std::endl;
 }
 
-void MEDFileFieldLoc::setName(const char *name)
+void MEDFileFieldLoc::setName(const std::string& name)
 {
   _name=name;
 }
@@ -631,7 +631,7 @@ std::string MEDFileFieldPerMeshPerTypePerDisc::getProfile() const
   return _profile;
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::setProfile(const char *newPflName)
+void MEDFileFieldPerMeshPerTypePerDisc::setProfile(const std::string& newPflName)
 {
   _profile=newPflName;
 }
@@ -641,7 +641,7 @@ std::string MEDFileFieldPerMeshPerTypePerDisc::getLocalization() const
   return _localization;
 }
 
-void MEDFileFieldPerMeshPerTypePerDisc::setLocalization(const char *newLocName)
+void MEDFileFieldPerMeshPerTypePerDisc::setLocalization(const std::string& newLocName)
 {
   _localization=newLocName;
 }
@@ -1887,7 +1887,7 @@ bool MEDFileFieldPerMesh::changeMeshNames(const std::vector< std::pair<std::stri
   return false;
 }
 
-bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileFieldPerMesh::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
                                                       MEDFileFieldGlobsReal& glob)
 {
   if(_mesh_name!=meshName)
@@ -2395,15 +2395,15 @@ MEDFileFieldPerMesh::MEDFileFieldPerMesh(MEDFileAnyTypeField1TSWithoutSDA *fath,
   copyTinyInfoFrom(mesh);
 }
 
-void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const char *pflName)
+void MEDFileFieldGlobs::loadProfileInFile(med_idt fid, int id, const std::string& pflName)
 {
   if(id>=(int)_pfls.size())
     _pfls.resize(id+1);
   _pfls[id]=DataArrayInt::New();
-  int lgth=MEDprofileSizeByName(fid,pflName);
+  int lgth=MEDprofileSizeByName(fid,pflName.c_str());
   _pfls[id]->setName(pflName);
   _pfls[id]->alloc(lgth,1);
-  MEDprofileRd(fid,pflName,_pfls[id]->getPointer());
+  MEDprofileRd(fid,pflName.c_str(),_pfls[id]->getPointer());
   _pfls[id]->applyLin(1,-1,0);//Converting into C format
 }
 
@@ -2519,7 +2519,7 @@ void MEDFileFieldGlobs::loadAllGlobals(med_idt fid)
     }
 }
 
-MEDFileFieldGlobs *MEDFileFieldGlobs::New(const char *fname)
+MEDFileFieldGlobs *MEDFileFieldGlobs::New(const std::string& fname)
 {
   return new MEDFileFieldGlobs(fname);
 }
@@ -2626,7 +2626,7 @@ MEDFileFieldGlobs *MEDFileFieldGlobs::deepCpyPart(const std::vector<std::string>
   return ret.retn();
 }
 
-MEDFileFieldGlobs::MEDFileFieldGlobs(const char *fname):_file_name(fname)
+MEDFileFieldGlobs::MEDFileFieldGlobs(const std::string& fname):_file_name(fname)
 {
 }
 
@@ -2664,7 +2664,7 @@ void MEDFileFieldGlobs::simpleRepr(std::ostream& oss) const
     }
 }
 
-void MEDFileFieldGlobs::setFileName(const char *fileName)
+void MEDFileFieldGlobs::setFileName(const std::string& fileName)
 {
   _file_name=fileName;
 }
@@ -2716,7 +2716,7 @@ int MEDFileFieldGlobs::getNbOfGaussPtPerCell(int locId) const
   return _locs[locId]->getNbOfGaussPtPerCell();
 }
 
-const MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const char *locName) const
+const MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName) const
 {
   return getLocalizationFromId(getLocalizationId(locName));
 }
@@ -2733,10 +2733,10 @@ namespace ParaMEDMEMImpl
   class LocFinder
   {
   public:
-    LocFinder(const char *loc):_loc(loc) { }
+    LocFinder(const std::string& loc):_loc(loc) { }
     bool operator() (const MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc>& loc) { return loc->isName(_loc); }
   private:
-    const char *_loc;
+    const std::string &_loc;
   };
 
   class PflFinder
@@ -2749,7 +2749,7 @@ namespace ParaMEDMEMImpl
   };
 }
 
-int MEDFileFieldGlobs::getLocalizationId(const char *loc) const
+int MEDFileFieldGlobs::getLocalizationId(const std::string& loc) const
 {
   std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileFieldLoc> >::const_iterator it=std::find_if(_locs.begin(),_locs.end(),ParaMEDMEMImpl::LocFinder(loc));
   if(it==_locs.end())
@@ -2765,7 +2765,7 @@ int MEDFileFieldGlobs::getLocalizationId(const char *loc) const
 /*!
  * The returned value is never null.
  */
-const DataArrayInt *MEDFileFieldGlobs::getProfile(const char *pflName) const
+const DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName) const
 {
   std::string pflNameCpp(pflName);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::const_iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp));
@@ -2793,7 +2793,7 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalizationFromId(int locId)
   return *_locs[locId];
 }
 
-MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const char *locName)
+MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const std::string& locName)
 {
   return getLocalizationFromId(getLocalizationId(locName));
 }
@@ -2801,7 +2801,7 @@ MEDFileFieldLoc& MEDFileFieldGlobs::getLocalization(const char *locName)
 /*!
  * The returned value is never null.
  */
-DataArrayInt *MEDFileFieldGlobs::getProfile(const char *pflName)
+DataArrayInt *MEDFileFieldGlobs::getProfile(const std::string& pflName)
 {
   std::string pflNameCpp(pflName);
   std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> >::iterator it=std::find_if(_pfls.begin(),_pfls.end(),ParaMEDMEMImpl::PflFinder(pflNameCpp));
@@ -2864,14 +2864,14 @@ std::vector<std::string> MEDFileFieldGlobs::getLocs() const
   return ret;
 }
 
-bool MEDFileFieldGlobs::existsPfl(const char *pflName) const
+bool MEDFileFieldGlobs::existsPfl(const std::string& pflName) const
 {
   std::vector<std::string> v=getPfls();
   std::string s(pflName);
   return std::find(v.begin(),v.end(),s)!=v.end();
 }
 
-bool MEDFileFieldGlobs::existsLoc(const char *locName) const
+bool MEDFileFieldGlobs::existsLoc(const std::string& locName) const
 {
   std::vector<std::string> v=getLocs();
   std::string s(locName);
@@ -2941,7 +2941,7 @@ void MEDFileFieldGlobs::appendProfile(DataArrayInt *pfl)
   _pfls.push_back(pfl);
 }
 
-void MEDFileFieldGlobs::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
+void MEDFileFieldGlobs::appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
 {
   std::string name(locName);
   if(name.empty())
@@ -2971,7 +2971,7 @@ std::string MEDFileFieldGlobs::createNewNameOfLoc() const
   return CreateNewNameNotIn("NewLoc_",names);
 }
 
-std::string MEDFileFieldGlobs::CreateNewNameNotIn(const char *prefix, const std::vector<std::string>& namesToAvoid)
+std::string MEDFileFieldGlobs::CreateNewNameNotIn(const std::string& prefix, const std::vector<std::string>& namesToAvoid)
 {
   for(std::size_t sz=0;sz<100000;sz++)
     {
@@ -2987,7 +2987,7 @@ std::string MEDFileFieldGlobs::CreateNewNameNotIn(const char *prefix, const std:
  * Creates a MEDFileFieldGlobsReal on a given file name. Nothing is read here.
  *  \param [in] fname - the file name.
  */
-MEDFileFieldGlobsReal::MEDFileFieldGlobsReal(const char *fname):_globals(MEDFileFieldGlobs::New(fname))
+MEDFileFieldGlobsReal::MEDFileFieldGlobsReal(const std::string& fname):_globals(MEDFileFieldGlobs::New(fname))
 {
 }
 
@@ -3113,7 +3113,7 @@ void MEDFileFieldGlobsReal::checkGlobsLocsPartCoherency() const
   contentNotNull()->checkGlobsLocsPartCoherency(getLocsReallyUsed());
 }
 
-void MEDFileFieldGlobsReal::loadProfileInFile(med_idt fid, int id, const char *pflName)
+void MEDFileFieldGlobsReal::loadProfileInFile(med_idt fid, int id, const std::string& pflName)
 {
   contentNotNull()->loadProfileInFile(fid,id,pflName);
 }
@@ -3163,7 +3163,7 @@ std::vector<std::string> MEDFileFieldGlobsReal::getLocs() const
  *  \param [in] pflName - the profile name of interest.
  *  \return bool - \c true if the profile named \a pflName exists.
  */
-bool MEDFileFieldGlobsReal::existsPfl(const char *pflName) const
+bool MEDFileFieldGlobsReal::existsPfl(const std::string& pflName) const
 {
   return contentNotNull()->existsPfl(pflName);
 }
@@ -3173,7 +3173,7 @@ bool MEDFileFieldGlobsReal::existsPfl(const char *pflName) const
  *  \param [in] locName - the localization name of interest.
  *  \return bool - \c true if the localization named \a locName exists.
  */
-bool MEDFileFieldGlobsReal::existsLoc(const char *locName) const
+bool MEDFileFieldGlobsReal::existsLoc(const std::string& locName) const
 {
   return contentNotNull()->existsLoc(locName);
 }
@@ -3192,7 +3192,7 @@ std::string MEDFileFieldGlobsReal::createNewNameOfLoc() const
  * Sets the name of a MED file.
  *  \param [inout] fileName - the file name.
  */
-void MEDFileFieldGlobsReal::setFileName(const char *fileName)
+void MEDFileFieldGlobsReal::setFileName(const std::string& fileName)
 {
   contentNotNull()->setFileName(fileName);
 }
@@ -3285,7 +3285,7 @@ void MEDFileFieldGlobsReal::changeLocsNames(const std::vector< std::pair<std::ve
  *  \param [in] newName - a new name of the profile.
  * \sa changePflsNames().
  */
-void MEDFileFieldGlobsReal::changePflName(const char *oldName, const char *newName)
+void MEDFileFieldGlobsReal::changePflName(const std::string& oldName, const std::string& newName)
 {
   std::vector< std::pair<std::vector<std::string>, std::string > > mapOfModif(1);
   std::pair<std::vector<std::string>, std::string > p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
@@ -3299,7 +3299,7 @@ void MEDFileFieldGlobsReal::changePflName(const char *oldName, const char *newNa
  *  \param [in] newName - a new name of the localization.
  * \sa changeLocsNames().
  */
-void MEDFileFieldGlobsReal::changeLocName(const char *oldName, const char *newName)
+void MEDFileFieldGlobsReal::changeLocName(const std::string& oldName, const std::string& newName)
 {
   std::vector< std::pair<std::vector<std::string>, std::string > > mapOfModif(1);
   std::pair<std::vector<std::string>, std::string > p(std::vector<std::string>(1,std::string(oldName)),std::string(newName));
@@ -3384,16 +3384,16 @@ int MEDFileFieldGlobsReal::getNbOfGaussPtPerCell(int locId) const
  *  \return int - the id of the localization.
  *  \throw If there is no a localization named \a loc.
  */
-int MEDFileFieldGlobsReal::getLocalizationId(const char *loc) const
+int MEDFileFieldGlobsReal::getLocalizationId(const std::string& loc) const
 {
   return contentNotNull()->getLocalizationId(loc);
 }
 
 /*!
  * Returns the name of the MED file.
- *  \return const char * - the MED file name.
+ *  \return const std::string&  - the MED file name.
  */
-const char *MEDFileFieldGlobsReal::getFileName() const
+std::string MEDFileFieldGlobsReal::getFileName() const
 {
   return contentNotNull()->getFileName();
 }
@@ -3409,7 +3409,7 @@ std::string MEDFileFieldGlobsReal::getFileName2() const
  *  \return const MEDFileFieldLoc& - the localization object having the name \a locName.
  *  \throw If there is no a localization named \a locName.
  */
-const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName) const
+const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const std::string& locName) const
 {
   return contentNotNull()->getLocalization(locName);
 }
@@ -3431,7 +3431,7 @@ const MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId) c
  *  \return const DataArrayInt * - the profile array having the name \a pflName.
  *  \throw If there is no a profile named \a pflName.
  */
-const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName) const
+const DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName) const
 {
   return contentNotNull()->getProfile(pflName);
 }
@@ -3466,7 +3466,7 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalizationFromId(int locId)
  *          having the name \a locName.
  *  \throw If there is no a localization named \a locName.
  */
-MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName)
+MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const std::string& locName)
 {
   return contentNotNull()->getLocalization(locName);
 }
@@ -3477,7 +3477,7 @@ MEDFileFieldLoc& MEDFileFieldGlobsReal::getLocalization(const char *locName)
  *  \return DataArrayInt * - a non-const pointer to the profile array having the name \a pflName.
  *  \throw If there is no a profile named \a pflName.
  */
-DataArrayInt *MEDFileFieldGlobsReal::getProfile(const char *pflName)
+DataArrayInt *MEDFileFieldGlobsReal::getProfile(const std::string& pflName)
 {
   return contentNotNull()->getProfile(pflName);
 }
@@ -3536,7 +3536,7 @@ void MEDFileFieldGlobsReal::appendProfile(DataArrayInt *pfl)
  *  \throw If a localization with the name \a locName already exists but is
  *         different form the new one.
  */
-void MEDFileFieldGlobsReal::appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
+void MEDFileFieldGlobsReal::appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w)
 {
   contentNotNull()->appendLoc(locName,geoType,refCoo,gsCoo,w);
 }
@@ -3563,7 +3563,7 @@ MEDFileFieldNameScope::MEDFileFieldNameScope()
 {
 }
 
-MEDFileFieldNameScope::MEDFileFieldNameScope(const char *fieldName):_name(fieldName)
+MEDFileFieldNameScope::MEDFileFieldNameScope(const std::string& fieldName):_name(fieldName)
 {
 }
 
@@ -3580,7 +3580,7 @@ std::string MEDFileFieldNameScope::getName() const
  * Sets name of \a this field
  *  \param [in] name - the new field name.
  */
-void MEDFileFieldNameScope::setName(const char *fieldName)
+void MEDFileFieldNameScope::setName(const std::string& fieldName)
 {
   _name=fieldName;
 }
@@ -3590,7 +3590,7 @@ std::string MEDFileFieldNameScope::getDtUnit() const
   return _dt_unit;
 }
 
-void MEDFileFieldNameScope::setDtUnit(const char *dtUnit)
+void MEDFileFieldNameScope::setDtUnit(const std::string& dtUnit)
 {
   _dt_unit=dtUnit;
 }
@@ -3691,7 +3691,7 @@ std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>
   return ret;
 }
 
-MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit),_nb_of_tuples_to_be_allocated(-2)
+MEDFileAnyTypeField1TSWithoutSDA::MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order):MEDFileFieldNameScope(fieldName),_iteration(iteration),_order(order),_csit(csit),_nb_of_tuples_to_be_allocated(-2)
 {
 }
 
@@ -3724,7 +3724,7 @@ std::string MEDFileAnyTypeField1TSWithoutSDA::getMeshName() const
   return _field_per_mesh[0]->getMeshName();
 }
 
-void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const char *newMeshName)
+void MEDFileAnyTypeField1TSWithoutSDA::setMeshName(const std::string& newMeshName)
 {
   std::string oldName(getMeshName());
   std::vector< std::pair<std::string,std::string> > v(1);
@@ -3932,10 +3932,10 @@ void MEDFileAnyTypeField1TSWithoutSDA::changeLocsRefsNamesGen2(const std::vector
  *          Length of this and of nested sequences is the same as that of \a typesF.
  *  \throw If no field is lying on \a mname.
  */
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeField1TSWithoutSDA::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
   int meshId=0;
-  if(mname)
+  if(!mname.empty())
     meshId=getMeshIdFromMeshName(mname);
   else
     if(_field_per_mesh.empty())
@@ -3984,7 +3984,7 @@ std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeField1TSWithoutSD
  *  \return int - the maximal absolute dimension of elements \a this fields lies on.
  *  \throw If no field is lying on \a mname.
  */
-int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::vector<int>& levs) const
+int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const
 {
   levs.clear();
   int meshId=getMeshIdFromMeshName(mname);
@@ -4016,7 +4016,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::getNonEmptyLevels(const char *mname, std::
  * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
  *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
  */
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId)
 {
   int mid=getMeshIdFromMeshName(mName);
   return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
@@ -4028,7 +4028,7 @@ MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGive
  * \param [in] locId is the localization id to find the right MEDFileFieldPerMeshPerTypePerDisc instance to set. It corresponds to the position of 
  *             \c pfls[std::distance(types.begin(),std::find(types.begin(),typ)] vector in MEDFileField1TSWithoutSDA::getFieldSplitedByType. For non gausspoints field users, the value is 0.
  */
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const
 {
   int mid=getMeshIdFromMeshName(mName);
   return _field_per_mesh[mid]->getLeafGivenTypeAndLocId(typ,locId);
@@ -4037,11 +4037,11 @@ const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TSWithoutSDA::getLe
 /*!
  * \param [in] mName specifies the underlying mesh name. This value can be pointer 0 for users that do not deal with fields on multi mesh.
  */
-int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const char *mName) const
+int MEDFileAnyTypeField1TSWithoutSDA::getMeshIdFromMeshName(const std::string& mName) const
 {
   if(_field_per_mesh.empty())
     throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::getMeshIdFromMeshName : No field set !");
-  if(mName==0)
+  if(mName.empty())
     return 0;
   std::string mName2(mName);
   int ret=0;
@@ -4078,7 +4078,7 @@ int MEDFileAnyTypeField1TSWithoutSDA::addNewEntryIfNecessary(const MEDCouplingMe
   return sz;
 }
 
-bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileAnyTypeField1TSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
                                                             MEDFileFieldGlobsReal& glob)
 {
   bool ret=false;
@@ -4126,16 +4126,24 @@ void MEDFileAnyTypeField1TSWithoutSDA::updateData(int newLgth, const std::vector
   if(_nb_of_tuples_to_be_allocated>=0)
     {
       _nb_of_tuples_to_be_allocated=newLgth;
+      const DataArray *oldArr(getUndergroundDataArray());
+      if(oldArr)
+        {
+          MEDCouplingAutoRefCountObjectPtr<DataArray> newArr(createNewEmptyDataArrayInstance());
+          newArr->setInfoAndChangeNbOfCompo(oldArr->getInfoOnComponents());
+          setArray(newArr);
+          _nb_of_tuples_to_be_allocated=newLgth;//force the _nb_of_tuples_to_be_allocated because setArray has been used specialy
+        }
       return ;
     }
   if(_nb_of_tuples_to_be_allocated==-1)
     return ;
   if(_nb_of_tuples_to_be_allocated==-2 || _nb_of_tuples_to_be_allocated==-3)
     {
-      const DataArray *oldArr=getUndergroundDataArray();
+      const DataArray *oldArr(getUndergroundDataArray());
       if(!oldArr || !oldArr->isAllocated())
         throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::updateData : internal error 1 !");
-      MEDCouplingAutoRefCountObjectPtr<DataArray> newArr=createNewEmptyDataArrayInstance();
+      MEDCouplingAutoRefCountObjectPtr<DataArray> newArr(createNewEmptyDataArrayInstance());
       newArr->alloc(newLgth,getNumberOfComponents());
       if(oldArr)
         newArr->copyStringInfoFrom(*oldArr);
@@ -4474,10 +4482,10 @@ std::vector<std::string>& MEDFileAnyTypeField1TSWithoutSDA::getInfo()
  *  \throw If no field of \a this is lying on the mesh \a mName.
  *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
  */
-MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
-  if(mName==0)
+  if(mName.empty())
     mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
   else
     mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder());
@@ -4534,10 +4542,10 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(
  *  \throw If there are no mesh entities in the mesh.
  *  \throw If no field values of the given \a type are available.
  */
-MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
+MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
 {
-   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
-  if(mName==0)
+  MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
+  if(mName.empty())
     mm=MEDFileMesh::New(glob->getFileName(),getMeshName().c_str(),getMeshIteration(),getMeshOrder());
   else
     mm=MEDFileMesh::New(glob->getFileName(),mName,getMeshIteration(),getMeshOrder());
@@ -4571,7 +4579,7 @@ MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldAtTopLevel(Typ
 MEDCouplingFieldDouble *MEDFileAnyTypeField1TSWithoutSDA::getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr<DataArray>& arrOut, const MEDFileFieldNameScope& nasc) const
 {
   static const char msg1[]="MEDFileField1TSWithoutSDA::getFieldOnMeshAtLevel : request for a renumbered field following mesh numbering whereas it is a profile field !";
-  int meshId=getMeshIdFromMeshName(mesh->getName().c_str());
+  int meshId=getMeshIdFromMeshName(mesh->getName());
   bool isPfl=false;
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=_field_per_mesh[meshId]->getFieldOnMeshAtLevel(type,glob,mesh,isPfl,arrOut,nasc);
   switch(renumPol)
@@ -4712,7 +4720,7 @@ std::vector<int> MEDFileField1TSWithoutSDA::CheckSBTMesh(const MEDCouplingMesh *
   return code;
 }
 
-MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos)
+MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos)
 {
   return new MEDFileField1TSWithoutSDA(fieldName,csit,iteration,order,infos);
 }
@@ -4751,10 +4759,10 @@ MEDFileField1TSWithoutSDA *MEDFileField1TSWithoutSDA::New(const char *fieldName,
  *          Length of this and of nested sequences is the same as that of \a typesF.
  *  \throw If no field is lying on \a mname.
  */
-std::vector< std::vector<DataArrayDouble *> > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector<DataArrayDouble *> > MEDFileField1TSWithoutSDA::getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
   int meshId=0;
-  if(mname)
+  if(!mname.empty())
     meshId=getMeshIdFromMeshName(mname);
   else
     if(_field_per_mesh.empty())
@@ -4870,7 +4878,7 @@ DataArray *MEDFileField1TSWithoutSDA::getUndergroundDataArrayExt(std::vector< st
   return getUndergroundDataArrayDoubleExt(entries);
 }
 
-MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order,
+MEDFileField1TSWithoutSDA::MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order,
                                                      const std::vector<std::string>& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order)
 {
   DataArrayDouble *arr=getOrCreateAndGetArrayDouble();
@@ -4949,7 +4957,7 @@ const DataArray *MEDFileField1TSWithoutSDA::getOrCreateAndGetArray() const
 
 //= MEDFileIntField1TSWithoutSDA
 
-MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const char *fieldName, int csit, int iteration, int order,
+MEDFileIntField1TSWithoutSDA *MEDFileIntField1TSWithoutSDA::New(const std::string& fieldName, int csit, int iteration, int order,
                                                                 const std::vector<std::string>& infos)
 {
   return new MEDFileIntField1TSWithoutSDA(fieldName,csit,iteration,order,infos);
@@ -4959,7 +4967,7 @@ MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA():MEDFileAnyTypeField
 {
 }
 
-MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order,
+MEDFileIntField1TSWithoutSDA::MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order,
                                                            const std::vector<std::string>& infos):MEDFileAnyTypeField1TSWithoutSDA(fieldName,csit,iteration,order)
 {
   DataArrayInt *arr=getOrCreateAndGetArrayInt();
@@ -5132,7 +5140,7 @@ MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS()
 
 //= MEDFileAnyTypeField1TS
 
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, bool loadAll)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll)
 {
   med_field_type typcha;
   //
@@ -5173,11 +5181,11 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
   return ret.retn();
 }
 
-MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, bool loadAll)
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, bool loadAll)
 try:MEDFileFieldGlobsReal(fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   _content=BuildContentFrom(fid,fileName,loadAll);
   loadGlobals(fid);
 }
@@ -5186,7 +5194,7 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   med_field_type typcha;
   std::vector<std::string> infos;
@@ -5223,7 +5231,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
   //
   med_int numdt,numit;
   med_float dt;
-  MEDfieldComputingStepInfo(fid,fieldName,1,&numdt,&numit,&dt);
+  MEDfieldComputingStepInfo(fid,fieldName.c_str(),1,&numdt,&numit,&dt);
   ret->setTime(numdt,numit,dt);
   ret->_csit=1;
   if(loadAll)
@@ -5233,11 +5241,11 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
   return ret.retn();
 }
 
-MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll)
 try:MEDFileFieldGlobsReal(fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   _content=BuildContentFrom(fid,fileName,fieldName,loadAll);
   loadGlobals(fid);
 }
@@ -5246,7 +5254,7 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const char *fileName)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const std::string& fileName)
 {
   if(!c)
     throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
@@ -5267,37 +5275,37 @@ MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::BuildNewInstanceFromContent(MEDF
   throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
 }
 
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, bool loadAll)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, bool loadAll)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
   ret->loadGlobals(fid);
   return ret.retn();
 }
 
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,loadAll);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
   ret->loadGlobals(fid);
   return ret.retn();
 }
 
-MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll)
+MEDFileAnyTypeField1TS *MEDFileAnyTypeField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TS> ret=BuildNewInstanceFromContent(c,fileName);
   ret->loadGlobals(fid);
   return ret.retn();
 }
 
-MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order, bool loadAll)
+MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
 {
   med_field_type typcha;
   std::vector<std::string> infos;
@@ -5332,7 +5340,7 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
     {
       med_int numdt,numit;
       med_float dt;
-      MEDfieldComputingStepInfo(fid,fieldName,i+1,&numdt,&numit,&dt);
+      MEDfieldComputingStepInfo(fid,fieldName.c_str(),i+1,&numdt,&numit,&dt);
       if(numdt==iteration && numit==order)
         {
           found=true;
@@ -5355,12 +5363,12 @@ MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::BuildContentFrom(med_i
   return ret.retn();
 }
 
-MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll)
+MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
 try:MEDFileFieldGlobsReal(fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
-  _content=BuildContentFrom(fid,fileName,fieldName,iteration,order,loadAll);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+  _content=BuildContentFrom(fid,fileName.c_str(),fieldName.c_str(),iteration,order,loadAll);
   loadGlobals(fid);
 }
 catch(INTERP_KERNEL::Exception& e)
@@ -5388,7 +5396,7 @@ MEDFileAnyTypeField1TS::MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWitho
     }
 }
 
-int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const char *fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut)
+int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const std::string& fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut)
 {
   if(checkFieldId)
     {
@@ -5422,7 +5430,7 @@ int MEDFileAnyTypeField1TS::LocateField2(med_idt fid, const char *fileName, int
  * \param [out]
  * \return in case of success the number of time steps available for the field with name \a fieldName.
  */
-int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const char *fileName, const char *fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut)
+int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const std::string& fileName, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut)
 {
   int nbFields=MEDnField(fid);
   bool found=false;
@@ -5465,7 +5473,7 @@ int MEDFileAnyTypeField1TS::LocateField(med_idt fid, const char *fileName, const
  * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newPflName already exists. If true, the renaming is done without check. It can lead to major bug.
  *             If false, an exception will be thrown to force user to change previously the name of the profile with name \b newPflName
  */
-void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob)
+void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob)
 {
   MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
   std::string oldPflName=disc->getProfile();
@@ -5503,7 +5511,7 @@ void MEDFileAnyTypeField1TS::setProfileNameOnLeaf(const char *mName, INTERP_KERN
  * \param [in] forceRenameOnGlob specifies the behaviour in case of profile \b newLocName already exists. If true, the renaming is done without check. It can lead to major bug.
  *             If false, an exception will be thrown to force user to change previously the name of the profile with name \b newLocName
  */
-void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob)
+void MEDFileAnyTypeField1TS::setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob)
 {
   MEDFileFieldPerMeshPerTypePerDisc *disc=getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
   std::string oldLocName=disc->getLocalization();
@@ -5549,10 +5557,10 @@ const MEDFileAnyTypeField1TSWithoutSDA *MEDFileAnyTypeField1TS::contentNotNullBa
  *  \throw If no field data is set.
  *  \throw If \a mode == 1 and the same data is present in an existing file.
  */
-void MEDFileAnyTypeField1TS::write(const char *fileName, int mode) const
+void MEDFileAnyTypeField1TS::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   writeLL(fid);
 }
 
@@ -5566,21 +5574,26 @@ void MEDFileAnyTypeField1TS::write(const char *fileName, int mode) const
  */
 void MEDFileAnyTypeField1TS::loadArrays()
 {
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+  if(getFileName().empty())
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TS::loadArrays : the structure does not come from a file !");
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
   contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
 }
 
 /*!
  * This method behaves as MEDFileAnyTypeField1TS::loadArrays does, the first call, if \a this was built using a file without loading big arrays.
- * But once data loaded once, this method does nothing.
+ * But once data loaded once, this method does nothing. Contrary to MEDFileAnyTypeField1TS::loadArrays and MEDFileAnyTypeField1TS::unloadArrays
+ * this method does not throw if \a this does not come from file read.
  * 
- * \throw If the fileName is not set or points to a non readable MED file.
  * \sa MEDFileAnyTypeField1TS::loadArrays, MEDFileAnyTypeField1TS::unloadArrays
  */
 void MEDFileAnyTypeField1TS::loadArraysIfNecessary()
 {
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
-  contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+  if(!getFileName().empty())
+    {
+      MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
+      contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+    }
 }
 
 /*!
@@ -5716,7 +5729,7 @@ std::string MEDFileAnyTypeField1TS::getName() const
   return contentNotNullBase()->getName();
 }
 
-void MEDFileAnyTypeField1TS::setName(const char *name)
+void MEDFileAnyTypeField1TS::setName(const std::string& name)
 {
   contentNotNullBase()->setName(name);
 }
@@ -5731,7 +5744,7 @@ std::string MEDFileAnyTypeField1TS::getDtUnit() const
   return contentNotNullBase()->getDtUnit();
 }
 
-void MEDFileAnyTypeField1TS::setDtUnit(const char *dtUnit)
+void MEDFileAnyTypeField1TS::setDtUnit(const std::string& dtUnit)
 {
   contentNotNullBase()->setDtUnit(dtUnit);
 }
@@ -5741,7 +5754,7 @@ std::string MEDFileAnyTypeField1TS::getMeshName() const
   return contentNotNullBase()->getMeshName();
 }
 
-void MEDFileAnyTypeField1TS::setMeshName(const char *newMeshName)
+void MEDFileAnyTypeField1TS::setMeshName(const std::string& newMeshName)
 {
   contentNotNullBase()->setMeshName(newMeshName);
 }
@@ -5800,17 +5813,17 @@ std::vector<std::string>& MEDFileAnyTypeField1TS::getInfo()
   return contentNotNullBase()->getInfo();
 }
 
-MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId)
+MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId)
 {
   return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
 }
 
-const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const
+const MEDFileFieldPerMeshPerTypePerDisc *MEDFileAnyTypeField1TS::getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const
 {
   return contentNotNullBase()->getLeafGivenMeshAndTypeAndLocId(mName,typ,locId);
 }
 
-int MEDFileAnyTypeField1TS::getNonEmptyLevels(const char *mname, std::vector<int>& levs) const
+int MEDFileAnyTypeField1TS::getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const
 {
   return contentNotNullBase()->getNonEmptyLevels(mname,levs);
 }
@@ -5820,7 +5833,7 @@ std::vector<TypeOfField> MEDFileAnyTypeField1TS::getTypesOfFieldAvailable() cons
   return contentNotNullBase()->getTypesOfFieldAvailable();
 }
 
-std::vector< std::vector<std::pair<int,int> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+std::vector< std::vector<std::pair<int,int> > > MEDFileAnyTypeField1TS::getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
                                                                                        std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception)
 {
   return contentNotNullBase()->getFieldSplitedByType(mname,types,typesF,pfls,locs);
@@ -5891,7 +5904,7 @@ int MEDFileAnyTypeField1TS::copyTinyInfoFrom(const MEDCouplingFieldDouble *field
  *          is to delete this field using decrRef() as it is no more needed.
  *  \throw If reading the file fails.
  */
-MEDFileField1TS *MEDFileField1TS::New(const char *fileName, bool loadAll)
+MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,loadAll);
   ret->contentNotNull();
@@ -5908,7 +5921,7 @@ MEDFileField1TS *MEDFileField1TS::New(const char *fileName, bool loadAll)
  *  \throw If reading the file fails.
  *  \throw If there is no field named \a fieldName in the file.
  */
-MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName,loadAll);
   ret->contentNotNull();
@@ -5928,7 +5941,7 @@ MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldNam
  *  \throw If there is no field named \a fieldName in the file.
  *  \throw If the required time step is missing from the file.
  */
-MEDFileField1TS *MEDFileField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll)
+MEDFileField1TS *MEDFileField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret=new MEDFileField1TS(fileName,fieldName,iteration,order,loadAll);
   ret->contentNotNull();
@@ -6040,21 +6053,21 @@ DataArrayDouble *MEDFileField1TS::ReturnSafelyDataArrayDouble(MEDCouplingAutoRef
   return arrOutC;
 }
 
-MEDFileField1TS::MEDFileField1TS(const char *fileName, bool loadAll)
+MEDFileField1TS::MEDFileField1TS(const std::string& fileName, bool loadAll)
 try:MEDFileAnyTypeField1TS(fileName,loadAll)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
   { throw e; }
 
-MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll)
 try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
   { throw e; }
 
-MEDFileField1TS::MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll)
+MEDFileField1TS::MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
 try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll)
 {
 }
@@ -6107,7 +6120,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevel(TypeOfField type, int m
   if(getFileName2().empty())
     throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut,*contentNotNull());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNull());
   MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
   return ret.retn();
 }
@@ -6139,7 +6152,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtTopLevel(TypeOfField type, in
   if(getFileName2().empty())
     throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,0,renumPol,this,arrOut,*contentNotNull());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNull());
   MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
   return ret.retn();
 }
@@ -6227,7 +6240,7 @@ MEDCouplingFieldDouble *MEDFileField1TS::getFieldOnMeshAtLevel(TypeOfField type,
  *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
  *  \sa getFieldAtLevel()
  */
-MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol) const
+MEDCouplingFieldDouble *MEDFileField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol) const
 {
   if(getFileName2().empty())
     throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
@@ -6321,7 +6334,7 @@ DataArrayDouble *MEDFileField1TS::getUndergroundDataArrayExt(std::vector< std::p
   return contentNotNull()->getUndergroundDataArrayDoubleExt(entries);
 }
 
-std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+std::vector< std::vector<DataArrayDouble *> > MEDFileField1TS::getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
                                                                                       std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception)
 {
   return contentNotNull()->getFieldSplitedByType2(mname,types,typesF,pfls,locs);
@@ -6336,21 +6349,21 @@ MEDFileIntField1TS *MEDFileIntField1TS::New()
   return ret.retn();
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, bool loadAll)
+MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,loadAll);
   ret->contentNotNull();
   return ret.retn();
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName,loadAll);
   ret->contentNotNull();
   return ret.retn();
 }
 
-MEDFileIntField1TS *MEDFileIntField1TS::New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll)
+MEDFileIntField1TS *MEDFileIntField1TS::New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret=new MEDFileIntField1TS(fileName,fieldName,iteration,order,loadAll);
   ret->contentNotNull();
@@ -6369,21 +6382,21 @@ MEDFileIntField1TS::MEDFileIntField1TS()
   _content=new MEDFileIntField1TSWithoutSDA;
 }
 
-MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, bool loadAll)
+MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, bool loadAll)
 try:MEDFileAnyTypeField1TS(fileName,loadAll)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
   { throw e; }
 
-MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll)
 try:MEDFileAnyTypeField1TS(fileName,fieldName,loadAll)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
   { throw e; }
 
-MEDFileIntField1TS::MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll)
+MEDFileIntField1TS::MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll)
 try:MEDFileAnyTypeField1TS(fileName,fieldName,iteration,order,loadAll)
 {
 }
@@ -6499,7 +6512,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevel(TypeOfField type, in
   if(getFileName2().empty())
     throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut2;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut2,*contentNotNull());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut2,*contentNotNull());
   DataArrayInt *arrOutC=dynamic_cast<DataArrayInt *>((DataArray *)arrOut2);
   if(!arrOutC)
     throw INTERP_KERNEL::Exception("MEDFileIntField1TS::getFieldAtLevelOld : mismatch between dataArrays type and MEDFileIntField1TS ! Expected int32 !");
@@ -6546,7 +6559,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtTopLevel(TypeOfField type,
   if(getFileName2().empty())
     throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtTopLevel : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtTopLevel method instead !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,0,renumPol,this,arr,*contentNotNull());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=contentNotNull()->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNull());
   arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
   return ret.retn();
 }
@@ -6637,7 +6650,7 @@ MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldOnMeshAtLevel(TypeOfField ty
  *  \throw If no field values of the given \a type or given \a meshDimRelToMax are available.
  *  \sa getFieldAtLevel()
  */
-MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const
+MEDCouplingFieldDouble *MEDFileIntField1TS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const
 {
   if(getFileName2().empty())
     throw INTERP_KERNEL::Exception("MEDFileField1TS::getFieldAtLevelOld : Request for a method that can be used for instances coming from file loading ! Use getFieldOnMeshAtLevel method instead !");
@@ -6691,7 +6704,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA()
 {
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const char *fieldName):MEDFileFieldNameScope(fieldName)
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileFieldNameScope(fieldName)
 {
 }
 
@@ -6707,7 +6720,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_i
   loadStructureOrStructureAndBigArraysRecursively(fid,nbOfStep,typcha,loadAll);
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
+MEDFileAnyTypeFieldMultiTSWithoutSDA::MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
 try:MEDFileFieldNameScope(fieldName),_infos(infos)
 {
   setDtUnit(dtunit.c_str());
@@ -6886,7 +6899,7 @@ std::string MEDFileAnyTypeFieldMultiTSWithoutSDA::getMeshName() const
   return _time_steps[0]->getMeshName();
 }
 
-void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const char *newMeshName)
+void MEDFileAnyTypeFieldMultiTSWithoutSDA::setMeshName(const std::string& newMeshName)
 {
   std::string oldName(getMeshName());
   std::vector< std::pair<std::string,std::string> > v(1);
@@ -6922,7 +6935,7 @@ DataArray *MEDFileAnyTypeFieldMultiTSWithoutSDA::getUndergroundDataArrayExt(int
   return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries);
 }
 
-bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
+bool MEDFileAnyTypeFieldMultiTSWithoutSDA::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N,
                                                                 MEDFileFieldGlobsReal& glob)
 {
   bool ret=false;
@@ -7243,7 +7256,7 @@ std::vector< std::pair<int,int> > MEDFileAnyTypeFieldMultiTSWithoutSDA::getItera
  * To retrieve the highest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+0);//absDim-meshDim+relativeLev
  * To retrieve the lowest level of f2 it should be done, f1->getFieldAtLevel(ON_CELLS,2-3+(-1));//absDim-meshDim+relativeLev
  */
-int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const
+int MEDFileAnyTypeFieldMultiTSWithoutSDA::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
 {
   return getTimeStepEntry(iteration,order).getNonEmptyLevels(mname,levs);
 }
@@ -7362,7 +7375,7 @@ std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTSWithoutSDA::ge
 /*!
  * entry point for users that want to iterate into MEDFile DataStructure without any overhead.
  */
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTSWithoutSDA::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
   return getTimeStepEntry(iteration,order).getFieldSplitedByType(mname,types,typesF,pfls,locs);
 }
@@ -7565,7 +7578,7 @@ void MEDFileAnyTypeFieldMultiTSWithoutSDA::setIteration(int i, MEDCouplingAutoRe
 
 //= MEDFileFieldMultiTSWithoutSDA
 
-MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
+MEDFileFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
 {
   return new MEDFileFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll);
 }
@@ -7574,7 +7587,7 @@ MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA()
 {
 }
 
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const char *fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName)
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName)
 {
 }
 
@@ -7588,7 +7601,7 @@ try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldId,loadAll)
 catch(INTERP_KERNEL::Exception& e)
   { throw e; }
 
-MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
+MEDFileFieldMultiTSWithoutSDA::MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
 try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll)
 {
 }
@@ -7628,7 +7641,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileFieldMultiTSWithoutSDA::createNew()
  * entry point for users that want to iterate into MEDFile DataStructure with a reduced overhead because output arrays are extracted (created) specially
  * for the call of this method. That's why the DataArrayDouble instance in returned vector of vector should be dealed by the caller.
  */
-std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTSWithoutSDA::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
   const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=getTimeStepEntry(iteration,order);
   const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
@@ -7663,11 +7676,11 @@ MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS()
 {
 }
 
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, bool loadAll)
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const std::string& fileName, bool loadAll)
 try:MEDFileFieldGlobsReal(fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   _content=BuildContentFrom(fid,fileName,loadAll);
   loadGlobals(fid);
 }
@@ -7676,7 +7689,7 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll)
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   med_field_type typcha;
   std::vector<std::string> infos;
@@ -7706,7 +7719,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr
   return ret.retn();
 }
 
-MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const char *fileName, bool loadAll)
+MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll)
 {
   med_field_type typcha;
   //
@@ -7736,7 +7749,7 @@ MEDFileAnyTypeFieldMultiTSWithoutSDA *MEDFileAnyTypeFieldMultiTS::BuildContentFr
   return ret.retn();
 }
 
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const char *fileName)
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const std::string& fileName)
 {
   if(!c)
     throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : empty content in input : unable to build a new instance !");
@@ -7757,11 +7770,11 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromCont
   throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::BuildNewInstanceFromContent : internal error ! a content of type different from FLOAT64 and INT32 has been built but not intercepted !");
 }
 
-MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileAnyTypeFieldMultiTS::MEDFileAnyTypeFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll)
 try:MEDFileFieldGlobsReal(fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   _content=BuildContentFrom(fid,fileName,fieldName,loadAll);
   loadGlobals(fid);
 }
@@ -7772,7 +7785,7 @@ catch(INTERP_KERNEL::Exception& e)
 
 //= MEDFileIntFieldMultiTSWithoutSDA
 
-MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
+MEDFileIntFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
 {
   return new MEDFileIntFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll);
 }
@@ -7781,11 +7794,11 @@ MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA()
 {
 }
 
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const char *fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName)
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName):MEDFileAnyTypeFieldMultiTSWithoutSDA(fieldName)
 {
 }
 
-MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
+MEDFileIntFieldMultiTSWithoutSDA::MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll)
 try:MEDFileAnyTypeFieldMultiTSWithoutSDA(fid,fieldName,fieldTyp,infos,nbOfStep,dtunit,loadAll)
 {
 }
@@ -7861,10 +7874,10 @@ MEDFileFieldMultiTSWithoutSDA *MEDFileIntFieldMultiTSWithoutSDA::convertToDouble
  *          is to delete this field using decrRef() as it is no more needed.
  *  \throw If reading the file fails.
  */
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName, bool loadAll)
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, bool loadAll)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,loadAll);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
   ret->loadGlobals(fid);
@@ -7881,10 +7894,10 @@ MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName
  *  \throw If reading the file fails.
  *  \throw If there is no field named \a fieldName in the file.
  */
-MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileAnyTypeFieldMultiTS *MEDFileAnyTypeFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> c=BuildContentFrom(fid,fileName,fieldName,loadAll);
   MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTS> ret=BuildNewInstanceFromContent(c,fileName);
   ret->loadGlobals(fid);
@@ -8035,7 +8048,7 @@ int MEDFileAnyTypeFieldMultiTS::getPosGivenTime(double time, double eps) const
   return contentNotNullBase()->getPosGivenTime(time,eps);
 }
 
-int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const
+int MEDFileAnyTypeFieldMultiTS::getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const
 {
   return contentNotNullBase()->getNonEmptyLevels(iteration,order,mname,levs);
 }
@@ -8045,7 +8058,7 @@ std::vector< std::vector<TypeOfField> > MEDFileAnyTypeFieldMultiTS::getTypesOfFi
   return contentNotNullBase()->getTypesOfFieldAvailable();
 }
 
-std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector< std::pair<int,int> > > MEDFileAnyTypeFieldMultiTS::getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
   return contentNotNullBase()->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
 }
@@ -8055,7 +8068,7 @@ std::string MEDFileAnyTypeFieldMultiTS::getName() const
   return contentNotNullBase()->getName();
 }
 
-void MEDFileAnyTypeFieldMultiTS::setName(const char *name)
+void MEDFileAnyTypeFieldMultiTS::setName(const std::string& name)
 {
   contentNotNullBase()->setName(name);
 }
@@ -8065,7 +8078,7 @@ std::string MEDFileAnyTypeFieldMultiTS::getDtUnit() const
   return contentNotNullBase()->getDtUnit();
 }
 
-void MEDFileAnyTypeFieldMultiTS::setDtUnit(const char *dtUnit)
+void MEDFileAnyTypeFieldMultiTS::setDtUnit(const std::string& dtUnit)
 {
   contentNotNullBase()->setDtUnit(dtUnit);
 }
@@ -8085,7 +8098,7 @@ std::string MEDFileAnyTypeFieldMultiTS::getMeshName() const
   return contentNotNullBase()->getMeshName();
 }
 
-void MEDFileAnyTypeFieldMultiTS::setMeshName(const char *newMeshName)
+void MEDFileAnyTypeFieldMultiTS::setMeshName(const std::string& newMeshName)
 {
   contentNotNullBase()->setMeshName(newMeshName);
 }
@@ -8128,10 +8141,10 @@ void MEDFileAnyTypeFieldMultiTS::writeLL(med_idt fid) const
  *  \throw If no field data is set.
  *  \throw If \a mode == 1 and the same data is present in an existing file.
  */
-void MEDFileAnyTypeFieldMultiTS::write(const char *fileName, int mode) const
+void MEDFileAnyTypeFieldMultiTS::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   writeLL(fid);
 }
 
@@ -8144,7 +8157,9 @@ void MEDFileAnyTypeFieldMultiTS::write(const char *fileName, int mode) const
  */
 void MEDFileAnyTypeFieldMultiTS::loadArrays()
 {
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+  if(getFileName().empty())
+    throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS::loadArrays : the structure does not come from a file !");
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
   contentNotNullBase()->loadBigArraysRecursively(fid,*contentNotNullBase());
 }
 
@@ -8157,8 +8172,11 @@ void MEDFileAnyTypeFieldMultiTS::loadArrays()
  */
 void MEDFileAnyTypeFieldMultiTS::loadArraysIfNecessary()
 {
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
-  contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+  if(!getFileName().empty())
+    {
+      MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
+      contentNotNullBase()->loadBigArraysRecursivelyIfNecessary(fid,*contentNotNullBase());
+    }
 }
 
 /*!
@@ -8511,7 +8529,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New()
  *          is to delete this field using decrRef() as it is no more needed.
  *  \throw If reading the file fails.
  */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, bool loadAll)
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,loadAll);
   ret->contentNotNull();//to check that content type matches with \a this type.
@@ -8528,7 +8546,7 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, bool loadAll
  *  \throw If reading the file fails.
  *  \throw If there is no field named \a fieldName in the file.
  */
-MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret=new MEDFileFieldMultiTS(fileName,fieldName,loadAll);
   ret->contentNotNull();//to check that content type matches with \a this type.
@@ -8650,7 +8668,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevel(TypeOfField type, i
   if(!myF1TSC)
     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting FLOAT64 !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arrOut,*contentNotNullBase());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arrOut,*contentNotNullBase());
   MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
   return ret.retn();
 }
@@ -8682,7 +8700,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtTopLevel(TypeOfField type
   if(!myF1TSC)
     throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::getFieldAtTopLevel : mismatch of type of field !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arrOut;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,0,renumPol,this,arrOut,*contentNotNullBase());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arrOut,*contentNotNullBase());
   MEDFileField1TS::SetDataArrayDoubleInField(ret,arrOut);
   return ret.retn();
 }
@@ -8758,7 +8776,7 @@ MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldOnMeshAtLevel(TypeOfField t
  * This method is called 'old' because the user should give the mesh name he wants to use for it's field.
  * This method is useful for MED2 file format when field on different mesh was autorized.
  */
-MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol) const
+MEDCouplingFieldDouble *MEDFileFieldMultiTS::getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol) const
 {
   const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
   const MEDFileField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileField1TSWithoutSDA *>(&myF1TS);
@@ -8876,14 +8894,14 @@ MEDFileFieldMultiTS::MEDFileFieldMultiTS()
   _content=new MEDFileFieldMultiTSWithoutSDA;
 }
 
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, bool loadAll)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const std::string& fileName, bool loadAll)
 try:MEDFileAnyTypeFieldMultiTS(fileName,loadAll)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
   { throw e; }
 
-MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll)
 try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll)
 {
 }
@@ -8894,7 +8912,7 @@ MEDFileFieldMultiTS::MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& ot
 {
 }
 
-std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
+std::vector< std::vector<DataArrayDouble *> > MEDFileFieldMultiTS::getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const
 {
   return contentNotNull()->getFieldSplitedByType2(iteration,order,mname,types,typesF,pfls,locs);
 }
@@ -8958,7 +8976,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New()
  *          is to delete this field using decrRef() as it is no more needed.
  *  \throw If reading the file fails.
  */
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, bool loadAll)
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,loadAll);
   ret->contentNotNull();//to check that content type matches with \a this type.
@@ -8975,7 +8993,7 @@ MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, bool l
  *  \throw If reading the file fails.
  *  \throw If there is no field named \a fieldName in the file.
  */
-MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileIntFieldMultiTS *MEDFileIntFieldMultiTS::New(const std::string& fileName, const std::string& fieldName, bool loadAll)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret=new MEDFileIntFieldMultiTS(fileName,fieldName,loadAll);
   ret->contentNotNull();//to check that content type matches with \a this type.
@@ -9072,7 +9090,7 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevel(TypeOfField type
   if(!myF1TSC)
     throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtLevel : mismatch of type of field expecting INT32 !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,0,renumPol,this,arr,*contentNotNullBase());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtLevel(type,meshDimRelToMax,std::string(),renumPol,this,arr,*contentNotNullBase());
   arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
   return ret.retn();
 }
@@ -9105,7 +9123,7 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtTopLevel(TypeOfField t
   if(!myF1TSC)
     throw INTERP_KERNEL::Exception("MEDFileIntFieldMultiTS::getFieldAtTopLevel : mismatch of type of field ! INT32 expected !");
   MEDCouplingAutoRefCountObjectPtr<DataArray> arr;
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,0,renumPol,this,arr,*contentNotNullBase());
+  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=myF1TSC->getFieldAtTopLevel(type,std::string(),renumPol,this,arr,*contentNotNullBase());
   arrOut=MEDFileIntField1TS::ReturnSafelyDataArrayInt(arr);
   return ret.retn();
 }
@@ -9183,7 +9201,7 @@ MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel(TypeOfFiel
  * This method is called 'old' because the user should give the mesh name he wants to use for it's field.
  * This method is useful for MED2 file format when field on different mesh was autorized.
  */
-MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const
+MEDCouplingFieldDouble *MEDFileIntFieldMultiTS::getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol) const
 {
   const MEDFileAnyTypeField1TSWithoutSDA& myF1TS=contentNotNullBase()->getTimeStepEntry(iteration,order);
   const MEDFileIntField1TSWithoutSDA *myF1TSC=dynamic_cast<const MEDFileIntField1TSWithoutSDA *>(&myF1TS);
@@ -9326,14 +9344,14 @@ MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWitho
 {
 }
 
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, bool loadAll)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll)
 try:MEDFileAnyTypeFieldMultiTS(fileName,loadAll)
 {
 }
 catch(INTERP_KERNEL::Exception& e)
   { throw e; }
 
-MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll)
+MEDFileIntFieldMultiTS::MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll)
 try:MEDFileAnyTypeFieldMultiTS(fileName,fieldName,loadAll)
 {
 }
@@ -9352,7 +9370,7 @@ MEDFileFields *MEDFileFields::New()
   return new MEDFileFields;
 }
 
-MEDFileFields *MEDFileFields::New(const char *fileName, bool loadAll)
+MEDFileFields *MEDFileFields::New(const std::string& fileName, bool loadAll)
 {
   return new MEDFileFields(fileName,loadAll);
 }
@@ -9516,11 +9534,11 @@ MEDFileFields::MEDFileFields()
 {
 }
 
-MEDFileFields::MEDFileFields(const char *fileName, bool loadAll)
+MEDFileFields::MEDFileFields(const std::string& fileName, bool loadAll)
 try:MEDFileFieldGlobsReal(fileName)
   {
     MEDFileUtilities::CheckFileForRead(fileName);
-    MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+    MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
     int nbFields=MEDnField(fid);
     _fields.resize(nbFields);
     med_field_type typcha;
@@ -9571,10 +9589,10 @@ void MEDFileFields::writeLL(med_idt fid) const
     }
 }
 
-void MEDFileFields::write(const char *fileName, int mode) const
+void MEDFileFields::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid(MEDfileOpen(fileName.c_str(),medmod));
   writeLL(fid);
 }
 
@@ -9587,7 +9605,9 @@ void MEDFileFields::write(const char *fileName, int mode) const
  */
 void MEDFileFields::loadArrays()
 {
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
+  if(getFileName().empty())
+    throw INTERP_KERNEL::Exception("MEDFileFields::loadArrays : the structure does not come from a file !");
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
     {
       MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
@@ -9605,12 +9625,15 @@ void MEDFileFields::loadArrays()
  */
 void MEDFileFields::loadArraysIfNecessary()
 {
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
-  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+  if(!getFileName().empty())
     {
-      MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
-      if(elt)
-        elt->loadBigArraysRecursivelyIfNecessary(fid,*elt);
+      MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName().c_str(),MED_ACC_RDONLY);
+      for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
+        {
+          MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
+          if(elt)
+            elt->loadBigArraysRecursivelyIfNecessary(fid,*elt);
+        }
     }
 }
 
@@ -9622,7 +9645,6 @@ void MEDFileFields::loadArraysIfNecessary()
  */
 void MEDFileFields::unloadArrays()
 {
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(getFileName(),MED_ACC_RDONLY);
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
     {
       MEDFileAnyTypeFieldMultiTSWithoutSDA *elt(*it);
@@ -9797,7 +9819,7 @@ bool MEDFileFields::changeMeshNames(const std::vector< std::pair<std::string,std
  * \return If true a renumbering has been performed. The structure in \a this has been modified. If false, nothing has been done: it is typically the case if \a meshName is not refered by any 
  *         field in \a this.
  */
-bool MEDFileFields::renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N)
+bool MEDFileFields::renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N)
 {
   bool ret=false;
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::iterator it=_fields.begin();it!=_fields.end();it++)
@@ -9861,7 +9883,7 @@ MEDFileFields *MEDFileFields::buildSubPart(const int *startIds, const int *endId
   return ret.retn();
 }
 
-MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const char *fieldName) const
+MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const std::string& fieldName) const
 {
   return getFieldAtPos(getPosFromFieldName(fieldName));
 }
@@ -9875,7 +9897,7 @@ MEDFileAnyTypeFieldMultiTS *MEDFileFields::getFieldWithName(const char *fieldNam
  * \param [in] meshName - the name of the mesh on w
  * \return a new object that the caller should deal with.
  */
-MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const char *meshName) const
+MEDFileFields *MEDFileFields::partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileFields> ret=MEDFileFields::New();
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> >::const_iterator it=_fields.begin();it!=_fields.end();it++)
@@ -9946,7 +9968,7 @@ MEDFileFieldsIterator *MEDFileFields::iterator()
   return new MEDFileFieldsIterator(this);
 }
 
-int MEDFileFields::getPosFromFieldName(const char *fieldName) const
+int MEDFileFields::getPosFromFieldName(const std::string& fieldName) const
 {
   std::string tmp(fieldName);
   std::vector<std::string> poss;
index 3da4614aa518e102b4375c84be465bfcd1a75b6e..2d54b1a02b386f75720c981dc9f57e326aa502f7 100644 (file)
@@ -52,17 +52,17 @@ namespace ParaMEDMEM
   public:
     MEDLOADER_EXPORT void simpleRepr(std::ostream& oss) const;
     MEDLOADER_EXPORT std::string getName() const { return _name; }
-    MEDLOADER_EXPORT void setName(const char *name);
-    static MEDFileFieldLoc *New(med_idt fid, const char *locName);
+    MEDLOADER_EXPORT void setName(const std::string& name);
+    static MEDFileFieldLoc *New(med_idt fid, const std::string& locName);
     static MEDFileFieldLoc *New(med_idt fid, int id);
-    static MEDFileFieldLoc *New(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
+    static MEDFileFieldLoc *New(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
     std::size_t getHeapMemorySizeWithoutChildren() const;
     std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDFileFieldLoc *deepCpy() const;
     MEDLOADER_EXPORT int getNbOfGaussPtPerCell() const { return _nb_gauss_pt; }
     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
     MEDLOADER_EXPORT std::string repr() const;
-    MEDLOADER_EXPORT bool isName(const char *name) const { return _name==name; }
+    MEDLOADER_EXPORT bool isName(const std::string& name) const { return _name==name; }
     MEDLOADER_EXPORT int getDimension() const { return _dim; }
     MEDLOADER_EXPORT int getNumberOfGaussPoints() const { return _nb_gauss_pt; }
     MEDLOADER_EXPORT int getNumberOfPointsInCells() const { return _nb_node_per_cell; }
@@ -72,9 +72,9 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT INTERP_KERNEL::NormalizedCellType getGeoType() const { return _geo_type; }
     MEDLOADER_EXPORT bool isEqual(const MEDFileFieldLoc& other, double eps) const;
   private:
-    MEDFileFieldLoc(med_idt fid, const char *locName);
+    MEDFileFieldLoc(med_idt fid, const std::string& locName);
     MEDFileFieldLoc(med_idt fid, int id);
-    MEDFileFieldLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
+    MEDFileFieldLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
   private:
     int _dim;
     int _nb_gauss_pt;
@@ -129,9 +129,9 @@ namespace ParaMEDMEM
     const DataArray *getOrCreateAndGetArray() const;
     const std::vector<std::string>& getInfo() const;
     std::string getProfile() const;
-    void setProfile(const char *newPflName);
+    void setProfile(const std::string& newPflName);
     std::string getLocalization() const;
-    void setLocalization(const char *newLocName);
+    void setLocalization(const std::string& newLocName);
     int getLocId() const { return _loc_id; }
     void setLocId(int newId) const { _loc_id=newId; }
     void setFather(MEDFileFieldPerMeshPerType *newFather) { _father=newFather; }
@@ -262,7 +262,7 @@ namespace ParaMEDMEM
     std::vector<std::string> getPflsReallyUsedMulti() const;
     std::vector<std::string> getLocsReallyUsedMulti() const;
     bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
-    bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
+    bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
     void keepOnlySpatialDiscretization(TypeOfField tof, int &globalNum, std::vector< std::pair<int,int> >& its);
     void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
@@ -304,7 +304,7 @@ namespace ParaMEDMEM
   class MEDFileFieldGlobs : public RefCountObject
   {
   public:
-    static MEDFileFieldGlobs *New(const char *fname);
+    static MEDFileFieldGlobs *New(const std::string& fname);
     static MEDFileFieldGlobs *New();
     std::size_t getHeapMemorySizeWithoutChildren() const;
     std::vector<const BigMemoryObject *> getDirectChildren() const;
@@ -315,43 +315,43 @@ namespace ParaMEDMEM
     void appendGlobs(const MEDFileFieldGlobs& other, double eps);
     void checkGlobsPflsPartCoherency(const std::vector<std::string>& pflsUsed) const;
     void checkGlobsLocsPartCoherency(const std::vector<std::string>& locsUsed) const;
-    void loadProfileInFile(med_idt fid, int id, const char *pflName);
+    void loadProfileInFile(med_idt fid, int id, const std::string& pflName);
     void loadProfileInFile(med_idt fid, int id);
     void loadGlobals(med_idt fid, const MEDFileFieldGlobsReal& real);
     void loadAllGlobals(med_idt fid);
     void writeGlobals(med_idt fid, const MEDFileWritable& opt) const;
     std::vector<std::string> getPfls() const;
     std::vector<std::string> getLocs() const;
-    bool existsPfl(const char *pflName) const;
-    bool existsLoc(const char *locName) const;
+    bool existsPfl(const std::string& pflName) const;
+    bool existsLoc(const std::string& locName) const;
     std::string createNewNameOfPfl() const;
     std::string createNewNameOfLoc() const;
     std::vector< std::vector<int> > whichAreEqualProfiles() const;
     std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
-    void setFileName(const char *fileName);
+    void setFileName(const std::string& fileName);
     void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     int getNbOfGaussPtPerCell(int locId) const;
-    int getLocalizationId(const char *loc) const;
-    const char *getFileName() const { return _file_name.c_str(); }
+    int getLocalizationId(const std::string& loc) const;
+    std::string getFileName() const { return _file_name; }
     std::string getFileName2() const { return _file_name; }
     const MEDFileFieldLoc& getLocalizationFromId(int locId) const;
-    const MEDFileFieldLoc& getLocalization(const char *locName) const;
+    const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
     const DataArrayInt *getProfileFromId(int pflId) const;
-    const DataArrayInt *getProfile(const char *pflName) const;
+    const DataArrayInt *getProfile(const std::string& pflName) const;
     MEDFileFieldLoc& getLocalizationFromId(int locId);
-    MEDFileFieldLoc& getLocalization(const char *locName);
-    DataArrayInt *getProfile(const char *pflName);
+    MEDFileFieldLoc& getLocalization(const std::string& locName);
+    DataArrayInt *getProfile(const std::string& pflName);
     DataArrayInt *getProfileFromId(int pflId);
     void killProfileIds(const std::vector<int>& pflIds);
     void killLocalizationIds(const std::vector<int>& locIds);
     //
     void appendProfile(DataArrayInt *pfl);
-    void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
+    void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
     //
-    static std::string CreateNewNameNotIn(const char *prefix, const std::vector<std::string>& namesToAvoid);
+    static std::string CreateNewNameNotIn(const std::string& prefix, const std::vector<std::string>& namesToAvoid);
   protected:
-    MEDFileFieldGlobs(const char *fname);
+    MEDFileFieldGlobs(const std::string& fname);
     MEDFileFieldGlobs();
     ~MEDFileFieldGlobs();
   protected:
@@ -365,7 +365,7 @@ namespace ParaMEDMEM
   class MEDFileFieldGlobsReal
   {
   public:
-    MEDLOADER_EXPORT MEDFileFieldGlobsReal(const char *fname);
+    MEDLOADER_EXPORT MEDFileFieldGlobsReal(const std::string& fname);
     MEDLOADER_EXPORT MEDFileFieldGlobsReal();
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
@@ -387,45 +387,45 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT virtual void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif) = 0;
     MEDLOADER_EXPORT virtual ~MEDFileFieldGlobsReal();
     //
-    MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const char *pflName);
+    MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id, const std::string& pflName);
     MEDLOADER_EXPORT void loadProfileInFile(med_idt fid, int id);
     MEDLOADER_EXPORT void loadGlobals(med_idt fid);
     MEDLOADER_EXPORT void loadAllGlobals(med_idt fid);
     MEDLOADER_EXPORT void writeGlobals(med_idt fid, const MEDFileWritable& opt) const;
     MEDLOADER_EXPORT std::vector<std::string> getPfls() const;
     MEDLOADER_EXPORT std::vector<std::string> getLocs() const;
-    MEDLOADER_EXPORT bool existsPfl(const char *pflName) const;
-    MEDLOADER_EXPORT bool existsLoc(const char *locName) const;
+    MEDLOADER_EXPORT bool existsPfl(const std::string& pflName) const;
+    MEDLOADER_EXPORT bool existsLoc(const std::string& locName) const;
     MEDLOADER_EXPORT std::string createNewNameOfPfl() const;
     MEDLOADER_EXPORT std::string createNewNameOfLoc() const;
     MEDLOADER_EXPORT std::vector< std::vector<int> > whichAreEqualProfiles() const;
     MEDLOADER_EXPORT std::vector< std::vector<int> > whichAreEqualLocs(double eps) const;
-    MEDLOADER_EXPORT void setFileName(const char *fileName);
+    MEDLOADER_EXPORT void setFileName(const std::string& fileName);
     MEDLOADER_EXPORT void changePflsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     MEDLOADER_EXPORT void changeLocsNamesInStruct(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     MEDLOADER_EXPORT void changePflsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     MEDLOADER_EXPORT void changeLocsNames(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
-    MEDLOADER_EXPORT void changePflName(const char *oldName, const char *newName);
-    MEDLOADER_EXPORT void changeLocName(const char *oldName, const char *newName);
+    MEDLOADER_EXPORT void changePflName(const std::string& oldName, const std::string& newName);
+    MEDLOADER_EXPORT void changeLocName(const std::string& oldName, const std::string& newName);
     MEDLOADER_EXPORT std::vector< std::pair<std::vector<std::string>, std::string > > zipPflsNames();
     MEDLOADER_EXPORT std::vector< std::pair<std::vector<std::string>, std::string > > zipLocsNames(double eps);
     MEDLOADER_EXPORT int getNbOfGaussPtPerCell(int locId) const;
-    MEDLOADER_EXPORT int getLocalizationId(const char *loc) const;
-    MEDLOADER_EXPORT const char *getFileName() const;
+    MEDLOADER_EXPORT int getLocalizationId(const std::string& loc) const;
+    MEDLOADER_EXPORT std::string getFileName() const;
     MEDLOADER_EXPORT std::string getFileName2() const;
     MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalizationFromId(int locId) const;
-    MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const char *locName) const;
+    MEDLOADER_EXPORT const MEDFileFieldLoc& getLocalization(const std::string& locName) const;
     MEDLOADER_EXPORT MEDFileFieldLoc& getLocalizationFromId(int locId);
-    MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const char *locName);
-    MEDLOADER_EXPORT const DataArrayInt *getProfile(const char *pflName) const;
+    MEDLOADER_EXPORT MEDFileFieldLoc& getLocalization(const std::string& locName);
+    MEDLOADER_EXPORT const DataArrayInt *getProfile(const std::string& pflName) const;
     MEDLOADER_EXPORT const DataArrayInt *getProfileFromId(int pflId) const;
-    MEDLOADER_EXPORT DataArrayInt *getProfile(const char *pflName);
+    MEDLOADER_EXPORT DataArrayInt *getProfile(const std::string& pflName);
     MEDLOADER_EXPORT DataArrayInt *getProfileFromId(int pflId);
     MEDLOADER_EXPORT void killProfileIds(const std::vector<int>& pflIds);
     MEDLOADER_EXPORT void killLocalizationIds(const std::vector<int>& locIds);
     //
     MEDLOADER_EXPORT void appendProfile(DataArrayInt *pfl);
-    MEDLOADER_EXPORT void appendLoc(const char *locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
+    MEDLOADER_EXPORT void appendLoc(const std::string& locName, INTERP_KERNEL::NormalizedCellType geoType, const std::vector<double>& refCoo, const std::vector<double>& gsCoo, const std::vector<double>& w);
   protected:
     MEDFileFieldGlobs *contentNotNull();
     const MEDFileFieldGlobs *contentNotNull() const;
@@ -437,11 +437,11 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT MEDFileFieldNameScope();
-    MEDLOADER_EXPORT MEDFileFieldNameScope(const char *fieldName);
+    MEDLOADER_EXPORT MEDFileFieldNameScope(const std::string& fieldName);
     MEDLOADER_EXPORT std::string getName() const;
-    MEDLOADER_EXPORT void setName(const char *fieldName);
+    MEDLOADER_EXPORT void setName(const std::string& fieldName);
     MEDLOADER_EXPORT std::string getDtUnit() const;
-    MEDLOADER_EXPORT void setDtUnit(const char *dtUnit);
+    MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit);
     MEDLOADER_EXPORT void copyNameScope(const MEDFileFieldNameScope& other);
   protected:
     std::string _name;
@@ -455,14 +455,14 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA();
-    MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order);
+    MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order);
     MEDLOADER_EXPORT int getIteration() const { return _iteration; }
     MEDLOADER_EXPORT int getOrder() const { return _order; }
     MEDLOADER_EXPORT double getTime(int& iteration, int& order) const { iteration=_iteration; order=_order; return _dt; }
     MEDLOADER_EXPORT void setTime(int iteration, int order, double val) { _dt=val; _iteration=iteration; _order=order; }
     MEDLOADER_EXPORT int getDimension() const;
     MEDLOADER_EXPORT std::string getMeshName() const;
-    MEDLOADER_EXPORT void setMeshName(const char *newMeshName);
+    MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
     MEDLOADER_EXPORT int getMeshIteration() const;
     MEDLOADER_EXPORT int getMeshOrder() const;
@@ -479,11 +479,11 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void changePflsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     MEDLOADER_EXPORT void changeLocsRefsNamesGen2(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     //
-    MEDLOADER_EXPORT int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const;
-    MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+    MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
+    MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     //
-    MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
-    MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
+    MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
+    MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
     MEDLOADER_EXPORT void deepCpyLeavesFrom(const MEDFileAnyTypeField1TSWithoutSDA& other);
   public:
     MEDLOADER_EXPORT int getNumberOfComponents() const;
@@ -507,13 +507,13 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT virtual DataArray *getOrCreateAndGetArray() = 0;
     MEDLOADER_EXPORT virtual const DataArray *getOrCreateAndGetArray() const = 0;
   public:
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDFileMesh *mesh, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const char *mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
+    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, const std::string& mName, int renumPol, const MEDFileFieldGlobsReal *glob, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFileFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum, MEDCouplingAutoRefCountObjectPtr<DataArray> &arrOut, const MEDFileFieldNameScope& nasc) const;
     DataArray *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFileFieldGlobsReal *glob, const MEDFileFieldNameScope& nasc) const;
   public:
-    MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
+    MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
     MEDLOADER_EXPORT std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA> > splitDiscretizations() const;
     MEDLOADER_EXPORT int keepOnlySpatialDiscretization(TypeOfField tof, std::vector< std::pair<int,int> >& its);
   public:
@@ -526,7 +526,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void unloadArrays();
     MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts, const MEDFileFieldNameScope& nasc) const;
   protected:
-    int getMeshIdFromMeshName(const char *mName) const;
+    int getMeshIdFromMeshName(const std::string& mName) const;
     int addNewEntryIfNecessary(const MEDCouplingMesh *mesh);
     void updateData(int newLgth, const std::vector< std::pair<int,int> >& oldStartStops);
   protected:
@@ -557,13 +557,13 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDouble() const;
     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayDoubleExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
-    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     MEDLOADER_EXPORT static void CheckMeshDimRel(int meshDimRelToMax);
     MEDLOADER_EXPORT static std::vector<int> CheckSBTMesh(const MEDCouplingMesh *mesh);
-    MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+    MEDLOADER_EXPORT static MEDFileField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
   public:
     MEDLOADER_EXPORT MEDFileField1TSWithoutSDA();
-    MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+    MEDLOADER_EXPORT MEDFileField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const;
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const;
     MEDLOADER_EXPORT void setArray(DataArray *arr);
@@ -586,7 +586,7 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT MEDFileIntField1TSWithoutSDA();
-    MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+    MEDLOADER_EXPORT static MEDFileIntField1TSWithoutSDA *New(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *deepCpy() const;
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *shallowCpy() const;
     MEDLOADER_EXPORT const char *getTypeStr() const;
@@ -602,7 +602,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT DataArrayInt *getUndergroundDataArrayIntExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
     MEDLOADER_EXPORT MEDFileField1TSWithoutSDA *convertToDouble() const;
   protected:
-    MEDFileIntField1TSWithoutSDA(const char *fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
+    MEDFileIntField1TSWithoutSDA(const std::string& fieldName, int csit, int iteration, int order, const std::vector<std::string>& infos);
   protected:
     MEDCouplingAutoRefCountObjectPtr< DataArrayInt > _arr;
   public:
@@ -616,33 +616,33 @@ namespace ParaMEDMEM
   {
   protected:
     MEDLOADER_EXPORT MEDFileAnyTypeField1TS();
-    MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const char *fileName, bool loadAll);
-    MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, bool loadAll);
-    MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll);
+    MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, bool loadAll);
+    MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll);
+    MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll);
     MEDLOADER_EXPORT MEDFileAnyTypeField1TS(const MEDFileAnyTypeField1TSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const char *fileName);
-    MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, bool loadAll);
-    MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll);
-    MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, int iteration, int order, bool loadAll);
+    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *BuildNewInstanceFromContent(MEDFileAnyTypeField1TSWithoutSDA *c, const std::string& fileName);
+    MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll);
+    MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll);
+    MEDLOADER_EXPORT static MEDFileAnyTypeField1TSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll);
     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
     // direct forwarding to MEDFileAnyTypeField1TSWithoutSDA instance _content
   public:
-    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
     MEDLOADER_EXPORT int getDimension() const;
     MEDLOADER_EXPORT int getIteration() const;
     MEDLOADER_EXPORT int getOrder() const;
     MEDLOADER_EXPORT double getTime(int& iteration, int& order) const;
     MEDLOADER_EXPORT void setTime(int iteration, int order, double val);
     MEDLOADER_EXPORT std::string getName() const;
-    MEDLOADER_EXPORT void setName(const char *name);
+    MEDLOADER_EXPORT void setName(const std::string& name);
     MEDLOADER_EXPORT std::string simpleRepr() const;
     MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int f1tsId) const;
     MEDLOADER_EXPORT std::string getDtUnit() const;
-    MEDLOADER_EXPORT void setDtUnit(const char *dtUnit);
+    MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit);
     MEDLOADER_EXPORT std::string getMeshName() const;
-    MEDLOADER_EXPORT void setMeshName(const char *newMeshName);
+    MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
     MEDLOADER_EXPORT int getMeshIteration() const;
     MEDLOADER_EXPORT int getMeshOrder() const;
@@ -655,13 +655,13 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
     MEDLOADER_EXPORT std::vector<std::string>& getInfo();
     MEDLOADER_EXPORT std::vector<TypeOfField> getTypesOfFieldAvailable() const;
-    MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+    MEDLOADER_EXPORT std::vector< std::vector<std::pair<int,int> > > getFieldSplitedByType(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
                                                                           std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
-    MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
-    MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
-    MEDLOADER_EXPORT int getNonEmptyLevels(const char *mname, std::vector<int>& levs) const;
+    MEDLOADER_EXPORT MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId);
+    MEDLOADER_EXPORT const MEDFileFieldPerMeshPerTypePerDisc *getLeafGivenMeshAndTypeAndLocId(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId) const;
+    MEDLOADER_EXPORT int getNonEmptyLevels(const std::string& mname, std::vector<int>& levs) const;
   public:
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT void loadArrays();
     MEDLOADER_EXPORT void loadArraysIfNecessary();
     MEDLOADER_EXPORT void unloadArrays();
@@ -672,9 +672,9 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT virtual MEDFileAnyTypeField1TS *shallowCpy() const = 0;
   public:
     //! underground method see MEDFileField1TSWithoutSDA::setProfileNameOnLeaf
-    MEDLOADER_EXPORT void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false);
+    MEDLOADER_EXPORT void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false);
     //! underground method see MEDFileField1TSWithoutSDA::setLocNameOnLeaf
-    MEDLOADER_EXPORT void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false);
+    MEDLOADER_EXPORT void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false);
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
@@ -684,8 +684,8 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void changePflsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
     MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
   public:
-    MEDLOADER_EXPORT static int LocateField2(med_idt fid, const char *fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut);
-    MEDLOADER_EXPORT static int LocateField(med_idt fid, const char *fileName, const char *fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut);
+    MEDLOADER_EXPORT static int LocateField2(med_idt fid, const std::string& fileName, int fieldIdCFormat, bool checkFieldId, std::string& fieldName, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut);
+    MEDLOADER_EXPORT static int LocateField(med_idt fid, const std::string& fileName, const std::string& fieldName, int& posCFormat, med_field_type& typcha, std::vector<std::string>& infos, std::string& dtunitOut);
   public:
     MEDLOADER_EXPORT virtual med_field_type getMEDFileFieldType() const = 0;
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA *contentNotNullBase();
@@ -702,9 +702,9 @@ namespace ParaMEDMEM
   class MEDFileField1TS : public MEDFileAnyTypeField1TS
   {
   public:
-    MEDLOADER_EXPORT static MEDFileField1TS *New(const char *fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
     MEDLOADER_EXPORT static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
     MEDLOADER_EXPORT static MEDFileField1TS *New();
     MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
@@ -713,7 +713,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const;
+    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const;
     MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
     //
     MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
@@ -724,7 +724,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray() const;
     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
     
-    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
+    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF,
                                                                                           std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const throw(INTERP_KERNEL::Exception);
   public:
     MEDLOADER_EXPORT static void SetDataArrayDoubleInField(MEDCouplingFieldDouble *f, MEDCouplingAutoRefCountObjectPtr<DataArray>& arr);
@@ -734,9 +734,9 @@ namespace ParaMEDMEM
     const MEDFileField1TSWithoutSDA *contentNotNull() const;
     MEDFileField1TSWithoutSDA *contentNotNull();
   private:
-    MEDFileField1TS(const char *fileName, bool loadAll);
-    MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll);
-    MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll);
+    MEDFileField1TS(const std::string& fileName, bool loadAll);
+    MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll);
+    MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll);
     MEDFileField1TS(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
     MEDFileField1TS();
   };
@@ -745,9 +745,9 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileIntField1TS *New();
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true);
     MEDLOADER_EXPORT static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
     MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
     MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const;
@@ -756,7 +756,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, DataArrayInt* &arrOut, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const;
+    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const;
     MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
     //
     MEDLOADER_EXPORT void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals);
@@ -770,9 +770,9 @@ namespace ParaMEDMEM
     MEDFileIntField1TSWithoutSDA *contentNotNull();
   private:
     MEDFileIntField1TS();
-    MEDFileIntField1TS(const char *fileName, bool loadAll);
-    MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll);
-    MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll);
+    MEDFileIntField1TS(const std::string& fileName, bool loadAll);
+    MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll);
+    MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll);
     MEDFileIntField1TS(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
   };
   
@@ -780,9 +780,9 @@ namespace ParaMEDMEM
   {
   protected:
     MEDFileAnyTypeFieldMultiTSWithoutSDA();
-    MEDFileAnyTypeFieldMultiTSWithoutSDA(const char *fieldName);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA(const std::string& fieldName);
     MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll);
-    MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
+    MEDFileAnyTypeFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
   public:
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
@@ -800,7 +800,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT const MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order) const;
     MEDLOADER_EXPORT MEDFileAnyTypeField1TSWithoutSDA& getTimeStepEntry(int iteration, int order);
     MEDLOADER_EXPORT std::string getMeshName() const;
-    MEDLOADER_EXPORT void setMeshName(const char *newMeshName);
+    MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
     MEDLOADER_EXPORT int getNumberOfTS() const;
     MEDLOADER_EXPORT void eraseEmptyTS();
@@ -817,14 +817,14 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void pushBackTimeStep(MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeField1TSWithoutSDA>& tse);
     MEDLOADER_EXPORT void synchronizeNameScope();
     MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
-    MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const;
+    MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
     MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArray *arr, MEDFileFieldGlobsReal& glob);
     MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArray *arr, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile, MEDFileFieldGlobsReal& glob);
-    MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+    MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
     MEDLOADER_EXPORT DataArray *getUndergroundDataArray(int iteration, int order) const;
     MEDLOADER_EXPORT DataArray *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
-    MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
+    MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N, MEDFileFieldGlobsReal& glob);
     MEDLOADER_EXPORT void loadStructureOrStructureAndBigArraysRecursively(med_idt fid, int nbPdt, med_field_type fieldTyp, bool loadAll);
     MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& opts) const;
     MEDLOADER_EXPORT void loadBigArraysRecursively(med_idt fid, const MEDFileFieldNameScope& nasc);
@@ -856,16 +856,16 @@ namespace ParaMEDMEM
   class MEDFileFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
   {
   public:
-    MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
+    MEDLOADER_EXPORT static MEDFileFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
     MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll);
     MEDLOADER_EXPORT const char *getTypeStr() const;
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const;
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const;
-    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA *convertToInt() const;
   protected:
-    MEDFileFieldMultiTSWithoutSDA(const char *fieldName);
-    MEDFileFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
+    MEDFileFieldMultiTSWithoutSDA(const std::string& fieldName);
+    MEDFileFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
     med_field_type getMEDFileFieldType() const { return MED_FLOAT64; }
     MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
     void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
@@ -876,15 +876,15 @@ namespace ParaMEDMEM
   class MEDFileIntFieldMultiTSWithoutSDA : public MEDFileAnyTypeFieldMultiTSWithoutSDA
   {
   public:
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
+    MEDLOADER_EXPORT static MEDFileIntFieldMultiTSWithoutSDA *New(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
     MEDLOADER_EXPORT MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, int fieldId, bool loadAll);
     MEDLOADER_EXPORT const char *getTypeStr() const;
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *shallowCpy() const;
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTSWithoutSDA *createNew() const;
     MEDLOADER_EXPORT MEDFileFieldMultiTSWithoutSDA *convertToDouble() const;
   protected:
-    MEDFileIntFieldMultiTSWithoutSDA(const char *fieldName);
-    MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const char *fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
+    MEDFileIntFieldMultiTSWithoutSDA(const std::string& fieldName);
+    MEDFileIntFieldMultiTSWithoutSDA(med_idt fid, const std::string& fieldName, med_field_type fieldTyp, const std::vector<std::string>& infos, int nbOfStep, const std::string& dtunit, bool loadAll);
     med_field_type getMEDFileFieldType() const { return MED_INT32; }
     MEDFileAnyTypeField1TSWithoutSDA *createNew1TSWithoutSDAEmptyInstance() const;
     void checkCoherencyOfType(const MEDFileAnyTypeField1TSWithoutSDA *f1ts) const;
@@ -901,19 +901,19 @@ namespace ParaMEDMEM
   {
   protected:
     MEDFileAnyTypeFieldMultiTS();
-    MEDFileAnyTypeFieldMultiTS(const char *fileName, bool loadAll);
-    MEDFileAnyTypeFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll);
+    MEDFileAnyTypeFieldMultiTS(const std::string& fileName, bool loadAll);
+    MEDFileAnyTypeFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll);
     MEDFileAnyTypeFieldMultiTS(const MEDFileAnyTypeFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
-    static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const char *fileName);
-    static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, bool loadAll);
-    static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const char *fileName, const char *fieldName, bool loadAll);
+    static MEDFileAnyTypeFieldMultiTS *BuildNewInstanceFromContent(MEDFileAnyTypeFieldMultiTSWithoutSDA *c, const std::string& fileName);
+    static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, bool loadAll);
+    static MEDFileAnyTypeFieldMultiTSWithoutSDA *BuildContentFrom(med_idt fid, const std::string& fileName, const std::string& fieldName, bool loadAll);
   public:
-    MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
     MEDLOADER_EXPORT void loadArrays();
     MEDLOADER_EXPORT void loadArraysIfNecessary();
     MEDLOADER_EXPORT void unloadArrays();
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
@@ -931,11 +931,11 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT static int CheckSupportAcrossTime(MEDFileAnyTypeFieldMultiTS *f0, MEDFileAnyTypeFieldMultiTS *f1, const MEDFileMesh *mesh, TypeOfField& tof0, TypeOfField& tof1);
   public:// direct forwarding to MEDFileField1TSWithoutSDA instance _content
     MEDLOADER_EXPORT std::string getName() const;
-    MEDLOADER_EXPORT void setName(const char *name);
+    MEDLOADER_EXPORT void setName(const std::string& name);
     MEDLOADER_EXPORT std::string getDtUnit() const;
-    MEDLOADER_EXPORT void setDtUnit(const char *dtUnit);
+    MEDLOADER_EXPORT void setDtUnit(const std::string& dtUnit);
     MEDLOADER_EXPORT std::string getMeshName() const;
-    MEDLOADER_EXPORT void setMeshName(const char *newMeshName);
+    MEDLOADER_EXPORT void setMeshName(const std::string& newMeshName);
     MEDLOADER_EXPORT std::string simpleRepr() const;
     MEDLOADER_EXPORT void simpleRepr(int bkOffset, std::ostream& oss, int fmtsId) const;
     MEDLOADER_EXPORT int getNumberOfTS() const;
@@ -956,9 +956,9 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT const std::vector<std::string>& getInfo() const;
     MEDLOADER_EXPORT void setInfo(const std::vector<std::string>& info);
     MEDLOADER_EXPORT int getNumberOfComponents() const;
-    MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const char *mname, std::vector<int>& levs) const;
+    MEDLOADER_EXPORT int getNonEmptyLevels(int iteration, int order, const std::string& mname, std::vector<int>& levs) const;
     MEDLOADER_EXPORT std::vector< std::vector<TypeOfField> > getTypesOfFieldAvailable() const;
-    MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+    MEDLOADER_EXPORT std::vector< std::vector< std::pair<int,int> > > getFieldSplitedByType(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     MEDLOADER_EXPORT MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> getContent();
   public:
     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
@@ -985,8 +985,8 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New();
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
     MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
     MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
@@ -1000,12 +1000,12 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
+    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const;
     MEDLOADER_EXPORT DataArrayDouble *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
     //
     MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field);
     MEDLOADER_EXPORT void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile);
-    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const char *mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
+    MEDLOADER_EXPORT std::vector< std::vector<DataArrayDouble *> > getFieldSplitedByType2(int iteration, int order, const std::string& mname, std::vector<INTERP_KERNEL::NormalizedCellType>& types, std::vector< std::vector<TypeOfField> >& typesF, std::vector< std::vector<std::string> >& pfls, std::vector< std::vector<std::string> >& locs) const;
     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArray(int iteration, int order) const;
     MEDLOADER_EXPORT DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > >& entries) const;
   private:
@@ -1014,8 +1014,8 @@ namespace ParaMEDMEM
   private:
     MEDFileFieldMultiTS();
     MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDFileFieldMultiTS(const char *fileName, bool loadAll);
-    MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll);
+    MEDFileFieldMultiTS(const std::string& fileName, bool loadAll);
+    MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll);
   };
 
   /*!
@@ -1025,8 +1025,8 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New();
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true);
-    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true);
     MEDLOADER_EXPORT static MEDFileIntFieldMultiTS *New(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
     MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
@@ -1037,7 +1037,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const;
     MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, DataArrayInt* &arrOut, int renumPol=0) const;
-    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const;
+    MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const;
     MEDLOADER_EXPORT DataArrayInt *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl) const;
     //
     MEDLOADER_EXPORT void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals);
@@ -1050,8 +1050,8 @@ namespace ParaMEDMEM
   private:
     MEDFileIntFieldMultiTS();
     MEDFileIntFieldMultiTS(const MEDFileIntFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
-    MEDFileIntFieldMultiTS(const char *fileName, bool loadAll);
-    MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll);
+    MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll);
+    MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll);
   };
 
   class MEDFileAnyTypeFieldMultiTSIterator
@@ -1075,12 +1075,12 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileFields *New();
-    MEDLOADER_EXPORT static MEDFileFields *New(const char *fileName, bool loadAll=true);
+    MEDLOADER_EXPORT static MEDFileFields *New(const std::string& fileName, bool loadAll=true);
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT MEDFileFields *deepCpy() const;
     MEDLOADER_EXPORT MEDFileFields *shallowCpy() const;
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
     MEDLOADER_EXPORT void loadArrays();
     MEDLOADER_EXPORT void loadArraysIfNecessary();
@@ -1096,11 +1096,11 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void pushField(MEDFileAnyTypeFieldMultiTS *field);
     MEDLOADER_EXPORT void pushFields(const std::vector<MEDFileAnyTypeFieldMultiTS *>& fields);
     MEDLOADER_EXPORT void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field);
-    MEDLOADER_EXPORT int getPosFromFieldName(const char *fieldName) const;
+    MEDLOADER_EXPORT int getPosFromFieldName(const std::string& fieldName) const;
     MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const;
-    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const;
+    MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const;
     MEDLOADER_EXPORT MEDFileFields *buildSubPart(const int *startIds, const int *endIds) const;
-    MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const;
+    MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const;
     MEDLOADER_EXPORT MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
     MEDLOADER_EXPORT MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(const std::vector< std::pair<int,int> >& timeSteps) const;
     MEDLOADER_EXPORT MEDFileFieldsIterator *iterator();
@@ -1108,7 +1108,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void destroyFieldsAtPos(const int *startIds, const int *endIds);
     MEDLOADER_EXPORT void destroyFieldsAtPos2(int bg, int end, int step);
     MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
-    MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const char *meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N);
+    MEDLOADER_EXPORT bool renumberEntitiesLyingOnMesh(const std::string& meshName, const std::vector<int>& oldCode, const std::vector<int>& newCode, const DataArrayInt *renumO2N);
   public:
     MEDLOADER_EXPORT std::vector<std::string> getPflsReallyUsed() const;
     MEDLOADER_EXPORT std::vector<std::string> getLocsReallyUsed() const;
@@ -1118,7 +1118,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void changeLocsRefsNamesGen(const std::vector< std::pair<std::vector<std::string>, std::string > >& mapOfModif);
   private:
     MEDFileFields();
-    MEDFileFields(const char *fileName, bool loadAll);
+    MEDFileFields(const std::string& fileName, bool loadAll);
   private:
     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileAnyTypeFieldMultiTSWithoutSDA> > _fields;
   };
index 6d9da01659b9e4b58c16256c919c359ce413e8d4..241cd422e2ae7484fcf427a13a86f41526e4639d 100644 (file)
@@ -52,12 +52,15 @@ std::vector<const BigMemoryObject *> MEDFileMeshStruct::getDirectChildren() cons
 
 MEDFileMeshStruct::MEDFileMeshStruct(const MEDFileMesh *mesh):_mesh(mesh)
 {
-  std::vector<int> levs=mesh->getNonEmptyLevels();
+  std::vector<int> levs(mesh->getNonEmptyLevels());
   _name=mesh->getName();
   _nb_nodes=mesh->getNumberOfNodes();
-  _geo_types_distrib.resize(levs.size());
-  for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
-    _geo_types_distrib[-(*lev)]=mesh->getDistributionOfTypes(*lev);
+  if(!levs.empty())
+    {
+      _geo_types_distrib.resize(-(*std::min_element(levs.begin(),levs.end()))+1);
+      for(std::vector<int>::const_iterator lev=levs.begin();lev!=levs.end();lev++)
+        _geo_types_distrib[-(*lev)]=mesh->getDistributionOfTypes(*lev);
+    }
 }
 
 int MEDFileMeshStruct::getLevelOfGeoType(INTERP_KERNEL::NormalizedCellType t) const
@@ -153,8 +156,7 @@ MEDMeshMultiLev *MEDMeshMultiLev::New(const MEDFileMesh *m, const std::vector<IN
 
 MEDMeshMultiLev *MEDMeshMultiLev::NewOnlyOnNode(const MEDFileMesh *m, const DataArrayInt *pflOnNode)
 {
-  std::vector<int> levs(1,0);
-  MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret(MEDMeshMultiLev::New(m,levs));
+  MEDCouplingAutoRefCountObjectPtr<MEDMeshMultiLev> ret(MEDMeshMultiLev::New(m,m->getNonEmptyLevels()));
   ret->selectPartOfNodes(pflOnNode);
   return ret.retn();
 }
@@ -177,6 +179,8 @@ bool MEDMeshMultiLev::isFastlyTheSameStruct(const MEDFileField1TSStructItem& fst
       const DataArrayInt *nr(_node_reduction);
       if(pflName.empty() && !nr)
         return true;
+      if(!pflName.empty() && !nr)
+        return false;
       if(pflName==nr->getName())
         return true;
       return false;
@@ -336,6 +340,11 @@ void MEDMeshMultiLev::retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isW
     }
 }
 
+std::vector< INTERP_KERNEL::NormalizedCellType > MEDMeshMultiLev::getGeoTypes() const
+{
+  return _geo_types;
+}
+
 void MEDMeshMultiLev::setFamilyIdsOnCells(DataArrayInt *famIds, bool isNoCopy)
 {
   _cell_fam_ids=famIds;
@@ -416,7 +425,7 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem&
           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p2(nr->deepCpy());
           p1->sort(true); p2->sort(true);
           if(!p1->isEqualWithoutConsideringStr(*p2))
-            throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : unexpected situation for nodes 3 !");
+            throw INTERP_KERNEL::Exception("MEDMeshMultiLev::constructDataArray : it appears that a profile on nodes does not cover the cells correctly !");
           p1=DataArrayInt::FindPermutationFromFirstToSecond(globs->getProfile(pflName.c_str()),nr);
           MEDCouplingAutoRefCountObjectPtr<DataArray> ret(vals->deepCpy());
           ret->renumberInPlace(p1->begin());
@@ -544,6 +553,51 @@ DataArray *MEDMeshMultiLev::constructDataArray(const MEDFileField1TSStructItem&
     }
 }
 
+/*!
+ * This method is called to add NORM_POINT1 cells in \a this so that orphan nodes in \a verticesToAdd will be fetched.
+ */
+void MEDMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr)
+{
+  int nbOfVertices(verticesToAdd->getNumberOfTuples());
+  std::size_t sz(_pfls.size());
+  _pfls.resize(sz+1);
+  _geo_types.resize(sz+1,INTERP_KERNEL::NORM_POINT1);
+  _nb_entities.resize(sz+1,nbOfVertices);
+  _node_reduction=nr; nr->incrRef();
+  _nb_nodes+=nbOfVertices;
+  const DataArrayInt *cf(_cell_fam_ids),*cn(_cell_num_ids),*nf(_node_fam_ids),*nn(_node_num_ids);
+  if(cf)
+    {
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
+      std::vector<const DataArrayInt *> a(2);
+      a[0]=cf;
+      if(nf)
+        tmp=nf->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end());
+      else
+        {
+          tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
+        }
+      a[1]=tmp;
+      _cell_fam_ids=DataArrayInt::Aggregate(a);
+      _cell_fam_ids_nocpy=false;
+    }
+  if(cn)
+    {
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp;
+      std::vector<const DataArrayInt *> a(2);
+      a[0]=cn;
+      if(nn)
+        tmp=nn->selectByTupleIdSafe(verticesToAdd->begin(),verticesToAdd->end());
+      else
+        {
+          tmp=DataArrayInt::New(); tmp->alloc(nbOfVertices,1); tmp->fillWithZero();
+        }
+      a[1]=tmp;
+      _cell_num_ids=DataArrayInt::Aggregate(a);
+      _cell_num_ids_nocpy=false;
+    }
+}
+
 MEDMeshMultiLev::MEDMeshMultiLev():_nb_nodes(0),_cell_fam_ids_nocpy(false)
 {
 }
@@ -584,6 +638,10 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>
       v.insert(v.end(),vTmp.begin(),vTmp.end());
     }
   std::size_t sz(v.size());
+  if(v.empty())
+    {
+      _coords=m->getCoords(); _coords->incrRef();
+    }
   _parts.resize(sz);
   _pfls.resize(sz);
   _geo_types.resize(sz);
@@ -620,7 +678,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>
           if(!tmps[i])
             f=false;
         }
-      if(f)
+      if(f && !tmps.empty())
         _cell_fam_ids=DataArrayInt::Aggregate(tmps);
     }
   _cell_num_ids_nocpy=(levs.size()==1);
@@ -643,7 +701,7 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>
           if(!tmps[i])
             n=false;
         }
-      if(n)
+      if(n && !tmps.empty())
         _cell_num_ids=DataArrayInt::Aggregate(tmps);
     }
   // node part
@@ -760,7 +818,6 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
    std::vector< const DataArrayInt *> aa(sz);
    for(std::size_t i=0;i<sz;i++)
      {
-       
        const DataArrayInt *pfl(_pfls[i]);
        MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m(_parts[i]);
        if(pfl)
@@ -777,9 +834,21 @@ void MEDUMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
        else
          _pfls[i]=cellIdsSafe;
      }
-   _node_reduction=DataArrayInt::Aggregate(aa);
+   if(!aa.empty())
+     _node_reduction=DataArrayInt::Aggregate(aa);//general case
+   else
+     _node_reduction=pflNodes->deepCpy();//case where no cells in read mesh.
    _node_reduction->sort(true);
    _node_reduction=_node_reduction->buildUnique();
+   if(_node_reduction->getNumberOfTuples()==pflNodes->getNumberOfTuples())
+     return ;//This is the classical case where the input node profile corresponds perfectly to a subset of cells in _parts
+   if(_node_reduction->getNumberOfTuples()>pflNodes->getNumberOfTuples())
+     throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::selectPartOfNodes : internal error in MEDCoupling during cell select from a list of nodes !");
+   // Here the cells available in _parts is not enough to cover all the nodes in pflNodes. So adding vertices cells in _parts...
+   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> pflNodes2(pflNodes->deepCpy());
+   pflNodes2->sort(true);
+   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> diff(pflNodes2->buildSubstractionOptimized(_node_reduction));
+   appendVertices(diff,pflNodes2);
 }
 
 MEDMeshMultiLev *MEDUMeshMultiLev::prepare() const
@@ -787,7 +856,7 @@ MEDMeshMultiLev *MEDUMeshMultiLev::prepare() const
   return new MEDUMeshMultiLev(*this);
 }
 
-MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDUMeshMultiLev& other):MEDMeshMultiLev(other),_parts(other._parts)
+MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDUMeshMultiLev& other):MEDMeshMultiLev(other),_parts(other._parts),_coords(other._coords)
 {
 }
 
@@ -806,11 +875,11 @@ MEDUMeshMultiLev::MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const
  */
 bool MEDUMeshMultiLev::buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const
 {
+  const DataArrayDouble *tmp(0);
   if(_parts.empty())
-    throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : empty array !");
-  if(!(const MEDCoupling1GTUMesh *)_parts[0])
-    throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : first part is null !");
-  const DataArrayDouble *tmp(_parts[0]->getCoords());
+    tmp=_coords;
+  else
+    tmp=_parts[0]->getCoords();
   if(!tmp)
     throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::getVTUArrays : the coordinates are null !");
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> a(const_cast<DataArrayDouble *>(tmp)); tmp->incrRef();
@@ -953,6 +1022,11 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<
   const DataArrayInt *nr(_node_reduction);
   if(!nr)
     return ;
+  if(nodalConnVTK->empty() && !polyhedNodalConnVTK)
+    {
+      coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end()));
+      return ;
+    }
   int sz(coords->getNumberOfTuples());
   std::vector<bool> b(sz,false);
   const int *work(nodalConnVTK->begin()),*endW(nodalConnVTK->end());
@@ -1023,13 +1097,32 @@ void MEDUMeshMultiLev::reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<
   coords=(coords->selectByTupleIdSafe(nr->begin(),nr->end()));
 }
 
+
+void MEDUMeshMultiLev::appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr)
+{
+  int nbOfCells(verticesToAdd->getNumberOfTuples());//it is not a bug cells are NORM_POINT1
+  MEDMeshMultiLev::appendVertices(verticesToAdd,nr);
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> elt(MEDCoupling1SGTUMesh::New("",INTERP_KERNEL::NORM_POINT1));
+  elt->allocateCells(nbOfCells);
+  for(int i=0;i<nbOfCells;i++)
+    {
+      int pt(verticesToAdd->getIJ(i,0));
+      elt->insertNextCell(&pt,&pt+1);
+    }
+  if(_parts.empty())
+    throw INTERP_KERNEL::Exception("MEDUMeshMultiLev::appendVertices : parts are empty !");
+  elt->setCoords(_parts[0]->getCoords());
+  MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> elt2((MEDCoupling1SGTUMesh *)elt); elt2->incrRef();
+  _parts.push_back(elt2);
+}
+
 //=
 
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev()
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev():_is_internal(true)
 {
 }
 
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev):_is_internal(true)
 {
   // ids fields management
   _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
@@ -1063,7 +1156,7 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh
     }
 }
 
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(nbOfNodes,gts,pfls,nbEntities)
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities):MEDMeshMultiLev(nbOfNodes,gts,pfls,nbEntities),_is_internal(true)
 {
   // ids fields management
   _cell_fam_ids_nocpy=true; _cell_num_ids_nocpy=true;
@@ -1097,6 +1190,10 @@ MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDFileStructuredMesh
     }
 }
 
+MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other),_is_internal(true)
+{
+}
+
 void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
 {
   if(!pflNodes || !pflNodes->isAllocated())
@@ -1122,10 +1219,6 @@ void MEDStructuredMeshMultiLev::selectPartOfNodes(const DataArrayInt *pflNodes)
     _pfls[0]=cellIdsSafe;
 }
 
-MEDStructuredMeshMultiLev::MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other):MEDMeshMultiLev(other)
-{
-}
-
 //=
 
 MEDCMeshMultiLev *MEDCMeshMultiLev::New(const MEDFileCMesh *m, const std::vector<int>& levs)
@@ -1144,13 +1237,14 @@ MEDCMeshMultiLev::MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>
     throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : null input pointer !");
   if(levs.size()!=1 || levs[0]!=0)
     throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor : levels supported is 0 only !");
-  int mdim(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(m->getMeshDimension()));
-  _coords.resize(mdim);
-  for(int i=0;i<mdim;i++)
+  int sdim(m->getSpaceDimension());
+  _coords.resize(sdim);
+  for(int i=0;i<sdim;i++)
     {
       DataArrayDouble *elt(const_cast<DataArrayDouble *>(m->getMesh()->getCoordsAt(i)));
       if(!elt)
         throw INTERP_KERNEL::Exception("MEDCMeshMultiLev constructor 2 : presence of null pointer for an vector of double along an axis !");
+      elt->incrRef();
       _coords[i]=elt;
     }
 }
@@ -1189,7 +1283,9 @@ std::vector<int> MEDCMeshMultiLev::getNodeGridStructure() const
 
 MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const
 {
-  const DataArrayInt *pfl(_pfls[0]),*nr(_node_reduction);
+  const DataArrayInt *pfl(0),*nr(_node_reduction);
+  if(!_pfls.empty())
+    pfl=_pfls[0];
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nnr;
   std::vector<int> cgs,ngs(getNodeGridStructure());
   cgs.resize(ngs.size());
@@ -1201,6 +1297,7 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const
       if(MEDCouplingStructuredMesh::IsPartStructured(pfl->begin(),pfl->end(),cgs,cellParts))
         {
           MEDCouplingAutoRefCountObjectPtr<MEDCMeshMultiLev> ret(new MEDCMeshMultiLev(*this));
+          ret->_is_internal=false;
           if(nr)
             { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); }
           ret->_nb_entities[0]=pfl->getNumberOfTuples();
@@ -1246,8 +1343,12 @@ MEDMeshMultiLev *MEDCMeshMultiLev::prepare() const
     }
 }
 
-std::vector< DataArrayDouble * > MEDCMeshMultiLev::buildVTUArrays() const
+/*!
+ * \a param [out] isInternal if true the returned pointers are those in main data structure. If false those pointers have been built espacially for that method.
+ */
+std::vector< DataArrayDouble * > MEDCMeshMultiLev::buildVTUArrays(bool& isInternal) const
 {
+  isInternal=_is_internal;
   std::size_t sz(_coords.size());
   std::vector< DataArrayDouble * > ret(sz);
   for(std::size_t i=0;i<sz;i++)
@@ -1312,7 +1413,9 @@ std::vector<int> MEDCurveLinearMeshMultiLev::getNodeGridStructure() const
 
 MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const
 {
-  const DataArrayInt *pfl(_pfls[0]),*nr(_node_reduction);
+  const DataArrayInt *pfl(0),*nr(_node_reduction);
+  if(!_pfls.empty())
+    pfl=_pfls[0];
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nnr;
   std::vector<int> cgs,ngs(getNodeGridStructure());
   cgs.resize(ngs.size());
@@ -1332,6 +1435,7 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const
             }
           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> p(MEDCouplingStructuredMesh::BuildExplicitIdsFrom(ngs,nodeParts));
           MEDCouplingAutoRefCountObjectPtr<MEDCurveLinearMeshMultiLev> ret(new MEDCurveLinearMeshMultiLev(*this));
+          ret->_is_internal=false;
           if(nr)
             { nnr=nr->deepCpy(); nnr->sort(true); ret->setNodeReduction(nnr); }
           ret->_nb_entities[0]=pfl->getNumberOfTuples();
@@ -1373,8 +1477,9 @@ MEDMeshMultiLev *MEDCurveLinearMeshMultiLev::prepare() const
     }
 }
 
-void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct) const
+void MEDCurveLinearMeshMultiLev::buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct, bool& isInternal) const
 {
+  isInternal=_is_internal;
   nodeStrct=_structure;
   const DataArrayDouble *coo(_coords);
   if(!coo)
@@ -1475,7 +1580,7 @@ void MEDFileField1TSStructItem2::checkInRange(int nbOfEntity, int nip, const MED
     }
 }
 
-bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const
+bool MEDFileField1TSStructItem2::isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const
 {
   if(startExp!=_start_end.first)
     return false;
@@ -1809,6 +1914,31 @@ MEDMeshMultiLev *MEDFileField1TSStructItem::buildFromScratchDataSetSupportOnCell
   return MEDMeshMultiLev::New(mst->getTheMesh(),a0,a1,a2);
 }
 
+std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileField1TSStructItem::getGeoTypes(const MEDFileMesh *m) const
+{
+  std::vector<INTERP_KERNEL::NormalizedCellType> ret;
+  if(_type==ON_NODES)
+    {
+      if(!_items.empty() && _items[0].getPflName().empty())
+        {
+          if(m)
+            return m->getAllGeoTypes();
+          else
+            return ret;
+        }
+      else
+        return ret;
+    }
+  for(std::vector< MEDFileField1TSStructItem2 >::const_iterator it=_items.begin();it!=_items.end();it++)
+    {
+      INTERP_KERNEL::NormalizedCellType elt((*it).getGeo());
+      std::vector<INTERP_KERNEL::NormalizedCellType>::iterator it2(std::find(ret.begin(),ret.end(),elt));
+      if(it2==ret.end())
+        ret.push_back(elt);
+    }
+  return ret;
+}
+
 MEDFileField1TSStructItem MEDFileField1TSStructItem::BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt)
 {
   TypeOfField atype;
@@ -1817,7 +1947,7 @@ MEDFileField1TSStructItem MEDFileField1TSStructItem::BuildItemFrom(const MEDFile
   std::vector< std::vector<std::string> > pfls,locs;
   std::vector< std::vector<TypeOfField> > typesF;
   std::vector<INTERP_KERNEL::NormalizedCellType> geoTypes;
-  std::vector< std::vector<std::pair<int,int> > > strtEnds=ref->getFieldSplitedByType(0,geoTypes,typesF,pfls,locs);
+  std::vector< std::vector<std::pair<int,int> > > strtEnds=ref->getFieldSplitedByType(std::string(),geoTypes,typesF,pfls,locs);
   std::size_t nbOfGeoTypes(geoTypes.size());
   if(nbOfGeoTypes==0)
     throw INTERP_KERNEL::Exception("MEDFileField1TSStruct : not null by empty ref  !");
@@ -1966,9 +2096,8 @@ MEDMeshMultiLev *MEDFileField1TSStruct::buildFromScratchDataSetSupport(const MED
   else
     {
       if(!presenceOfPartialNodeDiscr(pos1))
-        {//we have only all nodes, no cell definition info -> level 0;
-          std::vector<int> levs(1,0);
-          return MEDMeshMultiLev::New(mst->getTheMesh(),levs);
+        {//we have only all nodes, no cell definition info -> all existing levels !;
+          return MEDMeshMultiLev::New(mst->getTheMesh(),mst->getTheMesh()->getNonEmptyLevels());
         }
       else
         return MEDMeshMultiLev::NewOnlyOnNode(mst->getTheMesh(),_already_checked[pos1][0].getPfl(globs));
@@ -1992,6 +2121,24 @@ bool MEDFileField1TSStruct::isDataSetSupportFastlyEqualTo(const MEDFileField1TSS
   return true;
 }
 
+std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileField1TSStruct::getGeoTypes(const MEDFileMesh *m) const
+{
+  std::vector<INTERP_KERNEL::NormalizedCellType> ret;
+  for(std::vector<MEDFileField1TSStructItem>::const_iterator it=_already_checked.begin();it!=_already_checked.end();it++)
+    {
+      std::vector<INTERP_KERNEL::NormalizedCellType> ret2((*it).getGeoTypes(m));
+      for(std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator it2=ret2.begin();it2!=ret2.end();it2++)
+        {
+          if(*it2==INTERP_KERNEL::NORM_ERROR)
+            continue;
+          std::vector<INTERP_KERNEL::NormalizedCellType>::iterator it3(std::find(ret.begin(),ret.end(),*it2));
+          if(it3==ret.end())
+            ret.push_back(*it2);
+        }
+    }
+  return ret;
+}
+
 /*!
  * Returns true if presence in \a this of discretization ON_CELLS, ON_GAUSS_PT, ON_GAUSS_NE.
  * If true is returned the pos of the easiest is returned. The easiest is the first element in \a this having the less splitted subparts.
@@ -2145,3 +2292,24 @@ bool MEDFileFastCellSupportComparator::isDataSetSupportEqualToThePreviousOne(int
   const MEDFileField1TSStruct *objRef(_f1ts_cmps[timeStepId-1]);
   return objRef->isDataSetSupportFastlyEqualTo(*obj,globs);
 }
+
+int MEDFileFastCellSupportComparator::getNumberOfTS() const
+{
+  return _f1ts_cmps.size();
+}
+
+std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileFastCellSupportComparator::getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const
+{
+  if(timeStepId<0 || timeStepId>=(int)_f1ts_cmps.size())
+    {
+      std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::getGeoTypesAt : requested time step id #" << timeStepId << " is not in [0," << _f1ts_cmps.size() << ") !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  const MEDFileField1TSStruct *elt(_f1ts_cmps[timeStepId]);
+  if(!elt)
+    {
+      std::ostringstream oss; oss << "MEDFileFastCellSupportComparator::getGeoTypesAt : requested time step id #" << timeStepId << " points to a NULL pointer !";
+      throw INTERP_KERNEL::Exception(oss.str().c_str());
+    }
+  return elt->getGeoTypes(m);
+}
index e8d13ebfe02ebdba61bc81aa63ae5480f3c24116..6ec36a1f3b5363125c52a2bb98441dd4c7351fd9 100644 (file)
@@ -85,6 +85,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const;
     MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const;
     MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const;
+    MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const;
     void setFamilyIdsOnCells(DataArrayInt *famIds, bool isNoCopy);
     void setNumberIdsOnCells(DataArrayInt *numIds, bool isNoCopy);
     void setFamilyIdsOnNodes(DataArrayInt *famIds, bool isNoCopy);
@@ -96,6 +97,7 @@ namespace ParaMEDMEM
   protected:
     std::string getPflNameOfId(int id) const;
     DataArray *constructDataArray(const MEDFileField1TSStructItem& fst, const MEDFileFieldGlobsReal *globs, const DataArray *vals) const;
+    virtual void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr);
   protected:
     MEDMeshMultiLev();
     MEDMeshMultiLev(const MEDMeshMultiLev& other);
@@ -131,6 +133,8 @@ namespace ParaMEDMEM
     MEDMeshMultiLev *prepare() const;
     MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh>& part);
     MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const;
+  protected:
+    void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr);
   private:
     void reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const;
   private:
@@ -139,6 +143,8 @@ namespace ParaMEDMEM
     MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
   private:
     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> > _parts;
+    //! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts.
+    MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
   };
 
   class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
@@ -151,6 +157,8 @@ namespace ParaMEDMEM
     MEDStructuredMeshMultiLev(const MEDStructuredMeshMultiLev& other);
     MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, const std::vector<int>& lev);
     MEDStructuredMeshMultiLev(const MEDFileStructuredMesh *m, int nbOfNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
+  protected:
+    bool _is_internal;
   };
   
   class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
@@ -160,7 +168,7 @@ namespace ParaMEDMEM
     static MEDCMeshMultiLev *New(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
     std::vector<int> getNodeGridStructure() const;
     MEDMeshMultiLev *prepare() const;
-    MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays() const;
+    MEDLOADER_EXPORT std::vector< DataArrayDouble * > buildVTUArrays(bool& isInternal) const;
   private:
     MEDCMeshMultiLev(const MEDCMeshMultiLev& other);
     MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>& levs);
@@ -176,7 +184,7 @@ namespace ParaMEDMEM
     static MEDCurveLinearMeshMultiLev *New(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls , const std::vector<int>& nbEntities);
     std::vector<int> getNodeGridStructure() const;
     MEDMeshMultiLev *prepare() const;
-    MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct) const;
+    MEDLOADER_EXPORT void buildVTUArrays(DataArrayDouble *&coords, std::vector<int>& nodeStrct, bool& isInternal) const;
   private:
     MEDCurveLinearMeshMultiLev(const MEDCurveLinearMeshMultiLev& other);
     MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
@@ -206,7 +214,7 @@ namespace ParaMEDMEM
     int getNbOfIntegrationPts(const MEDFileFieldGlobsReal *globs) const;
     //! warning this method also set _nb_of_entity attribute !
     void checkInRange(int nbOfEntity, int nip, const MEDFileFieldGlobsReal *globs);
-    bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const char *pflName) const;
+    bool isFastlyEqual(int& startExp, INTERP_KERNEL::NormalizedCellType gt, const std::string& pflName) const;
     bool operator==(const MEDFileField1TSStructItem2& other) const throw(INTERP_KERNEL::Exception);
     bool isCellSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
     bool isNodeSupportEqual(const MEDFileField1TSStructItem2& other, const MEDFileFieldGlobsReal *globs) const;
@@ -241,6 +249,7 @@ namespace ParaMEDMEM
     MEDFileField1TSStructItem simplifyMeOnCellEntity(const MEDFileFieldGlobsReal *globs) const;
     bool isCompatibleWithNodesDiscr(const MEDFileField1TSStructItem& other, const MEDFileMeshStruct *meshSt, const MEDFileFieldGlobsReal *globs) const;
     bool isFullyOnOneLev(const MEDFileMeshStruct *meshSt, int& theFirstLevFull) const;
+    std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes(const MEDFileMesh *m) const;
     MEDLOADER_EXPORT MEDMeshMultiLev *buildFromScratchDataSetSupportOnCells(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const;
     MEDLOADER_EXPORT static MEDFileField1TSStructItem BuildItemFrom(const MEDFileAnyTypeField1TS *ref, const MEDFileMeshStruct *meshSt);
   private:
@@ -261,6 +270,7 @@ namespace ParaMEDMEM
     bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt);
     MEDLOADER_EXPORT MEDMeshMultiLev *buildFromScratchDataSetSupport(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs) const;
     bool isDataSetSupportFastlyEqualTo(const MEDFileField1TSStruct& other, const MEDFileFieldGlobsReal *globs) const;
+    std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypes(const MEDFileMesh *m) const;
   private:
     MEDFileField1TSStruct(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst);
     bool presenceOfCellDiscr(int& pos) const;
@@ -275,6 +285,8 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
     MEDLOADER_EXPORT MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
     MEDLOADER_EXPORT bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const;
+    MEDLOADER_EXPORT int getNumberOfTS() const;
+    MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const;
     bool isEqual(const MEDFileAnyTypeFieldMultiTS *other);
     bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other);
     std::size_t getHeapMemorySizeWithoutChildren() const;
index dd31d0a96efc5b31e474969a0f0203fe1d8f10fe..926f19dc09b0ef66a0d26ac9f66e8a4a6a38c4c4 100644 (file)
@@ -69,7 +69,7 @@ std::vector<const BigMemoryObject *> MEDFileMesh::getDirectChildren() const
  *  \throw If there is no meshes in the file.
  *  \throw If the mesh in the file is of a not supported type.
  */
-MEDFileMesh *MEDFileMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs)
+MEDFileMesh *MEDFileMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
 {
   std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
   if(ms.empty())
@@ -79,28 +79,28 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs
     }
   MEDFileUtilities::CheckFileForRead(fileName);
   ParaMEDMEM::MEDCouplingMeshType meshType;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int dt,it;
   std::string dummy2;
-  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2);
+  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2);
   switch(meshType)
     {
     case UNSTRUCTURED:
       {
         MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> ret=MEDFileUMesh::New();
-        ret->loadUMeshFromFile(fid,ms.front().c_str(),dt,it,mrs);
+        ret->loadUMeshFromFile(fid,ms.front(),dt,it,mrs);
         return (MEDFileUMesh *)ret.retn();
       }
     case CARTESIAN:
       {
         MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> ret=MEDFileCMesh::New();
-        ret->loadCMeshFromFile(fid,ms.front().c_str(),dt,it,mrs);
+        ret->loadCMeshFromFile(fid,ms.front(),dt,it,mrs);
         return (MEDFileCMesh *)ret.retn();
       }
     case CURVE_LINEAR:
       {
         MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> ret=MEDFileCurveLinearMesh::New();
-        ret->loadCLMeshFromFile(fid,ms.front().c_str(),dt,it,mrs);
+        ret->loadCLMeshFromFile(fid,ms.front(),dt,it,mrs);
         return (MEDFileCurveLinearMesh *)ret.retn();
       }
     default:
@@ -125,11 +125,11 @@ MEDFileMesh *MEDFileMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs
  *  \throw If there is no mesh with given attributes in the file.
  *  \throw If the mesh in the file is of a not supported type.
  */
-MEDFileMesh *MEDFileMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileMesh *MEDFileMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
   ParaMEDMEM::MEDCouplingMeshType meshType;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int dummy0,dummy1;
   std::string dummy2;
   MEDFileMeshL2::GetMeshIdFromName(fid,mName,meshType,dummy0,dummy1,dummy2);
@@ -187,12 +187,12 @@ void MEDFileMesh::write(med_idt fid) const
  *  \throw If the mesh name is not set.
  *  \throw If \a mode == 1 and the same data is present in an existing file.
  */
-void MEDFileMesh::write(const char *fileName, int mode) const
+void MEDFileMesh::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   std::ostringstream oss; oss << "MEDFileMesh : error on attempt to write in file : \"" << fileName << "\""; 
-  MEDFileUtilities::CheckMEDCode(fid,fid,oss.str().c_str());
+  MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
   write(fid);
 }
 
@@ -243,6 +243,11 @@ bool MEDFileMesh::isEqual(const MEDFileMesh *other, double eps, std::string& wha
   return true;
 }
 
+void MEDFileMesh::setName(const std::string& name)
+{
+  _name=name;
+}
+
 /*!
  * Clears redundant attributes of incorporated data arrays.
  */
@@ -319,7 +324,7 @@ void MEDFileMesh::clearFamGrpMaps()
  *  \return std::vector<std::string> - a sequence of names of the families.
  *  \throw If the name of a nonexistent group is specified.
  */
-std::vector<std::string> MEDFileMesh::getFamiliesOnGroup(const char *name) const
+std::vector<std::string> MEDFileMesh::getFamiliesOnGroup(const std::string& name) const
 {
   std::string oname(name);
   std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.find(oname);
@@ -364,7 +369,7 @@ std::vector<std::string> MEDFileMesh::getFamiliesOnGroups(const std::vector<std:
  *  \return std::vector<int> - sequence of ids of the families.
  *  \throw If the name of a nonexistent group is specified.
  */
-std::vector<int> MEDFileMesh::getFamiliesIdsOnGroup(const char *name) const
+std::vector<int> MEDFileMesh::getFamiliesIdsOnGroup(const std::string& name) const
 {
   std::string oname(name);
   std::map<std::string, std::vector<std::string> >::const_iterator it=_groups.find(oname);
@@ -385,7 +390,7 @@ std::vector<int> MEDFileMesh::getFamiliesIdsOnGroup(const char *name) const
  *  \param [in] name - the name of the group of interest.
  *  \param [in] fams - a sequence of names of families constituting the group.
  */
-void MEDFileMesh::setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams)
+void MEDFileMesh::setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams)
 {
   std::string oname(name);
   _groups[oname]=fams;
@@ -405,7 +410,7 @@ void MEDFileMesh::setFamiliesOnGroup(const char *name, const std::vector<std::st
  *  \param [in] famIds - a sequence of ids of families constituting the group.
  *  \throw If a family name is not found by its id.
  */
-void MEDFileMesh::setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds)
+void MEDFileMesh::setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds)
 {
   std::string oname(name);
   std::vector<std::string> fams(famIds.size());
@@ -423,7 +428,7 @@ void MEDFileMesh::setFamiliesIdsOnGroup(const char *name, const std::vector<int>
  *  \param [in] name - the name of the family of interest.
  *  \return std::vector<std::string> - a sequence of names of groups including the family.
  */
-std::vector<std::string> MEDFileMesh::getGroupsOnFamily(const char *name) const
+std::vector<std::string> MEDFileMesh::getGroupsOnFamily(const std::string& name) const
 {
   std::vector<std::string> ret;
   for(std::map<std::string, std::vector<std::string> >::const_iterator it1=_groups.begin();it1!=_groups.end();it1++)
@@ -444,7 +449,7 @@ std::vector<std::string> MEDFileMesh::getGroupsOnFamily(const char *name) const
  *  \param [in] grps - a sequence of group names to add the family in.
  *  \throw If a family named \a famName not yet exists.
  */
-void MEDFileMesh::setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps)
+void MEDFileMesh::setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps)
 {
   std::string fName(famName);
   const std::map<std::string,int>::const_iterator it=_families.find(fName);
@@ -504,7 +509,7 @@ void MEDFileMesh::assignFamilyNameWithGroupName()
   std::map<std::string,int> newFams;
   for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
     {
-      std::vector<std::string> grps=getGroupsOnFamily((*it).first.c_str());
+      std::vector<std::string> grps=getGroupsOnFamily((*it).first);
       if(grps.size()==1 && groups[grps[0]].size()==1)
         {
           if(newFams.find(grps[0])!=newFams.end())
@@ -557,7 +562,7 @@ std::vector<std::string> MEDFileMesh::removeEmptyGroups()
  *  \param [in] name - the name of the group to remove.
  *  \throw If no group with such a \a name exists.
  */
-void MEDFileMesh::removeGroup(const char *name)
+void MEDFileMesh::removeGroup(const std::string& name)
 {
   std::string oname(name);
   std::map<std::string, std::vector<std::string> >::iterator it=_groups.find(oname);
@@ -576,7 +581,7 @@ void MEDFileMesh::removeGroup(const char *name)
  *  \param [in] name - the name of the family to remove.
  *  \throw If no family with such a \a name exists.
  */
-void MEDFileMesh::removeFamily(const char *name)
+void MEDFileMesh::removeFamily(const std::string& name)
 {
   std::string oname(name);
   std::map<std::string, int >::iterator it=_families.find(oname);
@@ -638,7 +643,7 @@ std::vector<std::string> MEDFileMesh::removeOrphanFamilies()
       else
         {
           ret.push_back((*it).first);
-          std::vector<std::string> grpsOnEraseFam=getGroupsOnFamily((*it).first.c_str());
+          std::vector<std::string> grpsOnEraseFam=getGroupsOnFamily((*it).first);
           for(std::vector<std::string>::const_iterator it2=grpsOnEraseFam.begin();it2!=grpsOnEraseFam.end();it2++)
             {
               std::map<std::string, std::vector<std::string> >::iterator it3=grps.find(*it2);//it3!=grps.empty() thanks to copy
@@ -660,7 +665,7 @@ std::vector<std::string> MEDFileMesh::removeOrphanFamilies()
  *  \throw If no group named \a oldName exists in \a this mesh.
  *  \throw If a group named \a newName already exists.
  */
-void MEDFileMesh::changeGroupName(const char *oldName, const char *newName)
+void MEDFileMesh::changeGroupName(const std::string& oldName, const std::string& newName)
 {
   std::string oname(oldName);
   std::map<std::string, std::vector<std::string> >::iterator it=_groups.find(oname);
@@ -710,7 +715,7 @@ void MEDFileMesh::changeFamilyId(int oldId, int newId)
  *  \throw If no family named \a oldName exists in \a this mesh.
  *  \throw If a family named \a newName already exists.
  */
-void MEDFileMesh::changeFamilyName(const char *oldName, const char *newName)
+void MEDFileMesh::changeFamilyName(const std::string& oldName, const std::string& newName)
 {
   std::string oname(oldName);
   std::map<std::string, int >::iterator it=_families.find(oname);
@@ -827,7 +832,7 @@ bool MEDFileMesh::areGrpsEqual(const MEDFileMesh *other, std::string& what) cons
  *  \param [in] groupName - the group name.
  *  \return bool - \c true the group \a groupName exists in \a this mesh.
  */
-bool MEDFileMesh::existsGroup(const char *groupName) const
+bool MEDFileMesh::existsGroup(const std::string& groupName) const
 {
   std::string grpName(groupName);
   return _groups.find(grpName)!=_groups.end();
@@ -851,7 +856,7 @@ bool MEDFileMesh::existsFamily(int famId) const
  *  \param [in] familyName - the family name.
  *  \return bool - \c true the family \a familyName exists in \a this mesh.
  */
-bool MEDFileMesh::existsFamily(const char *familyName) const
+bool MEDFileMesh::existsFamily(const std::string& familyName) const
 {
   std::string fname(familyName);
   return _families.find(fname)!=_families.end();
@@ -862,13 +867,13 @@ bool MEDFileMesh::existsFamily(const char *familyName) const
  *  \param [in] familyName - the family name.
  *  \param [in] id - a new id of the family.
  */
-void MEDFileMesh::setFamilyId(const char *familyName, int id)
+void MEDFileMesh::setFamilyId(const std::string& familyName, int id)
 {
   std::string fname(familyName);
   _families[fname]=id;
 }
 
-void MEDFileMesh::setFamilyIdUnique(const char *familyName, int id)
+void MEDFileMesh::setFamilyIdUnique(const std::string& familyName, int id)
 {
   std::string fname(familyName);
   for(std::map<std::string,int>::const_iterator it=_families.begin();it!=_families.end();it++)
@@ -889,7 +894,7 @@ void MEDFileMesh::setFamilyIdUnique(const char *familyName, int id)
  *  \param [in] famId - an id of the family.
  *  \throw If a family with the same name or id already exists in \a this mesh.
  */
-void MEDFileMesh::addFamily(const char *familyName, int famId)
+void MEDFileMesh::addFamily(const std::string& familyName, int famId)
 {
   std::string fname(familyName);
   std::map<std::string,int>::const_iterator it=_families.find(fname);
@@ -928,7 +933,7 @@ void MEDFileMesh::addFamily(const char *familyName, int famId)
  *  \throw If no mesh entities of dimension \a meshDimRelToMaxExt exist in \a this mesh.
  *  \throw If no family field of dimension \a meshDimRelToMaxExt is present in \a this mesh.
  */
-void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const char *groupName)
+void MEDFileMesh::createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName)
 {
   std::string grpName(groupName);
   std::vector<int> levs=getNonEmptyLevelsExt();
@@ -996,7 +1001,7 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std
               std::string famName=getFamilyNameGivenId(*it2);
               std::ostringstream oss; oss << "Family_" << maxFamId;
               std::string zeName=CreateNameNotIn(oss.str(),allFams);
-              addFamilyOnAllGroupsHaving(famName.c_str(),zeName.c_str());
+              addFamilyOnAllGroupsHaving(famName,zeName);
               _families[zeName]=maxFamId;
               (const_cast<DataArrayInt *>(fieldFamIds))->changeValue(*it2,maxFamId);
               maxFamId++;
@@ -1014,7 +1019,7 @@ bool MEDFileMesh::keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std
  *  \throw If \a grpName or \a famName is an empty string.
  *  \throw If no family named \a famName is present in \a this mesh.
  */
-void MEDFileMesh::addFamilyOnGrp(const char *grpName, const char *famName)
+void MEDFileMesh::addFamilyOnGrp(const std::string& grpName, const std::string& famName)
 {
   std::string grpn(grpName);
   std::string famn(famName);
@@ -1046,7 +1051,7 @@ void MEDFileMesh::addFamilyOnGrp(const char *grpName, const char *famName)
  * This method is quite underground because it can lead to unconsistency because family 'otherFamName' is \b not added into _families.
  * This method is used by MEDFileMesh::keepFamIdsOnlyOnLevs method.
  */
-void MEDFileMesh::addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName)
+void MEDFileMesh::addFamilyOnAllGroupsHaving(const std::string& famName, const std::string& otherFamName)
 {
   std::string famNameCpp(famName);
   std::string otherCpp(otherFamName);
@@ -1060,12 +1065,12 @@ void MEDFileMesh::addFamilyOnAllGroupsHaving(const char *famName, const char *ot
     }
 }
 
-void MEDFileMesh::changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames)
+void MEDFileMesh::changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames)
 {
   ChangeAllGroupsContainingFamily(_groups,familyNameToChange,newFamiliesNames);
 }
 
-void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames)
+void MEDFileMesh::ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames)
 {
   std::string fam(familyNameToChange);
   for(std::map<std::string, std::vector<std::string> >::iterator it=groups.begin();it!=groups.end();it++)
@@ -1149,7 +1154,7 @@ void MEDFileMesh::setGroupInfo(const std::map<std::string, std::vector<std::stri
  *  \return int - the id of the family of interest.
  *  \throw If no family with such a \a name exists.
  */
-int MEDFileMesh::getFamilyId(const char *name) const
+int MEDFileMesh::getFamilyId(const std::string& name) const
 {
   std::string oname(name);
   std::map<std::string, int>::const_iterator it=_families.find(oname);
@@ -1355,12 +1360,12 @@ bool MEDFileMesh::ensureDifferentFamIdsPerLevel()
           if(allIds->presenceOfValue(*it3))
             {
               std::string famName=getFamilyNameGivenId(*it3);
-              std::vector<std::string> grps=getGroupsOnFamily(famName.c_str());
+              std::vector<std::string> grps=getGroupsOnFamily(famName);
               ren[*it3]=maxId;
               bool dummy;
               std::string newFam=findOrCreateAndGiveFamilyWithId(maxId,dummy);
               for(std::vector<std::string>::const_iterator it4=grps.begin();it4!=grps.end();it4++)
-                addFamilyOnGrp((*it4).c_str(),newFam.c_str());
+                addFamilyOnGrp((*it4),newFam);
             }
         }
       MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ids=fam->getIdsEqualList(&(*it2).second[0],&(*it2).second[0]+(*it2).second.size());
@@ -1581,7 +1586,7 @@ std::string MEDFileMesh::simpleRepr() const
  *  \throw If the name of a nonexistent group is specified.
  *  \throw If the family field is missing for \a meshDimRelToMaxExt.
  */
-DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum) const
+DataArrayInt *MEDFileMesh::getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum) const
 {
   std::vector<std::string> tmp(1);
   tmp[0]=grp;
@@ -1621,7 +1626,7 @@ DataArrayInt *MEDFileMesh::getGroupsArr(int meshDimRelToMaxExt, const std::vecto
  *          is to delete this array using decrRef() as it is no more needed. 
  *  \throw If the family field is missing for \a meshDimRelToMaxExt.
  */
-DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum) const
+DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum) const
 {
   std::vector<std::string> tmp(1);
   tmp[0]=fam;
@@ -1641,7 +1646,7 @@ DataArrayInt *MEDFileMesh::getFamilyArr(int meshDimRelToMaxExt, const char *fam,
  *  \throw If the name of a nonexistent group is specified.
  *  \throw If the family field is missing for nodes.
  */
-DataArrayInt *MEDFileMesh::getNodeGroupArr(const char *grp, bool renum) const
+DataArrayInt *MEDFileMesh::getNodeGroupArr(const std::string& grp, bool renum) const
 {
   std::vector<std::string> tmp(1);
   tmp[0]=grp;
@@ -1677,7 +1682,7 @@ DataArrayInt *MEDFileMesh::getNodeGroupsArr(const std::vector<std::string>& grps
  *  \throw If the name of a nonexistent group is specified.
  *  \throw If the family field is missing for nodes.
  */
-DataArrayInt *MEDFileMesh::getNodeFamilyArr(const char *fam, bool renum) const
+DataArrayInt *MEDFileMesh::getNodeFamilyArr(const std::string& fam, bool renum) const
 {
   std::vector<std::string> tmp(1);
   tmp[0]=fam;
@@ -1743,7 +1748,7 @@ void MEDFileMesh::setGroupsAtLevel(int meshDimRelToMaxExt, const std::vector<con
       for(unsigned int ii=0;ii<grps.size();ii++)
         {
           grps2[ii]=MEDFileUMeshSplitL1::Renumber(getRevNumberFieldAtLevel(meshDimRelToMaxExt),grps[ii]);
-          grps2[ii]->setName(grps[ii]->getName().c_str());
+          grps2[ii]->setName(grps[ii]->getName());
         }
       std::vector<const DataArrayInt *> grps3(grps2.begin(),grps2.end());
       fam=DataArrayInt::MakePartition(grps3,sz,fidsOfGroups);
@@ -1782,6 +1787,18 @@ void MEDFileMesh::appendFamilyEntries(const DataArrayInt *famIds, const std::vec
     }
 }
 
+std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileMesh::getAllGeoTypes() const
+{
+  std::vector<int> levs(getNonEmptyLevels());
+  std::vector<INTERP_KERNEL::NormalizedCellType> ret;
+  for(std::vector<int>::const_iterator it=levs.begin();it!=levs.end();it++)
+    {
+      std::vector<INTERP_KERNEL::NormalizedCellType> elts(getGeoTypesAtLevel(*it));
+      ret.insert(ret.end(),elts.begin(),elts.end());
+    }
+  return ret;
+}
+
 std::vector<int> MEDFileMesh::getDistributionOfTypes(int meshDimRelToMax) const
 {
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> mLev(getGenMeshAtLevel(meshDimRelToMax));
@@ -1900,7 +1917,7 @@ void MEDFileMesh::getFamilyRepr(std::ostream& oss) const
     {
       oss << "- Family with name \"" << (*it).first << "\" with number " << (*it).second << std::endl;
       oss << "  - Groups lying on this family : ";
-      std::vector<std::string> grps=getGroupsOnFamily((*it).first.c_str());
+      std::vector<std::string> grps=getGroupsOnFamily((*it).first);
       std::copy(grps.begin(),grps.end(),std::ostream_iterator<std::string>(oss," "));
       oss << std::endl << std::endl;
     }
@@ -1920,10 +1937,10 @@ void MEDFileMesh::getFamilyRepr(std::ostream& oss) const
  *  \throw If there is no mesh with given attributes in the file.
  *  \throw If the mesh in the file is not an unstructured one.
  */
-MEDFileUMesh *MEDFileUMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   return new MEDFileUMesh(fid,mName,dt,it,mrs);
 }
 
@@ -1937,7 +1954,7 @@ MEDFileUMesh *MEDFileUMesh::New(const char *fileName, const char *mName, int dt,
  *  \throw If there is no meshes in the file.
  *  \throw If the mesh in the file is not an unstructured one.
  */
-MEDFileUMesh *MEDFileUMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh *MEDFileUMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
 {
   std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
   if(ms.empty())
@@ -1946,12 +1963,12 @@ MEDFileUMesh *MEDFileUMesh::New(const char *fileName, MEDFileMeshReadSelector *m
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int dt,it;
   ParaMEDMEM::MEDCouplingMeshType meshType;
   std::string dummy2;
-  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2);
-  return new MEDFileUMesh(fid,ms.front().c_str(),dt,it,mrs);
+  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2);
+  return new MEDFileUMesh(fid,ms.front(),dt,it,mrs);
 }
 
 /*!
@@ -2157,11 +2174,19 @@ void MEDFileUMesh::clearNonDiscrAttributes() const
     }
 }
 
+void MEDFileUMesh::setName(const std::string& name)
+{
+  for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::iterator it=_ms.begin();it!=_ms.end();it++)
+    if((MEDFileUMeshSplitL1 *)(*it)!=0)
+      (*it)->setName(name);
+  MEDFileMesh::setName(name);
+}
+
 MEDFileUMesh::MEDFileUMesh()
 {
 }
 
-MEDFileUMesh::MEDFileUMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileUMesh::MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 try
   {
     loadUMeshFromFile(fid,mName,dt,it,mrs);
@@ -2171,7 +2196,7 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-void MEDFileUMesh::loadUMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMesh::loadUMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   MEDFileUMeshL2 loaderl2;
   ParaMEDMEM::MEDCouplingMeshType meshType;
@@ -2237,11 +2262,12 @@ void MEDFileUMesh::writeLL(med_idt fid) const
     }
   MEDmeshCr(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
   MEDmeshUniversalNameWr(fid,maa);
-  MEDFileUMeshL2::WriteCoords(fid,maa,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords);
+  std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
+  MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords);
   for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
     if((const MEDFileUMeshSplitL1 *)(*it)!=0)
-      (*it)->write(fid,maa,mdim);
-  MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa,_families,_groups,_too_long_str);
+      (*it)->write(fid,meshName,mdim);
+  MEDFileUMeshL2::WriteFamiliesAndGrps(fid,meshName,_families,_groups,_too_long_str);
 }
 
 /*!
@@ -2333,7 +2359,7 @@ std::vector<int> MEDFileUMesh::getNameArrNonEmptyLevelsExt() const
  *  \param [in] grp - the name of the group of interest.
  *  \return std::vector<int> - a sequence of the relative dimensions.
  */
-std::vector<int> MEDFileUMesh::getGrpNonEmptyLevels(const char *grp) const
+std::vector<int> MEDFileUMesh::getGrpNonEmptyLevels(const std::string& grp) const
 {
   std::vector<std::string> fams=getFamiliesOnGroup(grp);
   return getFamsNonEmptyLevels(fams);
@@ -2344,7 +2370,7 @@ std::vector<int> MEDFileUMesh::getGrpNonEmptyLevels(const char *grp) const
  *  \param [in] grp - the name of the group of interest.
  *  \return std::vector<int> - a sequence of the relative dimensions.
  */
-std::vector<int> MEDFileUMesh::getGrpNonEmptyLevelsExt(const char *grp) const
+std::vector<int> MEDFileUMesh::getGrpNonEmptyLevelsExt(const std::string& grp) const
 {
   std::vector<std::string> fams=getFamiliesOnGroup(grp);
   return getFamsNonEmptyLevelsExt(fams);
@@ -2356,7 +2382,7 @@ std::vector<int> MEDFileUMesh::getGrpNonEmptyLevelsExt(const char *grp) const
  *  \param [in] fam - the name of the family of interest.
  *  \return std::vector<int> - a sequence of the relative dimensions.
  */
-std::vector<int> MEDFileUMesh::getFamNonEmptyLevels(const char *fam) const
+std::vector<int> MEDFileUMesh::getFamNonEmptyLevels(const std::string& fam) const
 {
   std::vector<std::string> fams(1,std::string(fam));
   return getFamsNonEmptyLevels(fams);
@@ -2367,7 +2393,7 @@ std::vector<int> MEDFileUMesh::getFamNonEmptyLevels(const char *fam) const
  *  \param [in] fam - the name of the family of interest.
  *  \return std::vector<int> - a sequence of the relative dimensions.
  */
-std::vector<int> MEDFileUMesh::getFamNonEmptyLevelsExt(const char *fam) const
+std::vector<int> MEDFileUMesh::getFamNonEmptyLevelsExt(const std::string& fam) const
 {
   std::vector<std::string> fams(1,std::string(fam));
   return getFamsNonEmptyLevelsExt(fams);
@@ -2448,7 +2474,7 @@ std::vector<std::string> MEDFileUMesh::getGroupsOnSpecifiedLev(int meshDimRelToM
   std::vector<std::string> allGrps=getGroupsNames();
   for(std::vector<std::string>::const_iterator it=allGrps.begin();it!=allGrps.end();it++)
     {
-      std::vector<int> levs=getGrpNonEmptyLevelsExt((*it).c_str());
+      std::vector<int> levs=getGrpNonEmptyLevelsExt((*it));
       if(std::find(levs.begin(),levs.end(),meshDimRelToMaxExt)!=levs.end())
         ret.push_back(*it);
     }
@@ -2685,7 +2711,7 @@ void MEDFileUMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, con
         m->computeNodeIdsAlg(nodesFetched);
       else
         {
-          const DataArrayInt *arr(globs->getProfile(st[i].getPflName().c_str()));
+          const DataArrayInt *arr(globs->getProfile(st[i].getPflName()));
           MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> m2(dynamic_cast<MEDCoupling1GTUMesh *>(m->buildPartOfMySelf(arr->begin(),arr->end(),true)));
           m2->computeNodeIdsAlg(nodesFetched);
         }
@@ -2740,7 +2766,7 @@ DataArrayDouble *MEDFileUMesh::getCoords() const
  *  \throw If the name of a nonexistent group is specified.
  *  \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
  */
-MEDCouplingUMesh *MEDFileUMesh::getGroup(int meshDimRelToMaxExt, const char *grp, bool renum) const
+MEDCouplingUMesh *MEDFileUMesh::getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum) const
 {
   synchronizeTinyInfoOnLeaves();
   std::vector<std::string> tmp(1);
@@ -2768,7 +2794,7 @@ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vec
   std::vector<std::string> fams2=getFamiliesOnGroups(grps);
   MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> zeRet=getFamilies(meshDimRelToMaxExt,fams2,renum);
   if(grps.size()==1 && ((MEDCouplingUMesh *)zeRet))
-    zeRet->setName(grps[0].c_str());
+    zeRet->setName(grps[0]);
   return zeRet.retn();
 }
 
@@ -2786,7 +2812,7 @@ MEDCouplingUMesh *MEDFileUMesh::getGroups(int meshDimRelToMaxExt, const std::vec
  *  \throw If a name of a nonexistent family is present in \a grps.
  *  \throw If there are no mesh entities of \a meshDimRelToMaxExt dimension in \a this mesh.
  */
-MEDCouplingUMesh *MEDFileUMesh::getFamily(int meshDimRelToMaxExt, const char *fam, bool renum) const
+MEDCouplingUMesh *MEDFileUMesh::getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum) const
 {
   synchronizeTinyInfoOnLeaves();
   std::vector<std::string> tmp(1);
@@ -2827,7 +2853,7 @@ MEDCouplingUMesh *MEDFileUMesh::getFamilies(int meshDimRelToMaxExt, const std::v
   else
     zeRet=l1->getFamilyPart(0,0,renum);
   if(fams.size()==1 && ((MEDCouplingUMesh *)zeRet))
-    zeRet->setName(fams[0].c_str());
+    zeRet->setName(fams[0]);
   return zeRet.retn();
 }
 
@@ -2895,7 +2921,7 @@ MEDCouplingUMesh *MEDFileUMesh::getMeshAtLevel(int meshDimRelToMaxExt, bool renu
           MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> cc=_coords->deepCpy();
           umesh->setCoords(cc);
           MEDFileUMeshSplitL1::ClearNonDiscrAttributes(umesh);
-          umesh->setName(getName().c_str());
+          umesh->setName(getName());
           return umesh;
         }
     }
@@ -3185,7 +3211,7 @@ void MEDFileUMesh::optimizeFamilies()
     _groups.erase(*it);
 }
 
-void MEDFileUMesh::duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified)
+void MEDFileUMesh::duplicateNodesOnM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified)
 {
   std::vector<int> levs=getNonEmptyLevels();
   if(std::find(levs.begin(),levs.end(),0)==levs.end() || std::find(levs.begin(),levs.end(),-1)==levs.end())
@@ -3229,7 +3255,7 @@ void MEDFileUMesh::duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> szOfCellGrpOfSameType(tmp00);
   MEDCouplingAutoRefCountObjectPtr<DataArrayInt> idInMsOfCellGrpOfSameType(tmp11);
   //
-  newm1->setName(getName().c_str());
+  newm1->setName(getName());
   const DataArrayInt *fam=getFamilyFieldAtLevel(-1);
   if(!fam)
     throw INTERP_KERNEL::Exception("MEDFileUMesh::duplicateNodesOnM1Group : internal problem !");
@@ -3258,8 +3284,8 @@ void MEDFileUMesh::duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *
   setMeshAtLevel(-1,newm1);
   setFamilyFieldArr(-1,newFam);
   std::string grpName2(grpNameM1); grpName2+="_dup";
-  addFamily(grpName2.c_str(),idd);
-  addFamilyOnGrp(grpName2.c_str(),grpName2.c_str());
+  addFamily(grpName2,idd);
+  addFamilyOnGrp(grpName2,grpName2);
   //
   fam=_fam_coords;
   if(fam)
@@ -3499,7 +3525,7 @@ void MEDFileUMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids
               if(existsFamily(*famId))
                 {
                   std::string locFamName2=getFamilyNameGivenId(*famId); std::vector<std::string> v(2); v[0]=locFamName2; v[1]=locFamName;
-                  ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId).c_str(),v);
+                  ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v);
                 }
               maxVal++;
             } // modifying all other groups on *famId to lie on maxVal and lie the grp on maxVal
@@ -3512,7 +3538,7 @@ void MEDFileUMesh::addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids
           if(existsFamily(*famId))
             {
               std::string n1(FindOrCreateAndGiveFamilyWithId(families,isNodeGroup?maxVal:-maxVal,created)); std::vector<std::string> v(2); v[0]=n1; v[1]=n2;
-              ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId).c_str(),v);
+              ChangeAllGroupsContainingFamily(groups,getFamilyNameGivenId(*famId),v);
             }
           maxVal+=2;
         }
@@ -3653,10 +3679,10 @@ void MEDFileUMesh::setMeshes(const std::vector<const MEDCouplingUMesh *>& ms, bo
   for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms.begin();it!=ms.end();it++)
     {
       int mdim=(*it)->getMeshDimension();
-      setName((*it)->getName().c_str());
+      setName((*it)->getName());
       setMeshAtLevel(mdim-zeDim,const_cast<MEDCouplingUMesh *>(*it),renum);
     }
-  setName(name.c_str());
+  setName(name);
 }
 
 /*!
@@ -4498,12 +4524,21 @@ int MEDFileStructuredMesh::getSizeAtLevel(int meshDimRelToMaxExt) const
 
 int MEDFileStructuredMesh::getNumberOfNodes() const
 {
-  const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();
+  const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
   if(!cmesh)
     throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getNumberOfNodes : no cartesian mesh set !");
   return cmesh->getNumberOfNodes();
 }
 
+std::vector<INTERP_KERNEL::NormalizedCellType> MEDFileStructuredMesh::getGeoTypesAtLevel(int meshDimRelToMax) const
+{
+  if(meshDimRelToMax!=0)
+    throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGeoTypesAtLevel : only one level available for structured meshes ! Input 0 is mandatory !");
+  const MEDCouplingStructuredMesh *cmesh(getStructuredMesh());
+  std::vector<INTERP_KERNEL::NormalizedCellType> ret(1,cmesh->getTypeOfCell(0));
+  return ret;
+}
+
 void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const
 {
   if(st.getNumberOfItems()!=1)
@@ -4517,7 +4552,7 @@ void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem
       std::fill(nodesFetched.begin(),nodesFetched.end(),true);
       return ;
     }
-  const DataArrayInt *arr(globs->getProfile(st[0].getPflName().c_str()));
+  const DataArrayInt *arr(globs->getProfile(st[0].getPflName()));
   const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before
   int sz(nodesFetched.size());
   for(const int *work=arr->begin();work!=arr->end();work++)
@@ -4555,7 +4590,7 @@ med_geometry_type MEDFileStructuredMesh::GetGeoTypeFromMeshDim(int meshDim)
   return geoTypeReq;
 }
 
-void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   setName(strm->getName());
   setDescription(strm->getDescription());
@@ -4566,85 +4601,85 @@ void MEDFileStructuredMesh::loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt
   setTimeUnit(strm->getTimeUnit());
   MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs);
   med_bool chgt=MED_FALSE,trsf=MED_FALSE;
-  int nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
+  int nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
   if(nbOfElt>0)
     {
       if(!mrs || mrs->isNodeFamilyFieldReading())
         {
           _fam_nodes=DataArrayInt::New();
           _fam_nodes->alloc(nbOfElt,1);
-          MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer());
+          MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer());
         }
     }
-  nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf);
+  nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf);
   if(nbOfElt>0)
     {
       if(!mrs || mrs->isNodeNumFieldReading())
         {
           _num_nodes=DataArrayInt::New();
           _num_nodes->alloc(nbOfElt,1);
-          MEDmeshEntityNumberRd(fid,mName,dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer());
+          MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer());
         }
     }
   int meshDim=getStructuredMesh()->getMeshDimension();
   med_geometry_type geoTypeReq=GetGeoTypeFromMeshDim(meshDim);
-  nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
+  nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
   if(nbOfElt>0)
     {
       if(!mrs || mrs->isCellFamilyFieldReading())
         {
           _fam_cells=DataArrayInt::New();
           _fam_cells->alloc(nbOfElt,1);
-          MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_fam_cells->getPointer());
+          MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,_fam_cells->getPointer());
         }
     }
-  nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf);
+  nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf);
   if(nbOfElt>0)
     {
       if(!mrs || mrs->isCellNumFieldReading())
         {
           _num_cells=DataArrayInt::New();
           _num_cells->alloc(nbOfElt,1);
-          MEDmeshEntityNumberRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_num_cells->getPointer());
+          MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,_num_cells->getPointer());
         }
     }
-  nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf);
+  nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf);
   if(nbOfElt>0)
     {
       if(!mrs || mrs->isCellNameFieldReading())
         {
           _names_cells=DataArrayAsciiChar::New();
           _names_cells->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
-          MEDmeshEntityNameRd(fid,mName,dt,it,MED_CELL,geoTypeReq,_names_cells->getPointer());
+          MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,_names_cells->getPointer());
           _names_cells->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
         }
     }
-  nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf);
+  nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf);
   if(nbOfElt>0)
     {
       if(!mrs || mrs->isNodeNameFieldReading())
         {
           _names_nodes=DataArrayAsciiChar::New();
           _names_nodes->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
-          MEDmeshEntityNameRd(fid,mName,dt,it,MED_NODE,MED_NONE,_names_nodes->getPointer());
+          MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_names_nodes->getPointer());
           _names_nodes->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
         }
     }
 }
 
-void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) const
+void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const std::string& maa) const
 {
   int meshDim=getStructuredMesh()->getMeshDimension();
   med_geometry_type geoTypeReq=GetGeoTypeFromMeshDim(meshDim);
   //
   if((const DataArrayInt *)_fam_cells)
-    MEDmeshEntityFamilyNumberWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer());
+    MEDmeshEntityFamilyNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer());
   if((const DataArrayInt *)_fam_nodes)
-    MEDmeshEntityFamilyNumberWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer());
+    MEDmeshEntityFamilyNumberWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer());
   if((const DataArrayInt *)_num_cells)
-    MEDmeshEntityNumberWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer());
+    MEDmeshEntityNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer());
   if((const DataArrayInt *)_num_nodes)
-    MEDmeshEntityNumberWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer());
+    MEDmeshEntityNumberWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer());
   if((const DataArrayAsciiChar *)_names_cells)
     {
       if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE)
@@ -4653,7 +4688,7 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) cons
           oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      MEDmeshEntityNameWr(fid,maa,_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer());
+      MEDmeshEntityNameWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer());
     }
   if((const DataArrayAsciiChar *)_names_nodes)
     {
@@ -4663,10 +4698,10 @@ void MEDFileStructuredMesh::writeStructuredLL(med_idt fid, const char *maa) cons
           oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      MEDmeshEntityNameWr(fid,maa,_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer());
+      MEDmeshEntityNameWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer());
     }
   //
-  MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa,_families,_groups,_too_long_str);
+  MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa.c_str(),_families,_groups,_too_long_str);
 }
 
 /*!
@@ -4689,7 +4724,7 @@ MEDFileCMesh *MEDFileCMesh::New()
  *  \throw If there is no meshes in the file.
  *  \throw If the mesh in the file is not a Cartesian one.
  */
-MEDFileCMesh *MEDFileCMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs)
+MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
 {
   std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
   if(ms.empty())
@@ -4698,12 +4733,12 @@ MEDFileCMesh *MEDFileCMesh::New(const char *fileName, MEDFileMeshReadSelector *m
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int dt,it;
   ParaMEDMEM::MEDCouplingMeshType meshType;
   std::string dummy2;
-  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2);
-  return new MEDFileCMesh(fid,ms.front().c_str(),dt,it,mrs);
+  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2);
+  return new MEDFileCMesh(fid,ms.front(),dt,it,mrs);
 }
 
 /*!
@@ -4720,10 +4755,10 @@ MEDFileCMesh *MEDFileCMesh::New(const char *fileName, MEDFileMeshReadSelector *m
  *  \throw If there is no mesh with given attributes in the file.
  *  \throw If the mesh in the file is not a Cartesian one.
  */
-MEDFileCMesh *MEDFileCMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileCMesh *MEDFileCMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   return new MEDFileCMesh(fid,mName,dt,it,mrs);
 }
 
@@ -4752,6 +4787,18 @@ int MEDFileCMesh::getMeshDimension() const
   return _cmesh->getMeshDimension();
 }
 
+/*!
+ * Returns the dimension on nodes in \a this mesh.
+ *  \return int - the space dimension.
+ *  \throw If there are no cells in this mesh.
+ */
+int MEDFileCMesh::getSpaceDimension() const
+{
+  if(!((const MEDCouplingCMesh*)_cmesh))
+    throw INTERP_KERNEL::Exception("MEDFileCMesh::getSpaceDimension : unable to get spacedimension because no mesh set !");
+  return _cmesh->getSpaceDimension();
+}
+
 /*!
  * Returns a string describing \a this mesh.
  *  \return std::string - the mesh information string.
@@ -4841,7 +4888,7 @@ MEDFileCMesh::MEDFileCMesh()
 {
 }
 
-MEDFileCMesh::MEDFileCMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileCMesh::MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 try
   {
     loadCMeshFromFile(fid,mName,dt,it,mrs);
@@ -4851,7 +4898,7 @@ catch(INTERP_KERNEL::Exception& e)
     throw e;
   }
 
-void MEDFileCMesh::loadCMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileCMesh::loadCMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   ParaMEDMEM::MEDCouplingMeshType meshType;
   int dummy0,dummy1;
@@ -4908,8 +4955,7 @@ void MEDFileCMesh::writeLL(med_idt fid) const
   MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,maa,_too_long_str);
   MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,desc,_too_long_str);
   MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_LNAME_SIZE,dtunit,_too_long_str);
-  int spaceDim=_cmesh->getSpaceDimension();
-  int meshDim=_cmesh->getMeshDimension();
+  int spaceDim(_cmesh->getSpaceDimension());
   INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
   INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
   for(int i=0;i<spaceDim;i++)
@@ -4920,7 +4966,7 @@ void MEDFileCMesh::writeLL(med_idt fid) const
       MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
       MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
     }
-  MEDmeshCr(fid,maa,spaceDim,meshDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
+  MEDmeshCr(fid,maa,spaceDim,spaceDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
   MEDmeshUniversalNameWr(fid,maa);
   MEDmeshGridTypeWr(fid,maa,MED_CARTESIAN_GRID);
   for(int i=0;i<spaceDim;i++)
@@ -4929,7 +4975,8 @@ void MEDFileCMesh::writeLL(med_idt fid) const
       MEDmeshGridIndexCoordinateWr(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer());
     }
   //
-  MEDFileStructuredMesh::writeStructuredLL(fid,maa);
+  std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
+  MEDFileStructuredMesh::writeStructuredLL(fid,meshName);
 }
 
 void MEDFileCMesh::synchronizeTinyInfoOnLeaves() const
@@ -4937,10 +4984,10 @@ void MEDFileCMesh::synchronizeTinyInfoOnLeaves() const
   const MEDCouplingCMesh *cmesh=_cmesh;
   if(!cmesh)
     return;
-  (const_cast<MEDCouplingCMesh *>(cmesh))->setName(_name.c_str());
-  (const_cast<MEDCouplingCMesh *>(cmesh))->setDescription(_desc_name.c_str());
+  (const_cast<MEDCouplingCMesh *>(cmesh))->setName(_name);
+  (const_cast<MEDCouplingCMesh *>(cmesh))->setDescription(_desc_name);
   (const_cast<MEDCouplingCMesh *>(cmesh))->setTime(_time,_iteration,_order);
-  (const_cast<MEDCouplingCMesh *>(cmesh))->setTimeUnit(_dt_unit.c_str());
+  (const_cast<MEDCouplingCMesh *>(cmesh))->setTimeUnit(_dt_unit);
 }
 
 MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New()
@@ -4948,7 +4995,7 @@ MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New()
   return new MEDFileCurveLinearMesh;
 }
 
-MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const char *fileName, MEDFileMeshReadSelector *mrs)
+MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, MEDFileMeshReadSelector *mrs)
 {
   std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
   if(ms.empty())
@@ -4957,18 +5004,18 @@ MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const char *fileName, MEDFil
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int dt,it;
   ParaMEDMEM::MEDCouplingMeshType meshType;
   std::string dummy2;
-  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2);
-  return new MEDFileCurveLinearMesh(fid,ms.front().c_str(),dt,it,mrs);
+  MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2);
+  return new MEDFileCurveLinearMesh(fid,ms.front(),dt,it,mrs);
 }
 
-MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const char *fileName, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileCurveLinearMesh *MEDFileCurveLinearMesh::New(const std::string& fileName, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   return new MEDFileCurveLinearMesh(fid,mName,dt,it,mrs);
 }
 
@@ -5064,10 +5111,10 @@ void MEDFileCurveLinearMesh::synchronizeTinyInfoOnLeaves() const
   const MEDCouplingCurveLinearMesh *clmesh=_clmesh;
   if(!clmesh)
     return;
-  (const_cast<MEDCouplingCurveLinearMesh *>(clmesh))->setName(_name.c_str());
-  (const_cast<MEDCouplingCurveLinearMesh *>(clmesh))->setDescription(_desc_name.c_str());
+  (const_cast<MEDCouplingCurveLinearMesh *>(clmesh))->setName(_name);
+  (const_cast<MEDCouplingCurveLinearMesh *>(clmesh))->setDescription(_desc_name);
   (const_cast<MEDCouplingCurveLinearMesh *>(clmesh))->setTime(_time,_iteration,_order);
-  (const_cast<MEDCouplingCurveLinearMesh *>(clmesh))->setTimeUnit(_dt_unit.c_str());
+  (const_cast<MEDCouplingCurveLinearMesh *>(clmesh))->setTimeUnit(_dt_unit);
 }
 
 const MEDCouplingCurveLinearMesh *MEDFileCurveLinearMesh::getMesh() const
@@ -5094,7 +5141,7 @@ MEDFileCurveLinearMesh::MEDFileCurveLinearMesh()
 {
 }
 
-MEDFileCurveLinearMesh::MEDFileCurveLinearMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+MEDFileCurveLinearMesh::MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 try
   {
     loadCLMeshFromFile(fid,mName,dt,it,mrs);
@@ -5135,10 +5182,11 @@ void MEDFileCurveLinearMesh::writeLL(med_idt fid) const
   
   MEDmeshNodeCoordinateWr(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin());
   //
-  MEDFileStructuredMesh::writeStructuredLL(fid,maa);
+  std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
+  MEDFileStructuredMesh::writeStructuredLL(fid,meshName);
 }
 
-void MEDFileCurveLinearMesh::loadCLMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileCurveLinearMesh::loadCLMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   ParaMEDMEM::MEDCouplingMeshType meshType;
   int dummy0,dummy1;
@@ -5162,12 +5210,12 @@ MEDFileMeshMultiTS *MEDFileMeshMultiTS::New()
   return new MEDFileMeshMultiTS;
 }
 
-MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const char *fileName)
+MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName)
 {
   return new MEDFileMeshMultiTS(fileName);
 }
 
-MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const char *fileName, const char *mName)
+MEDFileMeshMultiTS *MEDFileMeshMultiTS::New(const std::string& fileName, const std::string& mName)
 {
   return new MEDFileMeshMultiTS(fileName,mName);
 }
@@ -5208,7 +5256,7 @@ std::string MEDFileMeshMultiTS::getName() const
   return _mesh_one_ts[0]->getName();
 }
 
-void MEDFileMeshMultiTS::setName(const char *newMeshName)
+void MEDFileMeshMultiTS::setName(const std::string& newMeshName)
 {
   std::string oldName(getName());
   std::vector< std::pair<std::string,std::string> > v(1);
@@ -5254,16 +5302,16 @@ void MEDFileMeshMultiTS::write(med_idt fid) const
     }
 }
 
-void MEDFileMeshMultiTS::write(const char *fileName, int mode) const
+void MEDFileMeshMultiTS::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   std::ostringstream oss; oss << "MEDFileMesh : error on attempt to write in file : \"" << fileName << "\""; 
-  MEDFileUtilities::CheckMEDCode(fid,fid,oss.str().c_str());
+  MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
   write(fid);
 }
 
-void MEDFileMeshMultiTS::loadFromFile(const char *fileName, const char *mName)
+void MEDFileMeshMultiTS::loadFromFile(const std::string& fileName, const std::string& mName)
 {//for the moment to be improved
   _mesh_one_ts.resize(1);
   _mesh_one_ts[0]=MEDFileMesh::New(fileName,mName,-1,-1);
@@ -5273,7 +5321,7 @@ MEDFileMeshMultiTS::MEDFileMeshMultiTS()
 {
 }
 
-MEDFileMeshMultiTS::MEDFileMeshMultiTS(const char *fileName)
+MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName)
 try
   {
     std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
@@ -5283,19 +5331,19 @@ try
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
     MEDFileUtilities::CheckFileForRead(fileName);
-    MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+    MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
     int dt,it;
     ParaMEDMEM::MEDCouplingMeshType meshType;
     std::string dummy2;
-    MEDFileMeshL2::GetMeshIdFromName(fid,ms.front().c_str(),meshType,dt,it,dummy2);
-    loadFromFile(fileName,ms.front().c_str());
+    MEDFileMeshL2::GetMeshIdFromName(fid,ms.front(),meshType,dt,it,dummy2);
+    loadFromFile(fileName,ms.front());
   }
 catch(INTERP_KERNEL::Exception& e)
   {
     throw e;
   }
 
-MEDFileMeshMultiTS::MEDFileMeshMultiTS(const char *fileName, const char *mName)
+MEDFileMeshMultiTS::MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName)
 try
   {
     loadFromFile(fileName,mName);
@@ -5310,7 +5358,7 @@ MEDFileMeshes *MEDFileMeshes::New()
   return new MEDFileMeshes;
 }
 
-MEDFileMeshes *MEDFileMeshes::New(const char *fileName)
+MEDFileMeshes *MEDFileMeshes::New(const std::string& fileName)
 {
   return new MEDFileMeshes(fileName);
 }
@@ -5325,12 +5373,12 @@ void MEDFileMeshes::write(med_idt fid) const
     }
 }
 
-void MEDFileMeshes::write(const char *fileName, int mode) const
+void MEDFileMeshes::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   std::ostringstream oss; oss << "MEDFileMesh : error on attempt to write in file : \"" << fileName << "\""; 
-  MEDFileUtilities::CheckMEDCode(fid,fid,oss.str().c_str());
+  MEDFileUtilities::CheckMEDCode(fid,fid,oss.str());
   checkCoherency();
   write(fid);
 }
@@ -5355,7 +5403,7 @@ MEDFileMesh *MEDFileMeshes::getMeshAtPos(int i) const
   return _meshes[i]->getOneTimeStep();
 }
 
-MEDFileMesh *MEDFileMeshes::getMeshWithName(const char *mname) const
+MEDFileMesh *MEDFileMeshes::getMeshWithName(const std::string& mname) const
 {
   std::vector<std::string> ms=getMeshesNames();
   std::vector<std::string>::iterator it=std::find(ms.begin(),ms.end(),mname);
@@ -5435,20 +5483,20 @@ void MEDFileMeshes::destroyMeshAtPos(int i)
   _meshes.erase(_meshes.begin()+i);
 }
 
-void MEDFileMeshes::loadFromFile(const char *fileName)
+void MEDFileMeshes::loadFromFile(const std::string& fileName)
 {
   std::vector<std::string> ms=MEDLoader::GetMeshNames(fileName);
   int i=0;
   _meshes.resize(ms.size());
   for(std::vector<std::string>::const_iterator it=ms.begin();it!=ms.end();it++,i++)
-    _meshes[i]=MEDFileMeshMultiTS::New(fileName,(*it).c_str());
+    _meshes[i]=MEDFileMeshMultiTS::New(fileName,(*it));
 }
 
 MEDFileMeshes::MEDFileMeshes()
 {
 }
 
-MEDFileMeshes::MEDFileMeshes(const char *fileName)
+MEDFileMeshes::MEDFileMeshes(const std::string& fileName)
 try
   {
     loadFromFile(fileName);
index d5b544972a0c713acaa292710a4989eedf0f6f53..ee996321b8c8272287c31099d50407f00fbb0a89 100644 (file)
@@ -37,8 +37,8 @@ namespace ParaMEDMEM
   class MEDFileMesh : public RefCountObject, public MEDFileWritable
   {
   public:
-    MEDLOADER_EXPORT static MEDFileMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0);
-    MEDLOADER_EXPORT static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT virtual MEDFileMesh *createNewEmpty() const = 0;
@@ -46,13 +46,13 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT virtual MEDFileMesh *shallowCpy() const = 0;
     MEDLOADER_EXPORT virtual bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
     MEDLOADER_EXPORT virtual void clearNonDiscrAttributes() const;
-    MEDLOADER_EXPORT void setName(const char *name) { _name=name; }
+    MEDLOADER_EXPORT virtual void setName(const std::string& name);
     MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
     MEDLOADER_EXPORT std::string getName() const { return _name; }
-    MEDLOADER_EXPORT const char *getUnivName() const { return _univ_name.c_str(); }
+    MEDLOADER_EXPORT std::string getUnivName() const { return _univ_name; }
     MEDLOADER_EXPORT bool getUnivNameWrStatus() const { return _univ_wr_status; }
     MEDLOADER_EXPORT void setUnivNameWrStatus(bool newStatus) { _univ_wr_status=newStatus; }
-    MEDLOADER_EXPORT void setDescription(const char *name) { _desc_name=name; }
+    MEDLOADER_EXPORT void setDescription(const std::string& name) { _desc_name=name; }
     MEDLOADER_EXPORT std::string getDescription() const { return _desc_name; }
     MEDLOADER_EXPORT void setOrder(int order) { _order=order; }
     MEDLOADER_EXPORT int getOrder() const { return _order; }
@@ -62,15 +62,17 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void setTime(int dt, int it, double time) { _time=time; _iteration=dt; _order=it; }
     MEDLOADER_EXPORT double getTime(int& dt, int& it) { dt=_iteration; it=_order; return _time; }
     MEDLOADER_EXPORT double getTimeValue() const { return _time; }
-    MEDLOADER_EXPORT void setTimeUnit(const char *unit) { _dt_unit=unit; }
-    MEDLOADER_EXPORT const char *getTimeUnit() const { return _dt_unit.c_str(); }
+    MEDLOADER_EXPORT void setTimeUnit(const std::string& unit) { _dt_unit=unit; }
+    MEDLOADER_EXPORT std::string getTimeUnit() const { return _dt_unit; }
+    MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getAllGeoTypes() const;
     MEDLOADER_EXPORT virtual int getNumberOfNodes() const = 0;
+    MEDLOADER_EXPORT virtual std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const = 0;
     MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevels() const = 0;
     MEDLOADER_EXPORT virtual std::vector<int> getNonEmptyLevelsExt() const = 0;
     MEDLOADER_EXPORT virtual std::vector<int> getFamArrNonEmptyLevelsExt() const = 0;
     MEDLOADER_EXPORT virtual std::vector<int> getNumArrNonEmptyLevelsExt() const = 0;
     MEDLOADER_EXPORT virtual std::vector<int> getNameArrNonEmptyLevelsExt() const = 0;
-    MEDLOADER_EXPORT virtual void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT virtual void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT virtual void write(med_idt fid) const;
     MEDLOADER_EXPORT virtual int getSizeAtLevel(int meshDimRelToMaxExt) const = 0;
     MEDLOADER_EXPORT virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const = 0;
@@ -79,15 +81,15 @@ namespace ParaMEDMEM
     //
     MEDLOADER_EXPORT bool areFamsEqual(const MEDFileMesh *other, std::string& what) const;
     MEDLOADER_EXPORT bool areGrpsEqual(const MEDFileMesh *other, std::string& what) const;
-    MEDLOADER_EXPORT bool existsGroup(const char *groupName) const;
+    MEDLOADER_EXPORT bool existsGroup(const std::string& groupName) const;
     MEDLOADER_EXPORT bool existsFamily(int famId) const;
-    MEDLOADER_EXPORT bool existsFamily(const char *familyName) const;
-    MEDLOADER_EXPORT void setFamilyId(const char *familyName, int id);
-    MEDLOADER_EXPORT void setFamilyIdUnique(const char *familyName, int id);
-    MEDLOADER_EXPORT virtual void addFamily(const char *familyName, int id);
-    MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName);
+    MEDLOADER_EXPORT bool existsFamily(const std::string& familyName) const;
+    MEDLOADER_EXPORT void setFamilyId(const std::string& familyName, int id);
+    MEDLOADER_EXPORT void setFamilyIdUnique(const std::string& familyName, int id);
+    MEDLOADER_EXPORT virtual void addFamily(const std::string& familyName, int id);
+    MEDLOADER_EXPORT virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName);
     MEDLOADER_EXPORT virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs);
-    MEDLOADER_EXPORT void addFamilyOnGrp(const char *grpName, const char *famName);
+    MEDLOADER_EXPORT void addFamilyOnGrp(const std::string& grpName, const std::string& famName);
     MEDLOADER_EXPORT std::string findOrCreateAndGiveFamilyWithId(int id, bool& created);
     MEDLOADER_EXPORT void setFamilyInfo(const std::map<std::string,int>& info);
     MEDLOADER_EXPORT void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
@@ -97,26 +99,26 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void clearFamGrpMaps();
     MEDLOADER_EXPORT const std::map<std::string,int>& getFamilyInfo() const { return _families; }
     MEDLOADER_EXPORT const std::map<std::string, std::vector<std::string> >& getGroupInfo() const { return _groups; }
-    MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroup(const char *name) const;
+    MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroup(const std::string& name) const;
     MEDLOADER_EXPORT std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const;
-    MEDLOADER_EXPORT std::vector<int> getFamiliesIdsOnGroup(const char *name) const;
-    MEDLOADER_EXPORT void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams);
-    MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds);
-    MEDLOADER_EXPORT std::vector<std::string> getGroupsOnFamily(const char *name) const;
-    MEDLOADER_EXPORT void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps);
+    MEDLOADER_EXPORT std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const;
+    MEDLOADER_EXPORT void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams);
+    MEDLOADER_EXPORT void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds);
+    MEDLOADER_EXPORT std::vector<std::string> getGroupsOnFamily(const std::string& name) const;
+    MEDLOADER_EXPORT void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps);
     MEDLOADER_EXPORT std::vector<std::string> getGroupsNames() const;
     MEDLOADER_EXPORT std::vector<std::string> getFamiliesNames() const;
     MEDLOADER_EXPORT void assignFamilyNameWithGroupName();
     MEDLOADER_EXPORT std::vector<std::string> removeEmptyGroups();
-    MEDLOADER_EXPORT void removeGroup(const char *name);
-    MEDLOADER_EXPORT void removeFamily(const char *name);
+    MEDLOADER_EXPORT void removeGroup(const std::string& name);
+    MEDLOADER_EXPORT void removeFamily(const std::string& name);
     MEDLOADER_EXPORT std::vector<std::string> removeOrphanGroups();
     MEDLOADER_EXPORT std::vector<std::string> removeOrphanFamilies();
-    MEDLOADER_EXPORT void changeGroupName(const char *oldName, const char *newName);
-    MEDLOADER_EXPORT void changeFamilyName(const char *oldName, const char *newName);
+    MEDLOADER_EXPORT void changeGroupName(const std::string& oldName, const std::string& newName);
+    MEDLOADER_EXPORT void changeFamilyName(const std::string& oldName, const std::string& newName);
     MEDLOADER_EXPORT void changeFamilyId(int oldId, int newId);
-    MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames);
-    MEDLOADER_EXPORT int getFamilyId(const char *name) const;
+    MEDLOADER_EXPORT void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
+    MEDLOADER_EXPORT int getFamilyId(const std::string& name) const;
     MEDLOADER_EXPORT int getMaxAbsFamilyId() const;
     MEDLOADER_EXPORT int getMaxFamilyId() const;
     MEDLOADER_EXPORT int getMinFamilyId() const;
@@ -147,19 +149,19 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT virtual const DataArrayAsciiChar *getNameFieldAtLevel(int meshDimRelToMaxExt) const = 0;
     MEDLOADER_EXPORT virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const = 0;
     MEDLOADER_EXPORT virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
-    MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const;
-    MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const;
-    MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const;
+    MEDLOADER_EXPORT virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
+    MEDLOADER_EXPORT virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
+    MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const;
     MEDLOADER_EXPORT virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const;
-    MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const;
+    MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const;
     MEDLOADER_EXPORT virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const;
     // tools
     MEDLOADER_EXPORT virtual bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell) = 0;
   protected:
     MEDFileMesh();
     //! protected because no way in MED file API to specify this name
-    void setUnivName(const char *name) { _univ_name=name; }
-    void addFamilyOnAllGroupsHaving(const char *famName, const char *otherFamName);
+    void setUnivName(const std::string& name) { _univ_name=name; }
+    void addFamilyOnAllGroupsHaving(const std::string& famName, const std::string& otherFamName);
     virtual void writeLL(med_idt fid) const = 0;
     void dealWithTinyInfo(const MEDCouplingMesh *m);
     virtual void synchronizeTinyInfoOnLeaves() const = 0;
@@ -167,7 +169,7 @@ namespace ParaMEDMEM
     virtual void appendFamilyEntries(const DataArrayInt *famIds, const std::vector< std::vector<int> >& fidsOfGrps, const std::vector<std::string>& grpNames);
     virtual void changeFamilyIdArr(int oldId, int newId) = 0;
     static void TranslateFamilyIds(int offset, DataArrayInt *famArr, std::vector< std::vector<int> >& famIdsPerGrp);
-    static void ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames);
+    static void ChangeAllGroupsContainingFamily(std::map<std::string, std::vector<std::string> >& groups, const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames);
     static std::string FindOrCreateAndGiveFamilyWithId(std::map<std::string,int>& families, int id, bool& created);
     static std::string CreateNameNotIn(const std::string& nameTry, const std::vector<std::string>& namesToAvoid);
     static int PutInThirdComponentOfCodeOffset(std::vector<int>& code, int strt);
@@ -192,8 +194,8 @@ namespace ParaMEDMEM
   {
     friend class MEDFileMesh;
   public:
-    MEDLOADER_EXPORT static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
-    MEDLOADER_EXPORT static MEDFileUMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
     MEDLOADER_EXPORT static MEDFileUMesh *New();
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
@@ -202,6 +204,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const;
     MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
     MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
+    MEDLOADER_EXPORT void setName(const std::string& name);
     MEDLOADER_EXPORT ~MEDFileUMesh();
     //
     MEDLOADER_EXPORT int getMaxAbsFamilyIdInArrays() const;
@@ -224,19 +227,19 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT std::vector<int> getFamArrNonEmptyLevelsExt() const;
     MEDLOADER_EXPORT std::vector<int> getNumArrNonEmptyLevelsExt() const;
     MEDLOADER_EXPORT std::vector<int> getNameArrNonEmptyLevelsExt() const;
-    MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevels(const char *grp) const;
-    MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const;
-    MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevels(const char *fam) const;
-    MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const;
+    MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const;
+    MEDLOADER_EXPORT std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const;
+    MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevels(const std::string& fam) const;
+    MEDLOADER_EXPORT std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const;
     MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const;
     MEDLOADER_EXPORT std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const;
     MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const;
     MEDLOADER_EXPORT std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const;
     MEDLOADER_EXPORT std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT DataArrayDouble *getCoords() const;
-    MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const;
+    MEDLOADER_EXPORT MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const;
     MEDLOADER_EXPORT MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const;
-    MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const;
+    MEDLOADER_EXPORT MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const;
     MEDLOADER_EXPORT MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
     MEDLOADER_EXPORT DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const;
     MEDLOADER_EXPORT MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const;
@@ -268,14 +271,14 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
     MEDLOADER_EXPORT void optimizeFamilies();
     // tools
-    MEDLOADER_EXPORT void duplicateNodesOnM1Group(const char *grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified);
+    MEDLOADER_EXPORT void duplicateNodesOnM1Group(const std::string& grpNameM1, DataArrayInt *&nodesDuplicated, DataArrayInt *&cellsModified, DataArrayInt *&cellsNotModified);
     MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
     MEDLOADER_EXPORT DataArrayInt *zipCoords();
   private:
     void writeLL(med_idt fid) const;
     MEDFileUMesh();
-    MEDFileUMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
-    void loadUMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    MEDFileUMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    void loadUMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
     const MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt) const;
     MEDFileUMeshSplitL1 *getMeshAtLevSafe(int meshDimRelToMaxExt);
     void checkMeshDimCoherency(int meshDim, int meshDimRelToMax) const;
@@ -322,14 +325,15 @@ namespace ParaMEDMEM
     MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) const;
     MEDLOADER_EXPORT int getSizeAtLevel(int meshDimRelToMaxExt) const;
     MEDLOADER_EXPORT int getNumberOfNodes() const;
+    MEDLOADER_EXPORT std::vector<INTERP_KERNEL::NormalizedCellType> getGeoTypesAtLevel(int meshDimRelToMax) const;
     MEDLOADER_EXPORT void whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const;
     // tools
     MEDLOADER_EXPORT bool unPolyze(std::vector<int>& oldCode, std::vector<int>& newCode, DataArrayInt *& o2nRenumCell);
   protected:
     void changeFamilyIdArr(int oldId, int newId);
     void deepCpyAttributes();
-    void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
-    void writeStructuredLL(med_idt fid, const char *maa) const;
+    void loadStrMeshFromFile(MEDFileStrMeshL2 *strm, med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    void writeStructuredLL(med_idt fid, const std::string& maa) const;
     virtual const MEDCouplingStructuredMesh *getStructuredMesh() const = 0;
     static med_geometry_type GetGeoTypeFromMeshDim(int meshDim);
   private:
@@ -348,8 +352,8 @@ namespace ParaMEDMEM
     friend class MEDFileMesh;
   public:
     MEDLOADER_EXPORT static MEDFileCMesh *New();
-    MEDLOADER_EXPORT static MEDFileCMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0);
-    MEDLOADER_EXPORT static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
@@ -357,6 +361,7 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT MEDFileMesh *shallowCpy() const;
     MEDLOADER_EXPORT bool isEqual(const MEDFileMesh *other, double eps, std::string& what) const;
     MEDLOADER_EXPORT int getMeshDimension() const;
+    MEDLOADER_EXPORT int getSpaceDimension() const;
     MEDLOADER_EXPORT std::string simpleRepr() const;
     MEDLOADER_EXPORT std::string advancedRepr() const;
     MEDLOADER_EXPORT void clearNonDiscrAttributes() const;
@@ -367,8 +372,8 @@ namespace ParaMEDMEM
     void writeLL(med_idt fid) const;
     MEDFileCMesh();
     void synchronizeTinyInfoOnLeaves() const;
-    MEDFileCMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
-    void loadCMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    MEDFileCMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    void loadCMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
   private:
     MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> _cmesh;
   };
@@ -378,8 +383,8 @@ namespace ParaMEDMEM
     friend class MEDFileMesh;
   public:
     MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New();
-    MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0);
-    MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0);
+    MEDLOADER_EXPORT static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0);
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT MEDFileMesh *createNewEmpty() const;
@@ -394,11 +399,11 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void setMesh(MEDCouplingCurveLinearMesh *m);
   private:
     MEDFileCurveLinearMesh();
-    MEDFileCurveLinearMesh(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    MEDFileCurveLinearMesh(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
     const MEDCouplingStructuredMesh *getStructuredMesh() const;
     void synchronizeTinyInfoOnLeaves() const;
     void writeLL(med_idt fid) const;
-    void loadCLMeshFromFile(med_idt fid, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp
+    void loadCLMeshFromFile(med_idt fid, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);//to imp
   private:
     MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> _clmesh;
   };
@@ -407,23 +412,23 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileMeshMultiTS *New();
-    MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const char *fileName);
-    MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const char *fileName, const char *mName);
+    MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName);
+    MEDLOADER_EXPORT static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName);
     MEDLOADER_EXPORT MEDFileMeshMultiTS *deepCpy() const;
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT std::string getName() const;
-    MEDLOADER_EXPORT void setName(const char *newMeshName);
+    MEDLOADER_EXPORT void setName(const std::string& newMeshName);
     MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
     MEDLOADER_EXPORT MEDFileMesh *getOneTimeStep() const;
     MEDLOADER_EXPORT void write(med_idt fid) const;
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT void setOneTimeStep(MEDFileMesh *mesh1TimeStep);
   private:
-    void loadFromFile(const char *fileName, const char *mName);
+    void loadFromFile(const std::string& fileName, const std::string& mName);
     MEDFileMeshMultiTS();
-    MEDFileMeshMultiTS(const char *fileName);
-    MEDFileMeshMultiTS(const char *fileName, const char *mName);
+    MEDFileMeshMultiTS(const std::string& fileName);
+    MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName);
   private:
     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> > _mesh_one_ts;
   };
@@ -434,18 +439,18 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileMeshes *New();
-    MEDLOADER_EXPORT static MEDFileMeshes *New(const char *fileName);
+    MEDLOADER_EXPORT static MEDFileMeshes *New(const std::string& fileName);
     MEDLOADER_EXPORT MEDFileMeshes *deepCpy() const;
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT std::string simpleRepr() const;
     MEDLOADER_EXPORT void simpleReprWithoutHeader(std::ostream& oss) const;
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT void write(med_idt fid) const;
     MEDLOADER_EXPORT int getNumberOfMeshes() const;
     MEDLOADER_EXPORT MEDFileMeshesIterator *iterator();
     MEDLOADER_EXPORT MEDFileMesh *getMeshAtPos(int i) const;
-    MEDLOADER_EXPORT MEDFileMesh *getMeshWithName(const char *mname) const;
+    MEDLOADER_EXPORT MEDFileMesh *getMeshWithName(const std::string& mname) const;
     MEDLOADER_EXPORT std::vector<std::string> getMeshesNames() const;
     MEDLOADER_EXPORT bool changeNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
     //
@@ -455,9 +460,9 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void destroyMeshAtPos(int i);
   private:
     void checkCoherency() const;
-    void loadFromFile(const char *fileName);
+    void loadFromFile(const std::string& fileName);
     MEDFileMeshes();
-    MEDFileMeshes(const char *fileName);
+    MEDFileMeshes(const std::string& fileName);
   private:
     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMeshMultiTS> > _meshes;
   };
index 9a8d48813c3c73b39b2ef6e06755f3acaf450cfe..fd123cc030d42b7ac359c13af6dbdaffada97d28 100644 (file)
@@ -212,7 +212,7 @@ void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int
   loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,MED_POLYHEDRON,entity,mrs);
 }
 
-void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names)
+void MEDFileUMeshPerType::Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names)
 {
   int nbOfCells=m->getNumberOfCells();
   if(nbOfCells<1)
@@ -229,7 +229,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const
         throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !");
       MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(m0->getNodalConnectivity()->deepCpy());
       std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
-      MEDmeshElementConnectivityWr(fid,mname,dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin());
+      MEDmeshElementConnectivityWr(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin());
     }
   else
     {
@@ -241,7 +241,7 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const
           MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(m0->getNodalConnectivity()->deepCpy()),arrI(m0->getNodalConnectivityIndex()->deepCpy());
           std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
           std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<int>(),1));
-          MEDmeshPolygon2Wr(fid,mname,dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin());
+          MEDmeshPolygon2Wr(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin());
         }
       else
         {
@@ -271,13 +271,13 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const
                 }
               w1[1]=w1[0]+nbOfFaces2;
             }
-          MEDmeshPolyhedronWr(fid,mname,dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab);
+          MEDmeshPolyhedronWr(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab);
         }
     }
   if(fam)
-    MEDmeshEntityFamilyNumberWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer());
+    MEDmeshEntityFamilyNumberWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer());
   if(num)
-    MEDmeshEntityNumberWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer());
+    MEDmeshEntityNumberWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer());
   if(names)
     {
       if(names->getNumberOfComponents()!=MED_SNAME_SIZE)
@@ -286,6 +286,6 @@ void MEDFileUMeshPerType::Write(med_idt fid, const char *mname, int mdim, const
           oss << " ! The array has " << names->getNumberOfComponents() << " components !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      MEDmeshEntityNameWr(fid,mname,dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer());
+      MEDmeshEntityNameWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer());
     }
 }
index 0868cf757cbb2ea0ea4796ef8a5dcc43d677a6a8..bf8cf826cb15a7e511b8bb27a7cced06ceb37ad7 100644 (file)
@@ -46,7 +46,7 @@ namespace ParaMEDMEM
     const DataArrayInt *getFam() const { return _fam; }
     const DataArrayInt *getNum() const { return _num; }
     const DataArrayAsciiChar *getNames() const { return _names; }
-    static void Write(med_idt fid, const char *mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
+    static void Write(med_idt fid, const std::string& mname, int mdim, const MEDCoupling1GTUMesh *m, const DataArrayInt *fam, const DataArrayInt *num, const DataArrayAsciiChar *names);
   private:
     MEDFileUMeshPerType(med_idt fid, const char *mName, int dt, int it, int mdim, med_geometry_type geoElt, INTERP_KERNEL::NormalizedCellType type,
                         med_entity_type entity, MEDFileMeshReadSelector *mrs);
index 39c409025837cd97ad314850edcf0ff7f8ccc967..3bc21de7b42c0fd50ce6000d871c29e26ef437d0 100644 (file)
@@ -50,7 +50,7 @@ std::vector<const BigMemoryObject *> MEDFileMeshL2::getDirectChildren() const
   return std::vector<const BigMemoryObject *>();
 }
 
-int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1)
+int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const std::string& mname, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1)
 {
   med_mesh_type type_maillage;
   char maillage_description[MED_COMMENT_SIZE+1];
@@ -94,7 +94,7 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM:
     case MED_STRUCTURED_MESH:
       {
         med_grid_type gt;
-        MEDmeshGridTypeRd(fid,mname,&gt);
+        MEDmeshGridTypeRd(fid,mname.c_str(),&gt);
         switch(gt)
           {
           case MED_CARTESIAN_GRID:
@@ -113,12 +113,12 @@ int MEDFileMeshL2::GetMeshIdFromName(med_idt fid, const char *mname, ParaMEDMEM:
     }
   med_int numdt,numit;
   med_float dtt;
-  MEDmeshComputationStepInfo(fid,mname,1,&numdt,&numit,&dtt);
+  MEDmeshComputationStepInfo(fid,mname.c_str(),1,&numdt,&numit,&dtt);
   dt=numdt; it=numit;
   return ret;
 }
 
-double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nstep, int dt, int it)
+double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const std::string& mName, int nstep, int dt, int it)
 {
   bool found=false;
   med_int numdt,numit;
@@ -126,7 +126,7 @@ double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nste
   std::vector< std::pair<int,int> > p(nstep);
   for(int i=0;i<nstep;i++)
     {
-      MEDmeshComputationStepInfo(fid,mName,i+1,&numdt,&numit,&dtt);
+      MEDmeshComputationStepInfo(fid,mName.c_str(),i+1,&numdt,&numit,&dtt);
       p[i]=std::make_pair<int,int>(numdt,numit);
       found=(numdt==dt) && (numit==numit);
     }
@@ -141,7 +141,7 @@ double MEDFileMeshL2::CheckMeshTimeStep(med_idt fid, const char *mName, int nste
   return dtt;
 }
 
-std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim)
+std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim)
 {
   med_mesh_type type_maillage;
   med_int spaceDim;
@@ -164,7 +164,7 @@ std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId,
     case MED_STRUCTURED_MESH:
       {
         med_grid_type gt;
-        MEDmeshGridTypeRd(fid,mName,&gt);
+        MEDmeshGridTypeRd(fid,mName.c_str(),&gt);
         switch(gt)
           {
           case MED_CARTESIAN_GRID:
@@ -191,22 +191,22 @@ std::vector<std::string> MEDFileMeshL2::getAxisInfoOnMesh(med_idt fid, int mId,
   return infosOnComp;
 }
 
-void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const char *meshName, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs)
+void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const std::string& meshName, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs)
 {
   if(mrs && !(mrs->isCellFamilyFieldReading() || mrs->isNodeFamilyFieldReading()))
     return ;
   char nomfam[MED_NAME_SIZE+1];
   med_int numfam;
-  int nfam=MEDnFamily(fid,meshName);
+  int nfam=MEDnFamily(fid,meshName.c_str());
   for(int i=0;i<nfam;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName,i+1);
-      med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
       INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
       INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
-      MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+      MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
       std::string famName=MEDLoaderBase::buildStringFromFortran(nomfam,MED_NAME_SIZE);
       fams[famName]=numfam;
       for(int j=0;j<ngro;j++)
@@ -217,7 +217,7 @@ void MEDFileMeshL2::ReadFamiliesAndGrps(med_idt fid, const char *meshName, std::
     }
 }
 
-void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const char *mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol)
+void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol)
 {
   for(std::map<std::string,int>::const_iterator it=fams.begin();it!=fams.end();it++)
     {
@@ -234,7 +234,7 @@ void MEDFileMeshL2::WriteFamiliesAndGrps(med_idt fid, const char *mname, const s
         MEDLoaderBase::safeStrCpy2((*it2).c_str(),MED_LNAME_SIZE-1,groName+i*MED_LNAME_SIZE,tooLongStrPol);
       INTERP_KERNEL::AutoPtr<char> famName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
       MEDLoaderBase::safeStrCpy((*it).first.c_str(),MED_NAME_SIZE,famName,tooLongStrPol);
-      int ret=MEDfamilyCr(fid,mname,famName,(*it).second,ngro,groName);
+      int ret=MEDfamilyCr(fid,mname.c_str(),famName,(*it).second,ngro,groName);
       ret++;
     }
 }
@@ -243,13 +243,13 @@ MEDFileUMeshL2::MEDFileUMeshL2()
 {
 }
 
-void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
-  _name.set(mName);
+  _name.set(mName.c_str());
   int nstep;
   int Mdim;
   ParaMEDMEM::MEDCouplingMeshType meshType;
-  std::vector<std::string> infosOnComp=getAxisInfoOnMesh(fid,mId,mName,meshType,nstep,Mdim);
+  std::vector<std::string> infosOnComp=getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim);
   if(meshType!=UNSTRUCTURED)
     throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected an unstructured one whereas in file it is not an unstructured !");
   _time=CheckMeshTimeStep(fid,mName,nstep,dt,it);
@@ -259,55 +259,55 @@ void MEDFileUMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in
   loadCoords(fid,mId,infosOnComp,mName,dt,it);
 }
 
-void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs)
+void MEDFileUMeshL2::loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs)
 {
   _per_type_mesh.resize(1);
   _per_type_mesh[0].clear();
   for(int j=0;j<MED_N_CELL_FIXED_GEO;j++)
     {
-      MEDFileUMeshPerType *tmp=MEDFileUMeshPerType::New(fid,mName,dt,it,mdim,typmai[j],typmai2[j],mrs);
+      MEDFileUMeshPerType *tmp=MEDFileUMeshPerType::New(fid,mName.c_str(),dt,it,mdim,typmai[j],typmai2[j],mrs);
       if(tmp)
         _per_type_mesh[0].push_back(tmp);
     }
   sortTypes();
 }
 
-void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const char *mName, int dt, int it)
+void MEDFileUMeshL2::loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it)
 {
   int spaceDim=infosOnComp.size();
   med_bool changement,transformation;
-  int nCoords=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation);
+  int nCoords=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&changement,&transformation);
   _coords=DataArrayDouble::New();
   _coords->alloc(nCoords,spaceDim);
   double *coordsPtr=_coords->getPointer();
-  MEDmeshNodeCoordinateRd(fid,mName,dt,it,MED_FULL_INTERLACE,coordsPtr);
-  if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
+  MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr);
+  if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
     {
       _fam_coords=DataArrayInt::New();
       _fam_coords->alloc(nCoords,1);
-      MEDmeshEntityFamilyNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer());
+      MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer());
     }
   else
     _fam_coords=0;
-  if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
+  if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NUMBER,MED_NODAL,&changement,&transformation)>0)
     {
       _num_coords=DataArrayInt::New();
       _num_coords->alloc(nCoords,1);
-      MEDmeshEntityNumberRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer());
+      MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer());
     }
   else
     _num_coords=0;
-  if(MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0)
+  if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_NAME,MED_NODAL,&changement,&transformation)>0)
     {
       _name_coords=DataArrayAsciiChar::New();
       _name_coords->alloc(nCoords+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
-      MEDmeshEntityNameRd(fid,mName,dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer());
+      MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer());
       _name_coords->reAlloc(nCoords);//not a bug to avoid the memory corruption due to last \0 at the end
     }
   else
     _name_coords=0;
   for(int i=0;i<spaceDim;i++)
-    _coords->setInfoOnComponent(i,infosOnComp[i].c_str());
+    _coords->setInfoOnComponent(i,infosOnComp[i]);
 }
 
 void MEDFileUMeshL2::sortTypes()
@@ -343,15 +343,15 @@ void MEDFileUMeshL2::sortTypes()
   _per_type_mesh.resize(_per_type_mesh.size()-nbOfUselessLev);
 }
 
-void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords)
+void MEDFileUMeshL2::WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords)
 {
   if(!coords)
     return ;
-  MEDmeshNodeCoordinateWr(fid,mname,dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer());
+  MEDmeshNodeCoordinateWr(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer());
   if(famCoords)
-    MEDmeshEntityFamilyNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer());
+    MEDmeshEntityFamilyNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer());
   if(numCoords)
-    MEDmeshEntityNumberWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer());
+    MEDmeshEntityNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer());
   if(nameCoords)
     {
       if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE)
@@ -360,7 +360,7 @@ void MEDFileUMeshL2::WriteCoords(med_idt fid, const char *mname, int dt, int it,
           oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !";
           throw INTERP_KERNEL::Exception(oss.str().c_str());
         }
-      MEDmeshEntityNameWr(fid,mname,dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer());
+      MEDmeshEntityNameWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer());
     }
 }
 
@@ -392,13 +392,13 @@ MEDFileCMeshL2::MEDFileCMeshL2()
 {
 }
 
-void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it)
+void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it)
 {
-  _name.set(mName);
+  _name.set(mName.c_str());
   int nstep;
   int Mdim;
   ParaMEDMEM::MEDCouplingMeshType meshType;
-  std::vector<std::string> infosOnComp=getAxisInfoOnMesh(fid,mId,mName,meshType,nstep,Mdim);
+  std::vector<std::string> infosOnComp=getAxisInfoOnMesh(fid,mId,mName.c_str(),meshType,nstep,Mdim);
   if(meshType!=CARTESIAN)
     throw INTERP_KERNEL::Exception("Invalid mesh type ! You are expected a structured one whereas in file it is not a structured !");
   _time=CheckMeshTimeStep(fid,mName,nstep,dt,it);
@@ -406,7 +406,7 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in
   _order=it;
   //
   med_grid_type gridtype;
-  MEDmeshGridTypeRd(fid,mName,&gridtype);
+  MEDmeshGridTypeRd(fid,mName.c_str(),&gridtype);
   if(gridtype!=MED_CARTESIAN_GRID)
     throw INTERP_KERNEL::Exception("Invalid structured mesh ! Expected cartesian mesh type !");
   _cmesh=MEDCouplingCMesh::New();
@@ -414,11 +414,11 @@ void MEDFileCMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, in
     {
       med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i);
       med_bool chgt=MED_FALSE,trsf=MED_FALSE;
-      int nbOfElt=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf);
+      int nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf);
       MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=DataArrayDouble::New();
       da->alloc(nbOfElt,1);
-      da->setInfoOnComponent(0,infosOnComp[i].c_str());
-      MEDmeshGridIndexCoordinateRd(fid,mName,dt,it,i+1,da->getPointer());
+      da->setInfoOnComponent(0,infosOnComp[i]);
+      MEDmeshGridIndexCoordinateRd(fid,mName.c_str(),dt,it,i+1,da->getPointer());
       _cmesh->setCoordsAt(i,da);
     }
 }
@@ -442,9 +442,9 @@ MEDFileCLMeshL2::MEDFileCLMeshL2()
 {
 }
 
-void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, int it)
+void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it)
 {
-  _name.set(mName);
+  _name.set(mName.c_str());
   int nstep;
   int Mdim;
   ParaMEDMEM::MEDCouplingMeshType meshType;
@@ -457,14 +457,14 @@ void MEDFileCLMeshL2::loadAll(med_idt fid, int mId, const char *mName, int dt, i
   //
   _clmesh=MEDCouplingCurveLinearMesh::New();
   INTERP_KERNEL::AutoPtr<int> stGrid=new int[Mdim];
-  MEDmeshGridStructRd(fid,mName,dt,it,stGrid);
+  MEDmeshGridStructRd(fid,mName.c_str(),dt,it,stGrid);
   _clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim);
   med_bool chgt=MED_FALSE,trsf=MED_FALSE;
-  int nbNodes=MEDmeshnEntity(fid,mName,dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf);
+  int nbNodes=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf);
   MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=DataArrayDouble::New();
   da->alloc(nbNodes,infosOnComp.size());
   da->setInfoOnComponents(infosOnComp);
-  MEDmeshNodeCoordinateRd(fid,mName,dt,it,MED_FULL_INTERLACE,da->getPointer());
+  MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,da->getPointer());
   _clmesh->setCoords(da);
 }
 
@@ -514,7 +514,7 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other):RefCo
 {
 }
 
-MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id):_m(this)
+MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id):_m(this)
 {
   const std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >& v=l2.getLev(id);
   if(v.empty())
@@ -581,6 +581,11 @@ MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld):_m(
   assignMesh(m,newOrOld);
 }
 
+void MEDFileUMeshSplitL1::setName(const std::string& name)
+{
+  _m_by_types.setName(name);
+}
+
 std::size_t MEDFileUMeshSplitL1::getHeapMemorySizeWithoutChildren() const
 {
   return 0;
@@ -872,7 +877,7 @@ void MEDFileUMeshSplitL1::setGroupsFromScratch(const std::vector<const MEDCoupli
     *w=famIdTrad[*w];
 }
 
-void MEDFileUMeshSplitL1::write(med_idt fid, const char *mName, int mdim) const
+void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) const
 {
   std::vector<MEDCoupling1GTUMesh *> ms(_m_by_types.getParts());
   int start=0;
@@ -1016,6 +1021,25 @@ MEDFileUMeshAggregateCompute::MEDFileUMeshAggregateCompute():_mp_time(0),_m_time
 {
 }
 
+void MEDFileUMeshAggregateCompute::setName(const std::string& name)
+{
+  if(_m_time>=_mp_time)
+    {
+      MEDCouplingUMesh *um(_m);
+      if(um)
+        um->setName(name);
+    }
+  if(_mp_time>=_m_time)
+    {
+      for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> >::iterator it=_m_parts.begin();it!=_m_parts.end();it++)
+        {
+          MEDCoupling1GTUMesh *tmp(*it);
+          if(tmp)
+            tmp->setName(name);
+        }
+    }
+}
+
 void MEDFileUMeshAggregateCompute::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts)
 {
   std::size_t sz(mParts.size());
@@ -1132,7 +1156,7 @@ void MEDFileUMeshAggregateCompute::forceComputationOfPartsFromUMesh() const
   _m_parts.resize(sz);
   for(std::size_t i=0;i<sz;i++)
     _m_parts[i]=MEDCoupling1GTUMesh::New(ms[i]);
-  _mp_time=std::max(_mp_time,_m_time)+1;
+  _mp_time=std::max(_mp_time,_m_time);
 }
 
 std::size_t MEDFileUMeshAggregateCompute::getTimeOfThis() const
index eb1d37adc3dbec5757ee0fe29e6fda68241ff1b0..9bdf38bfc25f99f4d34db0e4b1ab59c5f194cda7 100644 (file)
@@ -51,11 +51,11 @@ namespace ParaMEDMEM
     int getIteration() const { return _iteration; }
     int getOrder() const { return _order; }
     double getTime() { return _time; }
-    std::vector<std::string> getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim);
-    static int GetMeshIdFromName(med_idt fid, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1);
-    static double CheckMeshTimeStep(med_idt fid, const char *mname, int nstep, int dt, int it);
-    static void ReadFamiliesAndGrps(med_idt fid, const char *mname, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
-    static void WriteFamiliesAndGrps(med_idt fid, const char *mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
+    std::vector<std::string> getAxisInfoOnMesh(med_idt fid, int mId, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim);
+    static int GetMeshIdFromName(med_idt fid, const std::string& mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1);
+    static double CheckMeshTimeStep(med_idt fid, const std::string& mname, int nstep, int dt, int it);
+    static void ReadFamiliesAndGrps(med_idt fid, const std::string& mname, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
+    static void WriteFamiliesAndGrps(med_idt fid, const std::string& mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
   protected:
     MEDFileString _name;
     MEDFileString _description;
@@ -70,9 +70,9 @@ namespace ParaMEDMEM
   {
   public:
     MEDFileUMeshL2();
-    void loadAll(med_idt fid, int mId, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
-    void loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
-    void loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const char *mName, int dt, int it);
+    void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    void loadConnectivity(med_idt fid, int mdim, const std::string& mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    void loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const std::string& mName, int dt, int it);
     int getNumberOfLevels() const { return _per_type_mesh.size(); }
     bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); }
     const std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshPerType> >& getLev(int levId) const { return _per_type_mesh[levId]; }
@@ -83,7 +83,7 @@ namespace ParaMEDMEM
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> getCoordsFamily() const { return _fam_coords; }
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> getCoordsNum() const { return _num_coords; }
     MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> getCoordsName() const { return _name_coords; }
-    static void WriteCoords(med_idt fid, const char *mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords);
+    static void WriteCoords(med_idt fid, const std::string& mname, int dt, int it, double time, const DataArrayDouble *coords, const DataArrayInt *famCoords, const DataArrayInt *numCoords, const DataArrayAsciiChar *nameCoords);
   private:
     void sortTypes();
   private:
@@ -102,7 +102,7 @@ namespace ParaMEDMEM
   {
   public:
     MEDFileCMeshL2();
-    void loadAll(med_idt fid, int mId, const char *mName, int dt, int it);
+    void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it);
     MEDCouplingCMesh *getMesh() { return _cmesh; }
   private:
     static med_data_type GetDataTypeCorrespondingToSpaceId(int id);
@@ -114,7 +114,7 @@ namespace ParaMEDMEM
   {
   public:
     MEDFileCLMeshL2();
-    void loadAll(med_idt fid, int mId, const char *mName, int dt, int it);
+    void loadAll(med_idt fid, int mId, const std::string& mName, int dt, int it);
     MEDCouplingCurveLinearMesh *getMesh() { return _clmesh; }
   private:
     MEDCouplingAutoRefCountObjectPtr<MEDCouplingCurveLinearMesh> _clmesh;
@@ -141,6 +141,7 @@ namespace ParaMEDMEM
   {
   public:
     MEDFileUMeshAggregateCompute();
+    void setName(const std::string& name);
     void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
     void assignUMesh(MEDCouplingUMesh *m);
     MEDCouplingUMesh *getUmesh() const;
@@ -177,10 +178,11 @@ namespace ParaMEDMEM
     friend class MEDFileUMeshPermCompute;
   public:
     MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other);
-    MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id);
+    MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const std::string& mName, int id);
     MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m);
     MEDFileUMeshSplitL1(MEDCouplingUMesh *m);
     MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld);
+    void setName(const std::string& name);
     std::size_t getHeapMemorySizeWithoutChildren() const;
     std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDFileUMeshSplitL1 *deepCpy(DataArrayDouble *coords) const;
@@ -213,7 +215,7 @@ namespace ParaMEDMEM
     void eraseFamilyField();
     void setGroupsFromScratch(const std::vector<const MEDCouplingUMesh *>& ms, std::map<std::string,int>& familyIds,
                               std::map<std::string, std::vector<std::string> >& groups) throw(INTERP_KERNEL::Exception);
-    void write(med_idt fid, const char *mName, int mdim) const;
+    void write(med_idt fid, const std::string& mName, int mdim) const;
     //
     void setFamilyArr(DataArrayInt *famArr);
     void setRenumArr(DataArrayInt *renumArr);
index 0a04d8b04097da8f7f3b85e096d3a36fcb76d481..38559d7ae5b2b8e5b77e314bbecf527f19330d3b 100644 (file)
@@ -189,17 +189,17 @@ MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New()
   return new MEDFileParameterDouble1TS;
 }
 
-MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName)
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName)
 {
   return new MEDFileParameterDouble1TS(fileName);
 }
 
-MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName)
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName, const std::string& paramName)
 {
   return new MEDFileParameterDouble1TS(fileName,paramName);
 }
 
-MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const char *fileName, const char *paramName, int dt, int it)
+MEDFileParameterDouble1TS *MEDFileParameterDouble1TS::New(const std::string& fileName, const std::string& paramName, int dt, int it)
 {
   return new MEDFileParameterDouble1TS(fileName,paramName,dt,it);
 }
@@ -208,10 +208,10 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS()
 {
 }
 
-MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it)
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),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);
@@ -240,10 +240,10 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const
   throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
-MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const char *paramName)
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),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);
@@ -280,10 +280,10 @@ MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName, const
   throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
-MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const char *fileName)
+MEDFileParameterDouble1TS::MEDFileParameterDouble1TS(const std::string& fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int nbPar=MEDnParameter(fid);
   if(nbPar<1)
     {
@@ -355,10 +355,10 @@ std::vector<const BigMemoryObject *> MEDFileParameterDouble1TS::getDirectChildre
   return std::vector<const BigMemoryObject *>();
 }
 
-void MEDFileParameterDouble1TS::write(const char *fileName, int mode) const
+void MEDFileParameterDouble1TS::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   MEDFileParameterTinyInfo::writeLLHeader(fid,MED_FLOAT64);
   MEDFileParameterDouble1TSWTI::writeLL(fid,_name,*this);
 }
@@ -368,12 +368,12 @@ MEDFileParameterMultiTS *MEDFileParameterMultiTS::New()
   return new MEDFileParameterMultiTS;
 }
 
-MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName)
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName)
 {
   return new MEDFileParameterMultiTS(fileName);
 }
 
-MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const char *fileName, const char *paramName)
+MEDFileParameterMultiTS *MEDFileParameterMultiTS::New(const std::string& fileName, const std::string& paramName)
 {
   return new MEDFileParameterMultiTS(fileName,paramName);
 }
@@ -393,10 +393,10 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(const MEDFileParameterMultiTS&
       }
 }
 
-MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName)
+MEDFileParameterMultiTS::MEDFileParameterMultiTS(const std::string& fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int nbPar=MEDnParameter(fid);
   if(nbPar<1)
     {
@@ -416,10 +416,10 @@ MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName)
   finishLoading(fid,paramType,nbOfSteps);
 }
 
-MEDFileParameterMultiTS::MEDFileParameterMultiTS(const char *fileName, const char *paramName)
+MEDFileParameterMultiTS::MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),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);
@@ -522,10 +522,10 @@ bool MEDFileParameterMultiTS::isEqual(const MEDFileParameterMultiTS *other, doub
   return true;
 }
 
-void MEDFileParameterMultiTS::write(const char *fileName, int mode) const
+void MEDFileParameterMultiTS::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   writeLL(fid,*this);
 }
 
@@ -702,15 +702,15 @@ MEDFileParameters *MEDFileParameters::New()
   return new MEDFileParameters;
 }
 
-MEDFileParameters *MEDFileParameters::New(const char *fileName)
+MEDFileParameters *MEDFileParameters::New(const std::string& fileName)
 {
   return new MEDFileParameters(fileName);
 }
 
-MEDFileParameters::MEDFileParameters(const char *fileName)
+MEDFileParameters::MEDFileParameters(const std::string& fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int nbPar=MEDnParameter(fid);
   _params.resize(nbPar);
   INTERP_KERNEL::AutoPtr<char> pName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
@@ -722,7 +722,7 @@ MEDFileParameters::MEDFileParameters(const char *fileName)
       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());
+      _params[i]=MEDFileParameterMultiTS::New(fileName,paramNameCpp);
     }
 }
 
@@ -784,10 +784,10 @@ MEDFileParameters::MEDFileParameters(const MEDFileParameters& other, bool deepCo
       }
 }
 
-void MEDFileParameters::write(const char *fileName, int mode) const
+void MEDFileParameters::write(const std::string& fileName, int mode) const
 {
   med_access_mode medmod=MEDFileUtilities::TraduceWriteMode(mode);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,medmod);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),medmod);
   writeLL(fid);
 }
 
@@ -882,7 +882,7 @@ MEDFileParameterMultiTS *MEDFileParameters::getParamAtPos(int i) const
 /*!
  * \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
+MEDFileParameterMultiTS *MEDFileParameters::getParamWithName(const std::string& paramName) const
 {
   int pos=getPosFromParamName(paramName);
   return getParamAtPos(pos);
@@ -898,7 +898,7 @@ void MEDFileParameters::destroyParamAtPos(int i)
   _params[i]=MEDCouplingAutoRefCountObjectPtr<MEDFileParameterMultiTS>(0);
 }
 
-int MEDFileParameters::getPosFromParamName(const char *paramName) const
+int MEDFileParameters::getPosFromParamName(const std::string& paramName) const
 {
   std::ostringstream oss; oss << "MEDFileParameters::getPosFromParamName : no such name=" << paramName << " ! Possibilities are :";
   int ret=0;
index 1cd5d3330712185477910ff61e2d77e6352d4dd6..1bc97c27f298684fe1abf6fa4ac727fafc060da4 100644 (file)
@@ -80,9 +80,9 @@ namespace ParaMEDMEM
   class MEDFileParameterTinyInfo : public MEDFileWritable
   {
   public:
-    MEDLOADER_EXPORT void setDescription(const char *name) { _desc_name=name; }
+    MEDLOADER_EXPORT void setDescription(const std::string& name) { _desc_name=name; }
     MEDLOADER_EXPORT std::string getDescription() const { return _desc_name; }
-    MEDLOADER_EXPORT void setTimeUnit(const char *unit) { _dt_unit=unit; }
+    MEDLOADER_EXPORT void setTimeUnit(const std::string& unit) { _dt_unit=unit; }
     MEDLOADER_EXPORT std::string getTimeUnit() const { return _dt_unit; }
     MEDLOADER_EXPORT std::size_t getHeapMemSizeOfStrings() const;
     MEDLOADER_EXPORT bool isEqualStrings(const MEDFileParameterTinyInfo& other, std::string& what) const;
@@ -99,37 +99,37 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New();
-    MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const char *fileName);
-    MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName);
-    MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it);
+    MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName);
+    MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName);
+    MEDLOADER_EXPORT static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it);
     MEDLOADER_EXPORT virtual MEDFileParameter1TS *deepCpy() const;
     MEDLOADER_EXPORT virtual bool isEqual(const MEDFileParameter1TS *other, double eps, std::string& what) const;
     MEDLOADER_EXPORT virtual std::string simpleRepr() const;
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
-    MEDLOADER_EXPORT void setName(const char *name) { _name=name; }
+    MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; }
     MEDLOADER_EXPORT std::string getName() const { return _name; }
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
   private:
     MEDFileParameterDouble1TS();
-    MEDFileParameterDouble1TS(const char *fileName);
-    MEDFileParameterDouble1TS(const char *fileName, const char *paramName);
-    MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it);
+    MEDFileParameterDouble1TS(const std::string& fileName);
+    MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName);
+    MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it);
   };
 
   class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
   {
   public:
     MEDLOADER_EXPORT static MEDFileParameterMultiTS *New();
-    MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const char *fileName);
-    MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName);
+    MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const std::string& fileName);
+    MEDLOADER_EXPORT static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName);
     MEDLOADER_EXPORT std::string getName() const { return _name; }
-    MEDLOADER_EXPORT void setName(const char *name) { _name=name; }
+    MEDLOADER_EXPORT void setName(const std::string& name) { _name=name; }
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT MEDFileParameterMultiTS *deepCpy() const;
     MEDLOADER_EXPORT bool isEqual(const MEDFileParameterMultiTS *other, double eps, std::string& what) const;
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT void writeLL(med_idt fid, const MEDFileWritable& mw) const;
     MEDLOADER_EXPORT std::string simpleRepr() const;
     MEDLOADER_EXPORT void appendValue(int dt, int it, double time, double val);
@@ -144,8 +144,8 @@ namespace ParaMEDMEM
   protected:
     MEDFileParameterMultiTS();
     MEDFileParameterMultiTS(const MEDFileParameterMultiTS& other, bool deepCopy);
-    MEDFileParameterMultiTS(const char *fileName);
-    MEDFileParameterMultiTS(const char *fileName, const char *paramName);
+    MEDFileParameterMultiTS(const std::string& fileName);
+    MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName);
     void finishLoading(med_idt fid, med_parameter_type typ, int nbOfSteps);
   protected:
     std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileParameter1TS> > _param_per_ts;
@@ -155,12 +155,12 @@ namespace ParaMEDMEM
   {
   public:
     MEDLOADER_EXPORT static MEDFileParameters *New();
-    MEDLOADER_EXPORT static MEDFileParameters *New(const char *fileName);
+    MEDLOADER_EXPORT static MEDFileParameters *New(const std::string& fileName);
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
     MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
     MEDLOADER_EXPORT MEDFileParameters *deepCpy() const;
     MEDLOADER_EXPORT bool isEqual(const MEDFileParameters *other, double eps, std::string& what) const;
-    MEDLOADER_EXPORT void write(const char *fileName, int mode) const;
+    MEDLOADER_EXPORT void write(const std::string& fileName, int mode) const;
     MEDLOADER_EXPORT void writeLL(med_idt fid) const;
     MEDLOADER_EXPORT std::vector<std::string> getParamsNames() const;
     MEDLOADER_EXPORT std::string simpleRepr() const;
@@ -169,13 +169,13 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void pushParam(MEDFileParameterMultiTS *param);
     MEDLOADER_EXPORT void setParamAtPos(int i, MEDFileParameterMultiTS *param);
     MEDLOADER_EXPORT MEDFileParameterMultiTS *getParamAtPos(int i) const;
-    MEDLOADER_EXPORT MEDFileParameterMultiTS *getParamWithName(const char *paramName) const;
+    MEDLOADER_EXPORT MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const;
     MEDLOADER_EXPORT void destroyParamAtPos(int i);
-    MEDLOADER_EXPORT int getPosFromParamName(const char *paramName) const;
+    MEDLOADER_EXPORT int getPosFromParamName(const std::string& paramName) const;
     MEDLOADER_EXPORT int getNumberOfParams() const;
   protected:
     void simpleRepr2(int bkOffset, std::ostream& oss) const;
-    MEDFileParameters(const char *fileName);
+    MEDFileParameters(const std::string& fileName);
     MEDFileParameters(const MEDFileParameters& other, bool deepCopy);
     MEDFileParameters();
   protected:
index e2152003e845e0cc7f7aaf0a16e77f266bd9bf8b..3d2cbe48dbdfd38637b9504b2fd72cbc25e16cae 100644 (file)
@@ -56,7 +56,7 @@ const char *MEDFileUtilities::GetReadableMEDFieldType(med_field_type ft)
     }
 }
 
-void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const char *msg)
+void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const std::string& msg)
 {
   if(code<0)
     {
@@ -66,7 +66,7 @@ void MEDFileUtilities::CheckMEDCode(int code, med_idt fid, const char *msg)
     }
 }
 
-void MEDFileUtilities::CheckFileForRead(const char *fileName)
+void MEDFileUtilities::CheckFileForRead(const std::string& fileName)
 {
   int status=MEDLoaderBase::getStatusOfFile(fileName);
   std::ostringstream oss;
@@ -89,7 +89,7 @@ void MEDFileUtilities::CheckFileForRead(const char *fileName)
         throw INTERP_KERNEL::Exception(oss.str().c_str());
       }
     }
-  AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   if(fid<0)
     {
       oss << " has been detected as unreadable by MED file : impossible to read anything !";
index a17a407ee975f94f1f404ebd3137a09182607dac..426d3f2d11e38237a4d5207a1de3aa83716935d4 100644 (file)
@@ -30,8 +30,8 @@ namespace MEDFileUtilities
 {
   med_access_mode TraduceWriteMode(int medloaderwritemode);
   const char *GetReadableMEDFieldType(med_field_type ft);
-  void CheckMEDCode(int code, med_idt fid, const char *msg);
-  void CheckFileForRead(const char *fileName);
+  void CheckMEDCode(int code, med_idt fid, const std::string& msg);
+  void CheckFileForRead(const std::string& fileName);
 
   class AutoFid
   {
index 75c9acc1a3a38f31d6012e8b00fe798c4625d402..d4a5ed8e465df82f4dc45d9e51b1925040835037 100644 (file)
@@ -141,10 +141,10 @@ using namespace ParaMEDMEM;
 
 namespace MEDLoaderNS
 {
-  int readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector<int>& possibilities);
+  int readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector<int>& possibilities);
   void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity);
-  void writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
-  med_int getIdFromMeshName(med_idt fid, const char *meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception);
+  void writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
+  med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception);
   std::vector<std::string> getMeshNamesFid(med_idt fid);
 }
 
@@ -154,14 +154,14 @@ namespace MEDLoaderNS
 /// @cond INTERNAL
 
 /*!
- * This method returns a first quick overview of mesh with name 'meshName' into the file 'fileName'.
+ * This method returns a first quick overview of mesh with name \a meshName into the file \a fileName.
  * @param possibilities the relativeToMeshDim authorized to returned maxdim. This vector is systematically cleared at the begin of this method.
  * @return the maximal mesh dimension of specified mesh. If nothing found -1 is returned.
  */
-int MEDLoaderNS::readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector<int>& possibilities)
+int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector<int>& possibilities)
 {
   possibilities.clear();
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   int ret;
   std::set<int> poss;
   char nommaa[MED_NAME_SIZE+1];
@@ -214,9 +214,9 @@ int MEDLoaderNS::readUMeshDimFromFile(const char *fileName, const char *meshName
   return ret;
 }
 
-med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const char *meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception)
+med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception)
 {
-  if(meshName==0)
+  if(meshName.empty())
     {
       std::vector<std::string> meshes=getMeshNamesFid(fid);
       if(meshes.empty())
@@ -343,10 +343,10 @@ void MEDLoader::SetTooLongStrPolicy(int val)
  * - the space dimension
  * - the number of nodes
  */
-std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDLoader::GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes)
+std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDLoader::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   std::set<int> poss;
   char nommaa[MED_NAME_SIZE+1];
   char maillage_description[MED_COMMENT_SIZE+1];
@@ -401,23 +401,23 @@ std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > M
   return ret;
 }
 
-void MEDLoader::CheckFileForRead(const char *fileName)
+void MEDLoader::CheckFileForRead(const std::string& fileName)
 {
   MEDFileUtilities::CheckFileForRead(fileName);
 }
 
-std::vector<std::string> MEDLoader::GetMeshNames(const char *fileName)
+std::vector<std::string> MEDLoader::GetMeshNames(const std::string& fileName)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   std::vector<std::string> ret=MEDLoaderNS::getMeshNamesFid(fid);
   return ret;
 }
 
-std::vector< std::pair<std::string,std::string> > MEDLoader::GetComponentsNamesOfField(const char *fileName, const char *fieldName)
+std::vector< std::pair<std::string,std::string> > MEDLoader::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   std::vector<std::string> fields(nbFields);
   med_field_type typcha;
@@ -450,12 +450,12 @@ std::vector< std::pair<std::string,std::string> > MEDLoader::GetComponentsNamesO
   throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
-std::vector<std::string> MEDLoader::GetMeshNamesOnField(const char *fileName, const char *fieldName)
+std::vector<std::string> MEDLoader::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName)
 {
   CheckFileForRead(fileName);
   std::vector<std::string> ret;
   //
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -479,23 +479,23 @@ std::vector<std::string> MEDLoader::GetMeshNamesOnField(const char *fileName, co
   return ret;
 }
 
-std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const char *fileName, const char *meshName)
+std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
-  med_int nfam=MEDnFamily(fid,meshName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+  med_int nfam=MEDnFamily(fid,meshName.c_str());
   std::vector<std::string> ret(nfam);
   char nomfam[MED_NAME_SIZE+1];
   med_int numfam;
   for(int i=0;i<nfam;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName,i+1);
-      med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
       INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
       INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
-      MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+      MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
       std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
       ret[i]=cur;
     }
@@ -503,23 +503,23 @@ std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const char *fileName, c
 }
 
 
-std::vector<std::string> MEDLoader::GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName)
+std::vector<std::string> MEDLoader::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
-  med_int nfam=MEDnFamily(fid,meshName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+  med_int nfam=MEDnFamily(fid,meshName.c_str());
   std::vector<std::string> ret;
   char nomfam[MED_NAME_SIZE+1];
   med_int numfam;
   for(int i=0;i<nfam;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName,i+1);
-      med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
       INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
       INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
-      MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+      MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
       std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
       for(int j=0;j<ngro;j++)
         {
@@ -531,24 +531,24 @@ std::vector<std::string> MEDLoader::GetMeshFamiliesNamesOnGroup(const char *file
   return ret;
 }
 
-std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName)
+std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
-  med_int nfam=MEDnFamily(fid,meshName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+  med_int nfam=MEDnFamily(fid,meshName.c_str());
   std::vector<std::string> ret;
   char nomfam[MED_NAME_SIZE+1];
   med_int numfam;
   bool found=false;
   for(int i=0;i<nfam && !found;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName,i+1);
-      med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
       INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
       INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
-      MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+      MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
       std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
       found=(cur==famName);
       if(found)
@@ -568,23 +568,23 @@ std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileN
 }
 
   
-std::vector<std::string> MEDLoader::GetMeshGroupsNames(const char *fileName, const char *meshName)
+std::vector<std::string> MEDLoader::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
-  med_int nfam=MEDnFamily(fid,meshName);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+  med_int nfam=MEDnFamily(fid,meshName.c_str());
   std::vector<std::string> ret;
   char nomfam[MED_NAME_SIZE+1];
   med_int numfam;
   for(int i=0;i<nfam;i++)
     {
-      int ngro=MEDnFamilyGroup(fid,meshName,i+1);
-      med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+      int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+      med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
       INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
       INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
       INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
       INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
-      MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+      MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
       for(int j=0;j<ngro;j++)
         {
           std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
@@ -594,11 +594,11 @@ std::vector<std::string> MEDLoader::GetMeshGroupsNames(const char *fileName, con
     }
   return ret;
 }
-std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName)
+std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
 {
   CheckFileForRead(fileName);
   std::vector<ParaMEDMEM::TypeOfField> ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -664,11 +664,11 @@ std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *file
   return ret;
 }
 
-std::vector<std::string> MEDLoader::GetAllFieldNames(const char *fileName)
+std::vector<std::string> MEDLoader::GetAllFieldNames(const std::string& fileName)
 {
   CheckFileForRead(fileName);
   std::vector<std::string> ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   med_field_type typcha;
   for(int i=0;i<nbFields;i++)
@@ -687,11 +687,11 @@ std::vector<std::string> MEDLoader::GetAllFieldNames(const char *fileName)
   return ret;
 }
 
-std::vector<std::string> MEDLoader::GetAllFieldNamesOnMesh(const char *fileName, const char *meshName)
+std::vector<std::string> MEDLoader::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
 {
   CheckFileForRead(fileName);
   std::vector<std::string> ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -718,7 +718,7 @@ std::vector<std::string> MEDLoader::GetAllFieldNamesOnMesh(const char *fileName,
   return ret;
 }
 
-std::vector<std::string> MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName)
+std::vector<std::string> MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName)
 {
   CheckFileForRead(fileName);
   switch(type)
@@ -732,11 +732,11 @@ std::vector<std::string> MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField
     } 
 }
 
-std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const char *fileName, const char *meshName)
+std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
 {
   CheckFileForRead(fileName);
   std::vector<std::string> ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -782,11 +782,11 @@ std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const char *fileName
   return ret;
 }
 
-std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName)
+std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
 {
   CheckFileForRead(fileName);
   std::vector<std::string> ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   char pflname[MED_NAME_SIZE+1]="";
   char locname[MED_NAME_SIZE+1]="";
@@ -823,11 +823,11 @@ std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const char *fileName
   return ret;
 }
 
-std::vector< std::pair< std::pair<int,int>, double> > MEDLoader::GetAllFieldIterations(const char *fileName, const char *fieldName)
+std::vector< std::pair< std::pair<int,int>, double> > MEDLoader::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName)
 {
   CheckFileForRead(fileName);
   std::vector< std::pair< std::pair<int,int>, double > > ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -866,10 +866,10 @@ std::vector< std::pair< std::pair<int,int>, double> > MEDLoader::GetAllFieldIter
   throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
-double MEDLoader::GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order)
+double MEDLoader::GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order)
 {
   CheckFileForRead(fileName);
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -914,7 +914,7 @@ double MEDLoader::GetTimeAttachedOnFieldIteration(const char *fileName, const ch
   return ret;
 }
 
-std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName)
+std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
 {
   CheckFileForRead(fileName);
   switch(type)
@@ -928,12 +928,12 @@ std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(ParaMEDMEM::Type
     }
 }
 
-std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName)
+std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
 {
   CheckFileForRead(fileName);
   std::string meshNameCpp(meshName);
   std::vector< std::pair<int,int> > ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -1000,12 +1000,12 @@ std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const char *
   return ret;
 }
 
-std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName)
+std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
 {
   CheckFileForRead(fileName);
   std::string meshNameCpp(meshName);
   std::vector< std::pair<int,int> > ret;
-  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+  MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
   med_int nbFields=MEDnField(fid);
   //
   med_field_type typcha;
@@ -1065,7 +1065,7 @@ std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const char *
   return ret;
 }
 
-ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax)
+ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax)
 {
   CheckFileForRead(fileName);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
@@ -1089,7 +1089,7 @@ ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, c
   throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
-ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, int meshDimRelToMax)
+ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax)
 {
   CheckFileForRead(fileName);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName));
@@ -1113,7 +1113,7 @@ ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, i
   throw INTERP_KERNEL::Exception(oss.str().c_str());
 }
 
-ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax)
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax)
 {
   CheckFileForRead(fileName);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
@@ -1127,7 +1127,7 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName,
  return  mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
 }
 
-ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, int meshDimRelToMax)
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax)
 {
   CheckFileForRead(fileName);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName));
@@ -1141,14 +1141,14 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName,
  return  mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
 }
 
-int MEDLoader::ReadUMeshDimFromFile(const char *fileName, const char *meshName)
+int MEDLoader::ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName)
 {
   CheckFileForRead(fileName);
   std::vector<int> poss;
   return MEDLoaderNS::readUMeshDimFromFile(fileName,meshName,poss);
 }
 
-ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& fams)
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& fams)
 {
   CheckFileForRead(fileName);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
@@ -1162,7 +1162,7 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const char *fileN
     return mmuPtr->getFamilies(meshDimRelToMax,fams,true);
 }
 
-ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& grps)
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& grps)
 {
   CheckFileForRead(fileName);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
@@ -1176,7 +1176,7 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const char *fileNam
     return mmuPtr->getGroups(meshDimRelToMax,grps,true);
 }
 
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
 {
   CheckFileForRead(fileName);
   switch(type)
@@ -1194,7 +1194,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField
     } 
 }
 
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                   const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
 {
   if(its.empty())
@@ -1231,31 +1231,31 @@ std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMes
   return ret;
 }
 
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsCellOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                             const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
 {
   return ReadFieldsOnSameMesh(ON_CELLS,fileName,meshName,meshDimRelToMax,fieldName,its);
 }
 
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsNodeOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                       const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
 {
   return ReadFieldsOnSameMesh(ON_NODES,fileName,meshName,meshDimRelToMax,fieldName,its);
 }
 
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                        const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
 {
   return ReadFieldsOnSameMesh(ON_GAUSS_PT,fileName,meshName,meshDimRelToMax,fieldName,its);
 }
 
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussNEOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                          const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
 {
   return ReadFieldsOnSameMesh(ON_GAUSS_NE,fileName,meshName,meshDimRelToMax,fieldName,its);
 }
 
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
@@ -1272,7 +1272,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const char *fileNam
   return ret.retn();
 }
 
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
@@ -1314,7 +1314,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const char *fileNam
   return ret.retn();
 }
 
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
@@ -1331,7 +1331,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const char *fileNa
   return ret.retn();
 }
 
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
   MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
@@ -1348,7 +1348,7 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const char *file
   return ret.retn();
 }
 
-void MEDLoader::WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch)
+void MEDLoader::WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch)
 {
   if(!mesh)
     throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : input mesh is null !");
@@ -1389,7 +1389,7 @@ void MEDLoader::WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMes
   throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : only MEDCouplingUMesh, MEDCoupling1GTUMesh, MEDCouplingCMesh, MEDCouplingCurveLinear are dealed in this API for the moment !");
 }
 
-void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
+void MEDLoader::WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
 {
   if(!mesh)
     throw INTERP_KERNEL::Exception("MEDLoader::WriteUMesh : input mesh is null !");
@@ -1401,12 +1401,12 @@ void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUM
   m->write(fileName,mod);
 }
 
-void MEDLoader::WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
+void MEDLoader::WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
 {
   MEDLoader::WriteUMesh(fileName,mesh,writeFromScratch);
 }
 
-void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
+void MEDLoader::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
 {
   std::string meshName(meshNameC);
   if(meshName.empty())
@@ -1425,12 +1425,12 @@ void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshName
   m->write(fileName,mod);
 }
 
-void MEDLoader::WriteUMeshesPartitionDep(const char *fileName, const char *meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
+void MEDLoader::WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
 {
   WriteUMeshesPartition(fileName,meshNameC,meshes,writeFromScratch);
 }
 
-void MEDLoader::WriteUMeshes(const char *fileName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
+void MEDLoader::WriteUMeshes(const std::string& fileName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
 {
   int mod=writeFromScratch?2:0;
   MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
@@ -1439,7 +1439,7 @@ void MEDLoader::WriteUMeshes(const char *fileName, const std::vector<const ParaM
   m->write(fileName,mod);
 }
 
-void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
+void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
 {
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New());
   MEDLoader::AssignStaticWritePropertiesTo(*ff);
@@ -1492,7 +1492,7 @@ void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fil
   ff->write(fileName,0);
 }
 
-void MEDLoader::WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
+void MEDLoader::WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
 {
   if(!f)
     throw INTERP_KERNEL::Exception("MEDLoader::WriteField : input field is NULL !");
@@ -1579,12 +1579,12 @@ void MEDLoader::WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFi
     }
 }
 
-void MEDLoader::WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
+void MEDLoader::WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
 {
   WriteField(fileName,f,writeFromScratch);
 }
 
-void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f)
+void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f)
 {
   if(!f)
     throw INTERP_KERNEL::Exception("MEDLoader::WriteFieldUsingAlreadyWrittenMesh : input field is null !");
@@ -1597,12 +1597,15 @@ void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const Pa
     }
   MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts(MEDFileField1TS::New());
   AssignStaticWritePropertiesTo(*f1ts);
-  MEDCouplingUMesh *m=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh()));
-  if(!m)
-    throw INTERP_KERNEL::Exception("MEDLoader::WriteFieldUsingAlreadyWrittenMesh : only umesh in input field supported !");
-  MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=m->getRenumArrForMEDFileFrmt();
-  MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
-  f2->renumberCells(o2n->begin(),false);
-  f1ts->setFieldNoProfileSBT(f2);
+  MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
+  if(m)
+    {
+      MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+      MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
+      f2->renumberCells(o2n->begin(),false);
+      f1ts->setFieldNoProfileSBT(f2);
+    }
+  else
+    f1ts->setFieldNoProfileSBT(f);
   f1ts->write(fileName,0);
 }
index 1f0a7b1305021d5cea2be91333ec99726b2dfc80..feae9ede522ccb605e0cf819068de2440d4114a2 100644 (file)
@@ -47,57 +47,57 @@ class MEDLOADER_EXPORT MEDLoader
   static bool HasXDR();
   static std::string MEDFileVersionStr();
   static void MEDFileVersion(int& major, int& minor, int& release);
-  static void CheckFileForRead(const char *fileName);
-  static std::vector<std::string> GetMeshNames(const char *fileName);
-  static std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes);
-  static std::vector< std::pair<std::string,std::string> > GetComponentsNamesOfField(const char *fileName, const char *fieldName);
-  static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName);
-  static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName);
-  static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName);
-  static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName);
-  static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName);
-  static std::vector<std::string> GetAllFieldNames(const char *fileName);
-  static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName);
-  static std::vector<ParaMEDMEM::TypeOfField> GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName);
-  static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName);
-  static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName);
-  static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName);
-  static std::vector< std::pair<int,int> > GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName);
-  static std::vector< std::pair<int,int> > GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName);
-  static std::vector< std::pair<int,int> > GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName);
-  static std::vector< std::pair< std::pair<int,int>, double> > GetAllFieldIterations(const char *fileName, const char *fieldName);
-  static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order);
-  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& fams);
-  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& grps);
-  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0);
-  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, int meshDimRelToMax=0);
-  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0);
-  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0);
-  static int ReadUMeshDimFromFile(const char *fileName, const char *meshName);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
-  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+  static void CheckFileForRead(const std::string& fileName);
+  static std::vector<std::string> GetMeshNames(const std::string& fileName);
+  static std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes);
+  static std::vector< std::pair<std::string,std::string> > GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName);
+  static std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName);
+  static std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName);
+  static std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName);
+  static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName);
+  static std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName);
+  static std::vector<std::string> GetAllFieldNames(const std::string& fileName);
+  static std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
+  static std::vector<ParaMEDMEM::TypeOfField> GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+  static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName);
+  static std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
+  static std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName);
+  static std::vector< std::pair<int,int> > GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+  static std::vector< std::pair<int,int> > GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+  static std::vector< std::pair<int,int> > GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName);
+  static std::vector< std::pair< std::pair<int,int>, double> > GetAllFieldIterations(const std::string& fileName, const std::string& fieldName);
+  static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order);
+  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& fams);
+  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& grps);
+  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
+  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
+  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0);
+  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0);
+  static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
+  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                 const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
-  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsCellOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                     const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
-  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsNodeOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                     const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
-  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                      const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
-  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussNEOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+  static std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
                                                                                        const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
-  static void WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch);
-  static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch);
-  static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch);
-  static void WriteUMeshesPartition(const char *fileName, const char *meshName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
-  static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
-  static void WriteUMeshes(const char *fileName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
-  static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
-  static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
-  static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order);
+  static void WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch);
+  static void WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch);
+  static void WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch);
+  static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
+  static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
+  static void WriteUMeshes(const std::string& fileName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
+  static void WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
+  static void WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
+  static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f);
  public:
   static void AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj);
  private:
index e35e58563c7aeeb82c49aa410b4e8b1dba733f91..fe0aa8bf855cd9eaf6af4f9a0a0753d97b217095 100644 (file)
 
 const char MEDLoaderBase::WHITE_SPACES[]=" \n";
 
-int MEDLoaderBase::getStatusOfFile(const char *fileName)
+int MEDLoaderBase::getStatusOfFile(const std::string& fileName)
 {
   std::ifstream ifs;
-  ifs.open(fileName);
+  ifs.open(fileName.c_str());
   if((ifs.rdstate() & std::ifstream::failbit)!=0)
     {
       ifs.close();
       return NOT_EXIST;
     }
-  std::ofstream ofs(fileName,std::ios_base::app);
+  std::ofstream ofs(fileName.c_str(),std::ios_base::app);
   if((ofs.rdstate() & std::ofstream::failbit)!=0)
     {
       return EXIST_RDONLY;
@@ -199,7 +199,7 @@ std::string MEDLoaderBase::buildStringFromFortran(const char *expr, int lgth)
  * This method given the target size to respect 'sizeToRespect' tries to reduce size of 'src' string.
  * This method uses several soft methods to do its job. But if it fails a simple cut of string will be performed.
  */
-std::string MEDLoaderBase::zipString(const char *src, int sizeToRespect)
+std::string MEDLoaderBase::zipString(const std::string& src, int sizeToRespect)
 {
   std::string s(src);
   strip(s);
index 9ec2093b3681cc439a724668ce6e20c9cf11a14d..7d60b7e5c189d708ca9065f8184a75a0ebc2b1a3 100644 (file)
@@ -29,7 +29,7 @@
 class MEDLOADER_EXPORT MEDLoaderBase
 {
 public:
-  static int getStatusOfFile(const char *fileName);
+  static int getStatusOfFile(const std::string& fileName);
   static char *buildEmptyString(int lgth);
   static void getDirAndBaseName(const std::string& fullName, std::string& dirName, std::string& baseName);
   static std::string getPathSep();
@@ -41,7 +41,7 @@ public:
   static void safeStrCpy2(const char *src, int maxLgth, char *dest, int behaviour);
   static std::string buildStringFromFortran(const char *expr, int lgth);
   static void zipEqualConsChar(std::string& s, int minConsSmChar);
-  static std::string zipString(const char *src, int sizeToRespect);
+  static std::string zipString(const std::string& src, int sizeToRespect);
 public:
   static const int EXIST_RW=0;
   static const int NOT_EXIST=1;
index ad16d610ac9d417793b4ba475246dc2430b750c1..2449c8468169ae9a82da866dc46dace4104fba70 100644 (file)
@@ -2302,6 +2302,74 @@ void IntermediateMED::checkDataAvailability() const
     THROW_IK_EXCEPTION("Nodes and coordinates mismatch");
 }
 
+//================================================================================
+/*!
+ * \brief Safely adds a new Group
+ */
+//================================================================================
+
+Group* IntermediateMED::addNewGroup(std::vector<SauvUtilities::Group*>* groupsToFix)
+{
+  if ( _groups.size() == _groups.capacity() ) // re-allocation would occure
+    {
+      std::vector<Group> newGroups( _groups.size() );
+      newGroups.push_back( Group() );
+
+      for ( size_t i = 0; i < _groups.size(); ++i )
+        {
+          // avoid copying _cells
+          std::vector<const Cell*> cells;
+          cells.swap( _groups[i]._cells );
+          newGroups[i] = _groups[i];
+          newGroups[i]._cells.swap( cells );
+
+          // correct pointers to sub-groups
+          for ( size_t j = 0; j < _groups[i]._groups.size(); ++j )
+            {
+              int iG = _groups[i]._groups[j] - &_groups[0];
+              newGroups[i]._groups[j] = & newGroups[ iG ];
+            }
+        }
+
+      // fix given groups
+      if ( groupsToFix )
+        for ( size_t i = 0; i < groupsToFix->size(); ++i )
+          if ( (*groupsToFix)[i] )
+            {
+              int iG = (*groupsToFix)[i] - &_groups[0];
+              (*groupsToFix)[i] = & newGroups[ iG ];
+            }
+
+      // fix field supports
+      for ( int isNode = 0; isNode < 2; ++isNode )
+        {
+          std::vector<DoubleField* >& fields = isNode ? _nodeFields : _cellFields;
+          for ( size_t i = 0; i < fields.size(); ++i )
+            {
+              if ( !fields[i] ) continue;
+              for ( size_t j = 0; j < fields[i]->_sub.size(); ++j )
+                if ( fields[i]->_sub[j]._support )
+                  {
+                    int iG = fields[i]->_sub[j]._support - &_groups[0];
+                    fields[i]->_sub[j]._support = & newGroups[ iG ];
+                  }
+              if ( fields[i]->_group )
+                {
+                  int iG = fields[i]->_group - &_groups[0];
+                  fields[i]->_group = & newGroups[ iG ];
+                }
+            }
+        }
+
+      _groups.swap( newGroups );
+    }
+  else
+    {
+      _groups.push_back( Group() );
+    }
+  return &_groups.back();
+}
+
 //================================================================================
 /*!
  * \brief Makes ParaMEDMEM::MEDFileData from self
index 50bcc36047901ed5a9df06dd4caeacc3df80e6b4..fa16a1293396dfd11889623633d30b9d71a4f669 100644 (file)
@@ -94,7 +94,6 @@ namespace SauvUtilities
     std::string              _name;
     std::vector<const Cell*> _cells;
     std::vector< Group* >    _groups;    // des sous-groupes composant le Group
-    //bool                     _isShared;  // true if any Cell was added to the mesh from other Group
     bool                     _isProfile; // is a field support or not
     std::vector<std::string> _refNames;  /* names of groups referring this one;
                                             _refNames is resized according to nb of references
@@ -255,6 +254,7 @@ namespace SauvUtilities
     Node* getNode( TID nID ) { return _points.getNode( nID ); }
     int getNbCellsOfType( TCellType type ) const { return _cellsByType[type].size(); }
     const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); }
+    Group* addNewGroup(std::vector<SauvUtilities::Group*>* groupsToFix=0);
     ParaMEDMEM::MEDFileData* convertInMEDFileDS();
 
   private:
index 7c76e36cb53991f0b233e3051ecda1da142ab820..55a488303f91f177b994646edc4470153a3c1f8e 100644 (file)
@@ -44,14 +44,14 @@ using namespace std;
  */
 //================================================================================
 
-SauvReader* SauvReader::New(const char *fileName)
+SauvReader* SauvReader::New(const std::string& fileName)
 {
-  if ( !fileName || strlen(fileName) < 1 ) THROW_IK_EXCEPTION("Invalid file name");
+  if ( fileName.empty() ) THROW_IK_EXCEPTION("Invalid file name");
 
   ParaMEDMEM::MEDCouplingAutoRefCountObjectPtr< SauvUtilities::FileReader> parser;
 
   // try to open as XRD
-  parser = new XDRReader( fileName );
+  parser = new XDRReader( fileName.c_str() );
   if ( parser->open() )
     {
       SauvReader* reader = new SauvReader;
@@ -60,7 +60,7 @@ SauvReader* SauvReader::New(const char *fileName)
     }
 
   // try to open as ASCII
-  parser = new ASCIIReader( fileName );
+  parser = new ASCIIReader( fileName.c_str() );
   if ( parser->open() )
     {
       SauvReader* reader = new SauvReader;
@@ -428,9 +428,9 @@ void SauvReader::read_PILE_SOUS_MAILLAGE(const int                 nbObjects,
       SauvUtilities::Group & grp = _iMed->_groups[ grpID-1 ];
       if ( !grp._name.empty() ) // a group has several names
         { // create a group with subgroup grp and named grp.name
-          _iMed->_groups.push_back(Group());
-          _iMed->_groups.back()._groups.push_back( &_iMed->_groups[ grpID-1 ]);
-          _iMed->_groups.back()._name = grp._name;
+          SauvUtilities::Group* newGroup = _iMed->addNewGroup();
+          newGroup->_groups.push_back( &_iMed->_groups[ grpID-1 ]);
+          newGroup->_name = grp._name;
         }
       grp._name=objectNames[i];
 #ifdef _DEBUG
@@ -688,8 +688,7 @@ void SauvReader::setFieldSupport(const vector<SauvUtilities::Group*>& supports,
             sameOrder = ( supports[j] == newGroups[ j % newGroups.size() ]);
           if ( sameOrder )
             {
-              _iMed->_groups.push_back( SauvUtilities::Group() );
-              group = & _iMed->_groups.back();
+              group = _iMed->addNewGroup( & newGroups );
               group->_groups.swap( newGroups );
             }
         }
index cb7b7e6b6e03e2de2039cf69aa28ee11ba20e1aa..e6d3b53d56989919605e0d097ea9124864eb091b 100644 (file)
@@ -46,7 +46,7 @@ namespace ParaMEDMEM
 class SauvReader : public ParaMEDMEM::RefCountObject
 {
  public:
-  MEDLOADER_EXPORT static SauvReader* New(const char *fileName);
+  MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName);
   MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS();
   MEDLOADER_EXPORT ~SauvReader();
 
index 6478c2bbe9774dddb490819c64854b29e482a3e2..73e59c3d4320b12ee6c219a0e37f3da7cef53450 100644 (file)
@@ -621,10 +621,10 @@ void SauvWriter::makeProfileIDs( SubMesh*                          sm,
  */
 //================================================================================
 
-void SauvWriter::write(const char* fileName)
+void SauvWriter::write(const std::string& fileName)
 {
   std::fstream fileStream;
-  fileStream.open( fileName, ios::out);
+  fileStream.open( fileName.c_str(), ios::out);
   if
 #ifdef WIN32
     ( !fileStream || !fileStream.is_open() )
index bbbdce98d277bb849f18239abfb5c08dc672bf18..cbb64d3e6c846746d27483e31ea99d69652977f2 100644 (file)
@@ -48,7 +48,7 @@ namespace ParaMEDMEM
   public:
     MEDLOADER_EXPORT static SauvWriter *New();
     MEDLOADER_EXPORT void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0);
-    MEDLOADER_EXPORT void write(const char* fileName);
+    MEDLOADER_EXPORT void write(const std::string& fileName);
     MEDLOADER_EXPORT void setCpyGrpIfOnASingleFamilyStatus(bool status);
     MEDLOADER_EXPORT bool getCpyGrpIfOnASingleFamilyStatus() const;
   private:
index 87d2fbcce509e9a6f7d7ab9b2f37fa94c6690dab..7dc270e575a9f001027b8785af38cf2c2fc5eddb 100644 (file)
@@ -19,6 +19,7 @@
 #
 # Author Anthony GEAY (CEA/DEN/DM2S/STMF/LGLS)
 
+# http://www-vis.lbl.gov/NERSC/Software/ensight/doc/OnlineHelp/UM-C11.pdf
 import numpy as np
 from MEDLoader import *
 from CaseIO import CaseIO
@@ -53,7 +54,11 @@ class CaseReader(CaseIO):
         cI=DataArrayInt(len(cells)+1) ; cI.iota() ; cI*=nbNodesPerCell+1
         #
         cells2=cells.reshape(len(cells),nbNodesPerCell)
-        c2=DataArrayInt(cells2)
+        if cells2.dtype=='int32':
+            c2=DataArrayInt(cells2)
+        else:
+            c2=DataArrayInt(np.array(cells2,dtype="int32"))
+            pass
         c=DataArrayInt(len(cells),nbNodesPerCell+1) ; c[:,0]=ct ; c[:,1:]=c2-1 ; c.rearrange(1)
         m.setConnectivity(c,cI,True)
         m.checkCoherency2()
@@ -105,13 +110,96 @@ class CaseReader(CaseIO):
 
     def __convertGeo2MED(self,geoFileName):
         """ Convert all the geometry (all the meshes) contained in teh CASE file into MEDCouplingUMesh'es. """
-        fd=open(os.path.join(self._dirName,geoFileName),"r+b") ; fd.seek(0,2) ; end=fd.tell() ; fd.seek(0) ; fd.readline() ; fd.readline()
+        fd=open(os.path.join(self._dirName,geoFileName),"r+b") ; fd.seek(0,2) ; end=fd.tell() ; fd.seek(0) ; title=fd.read(80)
+        title=title.strip().lower()
+        if "binary" not in title:
+            raise Exception("Error only binary geo files are supported for the moment !")
+            pass
+        zeType=True
+        if "fortran" in title:
+            mcmeshes=self.__convertGeo2MEDFortran(fd,end) ; zeType=False
+        else:
+            mcmeshes=self.__convertGeo2MEDC(fd,end)
+        #
+        ms=MEDFileMeshes()
+        ms.resize(len(mcmeshes))
+        for i,m in enumerate(mcmeshes):
+            mlm=MEDFileUMesh()
+            mlm.setMeshAtLevel(0,m)
+            ms.setMeshAtPos(i,mlm)
+            pass
+        return mcmeshes,ms,zeType
+
+    def __convertGeo2MEDFortran(self,fd,end):
+        mcmeshes=[]
+        fd.read(80) # comment 1
+        fd.read(80) # comment 2
+        fd.read(80) # node id
+        fd.read(80) # element id
+        pos=fd.tell()
+        elt=fd.read(80) ; elt=elt.strip() ; pos=fd.tell()
+        mcmeshes2=[]
+        typ="part"
+        nbOfTurn=0
+        while abs(pos-end)>8 and "part" in typ:
+            if "part" not in elt:
+                raise Exception("Error on reading mesh fortran #1 !")
+            fd.seek(fd.tell()+4)# skip #
+            tmp=fd.read(80) ; meshName=tmp.split("P")[-1]
+            tmp=fd.read(80)
+            if "coordinates" not in tmp:
+                raise Exception("Error on reading mesh fortran #2 !")
+            pos=fd.tell() # 644
+            if nbOfTurn==0:
+                pos+=76 # what else ?
+            else:
+                pos+=40
+                pass
+            nbNodes=np.memmap(fd,dtype='>i4',mode='r',offset=int(pos),shape=(1,)).tolist()[0]
+            pos+=12 # what else ?
+            a=np.memmap(fd,dtype='>f4',mode='r',offset=int(pos),shape=(nbNodes))
+            b=np.memmap(fd,dtype='>f4',mode='r',offset=int(pos+nbNodes*4+2*4),shape=(nbNodes))
+            c=np.memmap(fd,dtype='>f4',mode='r',offset=int(pos+nbNodes*2*4+4*4),shape=(nbNodes))
+            coo=np.zeros(dtype=">f4",shape=(nbNodes*3))
+            coo[:nbNodes]=a ; coo[nbNodes:2*nbNodes]=b ; coo[2*nbNodes:]=c
+            coo=coo.reshape(nbNodes,3)
+            pos+=nbNodes*3*4 ; fd.seek(pos)#np.array(0,dtype='float%i'%(typeOfCoo)).nbytes
+            typ=fd.read(80).strip() ; pos=fd.tell()
+            zeK=""
+            for k in self.dictMCTyp2.keys():
+                if k in typ:
+                    zeK=k
+                    break
+                    pass
+                pass
+            pos+=8*4 # yeh man !
+            nbCellsOfType=np.memmap(fd,dtype='>i4',mode='r',offset=int(pos),shape=(1,)).tolist()[0]
+            pos+=4 # for the number of cells
+            pos+=2*4 # because it's great !
+            nbNodesPerCell=MEDCouplingMesh.GetNumberOfNodesOfGeometricType(self.dictMCTyp2[zeK])
+            nodalConn=np.memmap(fd,dtype='>i4',mode='r',offset=pos,shape=(nbCellsOfType,nbNodesPerCell))
+            meshName=meshName.strip()
+            mcmeshes2.append(self.__traduceMesh(meshName,zeK,coo,nodalConn))
+            pos+=nbNodesPerCell*nbCellsOfType*4
+            if abs(pos-end)>8:
+                fd.seek(pos) ;elt=fd.read(80) ; typ=elt[:] ; pos+=80 
+                pass
+            nbOfTurn+=1
+            pass
+        #coo=mcmeshes2[0].getCoords() ; name=mcmeshes2[0].getName()
+        #for itmesh in mcmeshes2: itmesh.setCoords(coo)
+        #m=MEDCouplingUMesh.MergeUMeshesOnSameCoords(mcmeshes2) ; m.setName(name)
+        #mcmeshes.append(m)
+        return mcmeshes2
+
+    def __convertGeo2MEDC(self,fd,end):
+        fd.readline()
         name=fd.readline().strip() ; fd.readline() ; fd.readline()
         pos=fd.tell()
         mcmeshes=[]
         elt=fd.read(80) ; elt=elt.strip() ; pos+=80
         while pos!=end:
-            if elt!="part":
+            if "part" not in elt:
                 raise Exception("Error on reading mesh #1 !")
             fd.seek(fd.tell()+4)
             meshName=fd.read(80).strip()
@@ -163,15 +251,8 @@ class CaseReader(CaseIO):
             m=MEDCouplingUMesh.MergeUMeshesOnSameCoords(mcmeshes2) ; m.setName(name)
             mcmeshes.append(m)
             pass
-        #
-        ms=MEDFileMeshes()
-        ms.resize(len(mcmeshes))
-        for i,m in enumerate(mcmeshes):
-            mlm=MEDFileUMesh()
-            mlm.setMeshAtLevel(0,m)
-            ms.setMeshAtPos(i,mlm)
-            pass
-        return mcmeshes,ms
+        return mcmeshes
+        
     
     def __convertField(self,mlfields, mcmeshes, fileName, fieldName, discr, nbCompo, locId, it):
         """ Convert the fields. """
@@ -211,6 +292,60 @@ class CaseReader(CaseIO):
             f.checkCoherency()
             mlfields[locId+meshId].appendFieldNoProfileSBT(f)
             pass
+
+    def __convertFieldFortran(self,mlfields, mcmeshes, fileName, fieldName, discr, nbCompo, locId, it):
+        """ Convert the fields. """
+        if re.search("[\*]+",fileName):
+            stars=re.search("[\*]+",fileName).group()
+            st="%0"+str(len(stars))+"i"
+            trueFileName=fileName.replace(stars,st%(it))
+            pass
+        else:
+            trueFileName=fileName
+            pass
+        fd=open(os.path.join(self._dirName,trueFileName),"r+b") ; fd.seek(0,2) ; end=fd.tell() ; fd.seek(0)
+        name=fd.read(80)
+        if fieldName not in name:
+            raise Exception("ConvertField : mismatch")
+        pos=fd.tell()
+        st=fd.read(80) ; st=st.strip() ; pos=fd.tell()
+        if "part" not in st:
+            raise Exception("ConvertField : mismatch #2")
+        st=fd.read(80).strip() ; pos=fd.tell()
+        pos+=12 # I love it
+        offset=0
+        nbTurn=0
+        while pos!=end and "part" not in st:
+            fdisc=MEDCouplingFieldDiscretization.New(self.discSpatial2[discr])
+            nbOfValues=fdisc.getNumberOfTuples(mcmeshes[nbTurn])
+            vals2=DataArrayDouble(nbOfValues,nbCompo)
+            pos+=24 # I love it again !
+            nbOfValsOfTyp=np.memmap(fd,dtype='>i4',mode='r',offset=pos,shape=(1)).tolist()[0]/4
+            pos+=4
+            vals=np.zeros(dtype=">f4",shape=(nbOfValsOfTyp*nbCompo))
+            for iii in xrange(nbCompo):
+                valsTmp=np.memmap(fd,dtype='>f4',mode='r',offset=int(pos),shape=(nbOfValsOfTyp))
+                vals[iii*nbOfValsOfTyp:(iii+1)*nbOfValsOfTyp]=valsTmp
+                pos+=nbOfValsOfTyp*4
+                pos+=2*4 ## hey hey, that is the ultimate class !
+                vals2.setInfoOnComponent(iii,chr(ord('X')+iii))
+                pass
+            if pos>end:
+                pos=end
+                pass
+            vals=vals.reshape(nbOfValsOfTyp,nbCompo)
+            vals2[offset:offset+nbOfValsOfTyp]=DataArrayDouble(np.array(vals,dtype='float64')).fromNoInterlace()
+            if pos!=end:
+                fd.seek(pos)
+                st=fd.read(80) ; st=st.strip() ; pos=fd.tell()
+                st=fd.read(80) ; st=st.strip() ; pos=fd.tell()
+                pass
+            f=MEDCouplingFieldDouble(self.discSpatial2[discr],ONE_TIME) ; f.setName("%s_%s"%(fieldName,mcmeshes[nbTurn].getName()))
+            f.setMesh(mcmeshes[nbTurn]) ; f.setArray(vals2) ; f.setTime(float(it),it,-1)
+            f.checkCoherency()
+            mlfields[locId+nbTurn].appendFieldNoProfileSBT(f)
+            nbTurn+=1
+            pass
         pass
     
     def loadInMEDFileDS(self):
@@ -221,26 +356,36 @@ class CaseReader(CaseIO):
         if ind==-1:
             raise Exception("Error with file %s"%(fname))
         geoName=re.match("model:([\W]*)([\w\.]+)",lines[ind+1]).group(2)
-        m1,m2=self.__convertGeo2MED(geoName)
-        ind=lines.index("VARIABLE\n")
+        m1,m2,typeOfFile=self.__convertGeo2MED(geoName)
         fieldsInfo=[]
-        for i in xrange(ind+1,lines.index("TIME\n")):
+        ind=lines.index("VARIABLE\n")
+        end=len(lines)-1
+        if "TIME\n" in lines:
+            end=lines.index("TIME\n")
+            pass
+        for i in xrange(ind+1,end):
             m=re.match("^([\w]+)[\s]+\per[\s]+([\w]+)[\s]*\:[\s]*([\w]+)[\s]+([\S]+)$",lines[i])
             if m:
+                if m.groups()[0]=="constant":
+                    continue
                 spatialDisc=m.groups()[1] ; fieldName=m.groups()[2] ; nbOfCompo=self.dictCompo2[m.groups()[0]] ; fieldFileName=m.groups()[3]
                 fieldsInfo.append((fieldName,spatialDisc,nbOfCompo,fieldFileName))
                 pass
             pass
         
         expr=re.compile("number[\s]+of[\s]+steps[\s]*\:[\s]*([\d]+)")
-        nbOfTimeSteps=int(expr.search(filter(expr.search,lines)[0]).group(1))
-        
-        expr=re.compile("filename[\s]+start[\s]+number[\s]*\:[\s]*([\d]+)")
-        startIt=int(expr.search(filter(expr.search,lines)[0]).group(1))
-        
-        expr=re.compile("filename[\s]+increment[\s]*\:[\s]*([\d]+)")
-        incrIt=int(expr.search(filter(expr.search,lines)[0]).group(1))
-        
+        tmp=filter(expr.search,lines)
+        if len(tmp)!=0:
+            nbOfTimeSteps=int(expr.search(filter(expr.search,lines)[0]).group(1))
+            expr=re.compile("filename[\s]+start[\s]+number[\s]*\:[\s]*([\d]+)")
+            startIt=int(expr.search(filter(expr.search,lines)[0]).group(1))
+            expr=re.compile("filename[\s]+increment[\s]*\:[\s]*([\d]+)")
+            incrIt=int(expr.search(filter(expr.search,lines)[0]).group(1))
+        else:
+            nbOfTimeSteps=1
+            startIt=0
+            incrIt=1
+            pass
         curIt=startIt
         mlfields=MEDFileFields()
         mlfields.resize(len(fieldsInfo)*len(m1))
@@ -254,7 +399,11 @@ class CaseReader(CaseIO):
         for ts in xrange(nbOfTimeSteps):
             i=0
             for field in fieldsInfo:
-                self.__convertField(mlfields,m1,field[3],field[0],field[1],field[2],i,curIt)
+                if typeOfFile:
+                    self.__convertField(mlfields,m1,field[3],field[0],field[1],field[2],i,curIt);
+                else:
+                    self.__convertFieldFortran(mlfields,m1,field[3],field[0],field[1],field[2],i,curIt)
+                    pass
                 i+=len(m1)
                 pass
             curIt+=incrIt
index 06607db5edcd98a4f1004a22754c9ebba2838554..594c74967af7a0a836cd1265980617241c12cd51 100644 (file)
@@ -226,19 +226,19 @@ public:
   static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
   static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
   static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
-  static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
-  static std::vector<std::string> GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
-  static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+  static void CheckFileForRead(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetMeshNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetMeshGroupsNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetAllFieldNames(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+  static std::vector<std::string> GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+  static double GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
   static void AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj) throw(INTERP_KERNEL::Exception);
   %extend
      {
@@ -253,7 +253,7 @@ public:
          return ret;
        }
 
-       static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+       static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
        {
          std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
          PyObject *ret=PyList_New(res.size());
@@ -268,7 +268,7 @@ public:
          return ret;
        }
 
-       static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+       static PyObject *GetAllFieldIterations(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
        {
          std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
          PyObject *ret=PyList_New(res.size());
@@ -284,7 +284,7 @@ public:
          return ret;
        }
 
-       static PyObject *GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+       static PyObject *GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
        {
          std::vector< std::pair<int,int> > res=MEDLoader::GetCellFieldIterations(fileName,meshName,fieldName);
          PyObject *ret=PyList_New(res.size());
@@ -298,7 +298,7 @@ public:
            }
          return ret;
        }
-       static PyObject *GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+       static PyObject *GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
        {
          std::vector< std::pair<int,int> > res=MEDLoader::GetNodeFieldIterations(fileName,meshName,fieldName);
          PyObject *ret=PyList_New(res.size());
@@ -312,7 +312,7 @@ public:
            }
          return ret;
        }
-       static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+       static PyObject *GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
        {
          std::vector< std::pair<std::string,std::string> > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName);
          PyObject *ret=PyList_New(res.size());
@@ -326,7 +326,7 @@ public:
            }
          return ret;
        }
-       static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+       static PyObject *GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception)
        {
          int meshDim,spaceDim,numberOfNodes;
          std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes);
@@ -353,32 +353,32 @@ public:
          PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes));
          return ret;
        }
-       static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax,
-                                             const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
+       static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax,
+                                             const std::string& fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception)
        {
          std::vector<std::pair<int,int> > its=convertTimePairIdsFromPy(liIts);
          std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> res=MEDLoader::ReadFieldsOnSameMesh(type,fileName,meshName,meshDimRelToMax,fieldName,its);
          return convertFieldDoubleVecToPy(res);
        }
-       static void WriteUMeshesPartition(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+       static void WriteUMeshesPartition(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
        {
          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
          MEDLoader::WriteUMeshesPartition(fileName,meshName,v,writeFromScratch);
        }
-       static void WriteUMeshesPartitionDep(const char *fileName, const char *meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+       static void WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
        {
          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
          MEDLoader::WriteUMeshesPartitionDep(fileName,meshName,v,writeFromScratch);
        }
-       static void WriteUMeshes(const char *fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+       static void WriteUMeshes(const std::string& fileName, PyObject *li, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
        {
          std::vector<const ParaMEDMEM::MEDCouplingUMesh *> v;
          convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",v);
          MEDLoader::WriteUMeshes(fileName,v,writeFromScratch);
        }
-       static PyObject *GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+       static PyObject *GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName) throw(INTERP_KERNEL::Exception)
        {
          std::vector< ParaMEDMEM::TypeOfField > v=MEDLoader::GetTypesOfField(fileName,meshName,fieldName);
          int size=v.size();
@@ -387,35 +387,35 @@ public:
            PyList_SetItem(ret,i,PyInt_FromLong((int)v[i]));
          return ret;
        }
-       static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
+       static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
        {
          std::vector<std::string> grps;
          converPyListToVecString(li,grps);
          return MEDLoader::ReadUMeshFromGroups(fileName,meshName,meshDimRelToMax,grps);
        }
-       static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
+       static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, PyObject *li) throw(INTERP_KERNEL::Exception)
        {
          std::vector<std::string> fams;
          converPyListToVecString(li,fams);
          return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
        }
      }
-  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
-  static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
-  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
-  static void WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
-  static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
-  static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
-  static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
-  static void WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
-  static void WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
+  static int ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+  static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+  static void WriteMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
+  static void WriteUMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
+  static void WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
+  static void WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
+  static void WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
+  static void WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception);
 };
 
 namespace ParaMEDMEM
@@ -469,18 +469,18 @@ namespace ParaMEDMEM
   class MEDFileMesh : public RefCountObject, public MEDFileWritable
   {
   public:
-    static MEDFileMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
-    static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
     virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
     virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
     virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
     virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
-    void setName(const char *name);
+    void setName(const std::string& name);
     std::string getName();
-    const char *getUnivName() const;
+    std::string getUnivName() const;
     bool getUnivNameWrStatus() const;
     void setUnivNameWrStatus(bool newStatus);
-    void setDescription(const char *name);
+    void setDescription(const std::string& name);
     std::string getDescription() const;
     void setOrder(int order);
     int getOrder() const;
@@ -489,8 +489,8 @@ namespace ParaMEDMEM
     void setTimeValue(double time);
     void setTime(int dt, int it, double time);
     double getTimeValue() const;
-    void setTimeUnit(const char *unit);
-    const char *getTimeUnit() const;
+    void setTimeUnit(const std::string& unit);
+    std::string getTimeUnit() const;
     virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
     virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
     virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
@@ -498,17 +498,17 @@ namespace ParaMEDMEM
     virtual std::vector<int> getDistributionOfTypes(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception);
     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);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
     //
-    bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
+    bool existsGroup(const std::string& groupName) const throw(INTERP_KERNEL::Exception);
     bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
-    bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
-    void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
-    void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
-    void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
-    void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
-    virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
+    bool existsFamily(const std::string& familyName) const throw(INTERP_KERNEL::Exception);
+    void setFamilyId(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
+    void setFamilyIdUnique(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
+    void addFamily(const std::string& familyName, int id) throw(INTERP_KERNEL::Exception);
+    void addFamilyOnGrp(const std::string& grpName, const std::string& famName) throw(INTERP_KERNEL::Exception);
+    virtual void createGroupOnAll(int meshDimRelToMaxExt, const std::string& groupName) throw(INTERP_KERNEL::Exception);
     virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
     void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
     void clearGrpMap() throw(INTERP_KERNEL::Exception);
@@ -516,28 +516,28 @@ namespace ParaMEDMEM
     void clearFamGrpMaps() throw(INTERP_KERNEL::Exception);
     const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
     const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
-    std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> getFamiliesOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
-    std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
-    void setFamiliesOnGroup(const char *name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
-    void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
-    std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
-    void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
+    std::vector<int> getFamiliesIdsOnGroup(const std::string& name) const throw(INTERP_KERNEL::Exception);
+    void setFamiliesOnGroup(const std::string& name, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception);
+    void setFamiliesIdsOnGroup(const std::string& name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
+    std::vector<std::string> getGroupsOnFamily(const std::string& name) const throw(INTERP_KERNEL::Exception);
+    void setGroupsOnFamily(const std::string& famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
     void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
     std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
-    void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
-    void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
+    void removeGroup(const std::string& name) throw(INTERP_KERNEL::Exception);
+    void removeFamily(const std::string& name) throw(INTERP_KERNEL::Exception);
     std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
     std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
-    void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
-    void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
+    void changeGroupName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
+    void changeFamilyName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
     void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
-    void changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
+    void changeAllGroupsContainingFamily(const std::string& familyNameToChange, const std::vector<std::string>& newFamiliesNames) throw(INTERP_KERNEL::Exception);
     void setFamilyInfo(const std::map<std::string,int>& info);
     void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
-    int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
+    int getFamilyId(const std::string& name) const throw(INTERP_KERNEL::Exception);
     int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
     int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
     int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
@@ -564,11 +564,11 @@ namespace ParaMEDMEM
     virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    virtual DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    virtual DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    virtual DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
     virtual DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
     %extend
        {
@@ -624,6 +624,26 @@ namespace ParaMEDMEM
            return res;
          }
 
+         PyObject *getAllGeoTypes() const throw(INTERP_KERNEL::Exception)
+         {
+           std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getAllGeoTypes());
+           std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
+           PyObject *res=PyList_New(result.size());
+           for(int i=0;iL!=result.end(); i++, iL++)
+             PyList_SetItem(res,i,PyInt_FromLong(*iL));
+           return res;
+         }
+
+         PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
+         {
+           std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
+           std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
+           PyObject *res=PyList_New(result.size());
+           for(int i=0;iL!=result.end(); i++, iL++)
+             PyList_SetItem(res,i,PyInt_FromLong(*iL));
+           return res;
+         }
+
          PyObject *getFamilyFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
          {
            const DataArrayInt *tmp=self->getFamilyFieldAtLevel(meshDimRelToMaxExt);
@@ -697,32 +717,32 @@ namespace ParaMEDMEM
   class MEDFileUMesh : public MEDFileMesh
   {
   public:
-    static MEDFileUMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
-    static MEDFileUMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileUMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileUMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
     static MEDFileUMesh *New();
     ~MEDFileUMesh();
     int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
     //
-    std::vector<int> getGrpNonEmptyLevels(const char *grp) const throw(INTERP_KERNEL::Exception);
-    std::vector<int> getGrpNonEmptyLevelsExt(const char *grp) const throw(INTERP_KERNEL::Exception);
-    std::vector<int> getFamNonEmptyLevels(const char *fam) const throw(INTERP_KERNEL::Exception);
-    std::vector<int> getFamNonEmptyLevelsExt(const char *fam) const throw(INTERP_KERNEL::Exception);
+    std::vector<int> getGrpNonEmptyLevels(const std::string& grp) const throw(INTERP_KERNEL::Exception);
+    std::vector<int> getGrpNonEmptyLevelsExt(const std::string& grp) const throw(INTERP_KERNEL::Exception);
+    std::vector<int> getFamNonEmptyLevels(const std::string& fam) const throw(INTERP_KERNEL::Exception);
+    std::vector<int> getFamNonEmptyLevelsExt(const std::string& fam) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getGrpsNonEmptyLevels(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getGrpsNonEmptyLevelsExt(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getFamsNonEmptyLevels(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
     std::vector<int> getFamsNonEmptyLevelsExt(const std::vector<std::string>& fams) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getGroupsOnSpecifiedLev(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingUMesh *getGroup(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getGroups(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingUMesh *getFamily(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getFamilyArr(int meshDimRelToMaxExt, const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getFamilies(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getNodeGroupArr(const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getNodeGroupArr(const std::string& grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *getNodeGroupsArr(const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
-    DataArrayInt *getNodeFamilyArr(const char *fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
+    DataArrayInt *getNodeFamilyArr(const std::string& fam, bool renum=false) const throw(INTERP_KERNEL::Exception);
     DataArrayInt *getNodeFamiliesArr(const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getMeshAtLevel(int meshDimRelToMaxExt, bool renum=false) const throw(INTERP_KERNEL::Exception);
     MEDCouplingUMesh *getLevel0Mesh(bool renum=false) const throw(INTERP_KERNEL::Exception);
@@ -745,12 +765,12 @@ namespace ParaMEDMEM
     DataArrayInt *extractNumberFieldOnGeoType(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
     %extend
        { 
-         MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
+         MEDFileUMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileUMesh::New(fileName,mName,dt,it,mrs);
          }
 
-         MEDFileUMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
+         MEDFileUMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileUMesh::New(fileName,mrs);
          }
@@ -759,16 +779,6 @@ namespace ParaMEDMEM
          {
            return MEDFileUMesh::New();
          }
-
-         PyObject *getGeoTypesAtLevel(int meshDimRelToMax) const throw(INTERP_KERNEL::Exception)
-         {
-           std::vector<INTERP_KERNEL::NormalizedCellType> result(self->getGeoTypesAtLevel(meshDimRelToMax));
-           std::vector<INTERP_KERNEL::NormalizedCellType>::const_iterator iL=result.begin();
-           PyObject *res=PyList_New(result.size());
-           for(int i=0;iL!=result.end(); i++, iL++)
-             PyList_SetItem(res,i,PyInt_FromLong(*iL));
-           return res;
-         }
          
          PyObject *getRevNumberFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
          {
@@ -814,7 +824,7 @@ namespace ParaMEDMEM
            return ret;
          }
 
-         PyObject *duplicateNodesOnM1Group(const char *grpNameM1) throw(INTERP_KERNEL::Exception)
+         PyObject *duplicateNodesOnM1Group(const std::string& grpNameM1) throw(INTERP_KERNEL::Exception)
          {
            DataArrayInt *ret0=0,*ret1=0,*ret2=0;
            self->duplicateNodesOnM1Group(grpNameM1,ret0,ret1,ret2);
@@ -857,9 +867,10 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileCMesh *New();
-    static MEDFileCMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
-    static MEDFileCMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileCMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileCMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
     void setMesh(MEDCouplingCMesh *m) throw(INTERP_KERNEL::Exception);
+    int getSpaceDimension() const throw(INTERP_KERNEL::Exception);
     %extend
        {
          MEDFileCMesh()
@@ -867,12 +878,12 @@ namespace ParaMEDMEM
            return MEDFileCMesh::New();
          }
 
-         MEDFileCMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
+         MEDFileCMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileCMesh::New(fileName,mrs);
          }
 
-         MEDFileCMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
+         MEDFileCMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileCMesh::New(fileName,mName,dt,it,mrs);
          }
@@ -891,8 +902,8 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileCurveLinearMesh *New();
-    static MEDFileCurveLinearMesh *New(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
-    static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileCurveLinearMesh *New(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
+    static MEDFileCurveLinearMesh *New(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception);
     void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
     %extend
        {
@@ -901,12 +912,12 @@ namespace ParaMEDMEM
            return MEDFileCurveLinearMesh::New();
          }
 
-         MEDFileCurveLinearMesh(const char *fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
+         MEDFileCurveLinearMesh(const std::string& fileName, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileCurveLinearMesh::New(fileName,mrs);
          }
 
-         MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
+         MEDFileCurveLinearMesh(const std::string& fileName, const std::string& mName, int dt=-1, int it=-1, MEDFileMeshReadSelector *mrs=0) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileCurveLinearMesh::New(fileName,mName,dt,it,mrs);
          }
@@ -925,11 +936,11 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileMeshMultiTS *New();
-    static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
-    static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
+    static MEDFileMeshMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileMeshMultiTS *New(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception);
     MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
     std::string getName() const throw(INTERP_KERNEL::Exception);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
     %extend
        { 
@@ -938,12 +949,12 @@ namespace ParaMEDMEM
            return MEDFileMeshMultiTS::New();
          }
 
-         MEDFileMeshMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+         MEDFileMeshMultiTS(const std::string& fileName) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileMeshMultiTS::New(fileName);
          }
 
-         MEDFileMeshMultiTS(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception)
+         MEDFileMeshMultiTS(const std::string& fileName, const std::string& mName) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileMeshMultiTS::New(fileName,mName);
          }
@@ -984,9 +995,9 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileMeshes *New();
-    static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileMeshes *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
     MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
     //
@@ -1001,7 +1012,7 @@ namespace ParaMEDMEM
            return MEDFileMeshes::New();
          }
 
-         MEDFileMeshes(const char *fileName) throw(INTERP_KERNEL::Exception)
+         MEDFileMeshes(const std::string& fileName) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileMeshes::New(fileName);
          }
@@ -1054,7 +1065,7 @@ namespace ParaMEDMEM
                ret->incrRef();
              return ret;
            }
-         MEDFileMesh *getMeshWithName(const char *mname) const throw(INTERP_KERNEL::Exception)
+         MEDFileMesh *getMeshWithName(const std::string& mname) const throw(INTERP_KERNEL::Exception)
            {
              MEDFileMesh *ret=self->getMeshWithName(mname);
              if(ret)
@@ -1098,8 +1109,8 @@ namespace ParaMEDMEM
     void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
-    bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
-    bool existsLoc(const char *locName) const throw(INTERP_KERNEL::Exception);
+    bool existsPfl(const std::string& pflName) const throw(INTERP_KERNEL::Exception);
+    bool existsLoc(const std::string& locName) const throw(INTERP_KERNEL::Exception);
     std::string createNewNameOfPfl() const throw(INTERP_KERNEL::Exception);
     std::string createNewNameOfLoc() const throw(INTERP_KERNEL::Exception);
     std::vector< std::vector<int> > whichAreEqualProfiles() const throw(INTERP_KERNEL::Exception);
@@ -1110,13 +1121,13 @@ namespace ParaMEDMEM
     virtual std::vector<std::string> getLocsReallyUsedMulti() const throw(INTERP_KERNEL::Exception);
     void killProfileIds(const std::vector<int>& pflIds) throw(INTERP_KERNEL::Exception);
     void killLocalizationIds(const std::vector<int>& locIds) throw(INTERP_KERNEL::Exception);
-    void changePflName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
-    void changeLocName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
+    void changePflName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
+    void changeLocName(const std::string& oldName, const std::string& newName) throw(INTERP_KERNEL::Exception);
     int getNbOfGaussPtPerCell(int locId) const throw(INTERP_KERNEL::Exception);
-    int getLocalizationId(const char *loc) const throw(INTERP_KERNEL::Exception);
+    int getLocalizationId(const std::string& loc) const throw(INTERP_KERNEL::Exception);
   %extend
      {
-       PyObject *getProfile(const char *pflName) const throw(INTERP_KERNEL::Exception)
+       PyObject *getProfile(const std::string& pflName) const throw(INTERP_KERNEL::Exception)
        {
          const DataArrayInt *ret=self->getProfile(pflName);
          if(ret)
@@ -1140,7 +1151,7 @@ namespace ParaMEDMEM
          return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
        }
        
-       PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
+       PyObject *getLocalization(const std::string& locName) const throw(INTERP_KERNEL::Exception)
        {
          const MEDFileFieldLoc *loc=&self->getLocalization(locName);
          if(loc)
@@ -1208,10 +1219,10 @@ namespace ParaMEDMEM
   class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
   {
   public:
-    static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     void loadArrays() throw(INTERP_KERNEL::Exception);
     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
     void unloadArrays() throw(INTERP_KERNEL::Exception);
@@ -1219,9 +1230,9 @@ namespace ParaMEDMEM
     int getIteration() const throw(INTERP_KERNEL::Exception);
     int getOrder() const throw(INTERP_KERNEL::Exception);
     std::string getName() throw(INTERP_KERNEL::Exception);
-    void setName(const char *name) throw(INTERP_KERNEL::Exception);
+    void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
     std::string getMeshName() throw(INTERP_KERNEL::Exception);
-    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
+    void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
     int getMeshIteration() const throw(INTERP_KERNEL::Exception);
     int getMeshOrder() const throw(INTERP_KERNEL::Exception);
     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
@@ -1232,7 +1243,7 @@ namespace ParaMEDMEM
     virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
     MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
-    void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
+    void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception);
     %extend
     {
       PyObject *getTime() throw(INTERP_KERNEL::Exception)
@@ -1255,12 +1266,12 @@ namespace ParaMEDMEM
         return elt;
       }
 
-      void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+      void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
       {
         self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
       }
       
-      void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+      void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
       {
         self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
       }
@@ -1280,7 +1291,7 @@ namespace ParaMEDMEM
         return ret2;
       }
 
-      PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      PyObject *getNonEmptyLevels(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
       {
         std::vector<int> ret1;
         int ret0=self->getNonEmptyLevels(mname,ret1);
@@ -1290,7 +1301,7 @@ namespace ParaMEDMEM
         return elt;
       }
 
-      PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      PyObject *getFieldSplitedByType(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
       {
         std::vector<INTERP_KERNEL::NormalizedCellType> types;
         std::vector< std::vector<TypeOfField> > typesF;
@@ -1350,34 +1361,34 @@ namespace ParaMEDMEM
   class MEDFileField1TS : public MEDFileAnyTypeField1TS
   {
   public:
-    static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
     static MEDFileField1TS *New();
     ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     //
     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
     void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
-    void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
-    void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
+    void setProfileNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
+    void setLocNameOnLeaf(const std::string& mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const std::string& newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
     %extend
        {
-         MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+         MEDFileField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileField1TS::New(fileName,loadAll);
          }
          
-         MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+         MEDFileField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileField1TS::New(fileName,fieldName,loadAll);
          }
 
-         MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+         MEDFileField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
          }
@@ -1410,7 +1421,7 @@ namespace ParaMEDMEM
            return ret;
          }
 
-         PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+         PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
          {
            std::vector<INTERP_KERNEL::NormalizedCellType> types;
            std::vector< std::vector<TypeOfField> > typesF;
@@ -1485,9 +1496,9 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileIntField1TS *New();
-    static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
     ParaMEDMEM::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
     //
     void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
@@ -1499,17 +1510,17 @@ namespace ParaMEDMEM
         return MEDFileIntField1TS::New();
       }
 
-      MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      MEDFileIntField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
       {
         return MEDFileIntField1TS::New(fileName,loadAll);
       }
 
-      MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
       {
         return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
       }
 
-      MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      MEDFileIntField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
       {
         return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
       }
@@ -1559,7 +1570,7 @@ namespace ParaMEDMEM
         return ret;
       }
       
-      PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      PyObject *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
       {
         DataArrayInt *ret1=0;
         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
@@ -1611,23 +1622,23 @@ namespace ParaMEDMEM
   class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
   {
   public:
-    static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileAnyTypeFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
     MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
     virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
     std::string getName() const throw(INTERP_KERNEL::Exception);
-    void setName(const char *name) throw(INTERP_KERNEL::Exception);
+    void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
     std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
-    void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
+    void setDtUnit(const std::string& dtUnit) throw(INTERP_KERNEL::Exception);
     std::string getMeshName() const throw(INTERP_KERNEL::Exception);
-    void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
+    void setMeshName(const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
     const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
     int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
     int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
     void eraseEmptyTS() 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);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     void loadArrays() throw(INTERP_KERNEL::Exception);
     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
     void unloadArrays() throw(INTERP_KERNEL::Exception);
@@ -1725,7 +1736,7 @@ namespace ParaMEDMEM
         return ret2;
       }
       
-      PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      PyObject *getNonEmptyLevels(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
       {
         std::vector<int> ret1;
         int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
@@ -1735,7 +1746,7 @@ namespace ParaMEDMEM
         return elt;
       }
       
-      PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+      PyObject *getFieldSplitedByType(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
       {
         std::vector<INTERP_KERNEL::NormalizedCellType> types;
         std::vector< std::vector<TypeOfField> > typesF;
@@ -1970,14 +1981,14 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
-    static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
     //
     MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+    MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
     //
     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
     void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
@@ -1989,12 +2000,12 @@ namespace ParaMEDMEM
            return MEDFileFieldMultiTS::New();
          }
 
-         MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+         MEDFileFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileFieldMultiTS::New(fileName,loadAll);
          }
 
-         MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+         MEDFileFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
          }
@@ -2014,7 +2025,7 @@ namespace ParaMEDMEM
            return ret;
          }
 
-         PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+         PyObject *getFieldSplitedByType2(int iteration, int order, const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
          {
            std::vector<INTERP_KERNEL::NormalizedCellType> types;
            std::vector< std::vector<TypeOfField> > typesF;
@@ -2107,8 +2118,8 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileIntFieldMultiTS *New();
-    static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
-    static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileIntFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
     //
     void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
     void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
@@ -2120,12 +2131,12 @@ namespace ParaMEDMEM
         return MEDFileIntFieldMultiTS::New();
       }
       
-      MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      MEDFileIntFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
       {
         return MEDFileIntFieldMultiTS::New(fileName,loadAll);
       }
       
-      MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+      MEDFileIntFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
       {
         return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
       }
@@ -2175,7 +2186,7 @@ namespace ParaMEDMEM
         return ret;
       }
       
-      PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+      PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
       {
         DataArrayInt *ret1=0;
         MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
@@ -2209,13 +2220,13 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
-    static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+    static MEDFileFields *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
     MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
     MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
     void loadArrays() throw(INTERP_KERNEL::Exception);
     void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
     void unloadArrays() throw(INTERP_KERNEL::Exception);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     int getNumberOfFields() const;
     std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
@@ -2223,10 +2234,10 @@ namespace ParaMEDMEM
     void resize(int newSize) throw(INTERP_KERNEL::Exception);
     void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
     void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
-    int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+    int getPosFromFieldName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
     MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
-    MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
-    MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
+    MEDFileAnyTypeFieldMultiTS *getFieldWithName(const std::string& fieldName) const throw(INTERP_KERNEL::Exception);
+    MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const std::string& meshName) const throw(INTERP_KERNEL::Exception);
     void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
     %extend
        {
@@ -2235,7 +2246,7 @@ namespace ParaMEDMEM
            return MEDFileFields::New();
          }
 
-         MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+         MEDFileFields(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileFields::New(fileName,loadAll);
          }
@@ -2409,9 +2420,9 @@ namespace ParaMEDMEM
   class MEDFileParameterTinyInfo : public MEDFileWritable
   {
   public:
-    void setDescription(const char *name);
+    void setDescription(const std::string& name);
     std::string getDescription() const;
-    void setTimeUnit(const char *unit);
+    void setTimeUnit(const std::string& unit);
     std::string getTimeUnit() const;
   };
 
@@ -2419,14 +2430,14 @@ namespace ParaMEDMEM
   {
   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);
+    static MEDFileParameterDouble1TS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
     virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
     virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
-    void setName(const char *name) throw(INTERP_KERNEL::Exception);
+    void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
     std::string getName() const throw(INTERP_KERNEL::Exception);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     %extend
     {
       MEDFileParameterDouble1TS()
@@ -2434,17 +2445,17 @@ namespace ParaMEDMEM
         return MEDFileParameterDouble1TS::New();
       }
       
-      MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+      MEDFileParameterDouble1TS(const std::string& fileName) throw(INTERP_KERNEL::Exception)
       {
         return MEDFileParameterDouble1TS::New(fileName);
       }
 
-      MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+      MEDFileParameterDouble1TS(const std::string& fileName, const std::string& 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)
+      MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
       {
         return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
       }
@@ -2472,12 +2483,12 @@ namespace ParaMEDMEM
   {
   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);
+    static MEDFileParameterMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
     std::string getName() const;
-    void setName(const char *name);
+    void setName(const std::string& name);
     MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
     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);
@@ -2490,12 +2501,12 @@ namespace ParaMEDMEM
         return MEDFileParameterMultiTS::New();
       }
       
-      MEDFileParameterMultiTS(const char *fileName)
+      MEDFileParameterMultiTS(const std::string& fileName)
       {
         return MEDFileParameterMultiTS::New(fileName);
       }
 
-      MEDFileParameterMultiTS(const char *fileName, const char *paramName)
+      MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
       {
         return MEDFileParameterMultiTS::New(fileName,paramName);
       }
@@ -2665,16 +2676,16 @@ namespace ParaMEDMEM
   {
   public:
     static MEDFileParameters *New();
-    static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileParameters *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
     MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
     std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
     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 getPosFromParamName(const std::string& paramName) const throw(INTERP_KERNEL::Exception);
     int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
     %extend
     {
@@ -2683,7 +2694,7 @@ namespace ParaMEDMEM
         return MEDFileParameters::New();
       }
       
-      MEDFileParameters(const char *fileName)
+      MEDFileParameters(const std::string& fileName)
       {
         return MEDFileParameters::New(fileName);
       }
@@ -2726,7 +2737,7 @@ namespace ParaMEDMEM
         return ret;
       }
 
-      MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
+      MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const throw(INTERP_KERNEL::Exception)
       {
         MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
         if(ret)
@@ -2751,7 +2762,7 @@ namespace ParaMEDMEM
   class MEDFileData : public RefCountObject, public MEDFileWritable
   {
   public:
-    static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static MEDFileData *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
     static MEDFileData *New();
     MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
     void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
@@ -2761,13 +2772,13 @@ namespace ParaMEDMEM
     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 changeMeshName(const std::string& oldMeshName, const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
     bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
     //
-    void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
     %extend
        {
-         MEDFileData(const char *fileName) throw(INTERP_KERNEL::Exception)
+         MEDFileData(const std::string& fileName) throw(INTERP_KERNEL::Exception)
          {
            return MEDFileData::New(fileName);
          }
@@ -2817,11 +2828,11 @@ namespace ParaMEDMEM
   class SauvReader : public RefCountObject
   {
   public:
-    static SauvReader* New(const char *fileName) throw(INTERP_KERNEL::Exception);
+    static SauvReader* New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
     MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
     %extend
     {
-      SauvReader(const char *fileName) throw(INTERP_KERNEL::Exception)
+      SauvReader(const std::string& fileName) throw(INTERP_KERNEL::Exception)
       {
         return SauvReader::New(fileName);
       }
@@ -2833,7 +2844,7 @@ namespace ParaMEDMEM
   public:
     static SauvWriter * New();
     void setMEDFileDS(const MEDFileData* medData, unsigned meshIndex = 0) throw(INTERP_KERNEL::Exception);
-    void write(const char* fileName) throw(INTERP_KERNEL::Exception);
+    void write(const std::string& fileName) throw(INTERP_KERNEL::Exception);
     void setCpyGrpIfOnASingleFamilyStatus(bool status) throw(INTERP_KERNEL::Exception);
     bool getCpyGrpIfOnASingleFamilyStatus() const throw(INTERP_KERNEL::Exception);
     %extend
@@ -2924,6 +2935,16 @@ namespace ParaMEDMEM
         PyTuple_SetItem(ret,1,ret1Py);
         return ret;
       }
+
+      PyObject *getGeoTypes() const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypes());
+        std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
+        PyObject *res(PyList_New(result.size()));
+        for(int i=0;iL!=result.end(); i++, iL++)
+          PyList_SetItem(res,i,PyInt_FromLong(*iL));
+        return res;
+      }
     }
   };
 
@@ -2968,11 +2989,17 @@ namespace ParaMEDMEM
     {
       PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
       {
-        std::vector< DataArrayDouble * > objs(self->buildVTUArrays());
+       bool isInternal;
+        std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
         std::size_t sz(objs.size());
-        PyObject *ret=PyList_New(sz);
+       PyObject *ret(PyTuple_New(2));
+        PyObject *ret0=PyList_New(sz);
         for(std::size_t i=0;i<sz;i++)
-          PyList_SetItem(ret,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+          PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+       PyTuple_SetItem(ret,0,ret0);
+       PyObject *ret1Py(isInternal?Py_True:Py_False);
+       Py_XINCREF(ret1Py);
+       PyTuple_SetItem(ret,1,ret1Py);
         return ret;
       }
     }
@@ -2989,14 +3016,18 @@ namespace ParaMEDMEM
       {
         DataArrayDouble *ret0(0);
         std::vector<int> ret1;
-        self->buildVTUArrays(ret0,ret1);
+       bool ret2;
+        self->buildVTUArrays(ret0,ret1,ret2);
         std::size_t sz(ret1.size());
-        PyObject *ret=PyTuple_New(2);
+        PyObject *ret=PyTuple_New(3);
         PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
         PyObject *ret1Py=PyList_New(sz);
         for(std::size_t i=0;i<sz;i++)
           PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
         PyTuple_SetItem(ret,1,ret1Py);
+       PyObject *ret2Py(ret2?Py_True:Py_False);
+       Py_XINCREF(ret2Py);
+       PyTuple_SetItem(ret,2,ret2Py);
         return ret;
       }
     }
@@ -3008,7 +3039,21 @@ namespace ParaMEDMEM
     static MEDFileFastCellSupportComparator *New(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref) throw(INTERP_KERNEL::Exception);
     MEDMeshMultiLev *buildFromScratchDataSetSupport(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
     bool isDataSetSupportEqualToThePreviousOne(int timeStepId, const MEDFileFieldGlobsReal *globs) const throw(INTERP_KERNEL::Exception);
+    int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
   protected:
     ~MEDFileFastCellSupportComparator();
+  public:
+    %extend
+    {
+      PyObject *getGeoTypesAt(int timeStepId, const MEDFileMesh *m) const throw(INTERP_KERNEL::Exception)
+      {
+        std::vector< INTERP_KERNEL::NormalizedCellType > result(self->getGeoTypesAt(timeStepId,m));
+        std::vector< INTERP_KERNEL::NormalizedCellType >::const_iterator iL(result.begin());
+        PyObject *res(PyList_New(result.size()));
+        for(int i=0;iL!=result.end(); i++, iL++)
+          PyList_SetItem(res,i,PyInt_FromLong(*iL));
+        return res;
+      }
+    }
   };
 }
index 441ee661045fe59bf058109d26c6d446bde0fdb0..66239aea59416c5411af86c19a9a8d71d957e374 100644 (file)
@@ -691,7 +691,7 @@ class MEDLoaderTest(unittest.TestCase):
         d.alloc(1,1)
         d.iota(1.)
         # seting a long name
-       d.setInfoOnComponent(0,"CONCENTRATION of I129")
+        d.setInfoOnComponent(0,"CONCENTRATION of I129")
         f.setArray(d)
         f.setName("field")
         #
@@ -710,6 +710,45 @@ class MEDLoaderTest(unittest.TestCase):
         MEDLoader.MEDLoader.WriteField(fname,f,True)
         pass
 
+    def testUsingAlreadyWrittenMesh2(self):
+        """ This test focuses on MEDLoader.WriteFieldUsingAlreadyWrittenMesh with mesh different from UMesh.
+        """
+        fname="Pyfile76.med"
+        mesh=MEDLoader.MEDCouplingCMesh("mesh")
+        arrX=MEDLoader.DataArrayDouble([0,1,2,3])
+        arrY=MEDLoader.DataArrayDouble([0,2,3,5,7])
+        arrZ=MEDLoader.DataArrayDouble([7])
+        mesh.setCoords(arrX,arrY,arrZ)
+        #
+        f1=MEDLoader.MEDCouplingFieldDouble(MEDLoader.ON_NODES) ; f1.setName("f1")
+        f1.setMesh(mesh)
+        arr=MEDLoader.DataArrayDouble(20) ; arr.iota()
+        f1.setArray(arr)
+        f1.checkCoherency()
+        #
+        f2=MEDLoader.MEDCouplingFieldDouble(MEDLoader.ON_NODES) ; f2.setName("f2")
+        f2.setMesh(mesh)
+        arr=MEDLoader.DataArrayDouble(20) ; arr.iota() ; arr*=3
+        f2.setArray(arr)
+        f2.checkCoherency()
+        #
+        f11=f1.deepCpy() ; (f11.getArray())[:]*=4 ; f11.setTime(1.1,5,6)
+        #
+        MEDLoader.MEDLoader.WriteMesh(fname,f1.getMesh(),True)
+        MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f1)
+        MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f2)
+        MEDLoader.MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fname,f11)
+        ##
+        f1r=MEDLoader.MEDLoader.ReadFieldNode(fname,"mesh",0,"f1",-1,-1);
+        self.assertTrue(f1.isEqual(f1r,1e-12,1e-12))
+        self.assertTrue(f1r.getArray().isEqual(MEDLoader.DataArrayDouble([0.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.,11.,12.,13.,14.,15.,16.,17.,18.,19.]),1e-12))
+        f2r=MEDLoader.MEDLoader.ReadFieldNode(fname,"mesh",0,"f2",-1,-1);
+        self.assertTrue(f2.isEqual(f2r,1e-12,1e-12))
+        self.assertTrue(f2r.getArray().isEqual(MEDLoader.DataArrayDouble([0.,3.,6.,9.,12.,15.,18.,21.,24.,27.,30.,33.,36.,39.,42.,45.,48.,51.,54.,57.]),1e-12))
+        f3r=MEDLoader.MEDLoader.ReadFieldNode(fname,"mesh",0,"f1",5,6);
+        self.assertTrue(f11.isEqual(f3r,1e-12,1e-12))
+        self.assertTrue(f3r.getArray().isEqual(MEDLoader.DataArrayDouble([0.,4.,8.,12.,16.,20.,24.,28.,32.,36.,40.,44.,48.,52.,56.,60.,64.,68.,72.,76.]),1e-12))
+        pass
     pass
 
 unittest.main()
index 2d49e5ed318d51fe2d1586f845e8a795ac1d8715..76318a2c6e80492601e1e4a0510ee877e2745da8 100644 (file)
@@ -347,6 +347,7 @@ class MEDLoaderTest(unittest.TestCase):
         self.assertTrue(m.getUnivNameWrStatus())
         m.write(outFileName,2);
         mm=MEDFileMesh.New(outFileName)
+        self.assertEqual([NORM_HEXA8],mm.getGeoTypesAtLevel(0))
         self.assertTrue(isinstance(mm,MEDFileCMesh))
         self.assertTrue(isinstance(mm.getUnivName(),str))
         self.assertTrue(len(mm.getUnivName())!=0)
@@ -3421,6 +3422,167 @@ class MEDLoaderTest(unittest.TestCase):
         self.assertTrue(f_read.isEqual(f,1e-12,1e-12))
         pass
 
+    def testLoadIfNecessaryOnFromScratchFields0(self):
+        """
+        This test checks that a call to loadArraysIfNecessary works (does nothing) on field data structure whatever its level 1TS, MTS, Fields.
+        """
+        fname="Pyfile77.med"
+        coords=DataArrayDouble([(0,0,0),(2,1,0),(1,0,0),(1,1,0),(2,0,0),(0,1,0)])
+        m=MEDCouplingUMesh("mesh",2) ; m.setCoords(coords)
+        m.allocateCells()
+        m.insertNextCell(NORM_QUAD4,[0,5,3,2])
+        m.insertNextCell(NORM_QUAD4,[4,2,3,1])
+        m.finishInsertingCells()
+        #
+        mm=MEDFileUMesh() ; mm.setMeshAtLevel(0,m)
+        ms=MEDFileMeshes() ; ms.pushMesh(mm)
+        fs=MEDFileFields()
+        arrs=4*[None]
+        #
+        ff0=MEDFileFieldMultiTS() ; fs.pushField(ff0)
+        f0=MEDCouplingFieldDouble(ON_GAUSS_NE) ; f0.setMesh(m) ; f0.setTimeUnit("ms")
+        f0.setTime(1.1,1,1)
+        f0.setName("myELNOField")
+        arrs[0]=DataArrayDouble([7,5,3,1,5,3,1,7]) ; arrs[0].setInfoOnComponent(0,"Comp0")
+        f0.setArray(arrs[0])
+        ff0.appendFieldNoProfileSBT(f0)
+        #
+        f0.setTime(2.2,2,1)
+        arrs[1]=DataArrayDouble([1,7,5,3,7,5,3,1]) ; arrs[1].setInfoOnComponent(0,"Comp0")
+        f0.setArray(arrs[1])
+        ff0.appendFieldNoProfileSBT(f0)
+        #
+        f0.setTime(3.3,3,1)
+        arrs[2]=DataArrayDouble([3,1,7,5,1,7,5,3]) ; arrs[2].setInfoOnComponent(0,"Comp0")
+        f0.setArray(arrs[2])
+        ff0.appendFieldNoProfileSBT(f0)
+        #
+        f0.setTime(4.4,4,1)
+        arrs[3]=DataArrayDouble([5,3,1,7,3,1,7,5]) ; arrs[3].setInfoOnComponent(0,"Comp0")
+        f0.setArray(arrs[3])
+        ff0.appendFieldNoProfileSBT(f0)
+        #
+        for i,arr in enumerate(arrs):
+            self.assertTrue(fs[0][i].getUndergroundDataArray().isEqual(arr,1e-12))
+            fs[0][i].loadArraysIfNecessary()
+            self.assertTrue(fs[0][i].getUndergroundDataArray().isEqual(arr,1e-12))
+            pass
+        fs.loadArraysIfNecessary()
+        for i,arr in enumerate(arrs):
+            self.assertTrue(fs[0][i].getUndergroundDataArray().isEqual(arr,1e-12))
+            pass
+        fs[0].loadArraysIfNecessary()
+        for i,arr in enumerate(arrs):
+            self.assertTrue(fs[0][i].getUndergroundDataArray().isEqual(arr,1e-12))
+            pass
+        pass
+    
+    def testField1TSSetFieldNoProfileSBTPerGeoTypes(self):
+        """ This test is very important, because the same mechanism is used by the MEDReader to generate a field on all the mesh without any processing and memory.
+        """
+        fname="Pyfile78.med"
+        coords=DataArrayDouble([-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. ],9,3)
+        targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4];
+        m0=MEDCouplingUMesh("mesh",3) ; m0.setCoords(coords)
+        m0.allocateCells()
+        for elt in [[0,1,2,3],[1,2,3,4],[2,3,4,5],[3,4,5,6],[4,5,6,7],[5,6,7,8]]:#6
+            m0.insertNextCell(NORM_TETRA4,elt)
+            pass
+        for elt in [[0,1,2,3,4],[1,2,3,4,5],[2,3,4,5,6],[3,4,5,6,7],[4,5,6,7,8]]:#5
+            m0.insertNextCell(NORM_PYRA5,elt)
+            pass
+        for elt in [[0,1,2,3,4,5],[1,2,3,4,5,6],[2,3,4,5,6,7],[3,4,5,6,7,8]]:#4
+            m0.insertNextCell(NORM_PENTA6,elt)
+            pass
+        m0.checkCoherency2()
+        m1=MEDCouplingUMesh(); m1.setName("mesh")
+        m1.setMeshDimension(2);
+        m1.allocateCells(5);
+        m1.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
+        m1.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
+        m1.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
+        m1.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
+        m1.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
+        m1.setCoords(coords);
+        m3=MEDCouplingUMesh("mesh",0) ; m3.setCoords(coords)
+        m3.allocateCells()
+        m3.insertNextCell(NORM_POINT1,[2])
+        m3.insertNextCell(NORM_POINT1,[3])
+        m3.insertNextCell(NORM_POINT1,[4])
+        m3.insertNextCell(NORM_POINT1,[5])
+        #
+        mm=MEDFileUMesh()
+        mm.setMeshAtLevel(0,m0)
+        mm.setMeshAtLevel(-1,m1)
+        mm.setMeshAtLevel(-3,m3)
+        mm.write(fname,2)
+        #### The file is written only with one mesh and no fields. Let's put a field on it geo types per geo types.
+        mm=MEDFileMesh.New(fname)
+        fs=MEDFileFields()
+        fmts=MEDFileFieldMultiTS()
+        f1ts=MEDFileField1TS()
+        for lev in mm.getNonEmptyLevels():
+            for gt in mm.getGeoTypesAtLevel(lev):
+                p0=mm.getDirectUndergroundSingleGeoTypeMesh(gt)
+                f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(p0)
+                arr=DataArrayDouble(f.getNumberOfTuplesExpected()) ; arr.iota()
+                f.setArray(arr) ; f.setName("f0")
+                f1ts.setFieldNoProfileSBT(f)
+                pass
+            pass
+        self.assertEqual(mm.getNonEmptyLevels(),(0,-1,-3))
+        for lev in [0,-1,-3]:
+            mm.getDirectUndergroundSingleGeoTypeMeshes(lev) # please let this line, it is for the test to emulate that
+            pass
+        fmts.pushBackTimeStep(f1ts)
+        fs.pushField(fmts)
+        fs.write(fname,0)
+        del fs,fmts,f1ts
+        #### The file contains now one mesh and one cell field with all cells wathever their level ang type fetched.
+        fs=MEDFileFields(fname)
+        self.assertEqual(len(fs),1)
+        self.assertEqual(len(fs[0]),1)
+        f1ts=fs[0][0]
+        self.assertEqual(f1ts.getFieldSplitedByType(),[(0,[(0,(0,4),'','')]),(3,[(0,(4,6),'','')]),(4,[(0,(6,9),'','')]),(14,[(0,(9,15),'','')]),(15,[(0,(15,20),'','')]),(16,[(0,(20,24),'','')])])
+        self.assertTrue(f1ts.getUndergroundDataArray().isEqual(DataArrayDouble([0,1,2,3,0,1,0,1,2,0,1,2,3,4,5,0,1,2,3,4,0,1,2,3]),1e-12))
+        pass
+
+    def testMEDFileUMeshSetName(self):
+        """ This test is a small but important one for MEDReader in sauv mode. When .sauv file is loaded the convertion is performed in memory and a preparation is done then.
+        This preparation makes access to internal MEDCouplingMesh pointers whose name must be updated.
+        """
+        fname="Pyfile79.med"
+        targetConn=[0,3,4,1, 1,4,2, 4,5,2, 6,7,4,3, 7,8,5,4];
+        mm=MEDFileUMesh()
+        m0=MEDCouplingUMesh() ; m0.setMeshDimension(2) # important no name here.
+        coords=DataArrayDouble([-0.3,-0.3,0., 0.2,-0.3,0., 0.7,-0.3,0., -0.3,0.2,0., 0.2,0.2,0., 0.7,0.2,0., -0.3,0.7,0., 0.2,0.7,0., 0.7,0.7,0. ],9,3)
+        m0.allocateCells(5);
+        m0.insertNextCell(NORM_TRI3,3,targetConn[4:7]);
+        m0.insertNextCell(NORM_TRI3,3,targetConn[7:10]);
+        m0.insertNextCell(NORM_QUAD4,4,targetConn[0:4]);
+        m0.insertNextCell(NORM_QUAD4,4,targetConn[10:14]);
+        m0.insertNextCell(NORM_QUAD4,4,targetConn[14:18]);
+        m0.setCoords(coords);
+        mm.setMeshAtLevel(0,m0)
+        m2=MEDCouplingUMesh() ; m2.setMeshDimension(0) ; m2.setCoords(coords) # important no name here.
+        m2.allocateCells()
+        m2.insertNextCell(NORM_POINT1,[2])
+        m2.insertNextCell(NORM_POINT1,[3])
+        m2.insertNextCell(NORM_POINT1,[4])
+        m2.insertNextCell(NORM_POINT1,[5])
+        mm.setMeshAtLevel(-2,m2)
+        self.assertEqual(mm.getName(),"")
+        self.assertEqual(mm.getMeshAtLevel(0).getName(),"")
+        mm.forceComputationOfParts()
+        self.assertEqual(mm.getDirectUndergroundSingleGeoTypeMesh(NORM_TRI3).getName(),"")
+        mm.setName("abc")
+        self.assertEqual(mm.getName(),"abc")
+        self.assertEqual(mm.getDirectUndergroundSingleGeoTypeMesh(NORM_TRI3).getName(),"abc")
+        self.assertEqual(mm.getDirectUndergroundSingleGeoTypeMesh(NORM_QUAD4).getName(),"abc")
+        self.assertEqual(mm.getDirectUndergroundSingleGeoTypeMesh(NORM_POINT1).getName(),"abc")
+        self.assertEqual(mm.getMeshAtLevel(0).getName(),"abc")
+        pass
+
     pass
 
 unittest.main()
index f713058825b6a7d11ca3d3aa06da4ffc194580a0..164269087805c54946bec3e3dd41153c8807385b 100644 (file)
@@ -583,9 +583,9 @@ class MEDLoaderTest4(unittest.TestCase):
         ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
         self.assertTrue(not ncc)
         self.assertTrue(a0.isEqual(a0Exp.changeNbOfComponents(3,0.),1e-12))
-        self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,5,9,9,9,9,9])))
-        self.assertTrue(a2.isEqual(DataArrayInt([0,4,8,12,16,21,26,31,36])))
-        self.assertTrue(a3.isEqual(DataArrayInt([3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31])))
+        self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,5,9,9,9,9,9,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,4,8,12,16,21,26,31,36,41,44,47,50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,98,101,104,107,110,113,116,119,122,125,128,131,134])))
+        self.assertTrue(a3.isEqual(DataArrayInt([3,0,1,2,3,3,4,5,3,6,7,8,3,9,10,11,4,12,13,14,15,4,16,17,18,19,4,20,21,22,23,4,24,25,26,27,4,28,29,30,31,2,0,1,2,1,2,2,2,0,2,3,4,2,4,5,2,5,3,2,6,7,2,7,8,2,8,6,2,9,10,2,10,11,2,11,9,2,12,13,2,13,14,2,14,15,2,15,12,2,16,17,2,17,18,2,18,19,2,19,16,2,20,21,2,21,22,2,22,23,2,23,20,2,24,25,2,25,26,2,26,27,2,27,24,2,28,29,2,29,30,2,30,31,2,31,28])))
         self.assertTrue(a4 is None)
         self.assertTrue(a5 is None)
         for i in xrange(2):
@@ -1086,7 +1086,8 @@ class MEDLoaderTest4(unittest.TestCase):
         fcscp=allFMTSLeavesPerCommonSupport[0][1]
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
-        a,b=mml2.buildVTUArrays()
+        (a,b),c=mml2.buildVTUArrays()
+        self.assertTrue(c)# c is True here because the returned array is directly those coming from internal structure
         self.assertTrue(a.isEqual(coordsX,1e-12))
         self.assertTrue(b.isEqual(coordsY,1e-12))
         self.assertTrue(isinstance(mml2,MEDCMeshMultiLev))
@@ -1126,7 +1127,8 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDCMeshMultiLev)) # here the 2nd support is a part of CMesh that is also a CMesh -> CMesh not a UMesh
-        a,b=mml2.buildVTUArrays()
+        (a,b),c=mml2.buildVTUArrays()
+        self.assertTrue(not c)# c is False because this a sub support specialy built for buildVTUArrays
         self.assertTrue(a.isEqual(coordsX[[2,3,4]],1e-12))
         self.assertTrue(b.isEqual(coordsY,1e-12))
         a6,a7=mml2.retrieveFamilyIdsOnCells()
@@ -1289,7 +1291,8 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDCurveLinearMeshMultiLev))
-        a,b=mml2.buildVTUArrays()
+        a,b,c=mml2.buildVTUArrays()
+        self.assertTrue(c)#True here because a is directly coming from internal data without copy
         self.assertTrue(a.isEqual(a0Exp,1e-12))
         self.assertEqual(b,[5,3])
         a6,a7=mml2.retrieveFamilyIdsOnCells()
@@ -1325,7 +1328,8 @@ class MEDLoaderTest4(unittest.TestCase):
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDCurveLinearMeshMultiLev)) # here the 2nd support is a part of CMesh that is also a CMesh -> CMesh not a UMesh
-        a,b=mml2.buildVTUArrays()
+        a,b,c=mml2.buildVTUArrays()
+        self.assertTrue(not c)#False here because a is the result of a computation not the internal strucutre
         self.assertTrue(a.isEqual(a0Exp[pfl2],1e-12))
         self.assertEqual(b,[3,3])
         a6,a7=mml2.retrieveFamilyIdsOnCells()
@@ -1431,8 +1435,8 @@ class MEDLoaderTest4(unittest.TestCase):
             fNode.setName(fieldName2) ; fNode.setMesh(m)
             fNode.setGaussLocalizationOnCells([0,1,2,3],[0.,0.,1.,0.,0.,1.],[0.5,0.5,0.7,0.7],[0.8,0.2])
             fNode.setGaussLocalizationOnCells([4,5],[0.,0.,1.,0.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3],[0.8,0.05,0.1,0.04,0.01])
-            fNode.setGaussLocalizationOnCells([6,7,8],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
-            fNode.setGaussLocalizationOnCells([9,10],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
+            fNode.setGaussLocalizationOnCells([6,7,8],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
+            fNode.setGaussLocalizationOnCells([9,10],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
             arr=DataArrayDouble(2*(4*2+2*5+3*4+2*7)) ; arr.iota(300+1000*i) ; arr.rearrange(2)
             fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkCoherency()
             f.setFieldNoProfileSBT(fNode)
@@ -1574,8 +1578,8 @@ class MEDLoaderTest4(unittest.TestCase):
             fNode.setName(fieldName2) ; fNode.setMesh(m[pfl1])
             fNode.setGaussLocalizationOnCells([0],[0.,0.,1.,0.,0.,1.],[0.5,0.5,0.7,0.7],[0.8,0.2])
             fNode.setGaussLocalizationOnCells([1],[0.,0.,1.,0.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3],[0.8,0.05,0.1,0.04,0.01])
-            fNode.setGaussLocalizationOnCells([2,3],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
-            fNode.setGaussLocalizationOnCells([4],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
+            fNode.setGaussLocalizationOnCells([2,3],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
+            fNode.setGaussLocalizationOnCells([4],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
             arr=DataArrayDouble(2*(2*1+5*1+4*2+7*1)) ; arr.iota(300+1000*i) ; arr.rearrange(2)
             fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_2 [m]","Com2_2 [s^2]"]) ; fNode.checkCoherency()
             f.setFieldProfile(fNode,mm,0,pfl1)
@@ -1808,10 +1812,10 @@ class MEDLoaderTest4(unittest.TestCase):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
-            fNode.setGaussLocalizationOnCells([0,2,3,4,7,15],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7],[0.8,0.2])
-            fNode.setGaussLocalizationOnCells([1,5,8,9],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3],[0.8,0.05,0.1,0.04,0.01])
-            fNode.setGaussLocalizationOnCells([6,10,13],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
-            fNode.setGaussLocalizationOnCells([11,12,14],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
+            fNode.setGaussLocalizationOnCells([0,2,3,4,7,15],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7],[0.8,0.2])
+            fNode.setGaussLocalizationOnCells([1,5,8,9],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3],[0.8,0.05,0.1,0.04,0.01])
+            fNode.setGaussLocalizationOnCells([6,10,13],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
+            fNode.setGaussLocalizationOnCells([11,12,14],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
             arr=DataArrayDouble(2*(2*6+5*4+4*3+7*3)) ; arr.iota(0+1000*i) ; arr.rearrange(2)
             fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency()
             f.setFieldNoProfileSBT(fNode)
@@ -1890,10 +1894,10 @@ class MEDLoaderTest4(unittest.TestCase):
             f=MEDFileField1TS()
             fNode=MEDCouplingFieldDouble(ON_GAUSS_PT) ; fNode.setTime(float(i),i,0)
             fNode.setName(fieldName0) ; fNode.setMesh(m)
-            fNode.setGaussLocalizationOnCells([0,2,3,4,7,15],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7],[0.8,0.2])
-            fNode.setGaussLocalizationOnCells([1,5,8,9],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3],[0.8,0.05,0.1,0.04,0.01])
-            fNode.setGaussLocalizationOnCells([6,10,13],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
-            fNode.setGaussLocalizationOnCells([11,12,14],[0.,0.,1.,0.,1.,1.,0.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
+            fNode.setGaussLocalizationOnCells([0,2,3,4,7,15],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7],[0.8,0.2])
+            fNode.setGaussLocalizationOnCells([1,5,8,9],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3],[0.8,0.05,0.1,0.04,0.01])
+            fNode.setGaussLocalizationOnCells([6,10,13],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2],[0.8,0.05,0.1,0.04])
+            fNode.setGaussLocalizationOnCells([11,12,14],[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[0.5,0.5,0.7,0.7,0.1,0.1,0.2,0.2,0.3,0.3,0.4,0.4,0.8,0.8],[0.8,0.05,0.1,0.01,0.02,0.005,0.005])
             arr=DataArrayDouble(2*(2*6+5*4+4*3+7*3)) ; arr.iota(0+1000*i) ; arr.rearrange(2)
             fNode.setArray(arr) ; arr.setInfoOnComponents(["Comp1_0 [m]","Com2_0 [s^2]"]) ; fNode.checkCoherency()
             f.setFieldNoProfileSBT(fNode)
@@ -2724,6 +2728,7 @@ class MEDLoaderTest4(unittest.TestCase):
         mst=MEDFileMeshStruct.New(ms[0])
         #
         fcscp=allFMTSLeavesPerCommonSupport1[0][1]
+        self.assertEqual([NORM_QUAD4],fcscp.getGeoTypesAt(0,ms[0]))
         mml=fcscp.buildFromScratchDataSetSupport(0,fields)
         mml2=mml.prepare()
         self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
@@ -3167,6 +3172,957 @@ class MEDLoaderTest4(unittest.TestCase):
             self.assertTrue(v.isEqual(vExp,1e-12))
             pass
         pass
+
+    def test21(self):
+        """ Here the created MED file contains only a mesh. The aim here is to test capability of MEDReader to support no fields.
+        This test checks nothing but write a MED file to be used by MEDReader tests.
+        """
+        fname="ForMEDReader21.med"
+        mm=MEDFileUMesh()
+        #
+        m0=MEDCouplingCMesh("mesh") ; arr=DataArrayDouble(5) ; arr.iota() ; m0.setCoords(arr,arr) ; m0=m0.buildUnstructured()
+        mm.setMeshAtLevel(0,m0)
+        grp0=DataArrayInt([5,6,9,10]) ; grp0.setName("Inside2D")
+        grp1=DataArrayInt([0,1,2,3,4,7,8,11,12,13,14,15]) ; grp1.setName("Border2D")
+        grp2=DataArrayInt([2,3,6,7]) ; grp2.setName("LowerRight2D")
+        mm.setGroupsAtLevel(0,[grp0,grp1,grp2])
+        #
+        m1=MEDCouplingUMesh(m0.getName(),1) ; m1.setCoords(m0.getCoords()) ; m1.allocateCells()
+        for elt in [[0,1],[1,2],[2,3],[3,4],[4,9],[9,14],[14,19],[19,24],[24,23],[23,22],[22,21],[21,20],[20,15],[15,10],[10,5],[5,0],[2,7],[7,12],[12,17],[17,22],
+                    [10,11],[11,12],[12,13],[13,14]]:
+            m1.insertNextCell(NORM_SEG2,elt)
+            pass
+        mm.setMeshAtLevel(-1,m1)
+        grp4=DataArrayInt([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]) ; grp4.setName("Border1D")
+        grp5=DataArrayInt([16,17,18,19,20,21,22,23]) ; grp5.setName("Inside1D")
+        grp6=DataArrayInt([18,19,22,23]) ; grp6.setName("UpperRight1D")
+        mm.setGroupsAtLevel(-1,[grp4,grp5,grp6])
+        #
+        grp7=DataArrayInt([1,2,3,6,7,8,11,12,13,16,17,18,21,22,23]) ; grp7.setName("InsideYNode")
+        grp8=DataArrayInt([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]) ; grp8.setName("InsideXNode")
+        mm.setGroupsAtLevel(1,[grp7,grp8])
+        #
+        mm.write(fname,2)
+        pass
+
+    def test22(self):
+        """ Use case where a field on nodes (ANodeField) on a mesh defined both in meshdim 2 and meshdim 1.
+        The only possible geometrical support that suits the field is those with meshdim equal to 1 (-1 in relative).
+        """
+        fname="ForMEDReader22.med"
+        fieldName0="ANodeField"
+        mm=MEDFileUMesh()
+        coo=DataArrayDouble([(4.,3.),(7.,3.),(2.,5.),(6.,5.),(9.,5.),(4.,7.),(8.,7.),(3.,8.),(9.,8.)])
+        m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(coo) ; m0.allocateCells() ; m0.insertNextCell(NORM_TRI3,[2,3,0]) ; m0.insertNextCell(NORM_TRI3,[3,1,0]) ; m0.insertNextCell(NORM_TRI3,[3,4,1])
+        mm.setMeshAtLevel(0,m0)
+        m1=MEDCouplingUMesh("mesh",1) ; m1.setCoords(coo) ; m1.allocateCells() ; m1.insertNextCell(NORM_SEG2,[2,0]) ;  m1.insertNextCell(NORM_SEG2,[0,1]) ; m1.insertNextCell(NORM_SEG2,[1,4])
+        m1.insertNextCell(NORM_SEG2,[3,5]) ; m1.insertNextCell(NORM_SEG2,[5,7]) ; m1.insertNextCell(NORM_SEG2,[3,6]) ; m1.insertNextCell(NORM_SEG2,[6,8])
+        mm.setMeshAtLevel(-1,m1)
+        fs=MEDFileFields()
+        fmts0=MEDFileFieldMultiTS() ; fs.pushField(fmts0)
+        fmts0.setDtUnit("s")
+        #
+        t=(1.1,0,-2)
+        f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m1)
+        f0.setName(fieldName0) ; f0.setTime(*t)
+        da=DataArrayDouble(9) ; da.iota() ; da.setInfoOnComponents(["zeInfo"])
+        f0.setArray(da)
+        f0.checkCoherency()
+        f1ts=MEDFileField1TS()
+        f1ts.setFieldNoProfileSBT(f0)
+        fmts0.pushBackTimeStep(f1ts)
+        #
+        t=(2.1,1,-3)
+        f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m1)
+        f0.setName(fieldName0) ; f0.setTime(*t)
+        da=DataArrayDouble(9) ; da.iota() ; da.reverse() ; da.setInfoOnComponents(["zeInfo"])
+        f0.setArray(da)
+        f0.checkCoherency()
+        f1ts=MEDFileField1TS()
+        f1ts.setFieldNoProfileSBT(f0)
+        fmts0.pushBackTimeStep(f1ts)
+        #
+        mm.write(fname,2)
+        fs.write(fname,0)
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False)
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),1)
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1)
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),1)
+        allFMTSLeavesPerCommonSupport1=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesToDisplay[0],ms[ms.getMeshesNames()[0]])
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1),1)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[0][0]),1)
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        #
+        fcscp=allFMTSLeavesPerCommonSupport1[0][1]
+        self.assertEqual([NORM_TRI3,NORM_SEG2],fcscp.getGeoTypesAt(0,ms[0]))#contains all cell types of underlying mesh because only nodes with no profiles
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc)
+        self.assertTrue(a0.isEqual(DataArrayDouble([(4.,3.,0.),(7.,3.,0.),(2.,5.,0.),(6.,5.,0.),(9.,5.,0.),(4.,7.,0.),(8.,7.,0.),(3.,8.,0.),(9.,8.,0.)]),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([5,5,5,3,3,3,3,3,3,3])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,4,8,12,15,18,21,24,27,30])))
+        self.assertTrue(a3.isEqual(DataArrayInt([3,2,3,0,3,3,1,0,3,3,4,1,2,2,0,2,0,1,2,1,4,2,3,5,2,5,7,2,3,6,2,6,8])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        a6,a7=mml2.retrieveFamilyIdsOnCells()
+        self.assertTrue(a6.isEqual(DataArrayInt([0,0,0,0,0,0,0,0,0,0])))
+        self.assertTrue(not a7) # copy here
+        a8,a9=mml2.retrieveNumberIdsOnCells()
+        self.assertTrue(not a8)
+        self.assertTrue(a9) # nocopy here
+        a10,a11=mml2.retrieveFamilyIdsOnNodes()
+        self.assertTrue(not a10)
+        self.assertTrue(a11) # no copy here
+        a12,a13=mml2.retrieveNumberIdsOnNodes()
+        self.assertTrue(not a12)
+        self.assertTrue(a13) # no copy here
+        #
+        f=allFMTSLeavesPerCommonSupport1[0][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+        f.loadArraysIfNecessary()
+        v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+        self.assertEqual(f.getName(),fieldName0)
+        self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble(9) ; vExp.iota() ; vExp.setInfoOnComponents(["zeInfo"])
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        #
+        f=allFMTSLeavesPerCommonSupport1[0][0][0][1]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+        f.loadArraysIfNecessary()
+        v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+        self.assertEqual(f.getName(),fieldName0)
+        self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble(9) ; vExp.iota() ; vExp.setInfoOnComponents(["zeInfo"]) ; vExp.reverse()
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        pass 
+    
+    def test23(self):
+        """ Non regression test 2219 of modes. Idem than test22 except that here the node field is on profile.
+        """
+        fname="ForMEDReader23.med"
+        fieldName0="ANodeField"
+        mm=MEDFileUMesh()
+        coo=DataArrayDouble([(4.,3.),(7.,3.),(2.,5.),(6.,5.),(9.,5.),(4.,7.),(8.,7.),(3.,8.),(9.,8.)])
+        m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(coo) ; m0.allocateCells() ; m0.insertNextCell(NORM_TRI3,[2,3,0]) ; m0.insertNextCell(NORM_TRI3,[3,1,0]) ; m0.insertNextCell(NORM_TRI3,[3,4,1])
+        mm.setMeshAtLevel(0,m0)
+        m1=MEDCouplingUMesh("mesh",1) ; m1.setCoords(coo) ; m1.allocateCells() ; m1.insertNextCell(NORM_SEG2,[2,0]) ;  m1.insertNextCell(NORM_SEG2,[0,1]) ; m1.insertNextCell(NORM_SEG2,[1,4])
+        m1.insertNextCell(NORM_SEG2,[3,5]) ; m1.insertNextCell(NORM_SEG2,[5,7]) ; m1.insertNextCell(NORM_SEG2,[3,6]) ; m1.insertNextCell(NORM_SEG2,[6,8])
+        mm.setMeshAtLevel(-1,m1)
+        fmts0=MEDFileFieldMultiTS()
+        fmts0.setDtUnit("s")
+        #
+        pfl=DataArrayInt([0,1,2,4]) ; pfl.setName("pfl")
+        pflCell=DataArrayInt([0,1,2]) ; m1Part=m1[pflCell] ; m1Part.zipCoords()
+        #
+        t=(1.1,0,-2)
+        f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m1Part)
+        f0.setName(fieldName0) ; f0.setTime(*t)
+        da=DataArrayDouble(4) ; da.iota() ; da.setInfoOnComponents(["zeInfo"])
+        f0.setArray(da)
+        f0.checkCoherency()
+        f1ts=MEDFileField1TS()
+        f1ts.setFieldProfile(f0,mm,-1,pfl)
+        fmts0.pushBackTimeStep(f1ts)
+        #
+        t=(2.1,1,-3)
+        f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m1Part)
+        f0.setName(fieldName0) ; f0.setTime(*t)
+        da=DataArrayDouble(4) ; da.iota() ; da.reverse() ; da.setInfoOnComponents(["zeInfo"])
+        f0.setArray(da)
+        f0.checkCoherency()
+        f1ts=MEDFileField1TS()
+        f1ts.setFieldProfile(f0,mm,-1,pfl)
+        fmts0.pushBackTimeStep(f1ts)
+        mm.write(fname,2)
+        fmts0.write(fname,0)
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False)
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),1)
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1)
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),1)
+        allFMTSLeavesPerCommonSupport1=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesToDisplay[0],ms[ms.getMeshesNames()[0]])
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1),1)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[0][0]),1)
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        #
+        fcscp=allFMTSLeavesPerCommonSupport1[0][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc)
+        self.assertTrue(a0.isEqual(DataArrayDouble([(4.,3.,0.),(7.,3.,0.),(2.,5.,0.),(9.,5.,0.)]),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([3,3,3])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,3,6])))
+        self.assertTrue(a3.isEqual(DataArrayInt([2,2,0,2,0,1,2,1,3])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        a6,a7=mml2.retrieveFamilyIdsOnCells()
+        self.assertTrue(a6.isEqual(DataArrayInt([0,0,0])))
+        self.assertTrue(not a7) # copy here
+        a8,a9=mml2.retrieveNumberIdsOnCells()
+        self.assertTrue(not a8)
+        self.assertTrue(a9) # nocopy here
+        a10,a11=mml2.retrieveFamilyIdsOnNodes()
+        self.assertTrue(not a10)
+        self.assertTrue(a11) # no copy here
+        a12,a13=mml2.retrieveNumberIdsOnNodes()
+        self.assertTrue(not a12)
+        self.assertTrue(a13) # no copy here
+        #
+        f=allFMTSLeavesPerCommonSupport1[0][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+        f.loadArraysIfNecessary()
+        v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+        self.assertEqual(f.getName(),fieldName0)
+        vExp=DataArrayDouble(4) ; vExp.iota() ; vExp.setInfoOnComponents(["zeInfo"])
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        #
+        f=allFMTSLeavesPerCommonSupport1[0][0][0][1]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+        f.loadArraysIfNecessary()
+        v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+        self.assertEqual(f.getName(),fieldName0)
+        vExp=DataArrayDouble(4) ; vExp.iota() ; vExp.setInfoOnComponents(["zeInfo"]) ; vExp.reverse()
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        pass
+
+    def test24(self):
+        """ Non regression test for cartesian mesh whose the 3rd direction has only one node. It a false 3D mesh.
+        """
+        fname="ForMEDReader24.med"
+        fieldName0="zeFieldNode"
+        cmesh=MEDCouplingCMesh("mesh")
+        arr0=DataArrayDouble([0.,1.1,2.2,3.3,4.4])
+        arr1=DataArrayDouble([0.,1.4,2.3])
+        arr2=DataArrayDouble([5.])
+        cmesh.setCoords(arr0,arr1,arr2)
+        fmts0=MEDFileFieldMultiTS()
+        fmts0.setDtUnit("s")
+        #
+        t=(1.1,2,3)
+        f=MEDCouplingFieldDouble(ON_NODES) ; f.setName(fieldName0)
+        f.setMesh(cmesh)
+        arr=DataArrayDouble(15) ; arr.setInfoOnComponents(["tutu"]) ; arr.iota()
+        f.setArray(arr)
+        f.setTime(*t)
+        f1ts=MEDFileField1TS()
+        f1ts.setFieldNoProfileSBT(f)
+        fmts0.pushBackTimeStep(f1ts)
+        #
+        t=(3.3,4,5)
+        arr=DataArrayDouble(15) ; arr.setInfoOnComponents(["tutu"]) ; arr.iota()
+        arr.reverse()
+        f.setArray(arr)
+        f.setTime(*t)
+        f1ts=MEDFileField1TS()
+        f1ts.setFieldNoProfileSBT(f)
+        fmts0.pushBackTimeStep(f1ts)
+        #
+        mm=MEDFileCMesh() ; mm.setMesh(cmesh)
+        mm.write(fname,2)
+        fmts0.write(fname,0)
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False)
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),1)
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1)
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),1)
+        allFMTSLeavesPerCommonSupport=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesToDisplay[0],ms[ms.getMeshesNames()[0]])
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport),1)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport[0][0]),1)
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        #
+        fcscp=allFMTSLeavesPerCommonSupport[0][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDCMeshMultiLev))
+        (a,b,c),d=mml2.buildVTUArrays()
+        self.assertTrue(d)#d is True because the a,b and c are directly those in the internal data structure
+        self.assertTrue(a.isEqual(arr0,1e-12))
+        self.assertTrue(b.isEqual(arr1,1e-12))
+        self.assertTrue(c.isEqual(arr2,1e-12))
+        for i in xrange(2):
+            f=allFMTSLeavesPerCommonSupport[0][0][0][i]
+            fsst=MEDFileField1TSStructItem.BuildItemFrom(f,mst)
+            f.loadArraysIfNecessary()
+            v=mml.buildDataArray(fsst,fields,f.getUndergroundDataArray())
+            self.assertEqual(f.getName(),fieldName0)
+            self.assertEqual(v.getHiddenCppPointer(),f.getUndergroundDataArray().getHiddenCppPointer())
+            vExp=DataArrayDouble(15) ; vExp.iota(0) ; vExp.setInfoOnComponents(["tutu"])
+            if i==1:
+                vExp.reverse()
+                pass
+            self.assertTrue(v.isEqual(vExp,1e-12))
+            pass
+        pass
+
+    def test25(self):
+        """ A tricky test that reproduces an invalid behaviour
+        Here a same field is defined both on CELLS and GAUSS_PT, with a profile for each.
+        The problem appears on array computation when performing CELLS then GAUSS_PT and CELLS again.
+        """
+        fname="ForMEDReader25.med"
+        m=MEDFileUMesh()
+        coords=DataArrayDouble([0.,0.,1.,0.,2.,0.,0.,1.,1.,1.,2.,1.,0.,2.,1.,2.,2.,2.,0.,3.,1.,3.,2.,3.,1.,4.,1.,5.,1.,6.],15,2)
+        m0=MEDCouplingUMesh("mesh",2) ; m0.setCoords(coords)
+        m0.allocateCells()
+        m0.insertNextCell(NORM_QUAD4,[0,3,4,1])
+        m0.insertNextCell(NORM_QUAD4,[1,4,5,2])
+        m0.insertNextCell(NORM_QUAD4,[3,6,7,4])
+        m0.insertNextCell(NORM_QUAD4,[4,7,8,5])
+        m0.insertNextCell(NORM_QUAD4,[6,9,10,7])
+        m0.insertNextCell(NORM_QUAD4,[7,10,11,8])
+        m.setMeshAtLevel(0,m0)
+        m1=MEDCouplingUMesh("mesh",1) ; m1.setCoords(coords)
+        m1.allocateCells()
+        m1.insertNextCell(NORM_SEG2,[10,12])
+        m1.insertNextCell(NORM_SEG2,[12,13])
+        m1.insertNextCell(NORM_SEG2,[13,14])
+        m.setMeshAtLevel(-1,m1)
+        m.setFamilyFieldArr(0,DataArrayInt([-1,-2,-3,-4,-5,-6]))
+        m.setFamilyFieldArr(-1,DataArrayInt([-7,-8,-9]))
+        m.setFamilyFieldArr(1,DataArrayInt([3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]))
+        m.setRenumFieldArr(0,DataArrayInt([101,102,103,104,105,106]))
+        m.setRenumFieldArr(-1,DataArrayInt([107,108,109]))
+        m.setRenumFieldArr(1,DataArrayInt([203,204,205,206,207,208,209,210,211,212,213,214,215,216,217]))
+        #
+        fmts=MEDFileFieldMultiTS()
+        info0=["aa","bbb"]
+        name0="zeField"
+        pflName0="pfl"
+        pflName1="pfl2"
+        #
+        f1ts=MEDFileField1TS()
+        f=MEDCouplingFieldDouble(ON_CELLS) ; f.setName(name0)
+        arr=DataArrayDouble([(-1,-11),(-2,-22)]) ; arr.setInfoOnComponents(info0)
+        f.setArray(arr)
+        pfl0=DataArrayInt([0,1]) ; pfl0.setName(pflName0)
+        f1ts.setFieldProfile(f,m,-1,pfl0)
+        del f
+        f2=MEDCouplingFieldDouble(ON_GAUSS_PT) ; f2.setName(name0)
+        arr=DataArrayDouble(15) ; arr.iota(1)
+        arr=DataArrayDouble.Meld(arr,arr+10) ; arr.setInfoOnComponents(info0)
+        f2.setArray(arr)
+        pfl1=DataArrayInt([1,3,5]) ; pfl1.setName(pflName1)
+        tmp=m0[pfl1] ; f2.setMesh(tmp)
+        f2.setGaussLocalizationOnType(NORM_QUAD4,[-1.,-1.,1.,-1.,1.,1.,-1.,1.],[-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.,0.],[0.1,0.1,0.1,0.1,0.6])
+        f2.checkCoherency()
+        f1ts.setFieldProfile(f2,m,0,pfl1)
+        fmts.pushBackTimeStep(f1ts)
+        #
+        m.write(fname,2)
+        fmts.write(fname,0)
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False) # false is absolutely necessary for the test
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),2)
+        ### here the test is important !!! Pointers must be different !
+        self.assertTrue(allFMTSLeavesToDisplay[0][0][0].getUndergroundDataArray().getHiddenCppPointer()!=allFMTSLeavesToDisplay[0][1][0].getUndergroundDataArray().getHiddenCppPointer())
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1)
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),2)
+        ### here the test is important !!! Pointers must be different !
+        self.assertTrue(allFMTSLeavesToDisplay[0][0][0].getUndergroundDataArray().getHiddenCppPointer()!=allFMTSLeavesToDisplay[0][1][0].getUndergroundDataArray().getHiddenCppPointer())
+        allFMTSLeavesPerCommonSupport1=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesToDisplay[0],ms[ms.getMeshesNames()[0]])
+        self.assertTrue(allFMTSLeavesToDisplay[0][0][0].getUndergroundDataArray().getHiddenCppPointer()!=allFMTSLeavesToDisplay[0][1][0].getUndergroundDataArray().getHiddenCppPointer())
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1),2)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[0][0]),1)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[1][0]),1)
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        # emulate first click
+        fcscp=allFMTSLeavesPerCommonSupport1[0][1]
+        self.assertEqual([NORM_SEG2],fcscp.getGeoTypesAt(0,ms[0]))
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc) # copy here because 2D -> 3D
+        expCoords=coords.changeNbOfComponents(3,0.)
+        self.assertTrue(a0.isEqual(expCoords,1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([3,3])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,3])))
+        self.assertTrue(a3.isEqual(DataArrayInt([2,10,12,2,12,13])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        a6,a7=mml2.retrieveFamilyIdsOnCells()
+        self.assertTrue(a6.isEqual(DataArrayInt([-7,-8])))
+        self.assertTrue(not a7) # copy here because profile on cells
+        a8,a9=mml2.retrieveNumberIdsOnCells()
+        self.assertTrue(a8.isEqual(DataArrayInt([107,108])))
+        self.assertTrue(not a9) # copy here because profile on cells
+        a10,a11=mml2.retrieveFamilyIdsOnNodes()
+        self.assertTrue(a10.isEqual(DataArrayInt([3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])))
+        self.assertTrue(a11) # no copy here
+        a12,a13=mml2.retrieveNumberIdsOnNodes()
+        self.assertTrue(a12.isEqual(DataArrayInt([203,204,205,206,207,208,209,210,211,212,213,214,215,216,217])))
+        self.assertTrue(a13) # no copy here
+        fff0=allFMTSLeavesPerCommonSupport1[0][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff0,mst)
+        fff0.loadArraysIfNecessary()
+        self.assertEqual([ON_CELLS],fff0.getTypesOfFieldAvailable())
+        v=mml.buildDataArray(fsst,fields,fff0.getUndergroundDataArray())
+        self.assertEqual(fff0.getName(),name0)
+        self.assertEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([(-1,-11),(-2,-22)]) ; vExp.setInfoOnComponents(info0)
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        del fff0
+        # emulate second click
+        fcscp=allFMTSLeavesPerCommonSupport1[1][1]
+        self.assertEqual([NORM_QUAD4],fcscp.getGeoTypesAt(0,ms[0]))
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc) # copy here because 2D -> 3D
+        expCoords=coords.changeNbOfComponents(3,0.)
+        self.assertTrue(a0.isEqual(expCoords,1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([9,9,9])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,5,10])))
+        self.assertTrue(a3.isEqual(DataArrayInt([4,1,4,5,2,4,4,7,8,5,4,7,10,11,8])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        a6,a7=mml2.retrieveFamilyIdsOnCells()
+        self.assertTrue(a6.isEqual(DataArrayInt([-2,-4,-6])))
+        self.assertTrue(not a7) # copy here because profile on cells
+        a8,a9=mml2.retrieveNumberIdsOnCells()
+        self.assertTrue(a8.isEqual(DataArrayInt([102,104,106])))
+        self.assertTrue(not a9) # copy here because profile on cells
+        a10,a11=mml2.retrieveFamilyIdsOnNodes()
+        self.assertTrue(a10.isEqual(DataArrayInt([3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])))
+        self.assertTrue(a11) # no copy here
+        a12,a13=mml2.retrieveNumberIdsOnNodes()
+        self.assertTrue(a12.isEqual(DataArrayInt([203,204,205,206,207,208,209,210,211,212,213,214,215,216,217])))
+        self.assertTrue(a13) # no copy here
+        fff1=allFMTSLeavesPerCommonSupport1[1][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff1,mst)
+        fff1.loadArraysIfNecessary()
+        self.assertEqual([ON_GAUSS_PT],fff1.getTypesOfFieldAvailable())
+        v=mml.buildDataArray(fsst,fields,fff1.getUndergroundDataArray())
+        self.assertEqual(fff1.getName(),name0)
+        self.assertEqual(v.getHiddenCppPointer(),fff1.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([1.,11.,2.,12.,3.,13.,4.,14.,5.,15.,6.,16.,7.,17.,8.,18.,9.,19.,10.,20.,11.,21.,12.,22.,13.,23.,14.,24.,15.,25.],15,2) ; vExp.setInfoOnComponents(info0)
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        # emulate third click
+        fcscp=allFMTSLeavesPerCommonSupport1[0][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc) # copy here because 2D -> 3D
+        expCoords=coords.changeNbOfComponents(3,0.)
+        self.assertTrue(a0.isEqual(expCoords,1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([3,3])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,3])))
+        self.assertTrue(a3.isEqual(DataArrayInt([2,10,12,2,12,13])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        a6,a7=mml2.retrieveFamilyIdsOnCells()
+        self.assertTrue(a6.isEqual(DataArrayInt([-7,-8])))
+        self.assertTrue(not a7) # copy here because profile on cells
+        a8,a9=mml2.retrieveNumberIdsOnCells()
+        self.assertTrue(a8.isEqual(DataArrayInt([107,108])))
+        self.assertTrue(not a9) # copy here because profile on cells
+        a10,a11=mml2.retrieveFamilyIdsOnNodes()
+        self.assertTrue(a10.isEqual(DataArrayInt([3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])))
+        self.assertTrue(a11) # no copy here
+        a12,a13=mml2.retrieveNumberIdsOnNodes()
+        self.assertTrue(a12.isEqual(DataArrayInt([203,204,205,206,207,208,209,210,211,212,213,214,215,216,217])))
+        self.assertTrue(a13) # no copy here
+        fff0=allFMTSLeavesPerCommonSupport1[0][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff0,mst)
+        fff0.loadArraysIfNecessary()
+        self.assertEqual([ON_CELLS],fff0.getTypesOfFieldAvailable())
+        v=mml.buildDataArray(fsst,fields,fff0.getUndergroundDataArray())
+        self.assertEqual(fff0.getName(),name0)
+        self.assertEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([(-1,-11),(-2,-22)]) ; vExp.setInfoOnComponents(info0)
+        self.assertTrue(v.isEqual(vExp,1e-12)) # <- THE test is here !!!
+        del fff0
+        pass
+
+    def test26(self):
+        """ Test focused on field on nodes (here f0Node and f1Node) lying on a profile of nodes that do not match perfectly a sub set of cells of its underlying mesh. See bug EDF 2405 and 2177.
+        For this type of fields the support will contain only vertices.
+        """
+        fname="ForMEDReader26.med"
+        coords=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,2.,0.),(1.,2.,0.),(2.,2.,0.),(3.,2.,0.),(0.,3.,0.),(1.,3.,0.),(2.,3.,0.),(3.,3.,0.)])
+        m0=MEDCouplingUMesh("mesh",2)
+        m0.allocateCells()
+        for elt in [[2,6,3],[6,7,3],[9,6,5],[9,10,6]]:
+            m0.insertNextCell(NORM_TRI3,elt)
+            pass
+        for elt in [[0,4,5,1],[1,5,6,2],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]:
+            m0.insertNextCell(NORM_QUAD4,elt)
+            pass
+        m0.setCoords(coords)
+        ##
+        mm=MEDFileUMesh()
+        mm.setMeshAtLevel(0,m0)
+        mm.setFamilyFieldArr(0,DataArrayInt([-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11]))
+        mm.setFamilyFieldArr(1,DataArrayInt([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))
+        #
+        f1ts0Node=MEDFileField1TS()
+        f1ts1Node=MEDFileField1TS()
+        f1ts2Cell=MEDFileField1TS()
+        f1ts3Cell=MEDFileField1TS()
+        f1ts4Cell=MEDFileField1TS()
+        f1ts5Node=MEDFileField1TS()
+        #
+        pfl0=DataArrayInt([4,5,6,8,9,12]) ; pfl0.setName("pfl0")
+        pfl1=DataArrayInt([0,1,4,5,7,10]) ; pfl1.setName("pfl1")
+        pfl2=DataArrayInt([0,1,2,3,4,5,6,7,10,11,14,15]) ; pfl2.setName("pfl2")
+        #
+        f0Node=MEDCouplingFieldDouble(ON_NODES) ; f0Node.setName("f0Node")
+        arr0=DataArrayDouble(6) ; arr0.iota()
+        f0Node.setArray(arr0)
+        f1ts0Node.setFieldProfile(f0Node,mm,0,pfl0)
+        #
+        f1Node=MEDCouplingFieldDouble(ON_NODES) ; f1Node.setName("f1Node")
+        arr1=DataArrayDouble(6) ; arr1.iota() ; arr1.reverse()
+        f1Node.setArray(arr1)
+        f1ts1Node.setFieldProfile(f1Node,mm,0,pfl0)
+        #
+        f2Cell=MEDCouplingFieldDouble(ON_CELLS) ; f2Cell.setName("f2Cell")
+        arr2=DataArrayDouble([2,3,0,1,4,5])
+        f2Cell.setArray(arr2)
+        f1ts2Cell.setFieldProfile(f2Cell,mm,0,pfl1)
+        #
+        f3Cell=MEDCouplingFieldDouble(ON_CELLS) ; f3Cell.setName("f3Cell")
+        arr3=DataArrayDouble([5,4,3,2,1,0])
+        f3Cell.setArray(arr3)
+        f1ts3Cell.setFieldProfile(f3Cell,mm,0,pfl1)
+        #
+        f4Cell=MEDCouplingFieldDouble(ON_CELLS) ; f4Cell.setName("f4Cell")
+        arr4=DataArrayDouble([2,2,0,1,1,0])
+        f4Cell.setArray(arr4)
+        f1ts4Cell.setFieldProfile(f4Cell,mm,0,pfl1)
+        #
+        f5Node=MEDCouplingFieldDouble(ON_NODES) ; f5Node.setName("f5Node")
+        arr5=DataArrayDouble([0,1,2,3,10,11,13,2,11,1,10,0])
+        f5Node.setArray(arr5)
+        f1ts5Node.setFieldProfile(f5Node,mm,0,pfl2)
+        #
+        fs=MEDFileFields()
+        for f in [f1ts0Node,f1ts1Node,f1ts2Cell,f1ts3Cell,f1ts4Cell,f1ts5Node]:
+            fmts=MEDFileFieldMultiTS()
+            fmts.pushBackTimeStep(f)
+            fs.pushField(fmts)
+            pass
+        mm.write(fname,2)
+        fs.write(fname,0)
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False)
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),6)
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1)
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),6)
+        allFMTSLeavesPerCommonSupport1=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesToDisplay[0],ms[ms.getMeshesNames()[0]])
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1),2)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[0][0]),4)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[1][0]),2)# <- the smart one is here
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        #
+        fcscp=allFMTSLeavesPerCommonSupport1[1][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        self.assertEqual([3,4,0],mml2.getGeoTypes())
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc)
+        self.assertTrue(a0.isEqual(DataArrayDouble([0.,1.,0.,1.,1.,0.,2.,1.,0.,0.,2.,0.,1.,2.,0.,0.,3.,0.],6,3),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([5,9,1])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,4,9])))
+        self.assertTrue(a3.isEqual(DataArrayInt([3,4,2,1,4,0,3,4,1,1,5])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        a6,a7=mml2.retrieveFamilyIdsOnCells()
+        self.assertTrue(a6.isEqual(DataArrayInt([-3,-7,13])))
+        self.assertTrue(not a7) # copy here because profile on cells
+        a8,a9=mml2.retrieveNumberIdsOnCells()
+        self.assertTrue(a8 is None)
+        self.assertTrue(a9) # no copy here because no number field
+        a10,a11=mml2.retrieveFamilyIdsOnNodes()
+        self.assertTrue(a10.isEqual(DataArrayInt([5,6,7,9,10,13])))
+        self.assertTrue(not a11) # copy here
+        a12,a13=mml2.retrieveNumberIdsOnNodes()
+        self.assertTrue(a12 is None)
+        self.assertTrue(a13) # no copy here because no number field
+        #
+        fff0=allFMTSLeavesPerCommonSupport1[1][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff0,mst)
+        fff0.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff0.getUndergroundDataArray())
+        self.assertEqual(fff0.getName(),"f0Node")
+        self.assertEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([0.,1.,2.,3.,4.,5.])
+        self.assertTrue(v.isEqual(vExp,1e-12)) # <- THE test is here !!!
+        #
+        fff1=allFMTSLeavesPerCommonSupport1[1][0][1][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff1,mst)
+        fff1.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff1.getUndergroundDataArray())
+        self.assertEqual(fff1.getName(),"f1Node")
+        self.assertEqual(v.getHiddenCppPointer(),fff1.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([5.,4.,3.,2.,1.,0.])
+        self.assertTrue(v.isEqual(vExp,1e-12)) # <- THE test is here !!!
+        pass
+
+    def test27(self):
+        """ This test defines 2 fields f0 and f1 on nodes lying on an unstructured mesh with no cells.
+        f0 is a field on all nodes. f1 is a partial field on nodes.
+        """
+        fname="ForMEDReader27.med"
+        coords=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,2.,0.),(1.,2.,0.),(2.,2.,0.),(3.,2.,0.),(0.,3.,0.),(1.,3.,0.),(2.,3.,0.),(3.,3.,0.)])
+        m0=MEDCouplingUMesh("mesh",2)
+        m0.allocateCells()
+        m0.setCoords(coords)
+        ##
+        mm=MEDFileUMesh()
+        mm.setMeshAtLevel(0,m0)
+        mm.setFamilyFieldArr(1,DataArrayInt([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))
+        #
+        f1ts0=MEDFileField1TS()
+        f1ts1=MEDFileField1TS()
+        #
+        f0=MEDCouplingFieldDouble(ON_NODES) ; f0.setMesh(m0) ; f0.setName("f0NoPfl")
+        arr0=DataArrayDouble([0.,1.,2.,3.,1.,1.5,2.2,3.1,2.,2.2,3.,3.1,3.,3.1,3.5,4.])
+        f0.setArray(arr0)
+        f0.checkCoherency()
+        f1ts0.setFieldNoProfileSBT(f0)
+        self.assertEqual(f1ts0.getMeshName(),"mesh")
+        #
+        pfl1=DataArrayInt([0,1,2,3,4,5,6,8,9,12]) ; pfl1.setName("pfl1")
+        f1=MEDCouplingFieldDouble(ON_NODES) ; f1.setName("f1Pfl")
+        arr1=DataArrayDouble([3.,2.,1.,0.,2.,1.5,0.,1.,0.,0.2])
+        f1.setArray(arr1)
+        f1ts1.setFieldProfile(f1,mm,0,pfl1)
+        self.assertEqual(f1ts1.getMeshName(),"mesh")
+        #
+        fs=MEDFileFields()
+        fmts0=MEDFileFieldMultiTS()
+        fmts0.pushBackTimeStep(f1ts0)
+        fmts1=MEDFileFieldMultiTS()
+        fmts1.pushBackTimeStep(f1ts1)
+        fs.pushField(fmts0) ; fs.pushField(fmts1)
+        self.assertEqual(fs[0].getMeshName(),"mesh")
+        self.assertEqual(fs[1].getMeshName(),"mesh")
+        mm.write(fname,2)
+        fs.write(fname,0)
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False)
+        self.assertEqual(fields[0].getMeshName(),"mesh")
+        self.assertEqual(fields[1].getMeshName(),"mesh")
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        self.assertEqual(fields_per_mesh[0][0].getMeshName(),"mesh")
+        self.assertEqual(fields_per_mesh[0][1].getMeshName(),"mesh")
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),2)
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1)
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),2)
+        allFMTSLeavesPerCommonSupport1=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesToDisplay[0],ms[ms.getMeshesNames()[0]])
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1),2)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[0][0]),1)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[1][0]),1)
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        #
+        fcscp=allFMTSLeavesPerCommonSupport1[0][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(ncc)
+        self.assertTrue(a0.isEqual(DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,2.,0.),(1.,2.,0.),(2.,2.,0.),(3.,2.,0.),(0.,3.,0.),(1.,3.,0.),(2.,3.,0.),(3.,3.,0.)]),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([])))
+        self.assertTrue(a2.isEqual(DataArrayInt([])))
+        self.assertTrue(a3.isEqual(DataArrayInt([])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        #
+        fff0=allFMTSLeavesPerCommonSupport1[0][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff0,mst)
+        fff0.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff0.getUndergroundDataArray())
+        self.assertEqual(fff0.getName(),"f0NoPfl")
+        self.assertEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([0.,1.,2.,3.,1.,1.5,2.2,3.1,2.,2.2,3.,3.1,3.,3.1,3.5,4])
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        #
+        fcscp=allFMTSLeavesPerCommonSupport1[1][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc)
+        self.assertTrue(a0.isEqual(DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(0,2,0),(1,2,0),(0,3,0)]),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([])))
+        self.assertTrue(a2.isEqual(DataArrayInt([])))
+        self.assertTrue(a3.isEqual(DataArrayInt([])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        fff1=allFMTSLeavesPerCommonSupport1[1][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff1,mst)
+        fff1.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff1.getUndergroundDataArray())
+        self.assertEqual(fff1.getName(),"f1Pfl")
+        self.assertNotEqual(v.getHiddenCppPointer(),fff1.getUndergroundDataArray().getHiddenCppPointer()) # pointers are not equal because Profile
+        vExp=DataArrayDouble([3.,2.,1.,0.,2.,1.5,0.,1.,0.,0.2])
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        pass
+
+    def test28(self):
+        """ This test defines 2 fields f0,f1,f2,f3 lying on an unstructured mesh whith cells including NORM_POINT1.
+        Both f0 and f1 are on NODES and f2 and f3 are on cells. f1 and f2 share the same support.
+        f0 is on a nodal support that is not matchable with any cells (including NORM_POINT1)
+        This test is a more aggressive version of test26.
+        """
+        fname="ForMEDReader28.med"
+        coords=DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,2.,0.),(1.,2.,0.),(2.,2.,0.),(3.,2.,0.),(0.,3.,0.),(1.,3.,0.),(2.,3.,0.),(3.,3.,0.)])
+        m0=MEDCouplingUMesh("mesh",2)
+        m0.allocateCells()
+        for elt in [[2,6,3],[6,7,3],[9,6,5],[9,10,6]]:
+            m0.insertNextCell(NORM_TRI3,elt)
+            pass
+        for elt in [[0,4,5,1],[1,5,6,2],[4,8,9,5],[6,10,11,7],[8,12,13,9],[9,13,14,10],[10,14,15,11]]:
+            m0.insertNextCell(NORM_QUAD4,elt)
+            pass
+        m0.setCoords(coords)
+        m2=MEDCouplingUMesh("mesh",0) ; m2.setCoords(coords)
+        m2.allocateCells()
+        for elt in [[8],[13]]:
+            m2.insertNextCell(NORM_POINT1,elt)
+            pass
+        ##
+        mm=MEDFileUMesh()
+        mm.setMeshAtLevel(0,m0)
+        mm.setMeshAtLevel(-2,m2)
+        mm.setFamilyFieldArr(0,DataArrayInt([-1,-2,-3,-4,-5,-6,-7,-8,-9,-10,-11]))
+        mm.setFamilyFieldArr(-2,DataArrayInt([-12,-13]))
+        mm.setFamilyFieldArr(1,DataArrayInt([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]))
+        #
+        f1ts0Node=MEDFileField1TS()
+        f1ts1Node=MEDFileField1TS()
+        f1ts2Cell=MEDFileField1TS()
+        f1ts3Cell=MEDFileField1TS()
+        #
+        pfl0=DataArrayInt([4,5,6,8,9,12]) ; pfl0.setName("pfl0")
+        pfl1=DataArrayInt([0,1,4,5,7,10]) ; pfl1.setName("pfl1")
+        pfl2=DataArrayInt([0,1,2,3,4,5,6,7,10,11,14,15]) ; pfl2.setName("pfl2")
+        #
+        f0Node=MEDCouplingFieldDouble(ON_NODES) ; f0Node.setName("f0Node")
+        arr0=DataArrayDouble(6) ; arr0.iota()
+        f0Node.setArray(arr0)
+        f1ts0Node.setFieldProfile(f0Node,mm,0,pfl0)
+        #
+        f1Node=MEDCouplingFieldDouble(ON_NODES) ; f1Node.setName("f1Node")
+        arr1=DataArrayDouble(12) ; arr1.iota() ; arr1.reverse()
+        f1Node.setArray(arr1)
+        f1ts1Node.setFieldProfile(f1Node,mm,0,pfl2)
+        #
+        f2Cell=MEDCouplingFieldDouble(ON_CELLS) ; f2Cell.setName("f2Cell")
+        arr2=DataArrayDouble([2,3,0,1,4,5])
+        f2Cell.setArray(arr2)
+        f1ts2Cell.setFieldProfile(f2Cell,mm,0,pfl1)
+        #
+        f3Cell=MEDCouplingFieldDouble(ON_CELLS) ; f3Cell.setName("f3Cell")
+        arr3=DataArrayDouble([5,4,3,2,1,0]) ; f3Cell.setArray(arr3)
+        f1ts3Cell.setFieldProfile(f3Cell,mm,0,pfl1)
+        f3Cell.setMesh(m2)
+        arr3=DataArrayDouble([-1.1,-3.1]) ; f3Cell.setArray(arr3)
+        f1ts3Cell.setFieldNoProfileSBT(f3Cell)
+        #
+        fs=MEDFileFields()
+        for f in [f1ts0Node,f1ts1Node,f1ts2Cell,f1ts3Cell]:
+            fmts=MEDFileFieldMultiTS()
+            fmts.pushBackTimeStep(f)
+            fs.pushField(fmts)
+            pass
+        mm.write(fname,2)
+        fs.write(fname,0)
+        ########## GO for reading in MEDReader,by not loading all. Mesh is fully loaded but not fields values
+        ms=MEDFileMeshes(fname)
+        fields=MEDFileFields(fname,False)
+        fields_per_mesh=[fields.partOfThisLyingOnSpecifiedMeshName(meshName) for meshName in ms.getMeshesNames()]
+        allFMTSLeavesToDisplay=[]
+        for fields in fields_per_mesh:
+            allFMTSLeavesToDisplay2=[]
+            for fmts in fields:
+                allFMTSLeavesToDisplay2+=fmts.splitDiscretizations()
+                pass
+            allFMTSLeavesToDisplay.append(allFMTSLeavesToDisplay2)
+            pass
+        self.assertEqual(len(allFMTSLeavesToDisplay),1)
+        self.assertEqual(len(allFMTSLeavesToDisplay[0]),4)
+        allFMTSLeavesPerTimeSeries=MEDFileAnyTypeFieldMultiTS.SplitIntoCommonTimeSeries(sum(allFMTSLeavesToDisplay,[]))
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries),1)
+        self.assertEqual(len(allFMTSLeavesPerTimeSeries[0]),4)
+        allFMTSLeavesPerCommonSupport1=MEDFileAnyTypeFieldMultiTS.SplitPerCommonSupport(allFMTSLeavesToDisplay[0],ms[ms.getMeshesNames()[0]])
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1),3)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[0][0]),2)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[1][0]),1)
+        self.assertEqual(len(allFMTSLeavesPerCommonSupport1[2][0]),1)
+        #
+        mst=MEDFileMeshStruct.New(ms[0])
+        #
+        fcscp=allFMTSLeavesPerCommonSupport1[2][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc)
+        self.assertTrue(a0.isEqual(DataArrayDouble([0.,1.,0.,1.,1.,0.,2.,1.,0.,0.,2.,0.,1.,2.,0.,0.,3.,0.],6,3),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([5,9,1,1])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,4,9,11])))
+        self.assertTrue(a3.isEqual(DataArrayInt([3,4,2,1,4,0,3,4,1,1,3,1,5])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        a6,a7=mml2.retrieveFamilyIdsOnCells()
+        self.assertTrue(a6.isEqual(DataArrayInt([-3,-7,-12,13])))
+        self.assertTrue(not a7) # copy here because profile on cells
+        a8,a9=mml2.retrieveNumberIdsOnCells()
+        self.assertTrue(a8 is None)
+        self.assertTrue(a9) # no copy here because no number field
+        a10,a11=mml2.retrieveFamilyIdsOnNodes()
+        self.assertTrue(a10.isEqual(DataArrayInt([5,6,7,9,10,13])))
+        self.assertTrue(not a11) # copy here
+        a12,a13=mml2.retrieveNumberIdsOnNodes()
+        self.assertTrue(a12 is None)
+        self.assertTrue(a13) # no copy here because no number field
+        #
+        fff0=allFMTSLeavesPerCommonSupport1[2][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff0,mst)
+        fff0.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff0.getUndergroundDataArray())
+        self.assertEqual(fff0.getName(),"f0Node")
+        self.assertEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([0.,1.,2.,3.,4.,5.])
+        self.assertTrue(v.isEqual(vExp,1e-12)) # <- THE test is here !!!
+        ###
+        fcscp=allFMTSLeavesPerCommonSupport1[0][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(not ncc)
+        self.assertTrue(a0.isEqual(DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(3,0,0),(0,1,0),(1,1,0),(2,1,0),(3,1,0),(2,2,0),(3,2,0),(2,3,0),(3,3,0)]),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([5,5,9,9,9,9])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,4,8,13,18,23])))
+        self.assertTrue(a3.isEqual(DataArrayInt([3,2,6,3,3,6,7,3,4,0,4,5,1,4,1,5,6,2,4,6,8,9,7,4,8,10,11,9])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        fff1=allFMTSLeavesPerCommonSupport1[0][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff1,mst)
+        fff1.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff1.getUndergroundDataArray())
+        self.assertEqual(fff1.getName(),"f2Cell")
+        self.assertNotEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([2,3,0,1,4,5])
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        fff2=allFMTSLeavesPerCommonSupport1[0][0][1][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff2,mst)
+        fff2.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff2.getUndergroundDataArray())
+        self.assertEqual(fff2.getName(),"f1Node")
+        self.assertNotEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([11,10,9,8,7,6,5,4,3,2,1,0])
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        ###
+        fcscp=allFMTSLeavesPerCommonSupport1[1][1]
+        mml=fcscp.buildFromScratchDataSetSupport(0,fields)
+        mml2=mml.prepare()
+        self.assertTrue(isinstance(mml2,MEDUMeshMultiLev))
+        ncc,a0,a1,a2,a3,a4,a5=mml2.buildVTUArrays()
+        self.assertTrue(ncc)# here all the 16 nodes are taken
+        self.assertTrue(a0.isEqual(DataArrayDouble([(0.,0.,0.),(1.,0.,0.),(2.,0.,0.),(3.,0.,0.),(0.,1.,0.),(1.,1.,0.),(2.,1.,0.),(3.,1.,0.),(0.,2.,0.),(1.,2.,0.),(2.,2.,0.),(3.,2.,0.),(0.,3.,0.),(1.,3.,0.),(2.,3.,0.),(3.,3.,0.)]),1e-12))
+        self.assertTrue(a1.isEqual(DataArrayByte([1,1,5,5,9,9,9,9])))
+        self.assertTrue(a2.isEqual(DataArrayInt([0,2,4,8,12,17,22,27])))
+        self.assertTrue(a3.isEqual(DataArrayInt([1,8,1,13,3,2,6,3,3,6,7,3,4,0,4,5,1,4,1,5,6,2,4,6,10,11,7,4,10,14,15,11])))
+        self.assertTrue(a4 is None)
+        self.assertTrue(a5 is None)
+        fff3=allFMTSLeavesPerCommonSupport1[1][0][0][0]
+        fsst=MEDFileField1TSStructItem.BuildItemFrom(fff3,mst)
+        fff3.loadArraysIfNecessary()
+        v=mml2.buildDataArray(fsst,fields,fff3.getUndergroundDataArray())
+        self.assertEqual(fff3.getName(),"f3Cell")
+        self.assertNotEqual(v.getHiddenCppPointer(),fff0.getUndergroundDataArray().getHiddenCppPointer())
+        vExp=DataArrayDouble([-1.1,-3.1,5,4,3,2,1,0])
+        self.assertTrue(v.isEqual(vExp,1e-12))
+        pass
     pass
 
 unittest.main()
index 88e32191aee0da7e77d88ce9e273a784bb48cffa..aed1ba60ebf8f215217e678c91e50f2aa31ca094 100644 (file)
@@ -57,17 +57,18 @@ MEDDataManager_i::~MEDDataManager_i()
   LOG("Deleting MEDDataManager_i instance");
 }
 
-const char * MEDDataManager_i::file_to_source(const char * filepath)
+std::string MEDDataManager_i::file_to_source(const char * filepath)
 {
-  string * source = new string("file://");
-  source->append(filepath);
-  return source->c_str();;
+  string source("file://");
+  source.append(filepath);
+  return source;
 }
-const char * MEDDataManager_i::source_to_file(const char * source)
+
+std::string MEDDataManager_i::source_to_file(const char * source)
 {
-  string * filepath = new string(source);
-  filepath->replace(0,7,"");
-  return filepath->c_str();
+  string filepath(source);
+  filepath.replace(0,7,"");
+  return filepath;
 }
 
 /*!
@@ -93,7 +94,8 @@ MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath)
   MEDOP::DatasourceHandler * datasourceHandler = new MEDOP::DatasourceHandler();
   datasourceHandler->id = _sourceLastId; _sourceLastId++;
   datasourceHandler->name = (Kernel_Utils::GetBaseName(filepath)).c_str();
-  datasourceHandler->uri = file_to_source(filepath);
+  std::string tmp(file_to_source(filepath));
+  datasourceHandler->uri = CORBA::string_dup(tmp.c_str());
   _datasourceHandlerMap[datasourceHandler->id] = datasourceHandler;
 
   // We start by read the list of meshes (spatial supports of fields)
@@ -189,10 +191,10 @@ MEDOP::DatasourceHandler * MEDDataManager_i::addDatasource(const char *filepath)
 }
 
 long MEDDataManager_i::getDatasourceId(const char *filepath) {
-  const char * uri = file_to_source(filepath);
+  std::string uri(file_to_source(filepath));
   DatasourceHandlerMapIterator it = _datasourceHandlerMap.begin();  
   while ( it != _datasourceHandlerMap.end() ) {
-    if ( strcmp(it->second->uri,uri) == 0 ) {
+    if ( strcmp(it->second->uri,uri.c_str()) == 0 ) {
       return it->first;
     }
     ++it;
@@ -508,7 +510,7 @@ MEDCouplingUMesh * MEDDataManager_i::getUMesh(long meshHandlerId) {
     }
 
     long sourceid = _meshHandlerMap[meshHandlerId]->sourceid;
-    const char * filepath = source_to_file((_datasourceHandlerMap[sourceid])->uri);  
+    std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri));  
     const char * meshName = _meshHandlerMap[meshHandlerId]->name;
     int meshDimRelToMax = 0;
     myMesh = MEDLoader::ReadUMeshFromFile(filepath,meshName,meshDimRelToMax);
@@ -582,8 +584,8 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand
 
   long sourceid = _meshHandlerMap[meshid]->sourceid;
 
-  const char * filepath = source_to_file((_datasourceHandlerMap[sourceid])->uri);
-  const char * meshName = myMesh->getName().c_str();
+  std::string filepath(source_to_file((_datasourceHandlerMap[sourceid])->uri));
+  std::string meshName(myMesh->getName());
   LOG("getFieldDouble: field "<<fieldHandler->fieldname<<" loaded from file "<<filepath);
   TypeOfField type = (TypeOfField)fieldHandler->type;
   int meshDimRelToMax = 0;
@@ -591,7 +593,7 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand
                 filepath,
                 meshName,
                 meshDimRelToMax,
-                fieldHandler->fieldname,
+                std::string(fieldHandler->fieldname),
                 fieldHandler->iteration,
                 fieldHandler->order);
   myField->setMesh(myMesh);
@@ -612,8 +614,8 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand
 MEDOP::FieldHandler * MEDDataManager_i::addField(MEDCouplingFieldDouble * fieldDouble,
              long meshHandlerId)
 {
-  const char * fieldName = fieldDouble->getName().c_str();
-  const char * meshName  = fieldDouble->getMesh()->getName().c_str();
+  std::string fieldName(fieldDouble->getName());
+  std::string meshName(fieldDouble->getMesh()->getName());
   TypeOfField  type      = fieldDouble->getTypeOfField();
 
   int iteration, order;
@@ -629,12 +631,12 @@ MEDOP::FieldHandler * MEDDataManager_i::addField(MEDCouplingFieldDouble * fieldD
   // the fielddouble name, because this name describes the operation
   // the field has been created with.
   string * source = new string("mem://"); source->append(fieldName);
-  MEDOP::FieldHandler * fieldHandler = newFieldHandler(fieldName,
-                   meshName,
-                   type,
-                   iteration,
-                   order,
-                   source->c_str());
+  MEDOP::FieldHandler * fieldHandler = newFieldHandler(fieldName.c_str(),
+                                                       meshName.c_str(),
+                                                       type,
+                                                       iteration,
+                                                       order,
+                                                       source->c_str());
 
   if ( meshHandlerId == LONG_UNDEFINED ) {
     // We have to gess the id of the underlying mesh to preserve data
index 7c54bf5d9e7a0f10b413b44fa6169eaefd4f27b3..5be3a86ea228b216dd0c6de4ae92cd0376dbee5b 100644 (file)
@@ -149,8 +149,8 @@ private:
              long         order,
              const char * source);
 
-  const char * file_to_source(const char * filepath);
-  const char * source_to_file(const char * source);
+  std::string  file_to_source(const char * filepath);
+  std::string  source_to_file(const char * source);
   long getDatasourceId(const char *filepath);
 
   MEDCouplingUMesh * getUMesh(long meshHandlerId);
index 861fb441ce61de6f368bc8a48ef4bece6060e389..5aa5cc734c04fe0886128741e5f8a5f53a6991d8 100644 (file)
@@ -192,7 +192,7 @@ void DatasourceController::OnAddDatasource()
 
   if ( filenames.count() <= 0 ) return;
   for ( QStringList::ConstIterator itFile = filenames.begin();
-       itFile != filenames.end(); ++itFile ) {
+        itFile != filenames.end(); ++itFile ) {
     QString filename = *itFile;
     this->addDatasource(QCHARSTAR(filename));
     _salomeModule->updateObjBrowser(true);
index 59a590bb35911a2c0a4376d4551ed4ca78f00238..ab1f66d8eeccad6cdd0c4fb4e4512fffd50f0a41 100644 (file)
@@ -1270,7 +1270,7 @@ MEDPARTITIONER::MeshCollection::MeshCollection(const std::string& filename, Para
     </mesh>\n \
   </mapping>\n \
 </root>\n";
-          std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile.c_str());
+          std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile);
           xml.replace(xml.find("$fileName"),9,myfile);
           xml.replace(xml.find("$meshName"),9,meshNames[0]);
           xml.replace(xml.find("$meshName"),9,meshNames[0]);
@@ -2003,13 +2003,13 @@ void MEDPARTITIONER::MeshCollection::setDomainNames(const std::string& name)
       std::ostringstream oss;
       oss<<name<<"_"<<i;
       if (!isParallelMode() || _domain_selector->isMyDomain(i))
-        _mesh[i]->setName(oss.str().c_str());
+        _mesh[i]->setName(oss.str());
     }
 }
 
 ParaMEDMEM::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::string descriptionField, int iold)
 //getField look for and read it if not done, and assume decrRef() in ~MeshCollection;
-//something like MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name.c_str(),f1->getMesh()->getName(),0,f1->getName(),0,1);
+//something like MEDCouplingFieldDouble *f2=MEDLoader::ReadFieldCell(name,f1->getMesh()->getName(),0,f1->getName(),0,1);
 {
   int rank=MyGlobals::_Rank;
   std::string tag="ioldFieldDouble="+IntToStr(iold);
@@ -2032,7 +2032,7 @@ ParaMEDMEM::DataArrayDouble *MEDPARTITIONER::MeshCollection::getField(std::strin
   meshName=MyGlobals::_Mesh_Names[iold];
   
   ParaMEDMEM::MEDCouplingFieldDouble* f2=MEDLoader::ReadField((ParaMEDMEM::TypeOfField) typeField,
-                                                              fileName.c_str(), meshName.c_str(), 0, fieldName.c_str(), DT, IT);
+                                                              fileName, meshName, 0, fieldName, DT, IT);
   
   ParaMEDMEM::DataArrayDouble* res=f2->getArray();
   //to know names of components
index 9c6001bc0e686c1f4494c1c58ee21c652553b8e1..3ff67ebdcada85574c77b9a0bff0c92693c61991 100644 (file)
@@ -97,7 +97,7 @@ void MeshCollectionDriver::readSubdomain(std::vector<int*>& cellglobal,
   std::string meshname=MyGlobals::_Mesh_Names[idomain];
   std::string file=MyGlobals::_File_Names[idomain];
 
-  ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str());
+  ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file,meshname);
   std::vector<int> nonEmpty=mfm->getNonEmptyLevels();
   
   try 
@@ -163,7 +163,7 @@ void MeshCollectionDriver::readSubdomain(int idomain)
   std::string meshname=MyGlobals::_Mesh_Names[idomain];
   std::string file=MyGlobals::_File_Names[idomain];
 
-  ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file.c_str(),meshname.c_str());
+  ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(file,meshname);
   std::vector<int> nonEmpty=mfm->getNonEmptyLevels();
   
   try 
@@ -240,7 +240,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile
   //     faceMeshFilter=(ParaMEDMEM::MEDCouplingUMesh *) faceMesh->buildPartOfMySelf(index,index+filter->getNbOfElems(),true);
   //     faceMesh=faceMeshFilter;
   //   }
-  cellMesh->setName(finalMeshName.c_str());
+  cellMesh->setName(finalMeshName);
   meshes.push_back(cellMesh);
   
   faceMesh->checkCoherency();
@@ -259,17 +259,17 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile
   //     boundaryMesh->setName("boundaryMesh");
   //   }
 
-  MEDLoader::WriteUMeshes(distfilename.c_str(), meshes, true);
+  MEDLoader::WriteUMeshes(distfilename, meshes, true);
   // if (faceMeshFilter!=0)
   //   faceMeshFilter->decrRef();
 
   // if (boundaryMesh!=0)
   //   {
   //     //doing that testMesh becomes second mesh sorted by alphabetical order of name
-  //     MEDLoader::WriteUMesh(distfilename.c_str(), boundaryMesh, false);
+  //     MEDLoader::WriteUMesh(distfilename, boundaryMesh, false);
   //     boundaryMesh->decrRef();
   //   }
-  ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(distfilename.c_str(), _collection->getMesh(idomain)->getName().c_str());
+  ParaMEDMEM::MEDFileUMesh* mfm=ParaMEDMEM::MEDFileUMesh::New(distfilename, _collection->getMesh(idomain)->getName());
 
   mfm->setFamilyInfo(_collection->getFamilyInfo());
   mfm->setGroupInfo(_collection->getGroupInfo());
@@ -286,7 +286,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile
   if (_collection->getMapDataArrayInt().find(key)!=_collection->getMapDataArrayInt().end())
     mfm->setFamilyFieldArr(0,_collection->getMapDataArrayInt().find(key)->second);
 
-  mfm->write(distfilename.c_str(),0);
+  mfm->write(distfilename,0);
   key="/inewFieldDouble="+IntToStr(idomain)+"/";
 
   std::map<std::string,ParaMEDMEM::DataArrayDouble*>::iterator it;
@@ -327,7 +327,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile
           continue;
         }
       nbfFieldFound++;
-      field->setName(fieldName.c_str());
+      field->setName(fieldName);
       field->setMesh(mfm->getLevel0Mesh(false));
       ParaMEDMEM::DataArrayDouble *da=(*it).second;
     
@@ -337,12 +337,12 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile
       r1=SelectTagsInVectorOfString(r1,"typeField="+IntToStr(typeField));
       r1=SelectTagsInVectorOfString(r1,"DT="+IntToStr(DT));
       r1=SelectTagsInVectorOfString(r1,"IT="+IntToStr(IT));
-      //not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription=").c_str());
+      //not saved in file? field->setDescription(ExtractFromDescription(r1[0], "fieldDescription="));
       int nbc=StrToInt(ExtractFromDescription(r1[0], "nbComponents="));
       if (nbc==da->getNumberOfComponents())
         {
           for (int i=0; i<nbc; i++) 
-            da->setInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"=").c_str());
+            da->setInfoOnComponent(i,ExtractFromDescription(r1[0], "componentInfo"+IntToStr(i)+"="));
         }
       else
         {
@@ -354,7 +354,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile
       field->checkCoherency();
       try
         {
-          MEDLoader::WriteField(distfilename.c_str(),field,false);
+          MEDLoader::WriteField(distfilename,field,false);
         }
       catch(INTERP_KERNEL::Exception& e)
         {
@@ -363,7 +363,7 @@ void MeshCollectionDriver::writeMedFile(int idomain, const std::string& distfile
           tmp+="_"+fieldName+"_"+IntToStr(nbfFieldFound)+".med";
           newName.replace(newName.find(".med"),4,tmp);
           std::cout << "WARNING : writeMedFile : create a new file name with only one field because MEDLoader::WriteField throw:" << newName << std::endl;
-          MEDLoader::WriteField(newName.c_str(),field,true);
+          MEDLoader::WriteField(newName,field,true);
         }
     }
   mfm->decrRef();
index 12538cf5f1caca822fd286b9a3d87b065a44e7ad..6fd6a42eaffe11ecf38f16f9d110e7034a4ea555 100644 (file)
@@ -559,20 +559,20 @@ std::vector<std::string> MEDPARTITIONER::BrowseFieldDouble(const ParaMEDMEM::MED
 std::vector<std::string> MEDPARTITIONER::BrowseAllFields(const std::string& myfile)
 {
   std::vector<std::string> res;
-  std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile.c_str());
+  std::vector<std::string> meshNames=MEDLoader::GetMeshNames(myfile);
   
   for (std::size_t i=0; i<meshNames.size(); i++)
     {
       std::vector<std::string> fieldNames=
-        MEDLoader::GetAllFieldNamesOnMesh(myfile.c_str(),meshNames[i].c_str());
+        MEDLoader::GetAllFieldNamesOnMesh(myfile,meshNames[i]);
       for (std::size_t j = 0; j < fieldNames.size(); j++)
         {
           std::vector< ParaMEDMEM::TypeOfField > typeFields=
-            MEDLoader::GetTypesOfField(myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str());
+            MEDLoader::GetTypesOfField(myfile, meshNames[i], fieldNames[j]);
           for (std::size_t k = 0; k < typeFields.size(); k++)
             {
               std::vector< std::pair< int, int > > its=
-                MEDLoader::GetFieldIterations(typeFields[k], myfile.c_str(), meshNames[i].c_str(), fieldNames[j].c_str());
+                MEDLoader::GetFieldIterations(typeFields[k], myfile, meshNames[i], fieldNames[j]);
               if (MyGlobals::_Is0verbose>100)
                 std::cout<< "fieldName " << fieldNames[j] << " typeField " << typeFields[k] << " its.size() " << its.size() << std::endl;
               for (std::size_t m = 0; m < its.size(); m++)
index dd96381ba65cc7c473b263351471afe708e0687f..fc122596e4ff457bfeabca80f78543ea5e5f13d5 100644 (file)
@@ -119,19 +119,19 @@ namespace ParaMEDMEM
           {
             MEDCouplingNormalizedUnstructuredMesh<2,2> source_mesh_wrapper(source_supportC);
             INTERP_KERNEL::Interpolation2D interpolation(*this);
-            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth);
           }
         else if(source_supportC->getMeshDimension()==3 && source_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(source_supportC);
             INTERP_KERNEL::Interpolation3D interpolation(*this);
-            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth);
           }
         else if(source_supportC->getMeshDimension()==2 && source_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,2> source_mesh_wrapper(source_supportC);
             INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.fromIntegralUniform(source_mesh_wrapper,surfaces,srcMeth);
           }
         else
           throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of source mesh to -1D targetMesh");
@@ -142,19 +142,19 @@ namespace ParaMEDMEM
           {
             MEDCouplingNormalizedUnstructuredMesh<2,2> distant_mesh_wrapper(distant_supportC);
             INTERP_KERNEL::Interpolation2D interpolation(*this);
-            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth);
           }
         else if(distant_supportC->getMeshDimension()==3 && distant_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,3> distant_mesh_wrapper(distant_supportC);
             INTERP_KERNEL::Interpolation3D interpolation(*this);
-            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth);
           }
         else if(distant_supportC->getMeshDimension()==2 && distant_supportC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,2> distant_mesh_wrapper(distant_supportC);
             INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth.c_str());
+            interpolation.toIntegralUniform(distant_mesh_wrapper,surfaces,srcMeth);
           }
         else
           throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of distant mesh to -1D sourceMesh");
@@ -166,7 +166,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(distant_supportC);
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(source_supportC);
         INTERP_KERNEL::Interpolation3D2D interpolator (*this);
-        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -177,7 +177,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,2> target_wrapper(distant_supportC);
         MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(source_supportC);
         INTERP_KERNEL::Interpolation2D1D interpolator (*this);
-        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -192,7 +192,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<1,1> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation1D interpolation(*this);
-        interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -203,7 +203,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,1> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation2DCurve interpolation(*this);
-        interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolation.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -214,7 +214,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,2> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation3DSurf interpolator (*this);
-        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -225,7 +225,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation2D interpolator (*this);
-        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -236,7 +236,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(source_supportC);
 
         INTERP_KERNEL::Interpolation3D interpolator (*this);
-        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());
+        interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
index 4015ee7e00a60b8ed324f6fa0dd493aefbcad53e..077539bfa885c2bab6cbec927ce9368ae7be3de7 100644 (file)
@@ -98,7 +98,8 @@ namespace ParaMEDMEM
   fvm_nodal_t*  medmemMeshToFVMMesh(const MEDMEM::MESH* mesh)
   {
     // create an FVM structure from the paramesh structure
-    fvm_nodal_t * fvm_nodal = fvm_nodal_create(mesh->getName().c_str(),mesh->getMeshDimension());
+    std::string meshName(mesh->getName());//this line avoid that mesh->getName() object killed before fvm_nodal_create read the const char *.
+    fvm_nodal_t * fvm_nodal = fvm_nodal_create(meshName.c_str(),mesh->getMeshDimension());
       
     //loop on cell types
     int nbtypes = mesh->getNumberOfTypes(MED_EN::MED_CELL);
@@ -168,7 +169,8 @@ namespace ParaMEDMEM
   {
 
     // create an FVM structure from the paramesh structure
-    fvm_nodal_t * fvm_nodal = fvm_nodal_create(support->getName().c_str(),1);
+    std::string supportName(support->getName());//this line avoid that support->getName() object killed before fvm_nodal_create read the const char *.
+    fvm_nodal_t * fvm_nodal = fvm_nodal_create(supportName.c_str(),1);
       
     const MEDMEM::MESH* mesh= support->getMesh();
       
index 82e15236a70f3e71f036287caaa5a7ecdba2f6c9..6c85fc105d83e81a6e9d5dc02b5a72de0997ddfa 100644 (file)
@@ -95,19 +95,19 @@ namespace ParaMEDMEM
           {
             MEDCouplingNormalizedUnstructuredMesh<2,2> target_mesh_wrapper(trgC);
             INTERP_KERNEL::Interpolation2D interpolation(*this);
-            colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth.c_str());
+            colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth);
           }
         else if(trgC->getMeshDimension()==3 && trgC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(trgC);
             INTERP_KERNEL::Interpolation3D interpolation(*this);
-            colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth.c_str());
+            colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth);
           }
         else if(trgC->getMeshDimension()==2 && trgC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,2> target_mesh_wrapper(trgC);
             INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-            colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth.c_str());
+            colSize=interpolation.fromIntegralUniform(target_mesh_wrapper,surfaces,trgMeth);
           }
         else
           throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of source mesh to -1D targetMesh");
@@ -118,19 +118,19 @@ namespace ParaMEDMEM
           {
             MEDCouplingNormalizedUnstructuredMesh<2,2> local_mesh_wrapper(srcC);
             INTERP_KERNEL::Interpolation2D interpolation(*this);
-            colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth.c_str());
+            colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth);
           }
         else if(srcC->getMeshDimension()==3 && srcC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,3> local_mesh_wrapper(srcC);
             INTERP_KERNEL::Interpolation3D interpolation(*this);
-            colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth.c_str());
+            colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth);
           }
         else if(srcC->getMeshDimension()==2 && srcC->getSpaceDimension()==3)
           {
             MEDCouplingNormalizedUnstructuredMesh<3,2> local_mesh_wrapper(srcC);
             INTERP_KERNEL::Interpolation3DSurf interpolation(*this);
-            colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth.c_str());
+            colSize=interpolation.toIntegralUniform(local_mesh_wrapper,surfaces,srcMeth);
           }
         else
           throw INTERP_KERNEL::Exception("No para interpolation available for the given mesh and space dimension of distant mesh to -1D sourceMesh");
@@ -142,7 +142,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC);
         
         INTERP_KERNEL::Interpolation3D2D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str());
+        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -154,7 +154,7 @@ namespace ParaMEDMEM
         
         INTERP_KERNEL::Interpolation3D2D interpolator (*this);
         vector<map<int,double> > surfacesTranspose;
-        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod.c_str());//not a bug target in source.
+        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);//not a bug target in source.
         TransposeMatrix(surfacesTranspose,colSize,surfaces);
         colSize=surfacesTranspose.size();
         target_wrapper.releaseTempArrays();
@@ -167,7 +167,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(srcC);
         
         INTERP_KERNEL::Interpolation2D1D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str());
+        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -179,7 +179,7 @@ namespace ParaMEDMEM
         
         INTERP_KERNEL::Interpolation2D1D interpolator (*this);
         vector<map<int,double> > surfacesTranspose;
-        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfacesTranspose,interpMethod.c_str());//not a bug target in source.
+        colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfacesTranspose,interpMethod);//not a bug target in source.
         TransposeMatrix(surfacesTranspose,colSize,surfaces);
         colSize=surfacesTranspose.size();
         target_wrapper.releaseTempArrays();
@@ -196,7 +196,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<1,1> source_wrapper(srcC);
 
         INTERP_KERNEL::Interpolation1D interpolation(*this);
-        colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str());
+        colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -207,7 +207,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,1> source_wrapper(srcC);
 
         INTERP_KERNEL::Interpolation2DCurve interpolation(*this);
-        colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str());
+        colSize=interpolation.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -218,7 +218,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,2> source_wrapper(srcC);
 
         INTERP_KERNEL::Interpolation3DSurf interpolator (*this);
-        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str());
+        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -229,7 +229,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<2,2> source_wrapper(srcC);
 
         INTERP_KERNEL::Interpolation2D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str());
+        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
@@ -240,7 +240,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC);
 
         INTERP_KERNEL::Interpolation3D interpolator (*this);
-        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod.c_str());
+        colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
       }
index 869c837cef42b196a2572d8a014582de635fd294..f63fb7a2077a03588c3c39c8ebdb59095dd4f298 100644 (file)
@@ -449,9 +449,9 @@ void ParaMEDMEMComponent_i::_initializeCoupling(SALOME_MED::MPIMEDCouplingFieldD
         st->compo = compo._retn();
         st->coupling = coupling;
         st->ior = lcompo;
-       
+        
         pthread_create(&(th[0]),NULL,th_initializecouplingdist,(void*)st);
-         
+        
         //initializing the coupling on the local object
         initializeCoupling (coupling.c_str(), rcompo.c_str());
         pthread_join (th[0], &ret_th); 
index 41c6938f46c31ab476becb939c0a9093b22048e7..260378989990b932dcb7122dfa3370bc5ad20a05 100644 (file)
@@ -57,8 +57,8 @@ int main(int argc, char** argv)
     }
   // Reading file structure
   cout << "Reading : " << flush;
-  MEDCouplingAutoRefCountObjectPtr<MEDFileData> fd=MEDFileData::New(filename_in.c_str());
-  MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname.c_str());
+  MEDCouplingAutoRefCountObjectPtr<MEDFileData> fd(MEDFileData::New(filename_in));
+  MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname);
   MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m);
   if(!mc)
     {
@@ -96,7 +96,7 @@ int main(int argc, char** argv)
       MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famField2=famField->renumber(perm->begin());
       mc->setFamilyFieldArr(0,famField2);
     }
-  mc->write(filename_out.c_str(),2);
+  mc->write(filename_out,2);
   t_family=clock();
   cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
   // Fields
@@ -107,20 +107,20 @@ int main(int argc, char** argv)
       for(int i=0;i<fs->getNumberOfFields();i++)
         {
           MEDFileFieldMultiTS *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i));
-         if(!fmts) continue;
+          if(!fmts) continue;
           if(fmts->getMeshName()==meshname)
             {
               for(int j=0;j<fmts->getNumberOfTS();j++)
                 {
                   MEDFileField1TS *f1ts=dynamic_cast<MEDFileField1TS*>(fmts->getTimeStepAtPos(j));
-                 if(!f1ts) continue;
+                  if(!f1ts) continue;
                   DataArrayDouble *arr=f1ts->getUndergroundDataArray();
                   arr->renumberInPlace(perm->begin());
                 }
             }
         }
-      fs->write(filename_out.c_str(),0);
-      //fs->renumberEntitiesLyingOnMesh(meshname.c_str(),code,code,o2n); bugged
+      fs->write(filename_out,0);
+      //fs->renumberEntitiesLyingOnMesh(meshname,code,code,o2n); bugged
     }
   t_field=clock();
   cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;