From 73435abe2881477b7da9bb5d8848c7c4087c396a Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 28 Sep 2011 07:51:37 +0000 Subject: [PATCH] Some improvements to avoid useless empty levels. --- src/MEDLoader/MEDFileMeshLL.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) -- 2.39.2