Salome HOME
Merge branch 'master' of salome:modules/med
[tools/medcoupling.git] / src / MEDLoader / MEDLoader.cxx
index 75c9acc1a3a38f31d6012e8b00fe798c4625d402..be6ff6382c8765e9098cee7df63546ad182049df 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 #include <algorithm>
 
 med_geometry_type typmai[MED_N_CELL_FIXED_GEO] = { MED_POINT1,
-                                                   MED_SEG2,
-                                                   MED_SEG3,
-                                                   MED_SEG4,
-                                                   MED_TRIA3,
-                                                   MED_QUAD4,
-                                                   MED_TRIA6,
-                                                   MED_TRIA7,
-                                                   MED_QUAD8,
-                                                   MED_QUAD9,
-                                                   MED_TETRA4,
-                                                   MED_PYRA5,
-                                                   MED_PENTA6,
-                                                   MED_HEXA8,
-                                                   MED_OCTA12,
-                                                   MED_TETRA10,
-                                                   MED_PYRA13,
-                                                   MED_PENTA15,
-                                                   MED_HEXA20,
-                                                   MED_HEXA27,
-                                                   MED_POLYGON,
-                                                   MED_POLYGON2,
-                                                   MED_POLYHEDRON };
+  MED_SEG2,
+  MED_SEG3,
+  MED_SEG4,
+  MED_TRIA3,
+  MED_QUAD4,
+  MED_TRIA6,
+  MED_TRIA7,
+  MED_QUAD8,
+  MED_QUAD9,
+  MED_TETRA4,
+  MED_PYRA5,
+  MED_PENTA6,
+  MED_HEXA8,
+  MED_OCTA12,
+  MED_TETRA10,
+  MED_PYRA13,
+  MED_PENTA15,
+  MED_HEXA20,
+  MED_HEXA27,
+  MED_POLYGON,
+  MED_POLYGON2,
+  MED_POLYHEDRON };
 
 med_geometry_type typmainoeud[1] = { MED_NONE };
 
 INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO] = { INTERP_KERNEL::NORM_POINT1,
-                                                                    INTERP_KERNEL::NORM_SEG2,
-                                                                    INTERP_KERNEL::NORM_SEG3,
-                                                                    INTERP_KERNEL::NORM_SEG4,
-                                                                    INTERP_KERNEL::NORM_TRI3,
-                                                                    INTERP_KERNEL::NORM_QUAD4,
-                                                                    INTERP_KERNEL::NORM_TRI6,
-                                                                    INTERP_KERNEL::NORM_TRI7,
-                                                                    INTERP_KERNEL::NORM_QUAD8,
-                                                                    INTERP_KERNEL::NORM_QUAD9,
-                                                                    INTERP_KERNEL::NORM_TETRA4,
-                                                                    INTERP_KERNEL::NORM_PYRA5,
-                                                                    INTERP_KERNEL::NORM_PENTA6,
-                                                                    INTERP_KERNEL::NORM_HEXA8,
-                                                                    INTERP_KERNEL::NORM_HEXGP12,
-                                                                    INTERP_KERNEL::NORM_TETRA10,
-                                                                    INTERP_KERNEL::NORM_PYRA13,
-                                                                    INTERP_KERNEL::NORM_PENTA15,
-                                                                    INTERP_KERNEL::NORM_HEXA20,
-                                                                    INTERP_KERNEL::NORM_HEXA27,
-                                                                    INTERP_KERNEL::NORM_POLYGON,
-                                                                    INTERP_KERNEL::NORM_QPOLYG,
-                                                                    INTERP_KERNEL::NORM_POLYHED };
+  INTERP_KERNEL::NORM_SEG2,
+  INTERP_KERNEL::NORM_SEG3,
+  INTERP_KERNEL::NORM_SEG4,
+  INTERP_KERNEL::NORM_TRI3,
+  INTERP_KERNEL::NORM_QUAD4,
+  INTERP_KERNEL::NORM_TRI6,
+  INTERP_KERNEL::NORM_TRI7,
+  INTERP_KERNEL::NORM_QUAD8,
+  INTERP_KERNEL::NORM_QUAD9,
+  INTERP_KERNEL::NORM_TETRA4,
+  INTERP_KERNEL::NORM_PYRA5,
+  INTERP_KERNEL::NORM_PENTA6,
+  INTERP_KERNEL::NORM_HEXA8,
+  INTERP_KERNEL::NORM_HEXGP12,
+  INTERP_KERNEL::NORM_TETRA10,
+  INTERP_KERNEL::NORM_PYRA13,
+  INTERP_KERNEL::NORM_PENTA15,
+  INTERP_KERNEL::NORM_HEXA20,
+  INTERP_KERNEL::NORM_HEXA27,
+  INTERP_KERNEL::NORM_POLYGON,
+  INTERP_KERNEL::NORM_QPOLYG,
+  INTERP_KERNEL::NORM_POLYHED };
 
 med_geometry_type typmai3[34] = { MED_POINT1,//0
-                                  MED_SEG2,//1
-                                  MED_SEG3,//2
-                                  MED_TRIA3,//3
-                                  MED_QUAD4,//4
-                                  MED_POLYGON,//5
-                                  MED_TRIA6,//6
-                                  MED_TRIA7,//7
-                                  MED_QUAD8,//8
-                                  MED_QUAD9,//9
-                                  MED_SEG4,//10
-                                  MED_NONE,//11
-                                  MED_NONE,//12
-                                  MED_NONE,//13
-                                  MED_TETRA4,//14
-                                  MED_PYRA5,//15
-                                  MED_PENTA6,//16
-                                  MED_NONE,//17
-                                  MED_HEXA8,//18
-                                  MED_NONE,//19
-                                  MED_TETRA10,//20
-                                  MED_NONE,//21
-                                  MED_OCTA12,//22
-                                  MED_PYRA13,//23
-                                  MED_NONE,//24
-                                  MED_PENTA15,//25
-                                  MED_NONE,//26
-                                  MED_HEXA27,//27
-                                  MED_NONE,//28
-                                  MED_NONE,//29
-                                  MED_HEXA20,//30
-                                  MED_POLYHEDRON,//31
-                                  MED_POLYGON2,//32
-                                  MED_NONE//33
+  MED_SEG2,//1
+  MED_SEG3,//2
+  MED_TRIA3,//3
+  MED_QUAD4,//4
+  MED_POLYGON,//5
+  MED_TRIA6,//6
+  MED_TRIA7,//7
+  MED_QUAD8,//8
+  MED_QUAD9,//9
+  MED_SEG4,//10
+  MED_NONE,//11
+  MED_NONE,//12
+  MED_NONE,//13
+  MED_TETRA4,//14
+  MED_PYRA5,//15
+  MED_PENTA6,//16
+  MED_NONE,//17
+  MED_HEXA8,//18
+  MED_NONE,//19
+  MED_TETRA10,//20
+  MED_NONE,//21
+  MED_OCTA12,//22
+  MED_PYRA13,//23
+  MED_NONE,//24
+  MED_PENTA15,//25
+  MED_NONE,//26
+  MED_HEXA27,//27
+  MED_NONE,//28
+  MED_NONE,//29
+  MED_HEXA20,//30
+  MED_POLYHEDRON,//31
+  MED_POLYGON2,//32
+  MED_NONE//33
 };
 
 double MEDLoader::_EPS_FOR_NODE_COMP=1.e-12;
