Salome HOME
50% of work performed of porting tests.
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_MeshCollectionDriver.cxx
index f41349581ebcd9641ca9f5ff31f4ea6932e285aa..ce0bc4d777836b5b04b83269ae935d7d4ba72cd4 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  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
@@ -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());
+  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();