From: ageay Date: Wed, 28 Sep 2011 07:51:37 +0000 (+0000) Subject: Some improvements to avoid useless empty levels. X-Git-Tag: V6_main_FINAL~946 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=73435abe2881477b7da9bb5d8848c7c4087c396a;p=tools%2Fmedcoupling.git Some improvements to avoid useless empty levels. --- diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index e67632da2..73f735047 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -271,6 +271,19 @@ void MEDFileUMeshL2::sortTypes() if((*it)->getDim()==dim-1) elt.push_back(*it); } + // suppression of contiguous empty levels at the end of _per_type_mesh. + int nbOfUselessLev=0; + bool isFirst=true; + for(std::vector< std::vector< MEDCouplingAutoRefCountObjectPtr > >::reverse_iterator it2=_per_type_mesh.rbegin();it2!=_per_type_mesh.rend();it2++) + { + if((*it2).empty() && isFirst) + { + nbOfUselessLev++; + } + else + isFirst=false; + } + _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)