X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDPartitioner%2FMEDPARTITIONER_MeshCollectionMedXmlDriver.cxx;h=bcd9138cb613e052bd11caccc5f4f97385166a9b;hb=8411b13fec372c7635bf04d2bb81a869dc038fdd;hp=9a7df8f5c94531acfd83922c2fda1aed794c83f4;hpb=10f37bf6f33a762626d7f1093b2f5450c1688667;p=tools%2Fmedcoupling.git diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx index 9a7df8f5c..bcd9138cb 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D +// Copyright (C) 2007-2020 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 @@ -169,7 +169,7 @@ int MeshCollectionMedXmlDriver::read(const char* filename, ParaDomainSelector* d //to know nb of cells on each proc to compute global cell ids from locally global domainSelector->gatherNbOf(_collection->getMesh()); } - _collection->setTopology(aPT); + _collection->setTopology(aPT, true); _collection->setDomainNames(_collection->getName()); return 0; } @@ -200,7 +200,7 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* //Description tag time_t present; - char date[6]; + char date[20]; #ifndef WIN32 time( &present); struct tm *time_asc = localtime(&present); @@ -242,10 +242,22 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* xmlNodePtr mesh_node = xmlNewChild(node, 0, BAD_CAST "mesh",0); xmlNewProp(mesh_node, BAD_CAST "name", BAD_CAST _collection->getName().c_str()); - int nbdomains= _collection->getMesh().size(); + int nbdomains= _collection->getNbOfGlobalMeshes(); //loop on the domains - std::string finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName="); + std::string finalMeshName=""; + if (MyGlobals::_General_Informations.size()!=0) + { + std::size_t found=MyGlobals::_General_Informations[0].find("finalMeshName="); + if ((found!=std::string::npos) && (found>0)) + { + finalMeshName=ExtractFromDescription(MyGlobals::_General_Informations[0], "finalMeshName="); + } + } + if (finalMeshName.empty()) + { + finalMeshName=_collection->getName(); + } for (int idomain=nbdomains-1; idomain>=0;idomain--) { std::string distfilename; @@ -277,7 +289,7 @@ void MeshCollectionMedXmlDriver::write(const char* filename, ParaDomainSelector* node = xmlNewChild(mesh_node,0, BAD_CAST "chunk",0); xmlNewProp(node, BAD_CAST "subdomain", BAD_CAST buff); xmlNewChild(node,0,BAD_CAST "name", BAD_CAST finalMeshName.c_str()); - //xmlNewChild(node,0,BAD_CAST "name", BAD_CAST (_collection->getMesh())[idomain]->getName()); + //xmlNewChild(node,0,BAD_CAST "name", BAD_CAST ((_collection->getMesh())[idomain]->getName()).c_str()); } }