@@ -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);
   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)
-{
-  if(meshName==0)
+med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName)
+    {
+  if(meshName.empty())
     {
       std::vector<std::string> meshes=getMeshNamesFid(fid);
       if(meshes.empty())
@@ -238,7 +238,7 @@ med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const char *meshName, std::s
     }
   trueMeshName=meshName;
   return iter-meshes.begin()+1;
-}
+    }
 
 std::vector<std::string> MEDLoaderNS::getMeshNamesFid(med_idt fid)
 {
@@ -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;
@@ -439,7 +439,7 @@ std::vector< std::pair<std::string,std::string> > MEDLoader::GetComponentsNamesO
           std::vector< std::pair<std::string,std::string> > ret(ncomp);
           for(int j=0;j<ncomp;j++)
             ret[j]=std::pair<std::string,std::string>(MEDLoaderBase::buildStringFromFortran(((char *)comp)+j*MED_SNAME_SIZE,MED_SNAME_SIZE),
-                                                      MEDLoaderBase::buildStringFromFortran(((char *)unit)+j*MED_SNAME_SIZE,MED_SNAME_SIZE));
+                MEDLoaderBase::buildStringFromFortran(((char *)unit)+j*MED_SNAME_SIZE,MED_SNAME_SIZE));
           return ret;
         }
       fields[i]=curFieldName;
@@ -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)
@@ -567,24 +567,24 @@ std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileN
   return ret;
 }
 
