From 3eaa1068e850c9e5135d9da5b9e86526238ba473 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Tue, 31 Mar 2015 15:25:44 +0000 Subject: [PATCH] better fix + doc --- Geo/GModelIO_MED.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Geo/GModelIO_MED.cpp b/Geo/GModelIO_MED.cpp index e17b9441ae..e0e13449b8 100644 --- a/Geo/GModelIO_MED.cpp +++ b/Geo/GModelIO_MED.cpp @@ -374,7 +374,10 @@ int GModel::readMED(const std::string &name, int meshIndex) for(int k = 0; k < numNodPerEle; k++) v[k] = verts[conn[numNodPerEle * j + med2mshNodeIndex(type, k)] - 1]; MElement *e = factory.create(mshType, v, eleTags.empty() ? 0 : eleTags[j]); - if(e) elements[-fam[j]].push_back(e); + // according to the MED documentation, fam[j] should be negative; still, + // accept all family ids, even positive, as some code do not export valid + // MED files + if(e) elements[std::abs(fam[j])].push_back(e); } _storeElementsInEntities(elements); } @@ -429,7 +432,9 @@ int GModel::readMED(const std::string &name, int meshIndex) continue; } #endif - // family tags are unique (for all dimensions) + // element family tags are unique (for all dimensions), and <= 0 (node + // family tags are positive - these will simply never match any Gmsh GEntity + // tag and will be ignored) GEntity *ge; if((ge = getRegionByTag(-familyNum))){} else if((ge = getFaceByTag(-familyNum))){} -- GitLab