From: Anthony GEAY Date: Tue, 13 Oct 2020 19:25:43 +0000 (+0200) Subject: Generalization of MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds and MEDFileUMesh... X-Git-Tag: V9_6_0b1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b64861b52d87424666a51fb54a911e939cb3b8f7;p=tools%2Fmedcoupling.git Generalization of MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds and MEDFileUMesh::LoadPart with empty mesh --- diff --git a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx index 031a6d5ea..c1a954a63 100755 --- a/src/MEDCoupling/MEDCouplingUMesh_internal.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_internal.cxx @@ -510,6 +510,11 @@ void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const mcIdType *begin, const MCAuto cellIdsKept=DataArrayIdType::New(); cellIdsKept->alloc(0,1); checkConnectivityFullyDefined(); mcIdType tmp=-1; + if(getNodalConnectivity()->empty()) + { + cellIdsKeptArr=cellIdsKept.retn(); + return; + } mcIdType sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,ToIdType(0))+1; std::vector fastFinder(sz,false); for(const mcIdType *work=begin;work!=end;work++) diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index 733d7e2b3..5809f3595 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -1496,8 +1496,17 @@ void MEDFileUMeshSplitL1::TraduceFamilyNumber(const std::vector< std::vectorgetMaxValue(pos); - _rev_num=_num->invertArrayN2O2O2N(maxValue+1); + if(!_num->empty()) + { + mcIdType maxValue=_num->getMaxValue(pos); + _rev_num=_num->invertArrayN2O2O2N(maxValue+1); + } + else + { + _rev_num = DataArrayIdType::New(); + _rev_num->alloc(0,1); + } + } //=