-  
-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;
@@ -633,7 +633,7 @@ std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *file
                     {
                       MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
                       med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
-                                                                pflname,&profilesize,locname,&nbi);
+                          pflname,&profilesize,locname,&nbi);
                       if(nbOfVal>0)
                         {
                           ret.push_back(ON_NODES);
@@ -648,7 +648,7 @@ std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *file
                     {
                       MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
                       med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
-                                                                pflname,&profilesize,locname,&nbi);
+                          pflname,&profilesize,locname,&nbi);
                       if(nbOfVal>0)
                         {
                           found=true;
@@ -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,25 +718,25 @@ 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)
-    {
+  {
     case ON_CELLS:
       return GetCellFieldNamesOnMesh(fileName,meshName);
     case ON_NODES:
       return GetNodeFieldNamesOnMesh(fileName,meshName);
     default:
       throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES or ON_CELLS !");
-    } 
+  }
 }
 
-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;
@@ -769,7 +769,7 @@ std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const char *fileName
                 {
                   MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
                   med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
-                                                            pflname,&profilesize,locname,&nbi);
+                      pflname,&profilesize,locname,&nbi);
                   if(nbOfVal>0)
                     {
                       found=true;
@@ -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]="";
@@ -813,7 +813,7 @@ std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const char *fileName
           int profilesize,nbi;
           MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
           med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
-                                                    pflname,&profilesize,locname,&nbi);
+              pflname,&profilesize,locname,&nbi);
           if(curMeshName==meshName && nbOfVal>0)
             {
               ret.push_back(curFieldName);
@@ -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,26 +914,26 @@ 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)
-    {
+  {
     case ON_CELLS:
       return GetCellFieldIterations(fileName,meshName,fieldName);
     case ON_NODES:
       return GetNodeFieldIterations(fileName,meshName,fieldName);
     default:
       throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES or ON_CELLS !");
-    }
+  }
 }
 
-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;
@@ -966,7 +966,7 @@ std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const char *
                   int profilesize,nbi;
                   MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
                   med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
-                                                            pflname,&profilesize,locname,&nbi);
+                      pflname,&profilesize,locname,&nbi);
                   std::string maa_ass_cpp(maa_ass);
                   if(nbOfVal>0)
                     {
@@ -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;
@@ -1035,15 +1035,15 @@ std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const char *
               int profilesize,nbi;
               MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
               med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
-                                                        pflname,&profilesize,locname,&nbi);
-               std::string maa_ass_cpp(maa_ass);
-               if(nbOfVal>0)
-                 {
-                   if(meshNameCpp==maa_ass_cpp)
-                     { ret.push_back(std::make_pair(numdt,numo)); }
-                   else
-                     s2.insert(maa_ass_cpp);
-                 }
+                  pflname,&profilesize,locname,&nbi);
+              std::string maa_ass_cpp(maa_ass);
+              if(nbOfVal>0)
+                {
+                  if(meshNameCpp==maa_ass_cpp)
+                    { ret.push_back(std::make_pair(numdt,numo)); }
+                  else
+                    s2.insert(maa_ass_cpp);
+                }
             }
         }
       else
@@ -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));
@@ -1124,10 +1124,10 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName,
       std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName=\""<< meshName << "\" exists but it is not an unstructured mesh !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
- return  mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
 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));
@@ -1138,17 +1138,17 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName,
       std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFile : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
- return  mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
 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));
@@ -1159,10 +1159,10 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const char *fileN
       std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromFamilies : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-    return mmuPtr->getFamilies(meshDimRelToMax,fams,true);
+  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);
@@ -1173,14 +1173,14 @@ ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const char *fileNam
       std::ostringstream oss; oss << "MEDLoader::ReadUMeshFromGroups : With fileName=\""<< fileName << "\", meshName (the first) =\""<< mm->getName() << "\" exists but it is not an unstructured mesh !";
       throw INTERP_KERNEL::Exception(oss.str().c_str());
     }
-    return mmuPtr->getGroups(meshDimRelToMax,grps,true);
+  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)
-    {
+  {
     case ON_CELLS:
       return ReadFieldCell(fileName,meshName,meshDimRelToMax,fieldName,iteration,order);
     case ON_NODES:
@@ -1191,11 +1191,11 @@ ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField
       return ReadFieldGaussNE(fileName,meshName,meshDimRelToMax,fieldName,iteration,order);
     default:
       throw INTERP_KERNEL::Exception("Type of field specified not managed ! manages are ON_NODES, ON_CELLS, ON_GAUSS_PT or ON_GAUSS_NE !");
-    } 
+  }
 }
 
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
-                                                                                  const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+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)
 {
   if(its.empty())
     return std::vector<ParaMEDMEM::MEDCouplingFieldDouble *>();
@@ -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,
-                                                                                            const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+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)
 {
   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,
-                                                                                      const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+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)
 {
   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,
-                                                                                       const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+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)
 {
   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,
-                                                                                         const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
+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)
 {
   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);
 }